cordova-plugin-mserviceinterface-2.0 1.0.68 → 1.0.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugin.xml +1 -1
- package/src/android/mInterface.java +41 -52
- package/src/android/mInterfaceUtil.java +27 -23
package/package.json
CHANGED
package/plugin.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
|
3
3
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
4
4
|
id="cordova-plugin-mserviceinterface-2.0"
|
|
5
|
-
version="1.0.
|
|
5
|
+
version="1.0.69">
|
|
6
6
|
<name>mserviceinterface-2.0</name>
|
|
7
7
|
<description>This plugin establishes the connection to the native interface and performs the requested task.</description>
|
|
8
8
|
<author>selfservit@gmail.com</author>
|
|
@@ -186,7 +186,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
186
186
|
Toast.makeText(cordova.getActivity().getApplicationContext(), args.getJSONObject(0).optString("message"), Toast.LENGTH_SHORT).show();
|
|
187
187
|
}
|
|
188
188
|
} catch (Exception exception) {
|
|
189
|
-
callbackContext.error("showToastWithOptions: "+ exception.getMessage());
|
|
189
|
+
callbackContext.error("showToastWithOptions: " + exception.getMessage());
|
|
190
190
|
}
|
|
191
191
|
} else if (action.equals("CheckLocationAccuracy")) {
|
|
192
192
|
int locationInt;
|
|
@@ -581,7 +581,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
581
581
|
try {
|
|
582
582
|
new mInterfaceUtil().readFile(args, callbackContext);
|
|
583
583
|
} catch (Exception e) {
|
|
584
|
-
callbackContext.error("ReadFile failed, exception is : "+e.getMessage());
|
|
584
|
+
callbackContext.error("ReadFile failed, exception is : " + e.getMessage());
|
|
585
585
|
}
|
|
586
586
|
return true;
|
|
587
587
|
} else if (action.equals("DeleteFile")) {
|
|
@@ -715,7 +715,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
715
715
|
cordova.getActivity().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + cordova.getActivity().getApplicationContext().getPackageName())));
|
|
716
716
|
callbackContext.success("success");
|
|
717
717
|
} catch (Exception e) {
|
|
718
|
-
callbackContext.error("UpdateNew failed, exception is : "+e.getMessage());
|
|
718
|
+
callbackContext.error("UpdateNew failed, exception is : " + e.getMessage());
|
|
719
719
|
}
|
|
720
720
|
} else if (action.equals("OpenFileWithViewer")) {
|
|
721
721
|
try {
|
|
@@ -735,7 +735,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
735
735
|
cordova.getActivity().startActivity(intent);
|
|
736
736
|
callbackContext.success();
|
|
737
737
|
} catch (Exception e) {
|
|
738
|
-
callbackContext.error("OpenFileWithViewer failed, exception is : "+e.getMessage());
|
|
738
|
+
callbackContext.error("OpenFileWithViewer failed, exception is : " + e.getMessage());
|
|
739
739
|
}
|
|
740
740
|
} else if (action.equals("CaptureImageFromCamera")) {
|
|
741
741
|
try {
|
|
@@ -746,7 +746,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
746
746
|
captureImage(callbackContext);
|
|
747
747
|
return true;
|
|
748
748
|
} catch (Exception e) {
|
|
749
|
-
callbackContext.error("CaptureImageFromCamera failed, exception is : "+e.getMessage());
|
|
749
|
+
callbackContext.error("CaptureImageFromCamera failed, exception is : " + e.getMessage());
|
|
750
750
|
}
|
|
751
751
|
} else if (action.equals("PickImageFromGallery")) {
|
|
752
752
|
try {
|
|
@@ -757,7 +757,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
757
757
|
pickImageFromGallery(callbackContext);
|
|
758
758
|
return true;
|
|
759
759
|
} catch (Exception e) {
|
|
760
|
-
callbackContext.error("PickImageFromGallery failed, exception is : "+e.getMessage());
|
|
760
|
+
callbackContext.error("PickImageFromGallery failed, exception is : " + e.getMessage());
|
|
761
761
|
}
|
|
762
762
|
} else if (action.equals("CaptureFromCamera")) {
|
|
763
763
|
try {
|
|
@@ -786,7 +786,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
786
786
|
final DownloadTask downloadTask = new DownloadTask(cordova.getActivity(), callback);
|
|
787
787
|
downloadTask.execute(args.optJSONObject(0).optString("url"), args.optJSONObject(0).optString("filePath"), args.optJSONObject(0).optString("thumbnailInd"));
|
|
788
788
|
} catch (Exception e) {
|
|
789
|
-
callbackContext.error("DownloadFile failed for "+args.optJSONObject(0).optString("url")+", exception is : "+e.getMessage());
|
|
789
|
+
callbackContext.error("DownloadFile failed for " + args.optJSONObject(0).optString("url") + ", exception is : " + e.getMessage());
|
|
790
790
|
}
|
|
791
791
|
return true;
|
|
792
792
|
} else if ("QueueProcessor".equals(action)) {
|
|
@@ -797,14 +797,14 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
797
797
|
scanQRCode(callbackContext);
|
|
798
798
|
return true;
|
|
799
799
|
} catch (Exception e) {
|
|
800
|
-
callbackContext.error("ScanQRCode failed, exception is : "+e.getMessage());
|
|
800
|
+
callbackContext.error("ScanQRCode failed, exception is : " + e.getMessage());
|
|
801
801
|
}
|
|
802
802
|
} else if (action.equals("ScanBarCode")) {
|
|
803
803
|
try {
|
|
804
804
|
scanBarCode(callbackContext);
|
|
805
805
|
return true;
|
|
806
806
|
} catch (Exception e) {
|
|
807
|
-
callbackContext.error("ScanBarCode failed, exception is : "+e.getMessage());
|
|
807
|
+
callbackContext.error("ScanBarCode failed, exception is : " + e.getMessage());
|
|
808
808
|
}
|
|
809
809
|
} else if (action.equals("GetSubDirectoryList")) {
|
|
810
810
|
new mInterfaceUtil().getSubDirectoryList(args, callbackContext);
|
|
@@ -823,7 +823,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
823
823
|
callbackContext.success("");
|
|
824
824
|
}
|
|
825
825
|
} catch (Exception e) {
|
|
826
|
-
callbackContext.error("GetAppStateInfo failed, exception is : "+e.getMessage());
|
|
826
|
+
callbackContext.error("GetAppStateInfo failed, exception is : " + e.getMessage());
|
|
827
827
|
}
|
|
828
828
|
return true;
|
|
829
829
|
} else if (action.equals("UpdateAppInfo")) {
|
|
@@ -835,7 +835,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
835
835
|
callbackContext.error("failed to update app info");
|
|
836
836
|
}
|
|
837
837
|
} catch (Exception e) {
|
|
838
|
-
callbackContext.error("UpdateAppInfo failed, exception is : "+e.getMessage());
|
|
838
|
+
callbackContext.error("UpdateAppInfo failed, exception is : " + e.getMessage());
|
|
839
839
|
}
|
|
840
840
|
return true;
|
|
841
841
|
} else if (action.equals("MoveFile")) {
|
|
@@ -878,7 +878,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
878
878
|
}
|
|
879
879
|
} catch (JSONException e) {
|
|
880
880
|
e.printStackTrace();
|
|
881
|
-
result = new PluginResult(PluginResult.Status.ERROR, "OpenSms failed, exception is : "+e.getMessage());
|
|
881
|
+
result = new PluginResult(PluginResult.Status.ERROR, "OpenSms failed, exception is : " + e.getMessage());
|
|
882
882
|
callback.sendPluginResult(result);
|
|
883
883
|
}
|
|
884
884
|
return true;
|
|
@@ -949,7 +949,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
949
949
|
}
|
|
950
950
|
} catch (Exception e) {
|
|
951
951
|
e.printStackTrace();
|
|
952
|
-
result = new PluginResult(PluginResult.Status.ERROR, "OpenEmail failed, exception is : "+e.getMessage());
|
|
952
|
+
result = new PluginResult(PluginResult.Status.ERROR, "OpenEmail failed, exception is : " + e.getMessage());
|
|
953
953
|
callback.sendPluginResult(result);
|
|
954
954
|
}
|
|
955
955
|
|
|
@@ -963,27 +963,27 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
963
963
|
callbackContext.success("success");
|
|
964
964
|
} catch (Exception e) {
|
|
965
965
|
e.printStackTrace();
|
|
966
|
-
result = new PluginResult(PluginResult.Status.ERROR, "copyAttachmentFile failed, exception is : "+e.getMessage());
|
|
966
|
+
result = new PluginResult(PluginResult.Status.ERROR, "copyAttachmentFile failed, exception is : " + e.getMessage());
|
|
967
967
|
callback.sendPluginResult(result);
|
|
968
968
|
}
|
|
969
969
|
|
|
970
970
|
} else if (action.equals("getMyAccountsData")) {
|
|
971
971
|
try {
|
|
972
|
-
String folderPath =
|
|
972
|
+
String folderPath = mInterfaceUtil.rootDirectory + "/" + args.getJSONObject(0).optString("folderPath");
|
|
973
973
|
ArrayList<JSONObject> dataArray = getJsonDataFromFiles(folderPath);
|
|
974
974
|
JSONArray jsonResult = new JSONArray(dataArray);
|
|
975
975
|
callbackContext.success(jsonResult.toString());
|
|
976
976
|
} catch (Exception e) {
|
|
977
977
|
e.printStackTrace();
|
|
978
|
-
PluginResult result = new PluginResult(PluginResult.Status.ERROR, "getMyAccountsData failed, exception is : "+e.getMessage());
|
|
978
|
+
PluginResult result = new PluginResult(PluginResult.Status.ERROR, "getMyAccountsData failed, exception is : " + e.getMessage());
|
|
979
979
|
callback.sendPluginResult(result);
|
|
980
980
|
}
|
|
981
|
-
}else if (action.equals("KillBackgroundExecutions")) {
|
|
981
|
+
} else if (action.equals("KillBackgroundExecutions")) {
|
|
982
982
|
callbackContext.success("success");
|
|
983
983
|
return true;
|
|
984
984
|
}
|
|
985
985
|
} catch (JSONException e) {
|
|
986
|
-
System.out.println(" unable to proccess plugin method, exception is : "+e.getMessage());
|
|
986
|
+
System.out.println(" unable to proccess plugin method, exception is : " + e.getMessage());
|
|
987
987
|
}
|
|
988
988
|
return true;
|
|
989
989
|
}
|
|
@@ -1018,6 +1018,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
1018
1018
|
}
|
|
1019
1019
|
return dataArray;
|
|
1020
1020
|
}
|
|
1021
|
+
|
|
1021
1022
|
private boolean validateMobileNumber(String mobileNo) {
|
|
1022
1023
|
String regex;
|
|
1023
1024
|
boolean result = false;
|
|
@@ -1093,7 +1094,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
1093
1094
|
pluginResult.setKeepCallback(true);
|
|
1094
1095
|
callbackContext.sendPluginResult(pluginResult);
|
|
1095
1096
|
} catch (Exception e) {
|
|
1096
|
-
callbackContext.error("scanQRCode failed, exception is : "+e.getMessage());
|
|
1097
|
+
callbackContext.error("scanQRCode failed, exception is : " + e.getMessage());
|
|
1097
1098
|
}
|
|
1098
1099
|
}
|
|
1099
1100
|
|
|
@@ -1113,7 +1114,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
1113
1114
|
pluginResult.setKeepCallback(true);
|
|
1114
1115
|
callbackContext.sendPluginResult(pluginResult);
|
|
1115
1116
|
} catch (Exception e) {
|
|
1116
|
-
callbackContext.error("scanBarCode failed, exception is : "+e.getMessage());
|
|
1117
|
+
callbackContext.error("scanBarCode failed, exception is : " + e.getMessage());
|
|
1117
1118
|
}
|
|
1118
1119
|
}
|
|
1119
1120
|
|
|
@@ -1121,7 +1122,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
1121
1122
|
try {
|
|
1122
1123
|
callbackContext.success("file://" + mInterfaceUtil.rootDirectory + "/");
|
|
1123
1124
|
} catch (Exception e) {
|
|
1124
|
-
callbackContext.error("getStorageRoot failed, exception is : "+e.getMessage());
|
|
1125
|
+
callbackContext.error("getStorageRoot failed, exception is : " + e.getMessage());
|
|
1125
1126
|
}
|
|
1126
1127
|
}
|
|
1127
1128
|
|
|
@@ -1217,7 +1218,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
1217
1218
|
callback.success("success");
|
|
1218
1219
|
}
|
|
1219
1220
|
} catch (Exception e) {
|
|
1220
|
-
callback.error("getPermissions failed, exception is : "+e.getMessage());
|
|
1221
|
+
callback.error("getPermissions failed, exception is : " + e.getMessage());
|
|
1221
1222
|
}
|
|
1222
1223
|
}
|
|
1223
1224
|
|
|
@@ -1293,7 +1294,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
1293
1294
|
pluginResult.setKeepCallback(true);
|
|
1294
1295
|
callbackContext.sendPluginResult(pluginResult);
|
|
1295
1296
|
} catch (Exception e) {
|
|
1296
|
-
callbackContext.error("pickImageFromGallery failed, exception is : "+e.getMessage());
|
|
1297
|
+
callbackContext.error("pickImageFromGallery failed, exception is : " + e.getMessage());
|
|
1297
1298
|
}
|
|
1298
1299
|
}
|
|
1299
1300
|
|
|
@@ -1459,12 +1460,12 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
1459
1460
|
callback.success(fileProperities);
|
|
1460
1461
|
} catch (Exception e) {
|
|
1461
1462
|
attachmentDestPath = "";
|
|
1462
|
-
callback.error("convertImageTo64BaseString failed, exception is : "+e.getMessage());
|
|
1463
|
+
callback.error("convertImageTo64BaseString failed, exception is : " + e.getMessage());
|
|
1463
1464
|
}
|
|
1464
1465
|
}
|
|
1465
1466
|
} catch (Exception e) {
|
|
1466
1467
|
attachmentDestPath = "";
|
|
1467
|
-
callbackContext.error("convertImageTo64BaseString failed, exception is : "+e.getMessage());
|
|
1468
|
+
callbackContext.error("convertImageTo64BaseString failed, exception is : " + e.getMessage());
|
|
1468
1469
|
}
|
|
1469
1470
|
|
|
1470
1471
|
} catch (Exception e) {
|
|
@@ -1480,20 +1481,8 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
1480
1481
|
File image = new File(filePath);
|
|
1481
1482
|
BitmapFactory.Options bmOptions = new BitmapFactory.Options();
|
|
1482
1483
|
Bitmap bitmap = BitmapFactory.decodeFile(image.getAbsolutePath(), bmOptions);
|
|
1483
|
-
|
|
1484
|
-
// Ensure the bitmap has an alpha channel (transparency).
|
|
1485
|
-
if (bitmap.getConfig() != Bitmap.Config.ARGB_8888) {
|
|
1486
|
-
Bitmap newBitmap = Bitmap.createBitmap(
|
|
1487
|
-
bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
|
|
1488
|
-
Canvas canvas = new Canvas(newBitmap);
|
|
1489
|
-
canvas.drawColor(Color.TRANSPARENT);
|
|
1490
|
-
canvas.drawBitmap(bitmap, 0, 0, null);
|
|
1491
|
-
bitmap.recycle();
|
|
1492
|
-
bitmap = newBitmap;
|
|
1493
|
-
}
|
|
1494
|
-
|
|
1495
1484
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
|
1496
|
-
bitmap.compress(Bitmap.CompressFormat.
|
|
1485
|
+
bitmap.compress(Bitmap.CompressFormat.PNG, 100, outputStream);
|
|
1497
1486
|
resultString = Base64.encodeToString(outputStream.toByteArray(), Base64.NO_WRAP);
|
|
1498
1487
|
} catch (Exception e) {
|
|
1499
1488
|
e.printStackTrace();
|
|
@@ -1510,7 +1499,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
1510
1499
|
pluginResult.setKeepCallback(true);
|
|
1511
1500
|
callbackContext.sendPluginResult(pluginResult);
|
|
1512
1501
|
} catch (Exception e) {
|
|
1513
|
-
callbackContext.error("unable to choose file, exception is : "+e.getMessage());
|
|
1502
|
+
callbackContext.error("unable to choose file, exception is : " + e.getMessage());
|
|
1514
1503
|
}
|
|
1515
1504
|
}
|
|
1516
1505
|
|
|
@@ -1543,7 +1532,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
1543
1532
|
r.put("build", packageManager.getPackageInfo(this.cordova.getActivity().getPackageName(), 0).versionCode);
|
|
1544
1533
|
callbackContext.success(r);
|
|
1545
1534
|
} catch (Exception e) {
|
|
1546
|
-
callbackContext.error("unable to get appVersion, exception is : "+e.getMessage());
|
|
1535
|
+
callbackContext.error("unable to get appVersion, exception is : " + e.getMessage());
|
|
1547
1536
|
}
|
|
1548
1537
|
}
|
|
1549
1538
|
|
|
@@ -1576,7 +1565,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
1576
1565
|
}
|
|
1577
1566
|
callbackContext.success(currentOrientation);
|
|
1578
1567
|
} catch (Exception e) {
|
|
1579
|
-
callbackContext.success("rotateScreen failed, exception is : "+e.getMessage());
|
|
1568
|
+
callbackContext.success("rotateScreen failed, exception is : " + e.getMessage());
|
|
1580
1569
|
}
|
|
1581
1570
|
}
|
|
1582
1571
|
|
|
@@ -1601,7 +1590,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
1601
1590
|
r.put("applicationName", getApplicationName(cordova.getActivity()));
|
|
1602
1591
|
callbackContext.success(r);
|
|
1603
1592
|
} catch (Exception e) {
|
|
1604
|
-
callbackContext.error("unable to get deviceInfo, exception is : "+e.getMessage());
|
|
1593
|
+
callbackContext.error("unable to get deviceInfo, exception is : " + e.getMessage());
|
|
1605
1594
|
}
|
|
1606
1595
|
}
|
|
1607
1596
|
|
|
@@ -1863,13 +1852,13 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
1863
1852
|
}
|
|
1864
1853
|
}
|
|
1865
1854
|
} catch (Exception e) {
|
|
1866
|
-
callback.error("onActivityResult failed, exception is : "+e.getMessage());
|
|
1855
|
+
callback.error("onActivityResult failed, exception is : " + e.getMessage());
|
|
1867
1856
|
}
|
|
1868
1857
|
} else {
|
|
1869
1858
|
callback.error("onActivityResult: Selected file path is null");
|
|
1870
1859
|
}
|
|
1871
1860
|
} catch (Exception e) {
|
|
1872
|
-
callback.error("onActivityResult failed, exception is : "+e.getMessage());
|
|
1861
|
+
callback.error("onActivityResult failed, exception is : " + e.getMessage());
|
|
1873
1862
|
}
|
|
1874
1863
|
} else if (requestCode == REQUEST_IMAGE_CAPTURE && callback != null) {
|
|
1875
1864
|
if (resultCode == RESULT_OK) {
|
|
@@ -2111,7 +2100,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
2111
2100
|
callback.error("Error occurred in opening outputStream");
|
|
2112
2101
|
}
|
|
2113
2102
|
} catch (Exception e) {
|
|
2114
|
-
callback.error("copyFileFromUri failed, exception is : "+e.getMessage());
|
|
2103
|
+
callback.error("copyFileFromUri failed, exception is : " + e.getMessage());
|
|
2115
2104
|
}
|
|
2116
2105
|
return outPutFilePath;
|
|
2117
2106
|
}
|
|
@@ -2165,7 +2154,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
2165
2154
|
.checkLocationSettings(mGoogleApiClient1, builder.build());
|
|
2166
2155
|
result.setResultCallback(this);
|
|
2167
2156
|
} catch (Exception e) {
|
|
2168
|
-
callbackContext.error("EnableGPSAutomatically failed, exception is : "+e.getMessage());
|
|
2157
|
+
callbackContext.error("EnableGPSAutomatically failed, exception is : " + e.getMessage());
|
|
2169
2158
|
}
|
|
2170
2159
|
}
|
|
2171
2160
|
|
|
@@ -2176,7 +2165,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
2176
2165
|
startLocationUpdates1();
|
|
2177
2166
|
}
|
|
2178
2167
|
} catch (Exception e) {
|
|
2179
|
-
System.out.println("GoogleApiClient failed, exception is : "+e.getMessage());
|
|
2168
|
+
System.out.println("GoogleApiClient failed, exception is : " + e.getMessage());
|
|
2180
2169
|
}
|
|
2181
2170
|
}
|
|
2182
2171
|
|
|
@@ -2208,7 +2197,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
2208
2197
|
break;
|
|
2209
2198
|
}
|
|
2210
2199
|
} catch (Exception e) {
|
|
2211
|
-
System.out.println("LocationSettingsResult failed, exception is : "+e.getMessage());
|
|
2200
|
+
System.out.println("LocationSettingsResult failed, exception is : " + e.getMessage());
|
|
2212
2201
|
}
|
|
2213
2202
|
}
|
|
2214
2203
|
|
|
@@ -2222,7 +2211,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
2222
2211
|
callback.success(mCurrentLocation1.getLatitude() + "," + mCurrentLocation1.getLongitude());
|
|
2223
2212
|
}
|
|
2224
2213
|
} catch (Exception e) {
|
|
2225
|
-
callback.error("onLocationChanged failed, exception is : "+e.getMessage());
|
|
2214
|
+
callback.error("onLocationChanged failed, exception is : " + e.getMessage());
|
|
2226
2215
|
}
|
|
2227
2216
|
}
|
|
2228
2217
|
|
|
@@ -2278,7 +2267,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
2278
2267
|
output.write(data, 0, count);
|
|
2279
2268
|
}
|
|
2280
2269
|
} catch (Exception e) {
|
|
2281
|
-
downloadFileCallback.error("DownloadTask failed for url"+sUrl[0]+" , exception is : "+e.getMessage());
|
|
2270
|
+
downloadFileCallback.error("DownloadTask failed for url" + sUrl[0] + " , exception is : " + e.getMessage());
|
|
2282
2271
|
}
|
|
2283
2272
|
if (sUrl[2].equalsIgnoreCase("true")) {
|
|
2284
2273
|
return sUrl[1];
|
|
@@ -2304,7 +2293,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
2304
2293
|
downloadFileCallback.success("");
|
|
2305
2294
|
}
|
|
2306
2295
|
} catch (Exception e) {
|
|
2307
|
-
downloadFileCallback.error("copyAttachmentFile failed, exception is : "+e.getMessage());
|
|
2296
|
+
downloadFileCallback.error("copyAttachmentFile failed, exception is : " + e.getMessage());
|
|
2308
2297
|
}
|
|
2309
2298
|
}
|
|
2310
2299
|
}
|
|
@@ -2401,7 +2390,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
2401
2390
|
else
|
|
2402
2391
|
callbackContext.error("Bad zip file");
|
|
2403
2392
|
} catch (Exception e) {
|
|
2404
|
-
String errorMessage = "unzipSync failed, exception is : "+e.getMessage();
|
|
2393
|
+
String errorMessage = "unzipSync failed, exception is : " + e.getMessage();
|
|
2405
2394
|
callbackContext.error(errorMessage);
|
|
2406
2395
|
} finally {
|
|
2407
2396
|
if (inputStream != null) {
|
|
@@ -89,6 +89,7 @@ public class mInterfaceUtil {
|
|
|
89
89
|
|
|
90
90
|
private static final String PREFS_NAME = "app_prefs";
|
|
91
91
|
private static final String KEY_FIRST_LAUNCH = "first_launch";
|
|
92
|
+
|
|
92
93
|
public static String decrypt(String encryptedText) {
|
|
93
94
|
String decryptedText = "";
|
|
94
95
|
try {
|
|
@@ -306,7 +307,7 @@ public class mInterfaceUtil {
|
|
|
306
307
|
callbackContext.error("No file available & File not deleted for " + str);
|
|
307
308
|
}
|
|
308
309
|
} catch (Exception e) {
|
|
309
|
-
callbackContext.error("deleteMultipleFiles failed: Exception is : "+e.getMessage());
|
|
310
|
+
callbackContext.error("deleteMultipleFiles failed: Exception is : " + e.getMessage());
|
|
310
311
|
}
|
|
311
312
|
}
|
|
312
313
|
|
|
@@ -399,7 +400,7 @@ public class mInterfaceUtil {
|
|
|
399
400
|
}
|
|
400
401
|
callbackContext.success("success");
|
|
401
402
|
} catch (Exception e) {
|
|
402
|
-
callbackContext.error("copyFile failed exception is : "+e.getMessage());
|
|
403
|
+
callbackContext.error("copyFile failed exception is : " + e.getMessage());
|
|
403
404
|
}
|
|
404
405
|
}
|
|
405
406
|
|
|
@@ -464,7 +465,7 @@ public class mInterfaceUtil {
|
|
|
464
465
|
deleteFilesFromDirectory();
|
|
465
466
|
callbackContext.success("success");
|
|
466
467
|
} catch (Exception e) {
|
|
467
|
-
callbackContext.error("copyAttachmentFile failed, exception is : "+e.getMessage());
|
|
468
|
+
callbackContext.error("copyAttachmentFile failed, exception is : " + e.getMessage());
|
|
468
469
|
}
|
|
469
470
|
}
|
|
470
471
|
|
|
@@ -512,7 +513,7 @@ public class mInterfaceUtil {
|
|
|
512
513
|
}
|
|
513
514
|
callbackContext.success("success");
|
|
514
515
|
} catch (Exception e) {
|
|
515
|
-
callbackContext.error("Move File failed, exception is : "+e.getMessage());
|
|
516
|
+
callbackContext.error("Move File failed, exception is : " + e.getMessage());
|
|
516
517
|
}
|
|
517
518
|
}
|
|
518
519
|
|
|
@@ -652,7 +653,7 @@ public class mInterfaceUtil {
|
|
|
652
653
|
}
|
|
653
654
|
} catch (Exception e) {
|
|
654
655
|
callbackContext.error(e.getMessage());
|
|
655
|
-
System.out.println("Queue processor failed, exception is : "+ e.getMessage());
|
|
656
|
+
System.out.println("Queue processor failed, exception is : " + e.getMessage());
|
|
656
657
|
}
|
|
657
658
|
}
|
|
658
659
|
|
|
@@ -1143,7 +1144,7 @@ public class mInterfaceUtil {
|
|
|
1143
1144
|
callbackContext.error("There is no file at the given path. Path: " + filePath);
|
|
1144
1145
|
}
|
|
1145
1146
|
} catch (Exception e) {
|
|
1146
|
-
callbackContext.error("unable to readFile, Exception is: "+e.getMessage());
|
|
1147
|
+
callbackContext.error("unable to readFile, Exception is: " + e.getMessage());
|
|
1147
1148
|
}
|
|
1148
1149
|
}
|
|
1149
1150
|
|
|
@@ -1155,10 +1156,10 @@ public class mInterfaceUtil {
|
|
|
1155
1156
|
filePath.delete();
|
|
1156
1157
|
callbackContext.success();
|
|
1157
1158
|
} else {
|
|
1158
|
-
callbackContext.error("File not deleted, Path: "+baseDirectory + "/" + args.getJSONObject(0).optString("filePath"));
|
|
1159
|
+
callbackContext.error("File not deleted, Path: " + baseDirectory + "/" + args.getJSONObject(0).optString("filePath"));
|
|
1159
1160
|
}
|
|
1160
1161
|
} catch (Exception e) {
|
|
1161
|
-
callbackContext.error("delete file failed, exception is : "+e.getMessage());
|
|
1162
|
+
callbackContext.error("delete file failed, exception is : " + e.getMessage());
|
|
1162
1163
|
}
|
|
1163
1164
|
}
|
|
1164
1165
|
|
|
@@ -1181,7 +1182,7 @@ public class mInterfaceUtil {
|
|
|
1181
1182
|
callbackContext.success();
|
|
1182
1183
|
} catch (Exception e) {
|
|
1183
1184
|
try {
|
|
1184
|
-
callbackContext.error("create File failed for path:"+ args.getJSONObject(0).optString("filePath") +" , exception is : "+e.getMessage());
|
|
1185
|
+
callbackContext.error("create File failed for path:" + args.getJSONObject(0).optString("filePath") + " , exception is : " + e.getMessage());
|
|
1185
1186
|
} catch (JSONException ex) {
|
|
1186
1187
|
e.printStackTrace();
|
|
1187
1188
|
}
|
|
@@ -1196,7 +1197,7 @@ public class mInterfaceUtil {
|
|
|
1196
1197
|
callbackContext.success(sss ? "true" : "false");
|
|
1197
1198
|
} catch (Exception e) {
|
|
1198
1199
|
try {
|
|
1199
|
-
callbackContext.error("validate file failed for path:"+baseDirectory + "/" + args.getJSONObject(0).optString("filePath")+" , exception is : "+e.getMessage());
|
|
1200
|
+
callbackContext.error("validate file failed for path:" + baseDirectory + "/" + args.getJSONObject(0).optString("filePath") + " , exception is : " + e.getMessage());
|
|
1200
1201
|
} catch (JSONException ex) {
|
|
1201
1202
|
e.printStackTrace();
|
|
1202
1203
|
}
|
|
@@ -1215,7 +1216,7 @@ public class mInterfaceUtil {
|
|
|
1215
1216
|
callbackContext.success();
|
|
1216
1217
|
} catch (Exception e) {
|
|
1217
1218
|
try {
|
|
1218
|
-
callbackContext.error("create directory failed for " + args.getJSONObject(0).optString("filePath") +", exception is : "+e.getMessage());
|
|
1219
|
+
callbackContext.error("create directory failed for " + args.getJSONObject(0).optString("filePath") + ", exception is : " + e.getMessage());
|
|
1219
1220
|
} catch (JSONException ex) {
|
|
1220
1221
|
e.printStackTrace();
|
|
1221
1222
|
}
|
|
@@ -1228,20 +1229,20 @@ public class mInterfaceUtil {
|
|
|
1228
1229
|
try {
|
|
1229
1230
|
String fileName = args.getJSONObject(0).optString("filePath");
|
|
1230
1231
|
if (fileName.equals("")) {
|
|
1231
|
-
callbackContext.error("deleteDirectory: Given directory path is empty. path: "+args.getJSONObject(0).optString("filePath"));
|
|
1232
|
+
callbackContext.error("deleteDirectory: Given directory path is empty. path: " + args.getJSONObject(0).optString("filePath"));
|
|
1232
1233
|
} else {
|
|
1233
1234
|
File dir = new File(rootDirectory + "/" + fileName);
|
|
1234
1235
|
if (dir.exists()) {
|
|
1235
1236
|
deleteRecursive(dir);
|
|
1236
1237
|
callbackContext.success();
|
|
1237
1238
|
} else {
|
|
1238
|
-
callbackContext.error("deleteDirectory: File does not exists in "+args.getJSONObject(0).optString("filePath"));
|
|
1239
|
+
callbackContext.error("deleteDirectory: File does not exists in " + args.getJSONObject(0).optString("filePath"));
|
|
1239
1240
|
}
|
|
1240
1241
|
|
|
1241
1242
|
}
|
|
1242
1243
|
} catch (Exception e) {
|
|
1243
1244
|
try {
|
|
1244
|
-
callbackContext.error("delete directory failed for "+args.getJSONObject(0).optString("filePath")+", exception is : "+e.getMessage());
|
|
1245
|
+
callbackContext.error("delete directory failed for " + args.getJSONObject(0).optString("filePath") + ", exception is : " + e.getMessage());
|
|
1245
1246
|
} catch (JSONException ex) {
|
|
1246
1247
|
throw new RuntimeException(ex);
|
|
1247
1248
|
}
|
|
@@ -1259,7 +1260,7 @@ public class mInterfaceUtil {
|
|
|
1259
1260
|
|
|
1260
1261
|
fileOrDirectory.delete();
|
|
1261
1262
|
} catch (Exception e) {
|
|
1262
|
-
|
|
1263
|
+
e.printStackTrace();
|
|
1263
1264
|
}
|
|
1264
1265
|
}
|
|
1265
1266
|
|
|
@@ -1301,7 +1302,7 @@ public class mInterfaceUtil {
|
|
|
1301
1302
|
callbackContext.success();
|
|
1302
1303
|
} catch (Exception e) {
|
|
1303
1304
|
e.printStackTrace();
|
|
1304
|
-
callbackContext.error("unzip failed, exception is : "+e.getMessage());
|
|
1305
|
+
callbackContext.error("unzip failed, exception is : " + e.getMessage());
|
|
1305
1306
|
}
|
|
1306
1307
|
}
|
|
1307
1308
|
|
|
@@ -1328,7 +1329,7 @@ public class mInterfaceUtil {
|
|
|
1328
1329
|
}
|
|
1329
1330
|
} catch (Exception e) {
|
|
1330
1331
|
try {
|
|
1331
|
-
callbackContext.error("getSubDirectoryList failed for "+args.getJSONObject(0).optString("filePath")+", exception is : "+e.getMessage());
|
|
1332
|
+
callbackContext.error("getSubDirectoryList failed for " + args.getJSONObject(0).optString("filePath") + ", exception is : " + e.getMessage());
|
|
1332
1333
|
} catch (JSONException ex) {
|
|
1333
1334
|
e.printStackTrace();
|
|
1334
1335
|
}
|
|
@@ -1358,7 +1359,7 @@ public class mInterfaceUtil {
|
|
|
1358
1359
|
}
|
|
1359
1360
|
} catch (Exception e) {
|
|
1360
1361
|
try {
|
|
1361
|
-
callbackContext.error("getFileList failed for "+args.getJSONObject(0).optString("filePath")+", exception is : "+e.getMessage());
|
|
1362
|
+
callbackContext.error("getFileList failed for " + args.getJSONObject(0).optString("filePath") + ", exception is : " + e.getMessage());
|
|
1362
1363
|
} catch (JSONException ex) {
|
|
1363
1364
|
e.printStackTrace();
|
|
1364
1365
|
}
|
|
@@ -1401,7 +1402,7 @@ public class mInterfaceUtil {
|
|
|
1401
1402
|
}
|
|
1402
1403
|
} catch (Exception e) {
|
|
1403
1404
|
System.out.println(e.getMessage());
|
|
1404
|
-
callbackContext.error("getAppStateInfo failed, exception is : "+e.getMessage());
|
|
1405
|
+
callbackContext.error("getAppStateInfo failed, exception is : " + e.getMessage());
|
|
1405
1406
|
}
|
|
1406
1407
|
}
|
|
1407
1408
|
|
|
@@ -1587,7 +1588,7 @@ public class mInterfaceUtil {
|
|
|
1587
1588
|
}
|
|
1588
1589
|
|
|
1589
1590
|
}
|
|
1590
|
-
}else {
|
|
1591
|
+
} else {
|
|
1591
1592
|
System.out.println("No my accounts file");
|
|
1592
1593
|
}
|
|
1593
1594
|
} catch (Exception e) {
|
|
@@ -1601,12 +1602,14 @@ public class mInterfaceUtil {
|
|
|
1601
1602
|
Void,
|
|
1602
1603
|
String> {
|
|
1603
1604
|
private JSONObject currentAccount;
|
|
1605
|
+
|
|
1604
1606
|
public void setParam(JSONObject currentAccount) {
|
|
1605
1607
|
this.currentAccount = currentAccount;
|
|
1606
1608
|
}
|
|
1609
|
+
|
|
1607
1610
|
@Override
|
|
1608
1611
|
protected String doInBackground(String... strings) {
|
|
1609
|
-
String currentLine,clientUrl,clientID,countryCode,cvsUrl,deviceID,sessionID,userID,localeID;
|
|
1612
|
+
String currentLine, clientUrl, clientID, countryCode, cvsUrl, deviceID, sessionID, userID, localeID;
|
|
1610
1613
|
URL requestAuthenticationPath,
|
|
1611
1614
|
requestValidateDevicePath, getKeysPath;
|
|
1612
1615
|
HttpURLConnection urlConObj;
|
|
@@ -1773,7 +1776,6 @@ public class mInterfaceUtil {
|
|
|
1773
1776
|
}
|
|
1774
1777
|
|
|
1775
1778
|
|
|
1776
|
-
|
|
1777
1779
|
public static boolean isConnected(Context applicationContext) {
|
|
1778
1780
|
try {
|
|
1779
1781
|
ConnectivityManager online = (ConnectivityManager) applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE);
|
|
@@ -1785,7 +1787,7 @@ public class mInterfaceUtil {
|
|
|
1785
1787
|
return false;
|
|
1786
1788
|
}
|
|
1787
1789
|
|
|
1788
|
-
public static void appCleanUp(CallbackContext callbackContext, Context applicationContext){
|
|
1790
|
+
public static void appCleanUp(CallbackContext callbackContext, Context applicationContext) {
|
|
1789
1791
|
try {
|
|
1790
1792
|
if (isFirstLaunch(applicationContext)) {
|
|
1791
1793
|
performCleanup(applicationContext);
|
|
@@ -1822,12 +1824,14 @@ public class mInterfaceUtil {
|
|
|
1822
1824
|
SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
|
|
1823
1825
|
return prefs.getBoolean(KEY_FIRST_LAUNCH, true);
|
|
1824
1826
|
}
|
|
1827
|
+
|
|
1825
1828
|
public static void setFirstLaunch(Context context, boolean value) {
|
|
1826
1829
|
SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
|
|
1827
1830
|
SharedPreferences.Editor editor = prefs.edit();
|
|
1828
1831
|
editor.putBoolean(KEY_FIRST_LAUNCH, value);
|
|
1829
1832
|
editor.apply();
|
|
1830
1833
|
}
|
|
1834
|
+
|
|
1831
1835
|
private static void deleteDirectory(File dir) {
|
|
1832
1836
|
if (dir != null && dir.isDirectory()) {
|
|
1833
1837
|
File[] files = dir.listFiles();
|