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

Commit

Permalink
fix(android-error): Solve android error
Browse files Browse the repository at this point in the history
see #16
  • Loading branch information
hypery2k committed Mar 27, 2017
1 parent bf72ff3 commit 0d50701
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
"node_modules",
"bundles"
]
}
}
35 changes: 15 additions & 20 deletions urlhandler.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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);
}
});

0 comments on commit 0d50701

Please sign in to comment.