cordova-plugin-mserviceinterface-2.0 1.0.67 → 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 +84 -38
- package/src/android/mInterfaceService.java +38 -63
- package/src/android/mInterfaceUtil.java +114 -65
- package/src/ios/mInterface.h +1 -0
- package/src/ios/mInterface.m +468 -240
|
@@ -49,6 +49,7 @@ import java.net.HttpURLConnection;
|
|
|
49
49
|
import java.net.URL;
|
|
50
50
|
import java.nio.charset.StandardCharsets;
|
|
51
51
|
import java.text.SimpleDateFormat;
|
|
52
|
+
import java.util.ArrayList;
|
|
52
53
|
import java.util.Arrays;
|
|
53
54
|
import java.util.Date;
|
|
54
55
|
import java.util.Locale;
|
|
@@ -88,6 +89,7 @@ public class mInterfaceUtil {
|
|
|
88
89
|
|
|
89
90
|
private static final String PREFS_NAME = "app_prefs";
|
|
90
91
|
private static final String KEY_FIRST_LAUNCH = "first_launch";
|
|
92
|
+
|
|
91
93
|
public static String decrypt(String encryptedText) {
|
|
92
94
|
String decryptedText = "";
|
|
93
95
|
try {
|
|
@@ -225,7 +227,7 @@ public class mInterfaceUtil {
|
|
|
225
227
|
String currentLine, lastKnownLocation = "";
|
|
226
228
|
File locationFile;
|
|
227
229
|
try {
|
|
228
|
-
locationFile = new File(rootDirectory, "/" + mInterfaceUtil.packageName + "/
|
|
230
|
+
locationFile = new File(rootDirectory, "/" + mInterfaceUtil.packageName + "/last_known_location.txt");
|
|
229
231
|
if (locationFile.exists() && !locationFile.isDirectory()) {
|
|
230
232
|
BufferedReader readerObj = new BufferedReader(new FileReader(locationFile));
|
|
231
233
|
while ((currentLine = readerObj.readLine()) != null) {
|
|
@@ -305,7 +307,7 @@ public class mInterfaceUtil {
|
|
|
305
307
|
callbackContext.error("No file available & File not deleted for " + str);
|
|
306
308
|
}
|
|
307
309
|
} catch (Exception e) {
|
|
308
|
-
callbackContext.error("deleteMultipleFiles failed: Exception is : "+e.getMessage());
|
|
310
|
+
callbackContext.error("deleteMultipleFiles failed: Exception is : " + e.getMessage());
|
|
309
311
|
}
|
|
310
312
|
}
|
|
311
313
|
|
|
@@ -398,7 +400,7 @@ public class mInterfaceUtil {
|
|
|
398
400
|
}
|
|
399
401
|
callbackContext.success("success");
|
|
400
402
|
} catch (Exception e) {
|
|
401
|
-
callbackContext.error("copyFile failed exception is : "+e.getMessage());
|
|
403
|
+
callbackContext.error("copyFile failed exception is : " + e.getMessage());
|
|
402
404
|
}
|
|
403
405
|
}
|
|
404
406
|
|
|
@@ -463,7 +465,7 @@ public class mInterfaceUtil {
|
|
|
463
465
|
deleteFilesFromDirectory();
|
|
464
466
|
callbackContext.success("success");
|
|
465
467
|
} catch (Exception e) {
|
|
466
|
-
callbackContext.error("copyAttachmentFile failed, exception is : "+e.getMessage());
|
|
468
|
+
callbackContext.error("copyAttachmentFile failed, exception is : " + e.getMessage());
|
|
467
469
|
}
|
|
468
470
|
}
|
|
469
471
|
|
|
@@ -511,7 +513,7 @@ public class mInterfaceUtil {
|
|
|
511
513
|
}
|
|
512
514
|
callbackContext.success("success");
|
|
513
515
|
} catch (Exception e) {
|
|
514
|
-
callbackContext.error("Move File failed, exception is : "+e.getMessage());
|
|
516
|
+
callbackContext.error("Move File failed, exception is : " + e.getMessage());
|
|
515
517
|
}
|
|
516
518
|
}
|
|
517
519
|
|
|
@@ -586,19 +588,11 @@ public class mInterfaceUtil {
|
|
|
586
588
|
String clientID, countryCode, userID, clientUrl;
|
|
587
589
|
BufferedReader myAccountsFileReader;
|
|
588
590
|
StringBuilder myAccountsFileBuilder;
|
|
589
|
-
|
|
590
|
-
JSONObject currentAccount;
|
|
591
|
+
ArrayList<JSONObject> accountsList;
|
|
591
592
|
String currentLine;
|
|
592
|
-
if (new File(rootDirectory, "/" + mInterfaceUtil.packageName + "/"
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
while ((currentLine = myAccountsFileReader.readLine()) != null) {
|
|
596
|
-
myAccountsFileBuilder.append(currentLine);
|
|
597
|
-
}
|
|
598
|
-
myAccountsFileReader.close();
|
|
599
|
-
accountsList = new JSONArray(decrypt(myAccountsFileBuilder.toString()));
|
|
600
|
-
for (int index = 0; index < accountsList.length(); index++) {
|
|
601
|
-
currentAccount = accountsList.optJSONObject(index);
|
|
593
|
+
if (new File(rootDirectory, "/" + mInterfaceUtil.packageName + "/my_accounts").exists()) {
|
|
594
|
+
accountsList = mInterface.getJsonDataFromFiles(new File(rootDirectory, "/" + mInterfaceUtil.packageName + "/my_accounts").getPath());
|
|
595
|
+
for (JSONObject currentAccount : accountsList) {
|
|
602
596
|
clientID = currentAccount.optString("client_id");
|
|
603
597
|
countryCode = currentAccount.optString("country_code");
|
|
604
598
|
userID = currentAccount.optString("user_id");
|
|
@@ -659,7 +653,7 @@ public class mInterfaceUtil {
|
|
|
659
653
|
}
|
|
660
654
|
} catch (Exception e) {
|
|
661
655
|
callbackContext.error(e.getMessage());
|
|
662
|
-
System.out.println("Queue processor failed, exception is : "+ e.getMessage());
|
|
656
|
+
System.out.println("Queue processor failed, exception is : " + e.getMessage());
|
|
663
657
|
}
|
|
664
658
|
}
|
|
665
659
|
|
|
@@ -1150,7 +1144,7 @@ public class mInterfaceUtil {
|
|
|
1150
1144
|
callbackContext.error("There is no file at the given path. Path: " + filePath);
|
|
1151
1145
|
}
|
|
1152
1146
|
} catch (Exception e) {
|
|
1153
|
-
callbackContext.error("unable to readFile, Exception is: "+e.getMessage());
|
|
1147
|
+
callbackContext.error("unable to readFile, Exception is: " + e.getMessage());
|
|
1154
1148
|
}
|
|
1155
1149
|
}
|
|
1156
1150
|
|
|
@@ -1162,10 +1156,10 @@ public class mInterfaceUtil {
|
|
|
1162
1156
|
filePath.delete();
|
|
1163
1157
|
callbackContext.success();
|
|
1164
1158
|
} else {
|
|
1165
|
-
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"));
|
|
1166
1160
|
}
|
|
1167
1161
|
} catch (Exception e) {
|
|
1168
|
-
callbackContext.error("delete file failed, exception is : "+e.getMessage());
|
|
1162
|
+
callbackContext.error("delete file failed, exception is : " + e.getMessage());
|
|
1169
1163
|
}
|
|
1170
1164
|
}
|
|
1171
1165
|
|
|
@@ -1188,7 +1182,7 @@ public class mInterfaceUtil {
|
|
|
1188
1182
|
callbackContext.success();
|
|
1189
1183
|
} catch (Exception e) {
|
|
1190
1184
|
try {
|
|
1191
|
-
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());
|
|
1192
1186
|
} catch (JSONException ex) {
|
|
1193
1187
|
e.printStackTrace();
|
|
1194
1188
|
}
|
|
@@ -1203,7 +1197,7 @@ public class mInterfaceUtil {
|
|
|
1203
1197
|
callbackContext.success(sss ? "true" : "false");
|
|
1204
1198
|
} catch (Exception e) {
|
|
1205
1199
|
try {
|
|
1206
|
-
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());
|
|
1207
1201
|
} catch (JSONException ex) {
|
|
1208
1202
|
e.printStackTrace();
|
|
1209
1203
|
}
|
|
@@ -1222,7 +1216,7 @@ public class mInterfaceUtil {
|
|
|
1222
1216
|
callbackContext.success();
|
|
1223
1217
|
} catch (Exception e) {
|
|
1224
1218
|
try {
|
|
1225
|
-
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());
|
|
1226
1220
|
} catch (JSONException ex) {
|
|
1227
1221
|
e.printStackTrace();
|
|
1228
1222
|
}
|
|
@@ -1235,20 +1229,20 @@ public class mInterfaceUtil {
|
|
|
1235
1229
|
try {
|
|
1236
1230
|
String fileName = args.getJSONObject(0).optString("filePath");
|
|
1237
1231
|
if (fileName.equals("")) {
|
|
1238
|
-
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"));
|
|
1239
1233
|
} else {
|
|
1240
1234
|
File dir = new File(rootDirectory + "/" + fileName);
|
|
1241
1235
|
if (dir.exists()) {
|
|
1242
1236
|
deleteRecursive(dir);
|
|
1243
1237
|
callbackContext.success();
|
|
1244
1238
|
} else {
|
|
1245
|
-
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"));
|
|
1246
1240
|
}
|
|
1247
1241
|
|
|
1248
1242
|
}
|
|
1249
1243
|
} catch (Exception e) {
|
|
1250
1244
|
try {
|
|
1251
|
-
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());
|
|
1252
1246
|
} catch (JSONException ex) {
|
|
1253
1247
|
throw new RuntimeException(ex);
|
|
1254
1248
|
}
|
|
@@ -1266,7 +1260,7 @@ public class mInterfaceUtil {
|
|
|
1266
1260
|
|
|
1267
1261
|
fileOrDirectory.delete();
|
|
1268
1262
|
} catch (Exception e) {
|
|
1269
|
-
|
|
1263
|
+
e.printStackTrace();
|
|
1270
1264
|
}
|
|
1271
1265
|
}
|
|
1272
1266
|
|
|
@@ -1308,7 +1302,7 @@ public class mInterfaceUtil {
|
|
|
1308
1302
|
callbackContext.success();
|
|
1309
1303
|
} catch (Exception e) {
|
|
1310
1304
|
e.printStackTrace();
|
|
1311
|
-
callbackContext.error("unzip failed, exception is : "+e.getMessage());
|
|
1305
|
+
callbackContext.error("unzip failed, exception is : " + e.getMessage());
|
|
1312
1306
|
}
|
|
1313
1307
|
}
|
|
1314
1308
|
|
|
@@ -1335,7 +1329,7 @@ public class mInterfaceUtil {
|
|
|
1335
1329
|
}
|
|
1336
1330
|
} catch (Exception e) {
|
|
1337
1331
|
try {
|
|
1338
|
-
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());
|
|
1339
1333
|
} catch (JSONException ex) {
|
|
1340
1334
|
e.printStackTrace();
|
|
1341
1335
|
}
|
|
@@ -1365,7 +1359,7 @@ public class mInterfaceUtil {
|
|
|
1365
1359
|
}
|
|
1366
1360
|
} catch (Exception e) {
|
|
1367
1361
|
try {
|
|
1368
|
-
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());
|
|
1369
1363
|
} catch (JSONException ex) {
|
|
1370
1364
|
e.printStackTrace();
|
|
1371
1365
|
}
|
|
@@ -1408,7 +1402,7 @@ public class mInterfaceUtil {
|
|
|
1408
1402
|
}
|
|
1409
1403
|
} catch (Exception e) {
|
|
1410
1404
|
System.out.println(e.getMessage());
|
|
1411
|
-
callbackContext.error("getAppStateInfo failed, exception is : "+e.getMessage());
|
|
1405
|
+
callbackContext.error("getAppStateInfo failed, exception is : " + e.getMessage());
|
|
1412
1406
|
}
|
|
1413
1407
|
}
|
|
1414
1408
|
|
|
@@ -1433,6 +1427,7 @@ public class mInterfaceUtil {
|
|
|
1433
1427
|
jsonObject1 = jsonObject1.put("client_id", clientID);
|
|
1434
1428
|
jsonObject1 = jsonObject1.put("country_code", countryCode);
|
|
1435
1429
|
jsonObject1 = jsonObject1.put("purposeCode", "mobile_address_store");
|
|
1430
|
+
jsonObject1 = jsonObject1.put("version", "doubleo");
|
|
1436
1431
|
System.out.println("data format: " + jsonObject1);
|
|
1437
1432
|
oStreamObj = new OutputStreamWriter(urlConObj.getOutputStream());
|
|
1438
1433
|
oStreamObj.write(jsonObject1.toString());
|
|
@@ -1445,11 +1440,21 @@ public class mInterfaceUtil {
|
|
|
1445
1440
|
}
|
|
1446
1441
|
responseReaderObj.close();
|
|
1447
1442
|
urlConObj.disconnect();
|
|
1448
|
-
|
|
1449
|
-
|
|
1443
|
+
|
|
1444
|
+
BufferedReader reader = new BufferedReader(new FileReader(new File(rootDirectory, "/" + mInterfaceUtil.packageName + "/" + "my_accounts" + "/" + clientID + "_" + countryCode + ".json")));
|
|
1445
|
+
StringBuilder content = new StringBuilder();
|
|
1446
|
+
String line;
|
|
1447
|
+
while ((line = reader.readLine()) != null) {
|
|
1448
|
+
content.append(line);
|
|
1449
|
+
}
|
|
1450
|
+
reader.close();
|
|
1451
|
+
// Parse the existing data as JSON
|
|
1452
|
+
JSONObject existingData = new JSONObject(decrypt(content.toString()));
|
|
1453
|
+
existingData.put("keys", serverResponseObj.toString());
|
|
1454
|
+
writerObj = new BufferedWriter(new FileWriter(new File(rootDirectory, "/" + mInterfaceUtil.packageName + "/" + "my_accounts" + "/" + clientID + "_" + countryCode + ".json")));
|
|
1455
|
+
writerObj.write(encrypt(existingData.toString()));
|
|
1450
1456
|
writerObj.flush();
|
|
1451
1457
|
writerObj.close();
|
|
1452
|
-
|
|
1453
1458
|
/* App State info DATA REQUEST */
|
|
1454
1459
|
requestAuthenticationPath = new URL(cvsUrl + "/" + "get_app_state_info.aspx");
|
|
1455
1460
|
urlConObj = (HttpURLConnection) requestAuthenticationPath.openConnection();
|
|
@@ -1537,37 +1542,54 @@ public class mInterfaceUtil {
|
|
|
1537
1542
|
}
|
|
1538
1543
|
|
|
1539
1544
|
public static void validateAppStateInfo(Context applicationContext) {
|
|
1545
|
+
|
|
1540
1546
|
String currentLine;
|
|
1541
1547
|
try {
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1548
|
+
if (new File(rootDirectory, "/" + mInterfaceUtil.packageName + "/my_accounts").exists()) {
|
|
1549
|
+
ArrayList<JSONObject> accountsList = mInterface.getJsonDataFromFiles(new File(rootDirectory, "/" + mInterfaceUtil.packageName + "/my_accounts").getPath());
|
|
1550
|
+
for (JSONObject currentAccount : accountsList) {
|
|
1551
|
+
String clientID = currentAccount.optString("client_id");
|
|
1552
|
+
String countryCode = currentAccount.optString("country_code");
|
|
1553
|
+
|
|
1554
|
+
|
|
1555
|
+
File appStateIndicatorFile = new File(rootDirectory, "/" + mInterfaceUtil.packageName + "/" + clientID + "/" + countryCode + "/" + "app_state_info.txt");
|
|
1556
|
+
if (appStateIndicatorFile.exists()) {
|
|
1557
|
+
BufferedReader authFileReader = new BufferedReader(new FileReader(appStateIndicatorFile));
|
|
1558
|
+
StringBuilder authFileBuilder = new StringBuilder();
|
|
1559
|
+
while ((currentLine = authFileReader.readLine()) != null) {
|
|
1560
|
+
authFileBuilder.append(currentLine);
|
|
1561
|
+
}
|
|
1562
|
+
authFileReader.close();
|
|
1563
|
+
JSONObject authFileObj = new JSONObject(decrypt(authFileBuilder.toString()));
|
|
1564
|
+
long lastModifiedTime = appStateIndicatorFile.lastModified();
|
|
1565
|
+
Date date = new Date();
|
|
1566
|
+
date.setTime(lastModifiedTime);
|
|
1567
|
+
String lastModifiedDate = new SimpleDateFormat("yyyyMMdd", new mInterfaceUtil().locale).format(date);
|
|
1568
|
+
|
|
1569
|
+
if (authFileObj.optString("validDevice").equals("nostatus") || !lastModifiedDate.equals(new SimpleDateFormat("yyyyMMdd", new mInterfaceUtil().locale).format(new Date()))) {
|
|
1570
|
+
if (isConnected(applicationContext)) {
|
|
1571
|
+
UpdateAppStateInfo task = new UpdateAppStateInfo();
|
|
1572
|
+
task.setParam(currentAccount);
|
|
1573
|
+
task.execute();
|
|
1574
|
+
} else {
|
|
1575
|
+
mInterfaceService.handleAppStateTimer("success");
|
|
1576
|
+
}
|
|
1577
|
+
} else {
|
|
1578
|
+
mInterfaceService.handleAppStateTimer("success");
|
|
1579
|
+
}
|
|
1559
1580
|
} else {
|
|
1560
|
-
|
|
1581
|
+
if (isConnected(applicationContext)) {
|
|
1582
|
+
UpdateAppStateInfo task = new UpdateAppStateInfo();
|
|
1583
|
+
task.setParam(currentAccount);
|
|
1584
|
+
task.execute();
|
|
1585
|
+
} else {
|
|
1586
|
+
mInterfaceService.handleAppStateTimer("failure");
|
|
1587
|
+
}
|
|
1561
1588
|
}
|
|
1562
|
-
|
|
1563
|
-
mInterfaceService.handleAppStateTimer("success");
|
|
1589
|
+
|
|
1564
1590
|
}
|
|
1565
1591
|
} else {
|
|
1566
|
-
|
|
1567
|
-
new UpdateAppStateInfo().execute();
|
|
1568
|
-
} else {
|
|
1569
|
-
mInterfaceService.handleAppStateTimer("failure");
|
|
1570
|
-
}
|
|
1592
|
+
System.out.println("No my accounts file");
|
|
1571
1593
|
}
|
|
1572
1594
|
} catch (Exception e) {
|
|
1573
1595
|
System.out.println(e.getMessage());
|
|
@@ -1579,9 +1601,15 @@ public class mInterfaceUtil {
|
|
|
1579
1601
|
private static class UpdateAppStateInfo extends AsyncTask<String,
|
|
1580
1602
|
Void,
|
|
1581
1603
|
String> {
|
|
1604
|
+
private JSONObject currentAccount;
|
|
1605
|
+
|
|
1606
|
+
public void setParam(JSONObject currentAccount) {
|
|
1607
|
+
this.currentAccount = currentAccount;
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1582
1610
|
@Override
|
|
1583
1611
|
protected String doInBackground(String... strings) {
|
|
1584
|
-
String currentLine;
|
|
1612
|
+
String currentLine, clientUrl, clientID, countryCode, cvsUrl, deviceID, sessionID, userID, localeID;
|
|
1585
1613
|
URL requestAuthenticationPath,
|
|
1586
1614
|
requestValidateDevicePath, getKeysPath;
|
|
1587
1615
|
HttpURLConnection urlConObj;
|
|
@@ -1591,6 +1619,15 @@ public class mInterfaceUtil {
|
|
|
1591
1619
|
BufferedReader responseReaderObj;
|
|
1592
1620
|
JSONObject responseDataObj;
|
|
1593
1621
|
try {
|
|
1622
|
+
clientID = currentAccount.optString("client_id");
|
|
1623
|
+
countryCode = currentAccount.optString("country_code");
|
|
1624
|
+
clientUrl = currentAccount.optString("client_url");
|
|
1625
|
+
cvsUrl = currentAccount.optString("cvs_url");
|
|
1626
|
+
deviceID = currentAccount.optString("device_id");
|
|
1627
|
+
sessionID = currentAccount.optString("session_id");
|
|
1628
|
+
userID = currentAccount.optString("user_id");
|
|
1629
|
+
localeID = currentAccount.optString("locale_id");
|
|
1630
|
+
|
|
1594
1631
|
getKeysPath = new URL(clientUrl + "/" + "common/components/Keys/" + "RetrieveKey.aspx");
|
|
1595
1632
|
urlConObj = (HttpURLConnection) getKeysPath.openConnection();
|
|
1596
1633
|
urlConObj.setDoOutput(true);
|
|
@@ -1601,6 +1638,7 @@ public class mInterfaceUtil {
|
|
|
1601
1638
|
jsonObject1 = jsonObject1.put("client_id", clientID);
|
|
1602
1639
|
jsonObject1 = jsonObject1.put("country_code", countryCode);
|
|
1603
1640
|
jsonObject1 = jsonObject1.put("purposeCode", "mobile_address_store");
|
|
1641
|
+
jsonObject1 = jsonObject1.put("version", "doubleo");
|
|
1604
1642
|
System.out.println("data format: " + jsonObject1);
|
|
1605
1643
|
oStreamObj = new OutputStreamWriter(urlConObj.getOutputStream());
|
|
1606
1644
|
oStreamObj.write(jsonObject1.toString());
|
|
@@ -1613,8 +1651,18 @@ public class mInterfaceUtil {
|
|
|
1613
1651
|
}
|
|
1614
1652
|
responseReaderObj.close();
|
|
1615
1653
|
urlConObj.disconnect();
|
|
1616
|
-
|
|
1617
|
-
|
|
1654
|
+
BufferedReader reader = new BufferedReader(new FileReader(new File(rootDirectory, "/" + mInterfaceUtil.packageName + "/" + "my_accounts" + "/" + clientID + "_" + countryCode + "/" + ".json")));
|
|
1655
|
+
StringBuilder content = new StringBuilder();
|
|
1656
|
+
String line;
|
|
1657
|
+
while ((line = reader.readLine()) != null) {
|
|
1658
|
+
content.append(line);
|
|
1659
|
+
}
|
|
1660
|
+
reader.close();
|
|
1661
|
+
// Parse the existing data as JSON
|
|
1662
|
+
JSONObject existingData = new JSONObject(decrypt(content.toString()));
|
|
1663
|
+
existingData.put("keys", serverResponseObj.toString());
|
|
1664
|
+
writerObj = new BufferedWriter(new FileWriter(new File(rootDirectory, "/" + mInterfaceUtil.packageName + "/" + "my_accounts" + "/" + clientID + "_" + countryCode + "/" + ".json")));
|
|
1665
|
+
writerObj.write(encrypt(existingData.toString()));
|
|
1618
1666
|
writerObj.flush();
|
|
1619
1667
|
writerObj.close();
|
|
1620
1668
|
/* App State info DATA REQUEST */
|
|
@@ -1728,7 +1776,6 @@ public class mInterfaceUtil {
|
|
|
1728
1776
|
}
|
|
1729
1777
|
|
|
1730
1778
|
|
|
1731
|
-
|
|
1732
1779
|
public static boolean isConnected(Context applicationContext) {
|
|
1733
1780
|
try {
|
|
1734
1781
|
ConnectivityManager online = (ConnectivityManager) applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE);
|
|
@@ -1740,7 +1787,7 @@ public class mInterfaceUtil {
|
|
|
1740
1787
|
return false;
|
|
1741
1788
|
}
|
|
1742
1789
|
|
|
1743
|
-
public static void appCleanUp(CallbackContext callbackContext, Context applicationContext){
|
|
1790
|
+
public static void appCleanUp(CallbackContext callbackContext, Context applicationContext) {
|
|
1744
1791
|
try {
|
|
1745
1792
|
if (isFirstLaunch(applicationContext)) {
|
|
1746
1793
|
performCleanup(applicationContext);
|
|
@@ -1777,12 +1824,14 @@ public class mInterfaceUtil {
|
|
|
1777
1824
|
SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
|
|
1778
1825
|
return prefs.getBoolean(KEY_FIRST_LAUNCH, true);
|
|
1779
1826
|
}
|
|
1827
|
+
|
|
1780
1828
|
public static void setFirstLaunch(Context context, boolean value) {
|
|
1781
1829
|
SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
|
|
1782
1830
|
SharedPreferences.Editor editor = prefs.edit();
|
|
1783
1831
|
editor.putBoolean(KEY_FIRST_LAUNCH, value);
|
|
1784
1832
|
editor.apply();
|
|
1785
1833
|
}
|
|
1834
|
+
|
|
1786
1835
|
private static void deleteDirectory(File dir) {
|
|
1787
1836
|
if (dir != null && dir.isDirectory()) {
|
|
1788
1837
|
File[] files = dir.listFiles();
|
package/src/ios/mInterface.h
CHANGED
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
//- (void)triggerAuthenticationServices:(NSString *)clientId countryCode:(NSString *)countryCode userId:(NSString *)userId sessionId:(NSString *)sessionId localeId:(NSString *)localeId deviceID:(NSString *)deviceID clientUrl:(NSString *)clientUrl cvsUrl:(NSString *)cvsUrl authIndFilePath:(NSString *)authIndFilePath;
|
|
109
109
|
- (void)GetSyncIndicator:(CDVInvokedUrlCommand*)command;
|
|
110
110
|
- (void)CopyAttachmentFile:(CDVInvokedUrlCommand*)command;
|
|
111
|
+
- (void)getMyAccountsData:(CDVInvokedUrlCommand*)command;
|
|
111
112
|
@property (strong, nonatomic) CLLocationManager * locationManager;
|
|
112
113
|
@property (strong, nonatomic) NSMutableArray * coordinatesArray;
|
|
113
114
|
@property (weak, nonatomic) IBOutlet UIButton *btnGallery;
|