Skip to content

Commit 32526f4

Browse files
Merge pull request #11 from thirtified/fix-isAvailable-for-non-iOS-platforms
Correctly report SafariViewController availability for non-iOS platforms
2 parents ffd297c + 19266d4 commit 32526f4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

www/SafariViewController.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
var exec = require("cordova/exec");
22
module.exports = {
33
isAvailable: function (callback) {
4-
exec(callback, null, "SafariViewController", "isAvailable", []);
4+
var errorHandler = function errorHandler(error) {
5+
// An error has occurred while trying to access the
6+
// SafariViewController native implementation, most likely because
7+
// we are on an unsupported platform.
8+
callback(false);
9+
};
10+
exec(callback, errorHandler, "SafariViewController", "isAvailable", []);
511
},
612
show: function (options, onSuccess, onError) {
713
var opts = options || {};
@@ -13,4 +19,4 @@ module.exports = {
1319
hide: function (onSuccess, onError) {
1420
exec(onSuccess, onError, "SafariViewController", "hide", []);
1521
}
16-
};
22+
};

0 commit comments

Comments
 (0)