#18 - fixed cordova 3.6.0 deprecation warnings, so we're ready for Cordova 4.x

This commit is contained in:
EddyVerbruggen 2014-09-27 15:41:53 +02:00
parent b9700455c7
commit 2fdfde7a1a
3 changed files with 13 additions and 5 deletions

View File

@ -2,7 +2,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="nl.x-services.plugins.toast"
version="2.0.1">
version="2.0.2">
<name>Toast</name>

View File

@ -6,6 +6,14 @@ import org.apache.cordova.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONException;
/*
// TODO nice way for the Toast plugin to offer a longer delay than the default short and long options
// TODO also look at https://github.com/JohnPersano/Supertoasts
new CountDownTimer(6000, 1000) {
public void onTick(long millisUntilFinished) {toast.show();}
public void onFinish() {toast.show();}
}.start();
*/
public class Toast extends CordovaPlugin {
private static final String ACTION_SHOW_EVENT = "show";

View File

@ -12,7 +12,7 @@
if (![position isEqual: @"top"] && ![position isEqual: @"center"] && ![position isEqual: @"bottom"]) {
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"invalid position. valid options are 'top', 'center' and 'bottom'"];
[self writeJavascript:[pluginResult toErrorCallbackString:command.callbackId]];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
return;
}
@ -23,14 +23,14 @@
durationInt = 5;
} else {
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"invalid duration. valid options are 'short' and 'long'"];
[self writeJavascript:[pluginResult toErrorCallbackString:command.callbackId]];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
return;
}
[self.webView makeToast:message duration:durationInt position:position];
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
[self writeJavascript:[pluginResult toSuccessCallbackString:command.callbackId]];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
@end