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

Commit

Permalink
fix(Action-Error): Solve Android action error
Browse files Browse the repository at this point in the history
see #22
  • Loading branch information
hypery2k committed Apr 6, 2017
1 parent 46900e3 commit 3ee1f62
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions urlhandler.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ export function handleIntent(intent: any) {
if (lastReceivedData === null || 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) => {
try {
setTimeout(() => {
getCallback()(extractAppURL(data));
});
});
} catch (ignored) {
application.android.on(application.AndroidApplication.activityResultEvent, (eventData) => {
setTimeout(() => {
getCallback()(extractAppURL(data));
});
});
}
}
} catch (e) {
console.error('Unknown error during getting App URL data', e);
Expand All @@ -25,7 +31,7 @@ application.android.on(application.AndroidApplication.activityCreatedEvent, (arg
let intent: android.content.Intent = args.activity.getIntent();
try {
if (new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_MAIN).valueOf()
|| new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf()) {
|| new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf()) {
handleIntent(intent);
}
} catch (e) {
Expand All @@ -37,7 +43,7 @@ application.android.on(application.AndroidApplication.activityResumedEvent, (arg
let intent: android.content.Intent = args.activity.getIntent();
try {
if (new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_MAIN).valueOf()
|| new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf()) {
|| new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf()) {
handleIntent(intent);
lastReceivedData = intent.getData();
}
Expand Down

0 comments on commit 3ee1f62

Please sign in to comment.