Skip to content

Commit cee89b0

Browse files
authored
Merge pull request #246 from tidev/fix/android-uncaught-exception
fix(android): fix uncaught exception when no intent is found
2 parents beb16cc + f231d0c commit cee89b0

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ In order to use the `close` event on Android it is recommended to have a short d
5353
* `close` -> `success` (Boolean), `url` (String)
5454
* `load` -> `success` (Boolean), `url` (String) - iOS only
5555
* `redirect` -> `url` (String) - iOS only
56+
* `error` -> `message` (String) - Android only
5657

5758
### `AuthenticationSession` (iOS only)
5859

android/manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# this is your module manifest and used by Titanium
33
# during compilation, packaging, distribution, etc.
44
#
5-
version: 2.3.0
5+
version: 2.3.1
66
apiversion: 4
77
architectures: arm64-v8a armeabi-v7a x86 x86_64
88
description: titanium-web-dialog

android/src/ti/webdialog/TitaniumWebDialogModule.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,14 @@ private void openCustomTab(Context context, List<String> customTabBrowsers, Krol
155155
tabIntent.intent.setPackage(s);
156156
}
157157

158-
tabIntent.launchUrl(context, Uri.parse(url));
158+
try {
159+
tabIntent.launchUrl(context, Uri.parse(url));
160+
} catch (Exception e) {
161+
KrollDict event = new KrollDict();
162+
event.put("message", e.getLocalizedMessage());
163+
164+
fireEvent("error", event);
165+
}
159166
}
160167

161168
private Bitmap getIcon(String path)

0 commit comments

Comments
 (0)