Skip to content
This repository was archived by the owner on Feb 10, 2023. It is now read-only.

Commit d810a40

Browse files
committed
fix(reinvocation-error): Remember state to no invoke a second time
see #9
1 parent e86e2d1 commit d810a40

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

urlhandler.android.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,18 @@ import { getCallback, extractAppURL } from './urlhandler.common';
44
export { handleOpenURL } from './urlhandler.common';
55
declare var android: any;
66

7+
let alreadyHandled: boolean = false;
8+
79
application.android.on(application.AndroidApplication.activityResumedEvent, (args) => {
8-
try {
9-
console.log('Event: ' + args.eventName + ', Activity: ' + args.activity);
10-
console.log(new String(args.activity.getIntent().getAction()).valueOf(), new String(android.content.Intent.ACTION_VIEW).valueOf());
11-
if (new String(args.activity.getIntent().getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf()) {
12-
let data = args.activity.getIntent().getData();
13-
getCallback()(extractAppURL(data));
10+
if (!alreadyHandled) {
11+
try {
12+
if (new String(args.activity.getIntent().getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf()) {
13+
let data = args.activity.getIntent().getData();
14+
getCallback()(extractAppURL(data));
15+
alreadyHandled = true;
16+
}
17+
} catch (e) {
18+
console.error('Unknown error during getting App URL data', e);
1419
}
15-
} catch (e) {
16-
console.error('Unknown error during getting App URL data', e);
1720
}
1821
});

0 commit comments

Comments
 (0)