cordova-plugin-mserviceinterface-2.0 1.0.82 → 1.0.84
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
CHANGED
package/plugin.xml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
|
3
|
-
xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-mserviceinterface-2.0" version="1.0.
|
|
3
|
+
xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-mserviceinterface-2.0" version="1.0.84">
|
|
4
4
|
<name>mserviceinterface-2.0</name>
|
|
5
5
|
<description>This plugin establishes the connection to the native interface and performs the requested task.</description>
|
|
6
6
|
<author>selfservit@gmail.com</author>
|
|
@@ -53,7 +53,6 @@
|
|
|
53
53
|
</config-file>
|
|
54
54
|
<config-file target="AndroidManifest.xml" parent="/manifest/application">
|
|
55
55
|
<service android:name="com.selfservit.util.mInterfaceService" android:foregroundServiceType="location" android:enabled="true" android:exported="true"/>
|
|
56
|
-
<meta-data android:name="com.onesignal.NotificationServiceExtension" android:value="com.selfservit.util.backgroundNotification" />
|
|
57
56
|
<receiver android:name="com.selfservit.util.mInterfaceReceiver" android:enabled="true" android:exported="true">
|
|
58
57
|
<intent-filter>
|
|
59
58
|
<action android:name="android.intent.action.BOOT_COMPLETED"/>
|
|
@@ -69,7 +69,6 @@ import com.google.android.gms.location.LocationSettingsStatusCodes;
|
|
|
69
69
|
import com.google.android.gms.location.Priority;
|
|
70
70
|
import com.google.zxing.integration.android.IntentIntegrator;
|
|
71
71
|
import com.google.zxing.integration.android.IntentResult;
|
|
72
|
-
import com.onesignal.OSDeviceState;
|
|
73
72
|
import com.onesignal.OneSignal;
|
|
74
73
|
|
|
75
74
|
import org.apache.cordova.CallbackContext;
|
|
@@ -237,18 +236,13 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
237
236
|
}
|
|
238
237
|
} else if (action.equals("GetFCMUtils")) {
|
|
239
238
|
try {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
progressObj.put("pushToken", pushToken);
|
|
248
|
-
callbackContext.success(progressObj);
|
|
249
|
-
} else {
|
|
250
|
-
callbackContext.error("Error occurred");
|
|
251
|
-
}
|
|
239
|
+
String userId = OneSignal.getUser().getOnesignalId();
|
|
240
|
+
String pushToken = OneSignal.getUser().getPushSubscription().getToken();
|
|
241
|
+
|
|
242
|
+
JSONObject progressObj = new JSONObject();
|
|
243
|
+
progressObj.put("userId", userId);
|
|
244
|
+
progressObj.put("pushToken", pushToken);
|
|
245
|
+
callbackContext.success(progressObj);
|
|
252
246
|
} catch (Exception e) {
|
|
253
247
|
System.out.println("GetFCMUtils: Exception is: " + e.getMessage());
|
|
254
248
|
callbackContext.error(e.getMessage());
|
package/src/ios/mInterface.m
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
#include <sys/sysctl.h>
|
|
12
12
|
#include "TargetConditionals.h"
|
|
13
13
|
#import "OneSignalPush.h"
|
|
14
|
-
#import <OneSignal/OneSignal.h>
|
|
15
14
|
#import <objc/runtime.h>
|
|
16
15
|
#import <AVFoundation/AVFoundation.h>
|
|
17
16
|
#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
|
|
@@ -175,6 +174,7 @@
|
|
|
175
174
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
176
175
|
AVCaptureVideoPreviewLayer *previewLayer = objc_getAssociatedObject(self, @selector(previewLayer));
|
|
177
176
|
[previewLayer removeFromSuperlayer];
|
|
177
|
+
UIButton *closeButton = objc_getAssociatedObject(self, @selector(closeScanner)); if (closeButton) { [closeButton removeFromSuperview];}
|
|
178
178
|
});
|
|
179
179
|
|
|
180
180
|
CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:scannedCode];
|
|
@@ -343,11 +343,7 @@
|
|
|
343
343
|
|
|
344
344
|
}
|
|
345
345
|
- (void)GetFCMUtils:(CDVInvokedUrlCommand *)command {
|
|
346
|
-
|
|
347
|
-
NSMutableDictionary * deviceDict = [[NSMutableDictionary alloc] init];
|
|
348
|
-
[deviceDict setValue:deviceState.userId forKey:@"userId"];
|
|
349
|
-
[deviceDict setValue:deviceState.pushToken forKey:@"pushToken"];
|
|
350
|
-
CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:deviceDict];
|
|
346
|
+
CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:YES];
|
|
351
347
|
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
|
|
352
348
|
}
|
|
353
349
|
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
package com.selfservit.util;
|
|
2
|
-
|
|
3
|
-
import static com.selfservit.util.mInterfaceUtil.decrypt;
|
|
4
|
-
|
|
5
|
-
import android.content.Context;
|
|
6
|
-
import android.util.Log;
|
|
7
|
-
|
|
8
|
-
import com.onesignal.OSNotification;
|
|
9
|
-
import com.onesignal.OSNotificationReceivedEvent;
|
|
10
|
-
import com.onesignal.OneSignal;
|
|
11
|
-
|
|
12
|
-
import org.json.JSONException;
|
|
13
|
-
import org.json.JSONObject;
|
|
14
|
-
|
|
15
|
-
import java.io.BufferedReader;
|
|
16
|
-
import java.io.File;
|
|
17
|
-
import java.io.FileReader;
|
|
18
|
-
import java.io.FileWriter;
|
|
19
|
-
import java.io.IOException;
|
|
20
|
-
import java.util.Date;
|
|
21
|
-
import java.util.Locale;
|
|
22
|
-
|
|
23
|
-
public class backgroundNotification implements OneSignal.OSRemoteNotificationReceivedHandler {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
String[] baseDirectory;
|
|
27
|
-
File notificationsFile, fileDirectory;
|
|
28
|
-
JSONObject msgBody, msgHeader;
|
|
29
|
-
public static final Locale locale = Locale.US;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
@Override
|
|
33
|
-
public void remoteNotificationReceived(Context context, OSNotificationReceivedEvent osNotificationReceivedEvent) {
|
|
34
|
-
/* Do something with notification payload */
|
|
35
|
-
OSNotification notification = osNotificationReceivedEvent.getNotification();
|
|
36
|
-
try {
|
|
37
|
-
msgHeader = (JSONObject) notification.getAdditionalData().get("msgHeader");
|
|
38
|
-
String packageName = msgHeader.getString("appID");
|
|
39
|
-
baseDirectory = packageName.split("\\.");
|
|
40
|
-
String clientID = msgHeader.getString("clientID");
|
|
41
|
-
String countryCode = msgHeader.getString("countryCode");
|
|
42
|
-
msgBody = (JSONObject) notification.getAdditionalData().get("msgBody");
|
|
43
|
-
msgBody.put("notificationID", notification.getNotificationId());
|
|
44
|
-
String scrID = msgBody.getString("scrID");
|
|
45
|
-
String key = msgBody.getString("key");
|
|
46
|
-
String subKey = msgBody.getString("subKey");
|
|
47
|
-
|
|
48
|
-
if (!scrID.contains("_chat")) {
|
|
49
|
-
fileDirectory = new File(mInterfaceUtil.rootDirectory + "/" + baseDirectory[(baseDirectory.length - 1)] + "/" + clientID + "/" + countryCode + "/" + "notifications" + "/" + "unread");
|
|
50
|
-
if (!fileDirectory.exists()) {
|
|
51
|
-
boolean success = fileDirectory.mkdirs();
|
|
52
|
-
if (!success) {
|
|
53
|
-
System.out.println("Directory not created");
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
notificationsFile = new File(fileDirectory, notification.getNotificationId() + ".json");
|
|
57
|
-
Date date = new Date();
|
|
58
|
-
msgBody.put("dateTime", Date.parse(date.toString()));
|
|
59
|
-
JSONObject jsonObj = notification.toJSONObject();
|
|
60
|
-
jsonObj.remove("rawPayload");
|
|
61
|
-
FileWriter fw = new FileWriter(notificationsFile);
|
|
62
|
-
fw.write(mInterfaceUtil.encrypt(jsonObj.toString()));
|
|
63
|
-
fw.close();
|
|
64
|
-
}
|
|
65
|
-
} catch (JSONException | IOException e) {
|
|
66
|
-
e.printStackTrace();
|
|
67
|
-
}
|
|
68
|
-
JSONObject data = notification.getAdditionalData();
|
|
69
|
-
Log.i("OneSignalExample", "Received Notification Data: " + data);
|
|
70
|
-
|
|
71
|
-
// If complete isn't call within a time period of 25 seconds, OneSignal internal logic will show the original notification
|
|
72
|
-
// To omit displaying a notification, pass `null` to complete()
|
|
73
|
-
osNotificationReceivedEvent.complete(notification);
|
|
74
|
-
}
|
|
75
|
-
}
|