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

Commit 3ee1f62

Browse files
committed
fix(Action-Error): Solve Android action error
see #22
1 parent 46900e3 commit 3ee1f62

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

urlhandler.android.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@ export function handleIntent(intent: any) {
1010
if (lastReceivedData === null || data.toString() !== lastReceivedData.toString()) {
1111
try {
1212
if (new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf()) {
13-
application.android.on(application.AndroidApplication.activityResultEvent, (eventData) => {
13+
try {
1414
setTimeout(() => {
1515
getCallback()(extractAppURL(data));
1616
});
17-
});
17+
} catch (ignored) {
18+
application.android.on(application.AndroidApplication.activityResultEvent, (eventData) => {
19+
setTimeout(() => {
20+
getCallback()(extractAppURL(data));
21+
});
22+
});
23+
}
1824
}
1925
} catch (e) {
2026
console.error('Unknown error during getting App URL data', e);
@@ -25,7 +31,7 @@ application.android.on(application.AndroidApplication.activityCreatedEvent, (arg
2531
let intent: android.content.Intent = args.activity.getIntent();
2632
try {
2733
if (new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_MAIN).valueOf()
28-
|| new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf()) {
34+
|| new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf()) {
2935
handleIntent(intent);
3036
}
3137
} catch (e) {
@@ -37,7 +43,7 @@ application.android.on(application.AndroidApplication.activityResumedEvent, (arg
3743
let intent: android.content.Intent = args.activity.getIntent();
3844
try {
3945
if (new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_MAIN).valueOf()
40-
|| new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf()) {
46+
|| new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf()) {
4147
handleIntent(intent);
4248
lastReceivedData = intent.getData();
4349
}

0 commit comments

Comments
 (0)