Skip to content

Commit

Permalink
Whitespce changes- convert spaces to tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
aharris88 / aharris88 committed Dec 31, 2014
1 parent 915fe99 commit e270023
Showing 1 changed file with 29 additions and 26 deletions.
55 changes: 29 additions & 26 deletions src/android/Sms.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class Sms extends CordovaPlugin {

@Override
public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException {

if (action.equals(ACTION_SEND_SMS)) {
try {
String phoneNumber = args.getJSONArray(0).join(";").replace("\"", "");
Expand All @@ -43,34 +44,34 @@ public boolean execute(String action, JSONArray args, final CallbackContext call
// always passes success back to the app
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK));
} else {
// by creating this broadcast receiver we can check whether or not the SMS was sent
// by creating this broadcast receiver we can check whether or not the SMS was sent
if (receiver == null) {
this.receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
PluginResult pluginResult;

switch (getResultCode()) {
case SmsManager.STATUS_ON_ICC_SENT:
pluginResult = new PluginResult(PluginResult.Status.OK);
pluginResult.setKeepCallback(true);
callbackContext.sendPluginResult(pluginResult);
break;
case Activity.RESULT_OK:
pluginResult = new PluginResult(PluginResult.Status.OK);
pluginResult.setKeepCallback(true);
callbackContext.sendPluginResult(pluginResult);
break;
case SmsManager.RESULT_ERROR_NO_SERVICE:
pluginResult = new PluginResult(PluginResult.Status.ERROR);
pluginResult.setKeepCallback(true);
callbackContext.sendPluginResult(pluginResult);
break;
default:
pluginResult = new PluginResult(PluginResult.Status.ERROR);
pluginResult.setKeepCallback(true);
callbackContext.sendPluginResult(pluginResult);
break;
case SmsManager.STATUS_ON_ICC_SENT:
pluginResult = new PluginResult(PluginResult.Status.OK);
pluginResult.setKeepCallback(true);
callbackContext.sendPluginResult(pluginResult);
break;
case Activity.RESULT_OK:
pluginResult = new PluginResult(PluginResult.Status.OK);
pluginResult.setKeepCallback(true);
callbackContext.sendPluginResult(pluginResult);
break;
case SmsManager.RESULT_ERROR_NO_SERVICE:
pluginResult = new PluginResult(PluginResult.Status.ERROR);
pluginResult.setKeepCallback(true);
callbackContext.sendPluginResult(pluginResult);
break;
default:
pluginResult = new PluginResult(PluginResult.Status.ERROR);
pluginResult.setKeepCallback(true);
callbackContext.sendPluginResult(pluginResult);
break;
}
}
};
Expand All @@ -90,8 +91,7 @@ public void onReceive(Context context, Intent intent) {

private boolean checkSupport() {
Activity ctx = this.cordova.getActivity();
return ctx.getPackageManager().hasSystemFeature(
PackageManager.FEATURE_TELEPHONY);
return ctx.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
}

@SuppressLint("NewApi")
Expand All @@ -117,7 +117,8 @@ private void invokeSMSIntent(String phoneNumber, String message) {

private void send(String phoneNumber, String message) {
SmsManager manager = SmsManager.getDefault();
PendingIntent sentIntent = PendingIntent.getBroadcast(this.cordova.getActivity(), 0, new Intent(INTENT_FILTER_SMS_SENT), 0);
PendingIntent sentIntent = PendingIntent.getBroadcast(this.cordova.getActivity(),
0, new Intent(INTENT_FILTER_SMS_SENT), 0);

// Use SendMultipartTextMessage if the message requires it
int parts_size = manager.divideMessage(message).size();
Expand All @@ -128,9 +129,10 @@ private void send(String phoneNumber, String message) {
sentIntents.add(sentIntent);
}
manager.sendMultipartTextMessage(phoneNumber, null, parts,
sentIntents, null);
sentIntents, null);
} else {
manager.sendTextMessage(phoneNumber, null, message, sentIntent, null);
manager.sendTextMessage(phoneNumber, null, message, sentIntent,
null);
}
}

Expand All @@ -145,3 +147,4 @@ public void onDestroy() {
}
}
}

0 comments on commit e270023

Please sign in to comment.