From 0d50701e6af202668c1eef39fb93f974b41d042a Mon Sep 17 00:00:00 2001 From: Martin Reinhardt Date: Mon, 27 Mar 2017 09:05:12 +0200 Subject: [PATCH] fix(android-error): Solve android error see #16 --- tsconfig.json | 2 +- urlhandler.android.ts | 35 +++++++++++++++-------------------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index fc3fe53..813db23 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -20,4 +20,4 @@ "node_modules", "bundles" ] -} +} \ No newline at end of file diff --git a/urlhandler.android.ts b/urlhandler.android.ts index 7dfa469..9ea3587 100644 --- a/urlhandler.android.ts +++ b/urlhandler.android.ts @@ -7,7 +7,7 @@ let lastReceivedData = null; export function handleIntent(intent: any) { let data = intent.getData(); - if (data !== lastReceivedData) { + if (data.toString() !== lastReceivedData.toString()) { try { if (new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf()) { application.android.on(application.AndroidApplication.activityResultEvent, (eventData) => { @@ -22,29 +22,24 @@ export function handleIntent(intent: any) { } } application.android.on(application.AndroidApplication.activityCreatedEvent, (args) => { - let intent: android.content.Intent = args.activity.getIntent(), - data = intent.getData(); - if (data !== lastReceivedData) { - try { - if (new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf()) { - handleIntent(intent); - } - } catch (e) { - console.error('Unknown error during getting App URL data', e); + let intent: android.content.Intent = args.activity.getIntent(); + try { + if (new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf()) { + handleIntent(intent); } + } catch (e) { + console.error('Unknown error during getting App URL data', e); } + }); application.android.on(application.AndroidApplication.activityResumedEvent, (args) => { - let intent: android.content.Intent = args.activity.getIntent(), - data = intent.getData(); - if (data !== lastReceivedData) { - try { - if (new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf()) { - handleIntent(intent); - lastReceivedData = data; - } - } catch (e) { - console.error('Unknown error during getting App URL data', e); + let intent: android.content.Intent = args.activity.getIntent(); + try { + if (new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf()) { + handleIntent(intent); + lastReceivedData = intent.getData(); } + } catch (e) { + console.error('Unknown error during getting App URL data', e); } });