cordova-plugin-mserviceinterface-2.0 1.0.26 → 1.0.30
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 +28 -28
- package/plugin.xml +154 -153
- package/src/android/CallbackProgressDialog.java +53 -53
- package/src/android/FileProvider.java +7 -7
- package/src/android/backgroundNotification.java +120 -120
- package/src/android/doubleogradle.gradle +5 -5
- package/src/android/mInterface.java +2206 -2087
- package/src/android/mInterfaceReceiver.java +59 -59
- package/src/android/mInterfaceService.java +752 -749
- package/src/android/mInterfaceUtil.java +1686 -1686
- package/src/android/res/xml/network_security_config.xml +8 -8
- package/src/android/res/xml/opener_paths.xml +16 -16
- package/src/ios/InternetConnection.h +64 -64
- package/src/ios/InternetConnection.m +242 -242
- package/src/ios/SSZipArchive.h +146 -146
- package/src/ios/SSZipArchive.m +1180 -1180
- package/src/ios/SSZipCommon.h +66 -66
- package/src/ios/UICKeyChainStore.h +64 -64
- package/src/ios/UICKeyChainStore.m +434 -434
- package/src/ios/XMLConverter.h +61 -61
- package/src/ios/XMLConverter.m +243 -243
- package/src/ios/ZipArchive.h +19 -19
- package/src/ios/aes/aes.h +270 -270
- package/src/ios/aes/aes_ni.c +687 -687
- package/src/ios/aes/aes_ni.h +59 -59
- package/src/ios/aes/aescrypt.c +301 -301
- package/src/ios/aes/aeskey.c +554 -554
- package/src/ios/aes/aesopt.h +776 -776
- package/src/ios/aes/aestab.c +418 -418
- package/src/ios/aes/aestab.h +173 -173
- package/src/ios/aes/brg_endian.h +127 -127
- package/src/ios/aes/brg_types.h +191 -191
- package/src/ios/aes/fileenc.c +145 -145
- package/src/ios/aes/fileenc.h +121 -121
- package/src/ios/aes/hmac.c +209 -209
- package/src/ios/aes/hmac.h +119 -119
- package/src/ios/aes/prng.c +155 -155
- package/src/ios/aes/prng.h +82 -82
- package/src/ios/aes/pwd2key.c +181 -181
- package/src/ios/aes/pwd2key.h +45 -45
- package/src/ios/aes/sha1.c +283 -283
- package/src/ios/aes/sha1.h +72 -72
- package/src/ios/mInterface.h +1 -0
- package/src/ios/mInterface.m +15 -3
- package/src/ios/minizip/crypt.c +146 -146
- package/src/ios/minizip/crypt.h +66 -66
- package/src/ios/minizip/ioapi.c +353 -353
- package/src/ios/minizip/ioapi.h +154 -154
- package/src/ios/minizip/ioapi_buf.c +452 -452
- package/src/ios/minizip/ioapi_buf.h +52 -52
- package/src/ios/minizip/ioapi_mem.c +167 -167
- package/src/ios/minizip/ioapi_mem.h +52 -52
- package/src/ios/minizip/minishared.c +292 -292
- package/src/ios/minizip/minishared.h +50 -50
- package/src/ios/minizip/unzip.c +2007 -2007
- package/src/ios/minizip/unzip.h +254 -254
- package/src/ios/minizip/zip.c +2007 -2007
- package/src/ios/minizip/zip.h +215 -215
- package/www/mInterface.js +3 -3
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
package com.selfservit.util;
|
|
2
|
-
|
|
3
|
-
import android.os.Build;
|
|
4
|
-
import android.os.Environment;
|
|
5
|
-
import android.support.annotation.RequiresApi;
|
|
6
|
-
import android.support.v4.app.NotificationCompat;
|
|
7
|
-
import android.util.Log;
|
|
8
|
-
import com.onesignal.NotificationExtenderService;
|
|
9
|
-
import com.onesignal.OSNotificationDisplayedResult;
|
|
10
|
-
import com.onesignal.OSNotificationReceivedResult;
|
|
11
|
-
import org.json.JSONException;
|
|
12
|
-
import org.json.JSONObject;
|
|
13
|
-
import java.io.BufferedReader;
|
|
14
|
-
import java.io.File;
|
|
15
|
-
import java.io.FileReader;
|
|
16
|
-
import java.io.FileWriter;
|
|
17
|
-
import java.io.IOException;
|
|
18
|
-
import java.math.BigInteger;
|
|
19
|
-
import java.text.SimpleDateFormat;
|
|
20
|
-
import java.util.Date;
|
|
21
|
-
import java.util.Locale;
|
|
22
|
-
import static com.selfservit.util.mInterfaceUtil.decrypt;
|
|
23
|
-
|
|
24
|
-
public class backgroundNotification extends NotificationExtenderService {
|
|
25
|
-
|
|
26
|
-
String[] baseDirectory;
|
|
27
|
-
File notificationsFile,fileDirectory;
|
|
28
|
-
JSONObject msgBody, msgHeader;
|
|
29
|
-
public static final Locale locale = Locale.US;
|
|
30
|
-
|
|
31
|
-
@RequiresApi(api = Build.VERSION_CODES.O)
|
|
32
|
-
@Override
|
|
33
|
-
protected boolean onNotificationProcessing(OSNotificationReceivedResult notification) {
|
|
34
|
-
|
|
35
|
-
OverrideSettings overrideSettings = new OverrideSettings();
|
|
36
|
-
overrideSettings.extender = new NotificationCompat.Extender() {
|
|
37
|
-
@Override
|
|
38
|
-
public NotificationCompat.Builder extend(NotificationCompat.Builder builder) {
|
|
39
|
-
// Sets the background notification color to White on Android 5.0+ devices.
|
|
40
|
-
return builder.setColor(new BigInteger("#FFFFFF", 16).intValue());
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/* Do something with notification payload */
|
|
45
|
-
try {
|
|
46
|
-
msgHeader = (JSONObject) notification.payload.additionalData.get("msgHeader");
|
|
47
|
-
String packageName = msgHeader.getString("appID");
|
|
48
|
-
baseDirectory = packageName.split("\\.");
|
|
49
|
-
String clientID = msgHeader.getString("clientID");
|
|
50
|
-
String countryCode = msgHeader.getString("countryCode");
|
|
51
|
-
msgBody = (JSONObject) notification.payload.additionalData.get("msgBody");
|
|
52
|
-
msgBody.put("notificationID",notification.payload.notificationID);
|
|
53
|
-
String scrID = msgBody.getString("scrID");
|
|
54
|
-
String key = msgBody.getString("key");
|
|
55
|
-
String subKey = msgBody.getString("subKey");
|
|
56
|
-
|
|
57
|
-
if(scrID.equals("chat")) {
|
|
58
|
-
if (!subKey.equals("")) {
|
|
59
|
-
fileDirectory = new File(mInterfaceUtil.rootDirectory + "/" + baseDirectory[(baseDirectory.length - 1)] + "/" + clientID + "/" + countryCode + "/" + "content_store" + "/" + "msvMsg" + "/" + "history" + "/" + key + "/" + subKey);
|
|
60
|
-
if (!fileDirectory.exists()) {
|
|
61
|
-
fileDirectory.mkdirs();
|
|
62
|
-
}
|
|
63
|
-
notificationsFile = new File(fileDirectory, subKey + ".txt");
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
// Check if the specified file Exists or not
|
|
67
|
-
if (notificationsFile.exists()) {
|
|
68
|
-
System.out.println("Exists");
|
|
69
|
-
try {
|
|
70
|
-
FileReader fr = new FileReader(notificationsFile);
|
|
71
|
-
BufferedReader bufferedReader = new BufferedReader(fr);
|
|
72
|
-
StringBuilder notificationDatas = new StringBuilder();
|
|
73
|
-
String line;
|
|
74
|
-
while ((line = bufferedReader.readLine()) != null) {
|
|
75
|
-
notificationDatas.append(line);
|
|
76
|
-
System.out.println(line);
|
|
77
|
-
}
|
|
78
|
-
String notificationStr = decrypt(notificationDatas.toString());
|
|
79
|
-
notificationStr = notificationStr + msgBody.toString() + ",";
|
|
80
|
-
FileWriter fw = new FileWriter(notificationsFile);
|
|
81
|
-
fw.write(mInterfaceUtil.encrypt(notificationStr));
|
|
82
|
-
fw.close();
|
|
83
|
-
} catch (Exception e) {
|
|
84
|
-
System.out.println(e);
|
|
85
|
-
}
|
|
86
|
-
} else {
|
|
87
|
-
System.out.println("Does not Exists");
|
|
88
|
-
try {
|
|
89
|
-
FileWriter fw = new FileWriter(notificationsFile);
|
|
90
|
-
fw.write(mInterfaceUtil.encrypt(notification.payload.additionalData.getString("msgBody") + ","));
|
|
91
|
-
fw.close();
|
|
92
|
-
} catch (IOException e1) {
|
|
93
|
-
e1.printStackTrace();
|
|
94
|
-
} catch (JSONException e) {
|
|
95
|
-
e.printStackTrace();
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
} else {
|
|
100
|
-
fileDirectory = new File(mInterfaceUtil.rootDirectory + "/" + baseDirectory[(baseDirectory.length - 1)] + "/" + clientID + "/" + countryCode + "/" + "notifications" + "/" + "unread");
|
|
101
|
-
if (!fileDirectory.exists()) {
|
|
102
|
-
fileDirectory.mkdirs();
|
|
103
|
-
}
|
|
104
|
-
notificationsFile = new File(fileDirectory, notification.payload.notificationID + ".json");
|
|
105
|
-
Date date = new Date();
|
|
106
|
-
msgBody.put("dateTime",Date.parse(date.toString()));
|
|
107
|
-
JSONObject jsonObj = notification.payload.toJSONObject();
|
|
108
|
-
jsonObj.remove("rawPayload");
|
|
109
|
-
FileWriter fw = new FileWriter(notificationsFile);
|
|
110
|
-
fw.write(mInterfaceUtil.encrypt(jsonObj.toString()));
|
|
111
|
-
fw.close();
|
|
112
|
-
}
|
|
113
|
-
} catch (JSONException | IOException e) {
|
|
114
|
-
e.printStackTrace();
|
|
115
|
-
}
|
|
116
|
-
OSNotificationDisplayedResult displayedResult;
|
|
117
|
-
displayedResult = displayNotification(overrideSettings);
|
|
118
|
-
Log.d("OneSignalExample", "Notification displayed with id: " + displayedResult.androidNotificationId);
|
|
119
|
-
return false;
|
|
120
|
-
}
|
|
1
|
+
package com.selfservit.util;
|
|
2
|
+
|
|
3
|
+
import android.os.Build;
|
|
4
|
+
import android.os.Environment;
|
|
5
|
+
import android.support.annotation.RequiresApi;
|
|
6
|
+
import android.support.v4.app.NotificationCompat;
|
|
7
|
+
import android.util.Log;
|
|
8
|
+
import com.onesignal.NotificationExtenderService;
|
|
9
|
+
import com.onesignal.OSNotificationDisplayedResult;
|
|
10
|
+
import com.onesignal.OSNotificationReceivedResult;
|
|
11
|
+
import org.json.JSONException;
|
|
12
|
+
import org.json.JSONObject;
|
|
13
|
+
import java.io.BufferedReader;
|
|
14
|
+
import java.io.File;
|
|
15
|
+
import java.io.FileReader;
|
|
16
|
+
import java.io.FileWriter;
|
|
17
|
+
import java.io.IOException;
|
|
18
|
+
import java.math.BigInteger;
|
|
19
|
+
import java.text.SimpleDateFormat;
|
|
20
|
+
import java.util.Date;
|
|
21
|
+
import java.util.Locale;
|
|
22
|
+
import static com.selfservit.util.mInterfaceUtil.decrypt;
|
|
23
|
+
|
|
24
|
+
public class backgroundNotification extends NotificationExtenderService {
|
|
25
|
+
|
|
26
|
+
String[] baseDirectory;
|
|
27
|
+
File notificationsFile,fileDirectory;
|
|
28
|
+
JSONObject msgBody, msgHeader;
|
|
29
|
+
public static final Locale locale = Locale.US;
|
|
30
|
+
|
|
31
|
+
@RequiresApi(api = Build.VERSION_CODES.O)
|
|
32
|
+
@Override
|
|
33
|
+
protected boolean onNotificationProcessing(OSNotificationReceivedResult notification) {
|
|
34
|
+
|
|
35
|
+
OverrideSettings overrideSettings = new OverrideSettings();
|
|
36
|
+
overrideSettings.extender = new NotificationCompat.Extender() {
|
|
37
|
+
@Override
|
|
38
|
+
public NotificationCompat.Builder extend(NotificationCompat.Builder builder) {
|
|
39
|
+
// Sets the background notification color to White on Android 5.0+ devices.
|
|
40
|
+
return builder.setColor(new BigInteger("#FFFFFF", 16).intValue());
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/* Do something with notification payload */
|
|
45
|
+
try {
|
|
46
|
+
msgHeader = (JSONObject) notification.payload.additionalData.get("msgHeader");
|
|
47
|
+
String packageName = msgHeader.getString("appID");
|
|
48
|
+
baseDirectory = packageName.split("\\.");
|
|
49
|
+
String clientID = msgHeader.getString("clientID");
|
|
50
|
+
String countryCode = msgHeader.getString("countryCode");
|
|
51
|
+
msgBody = (JSONObject) notification.payload.additionalData.get("msgBody");
|
|
52
|
+
msgBody.put("notificationID",notification.payload.notificationID);
|
|
53
|
+
String scrID = msgBody.getString("scrID");
|
|
54
|
+
String key = msgBody.getString("key");
|
|
55
|
+
String subKey = msgBody.getString("subKey");
|
|
56
|
+
|
|
57
|
+
if(scrID.equals("chat")) {
|
|
58
|
+
if (!subKey.equals("")) {
|
|
59
|
+
fileDirectory = new File(mInterfaceUtil.rootDirectory + "/" + baseDirectory[(baseDirectory.length - 1)] + "/" + clientID + "/" + countryCode + "/" + "content_store" + "/" + "msvMsg" + "/" + "history" + "/" + key + "/" + subKey);
|
|
60
|
+
if (!fileDirectory.exists()) {
|
|
61
|
+
fileDirectory.mkdirs();
|
|
62
|
+
}
|
|
63
|
+
notificationsFile = new File(fileDirectory, subKey + ".txt");
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
// Check if the specified file Exists or not
|
|
67
|
+
if (notificationsFile.exists()) {
|
|
68
|
+
System.out.println("Exists");
|
|
69
|
+
try {
|
|
70
|
+
FileReader fr = new FileReader(notificationsFile);
|
|
71
|
+
BufferedReader bufferedReader = new BufferedReader(fr);
|
|
72
|
+
StringBuilder notificationDatas = new StringBuilder();
|
|
73
|
+
String line;
|
|
74
|
+
while ((line = bufferedReader.readLine()) != null) {
|
|
75
|
+
notificationDatas.append(line);
|
|
76
|
+
System.out.println(line);
|
|
77
|
+
}
|
|
78
|
+
String notificationStr = decrypt(notificationDatas.toString());
|
|
79
|
+
notificationStr = notificationStr + msgBody.toString() + ",";
|
|
80
|
+
FileWriter fw = new FileWriter(notificationsFile);
|
|
81
|
+
fw.write(mInterfaceUtil.encrypt(notificationStr));
|
|
82
|
+
fw.close();
|
|
83
|
+
} catch (Exception e) {
|
|
84
|
+
System.out.println(e);
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
System.out.println("Does not Exists");
|
|
88
|
+
try {
|
|
89
|
+
FileWriter fw = new FileWriter(notificationsFile);
|
|
90
|
+
fw.write(mInterfaceUtil.encrypt(notification.payload.additionalData.getString("msgBody") + ","));
|
|
91
|
+
fw.close();
|
|
92
|
+
} catch (IOException e1) {
|
|
93
|
+
e1.printStackTrace();
|
|
94
|
+
} catch (JSONException e) {
|
|
95
|
+
e.printStackTrace();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
} else {
|
|
100
|
+
fileDirectory = new File(mInterfaceUtil.rootDirectory + "/" + baseDirectory[(baseDirectory.length - 1)] + "/" + clientID + "/" + countryCode + "/" + "notifications" + "/" + "unread");
|
|
101
|
+
if (!fileDirectory.exists()) {
|
|
102
|
+
fileDirectory.mkdirs();
|
|
103
|
+
}
|
|
104
|
+
notificationsFile = new File(fileDirectory, notification.payload.notificationID + ".json");
|
|
105
|
+
Date date = new Date();
|
|
106
|
+
msgBody.put("dateTime",Date.parse(date.toString()));
|
|
107
|
+
JSONObject jsonObj = notification.payload.toJSONObject();
|
|
108
|
+
jsonObj.remove("rawPayload");
|
|
109
|
+
FileWriter fw = new FileWriter(notificationsFile);
|
|
110
|
+
fw.write(mInterfaceUtil.encrypt(jsonObj.toString()));
|
|
111
|
+
fw.close();
|
|
112
|
+
}
|
|
113
|
+
} catch (JSONException | IOException e) {
|
|
114
|
+
e.printStackTrace();
|
|
115
|
+
}
|
|
116
|
+
OSNotificationDisplayedResult displayedResult;
|
|
117
|
+
displayedResult = displayNotification(overrideSettings);
|
|
118
|
+
Log.d("OneSignalExample", "Notification displayed with id: " + displayedResult.androidNotificationId);
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
121
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
android {
|
|
2
|
-
defaultConfig {
|
|
3
|
-
multiDexEnabled true
|
|
4
|
-
|
|
5
|
-
}
|
|
1
|
+
android {
|
|
2
|
+
defaultConfig {
|
|
3
|
+
multiDexEnabled true
|
|
4
|
+
|
|
5
|
+
}
|
|
6
6
|
}
|