[TIMOB-27862] Android: Add callback support to Ti.Platform.openURL()
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-07-29T21:07:46.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 9.1.0 |
Components | Android |
Labels | android, callback, openUrl, parity |
Reporter | Joshua Quick |
Assignee | Joshua Quick |
Created | 2020-04-22T00:29:23.000+0000 |
Updated | 2020-07-29T21:07:46.000+0000 |
Description
*Summary:*
On Android, the
Ti.Platform.openURL()
method only supports the URL argument. The 2 optional arguments, "options" dictionary and callback, are ignored and only supported on iOS.
https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Platform-method-openURL
We should add support for the callback argument for consistency with iOS.
// Add support for the callback argument.
var result = Ti.Platform.openURL("https://www.google.com", function(e) {
Ti.API.info("### openURL() callback event.success: " + e.success);
});
// We should still support returned boolean for backward compatibility.
Ti.API.info("### openURL() returned: " + result);
*Note:*
The "options" dictionary should continue to be ignored since it only supports iOS settings. Meaning that the below should work on Android without issue.
var result = Ti.Platform.openURL("https://www.google.com", {/* Ignore Me */}, function(e) {
Ti.API.info("### openURL() callback event.success: " + e.success);
});
PR (master): https://github.com/appcelerator/titanium_mobile/pull/11668
FR Passed
Verified on: Mac OS: 10.15.4 SDK: 9.1.0.v20200727104531 Appc CLI: 8.1.0-master.7 JDK: 11.0.4 Node: 10.17.0 Studio: 6.0.0.202005141803 Device: Pixel3(v10.0) emulator