Skip to content
Browse files

Merge pull request #709 from Patrick64/patch-1

[WebIntent Android] Compatibility for Phonegap 2.0
  • Loading branch information...
2 parents cc9a2f0 + ddd09ea commit 24212d449ddfb71f4ade67204d5fc51bad669e95 @macdonst macdonst committed Aug 15, 2012
Showing with 13 additions and 9 deletions.
  1. +13 −9 Android/WebIntent/webintent.js
View
22 Android/WebIntent/webintent.js
@@ -1,5 +1,5 @@
/**
- * Phonegap Web Intent plugin
+ * cordova Web Intent plugin
* Copyright (c) Boris Smus 2010
*
*/
@@ -15,31 +15,31 @@ WebIntent.EXTRA_STREAM = "android.intent.extra.STREAM";
WebIntent.EXTRA_EMAIL = "android.intent.extra.EMAIL";
WebIntent.prototype.startActivity = function(params, success, fail) {
- return PhoneGap.exec(function(args) {
+ return cordova.exec(function(args) {
success(args);
}, function(args) {
fail(args);
}, 'WebIntent', 'startActivity', [params]);
};
WebIntent.prototype.hasExtra = function(params, success, fail) {
- return PhoneGap.exec(function(args) {
+ return cordova.exec(function(args) {
success(args);
}, function(args) {
fail(args);
}, 'WebIntent', 'hasExtra', [params]);
};
WebIntent.prototype.getUri = function(success, fail) {
- return PhoneGap.exec(function(args) {
+ return cordova.exec(function(args) {
success(args);
}, function(args) {
fail(args);
}, 'WebIntent', 'getUri', []);
};
WebIntent.prototype.getExtra = function(params, success, fail) {
- return PhoneGap.exec(function(args) {
+ return cordova.exec(function(args) {
success(args);
}, function(args) {
fail(args);
@@ -48,20 +48,24 @@ WebIntent.prototype.getExtra = function(params, success, fail) {
WebIntent.prototype.onNewIntent = function(callback) {
- return PhoneGap.exec(function(args) {
+ return cordova.exec(function(args) {
callback(args);
}, function(args) {
}, 'WebIntent', 'onNewIntent', []);
};
WebIntent.prototype.sendBroadcast = function(params, success, fail) {
- return PhoneGap.exec(function(args) {
+ return cordova.exec(function(args) {
success(args);
}, function(args) {
fail(args);
}, 'WebIntent', 'sendBroadcast', [params]);
};
-PhoneGap.addConstructor(function() {
- PhoneGap.addPlugin('webintent', new WebIntent());
+cordova.addConstructor(function() {
+ window.webintent = new WebIntent();
+
+ // backwards compatibility
+ window.plugins = window.plugins || {};
+ window.plugins.webintent = window.webintent;
});

0 comments on commit 24212d4

Please sign in to comment.
Something went wrong with that request. Please try again.