cordova-plugin-mserviceinterface-2.0 1.0.76 → 1.0.78

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-plugin-mserviceinterface-2.0",
3
- "version": "1.0.76",
3
+ "version": "1.0.78",
4
4
  "description": "This plugin establishes the connection to the native interface and performs the requested task.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/plugin.xml CHANGED
@@ -1,8 +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"
4
- id="cordova-plugin-mserviceinterface-2.0"
5
- version="1.0.76">
3
+ xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-mserviceinterface-2.0" version="1.0.78">
6
4
  <name>mserviceinterface-2.0</name>
7
5
  <description>This plugin establishes the connection to the native interface and performs the requested task.</description>
8
6
  <author>selfservit@gmail.com</author>
@@ -18,21 +16,21 @@
18
16
  <clobbers target="mInterface" />
19
17
  </js-module>
20
18
  <platform name="android">
21
- <framework src="src/android/doubleogradle.gradle" custom="true" type="gradleReference"/>
22
- <framework src="com.google.android.gms:play-services-location:21.0.1" />
23
- <framework src="androidx.exifinterface:exifinterface:1.3.5" />
24
- <framework src="com.android.support:support-v4:28.0.0" />
25
- <framework src="com.google.zxing:core:3.3.2" />
26
- <framework src="com.journeyapps:zxing-android-embedded:3.6.0@aar" />
27
- <framework src="id.zelory:compressor:2.1.1" />
28
- <edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application">
19
+ <framework src="src/android/doubleogradle.gradle" custom="true" type="gradleReference"/>
20
+ <framework src="com.google.android.gms:play-services-location:21.0.1" />
21
+ <framework src="androidx.exifinterface:exifinterface:1.3.5" />
22
+ <framework src="com.android.support:support-v4:28.0.0" />
23
+ <framework src="com.google.zxing:core:3.3.2" />
24
+ <framework src="com.journeyapps:zxing-android-embedded:3.6.0@aar" />
25
+ <framework src="id.zelory:compressor:2.1.1" />
26
+ <edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application">
29
27
  <application android:allowBackup="false" />
30
28
  <application android:networkSecurityConfig="@xml/network_security_config" />
31
29
  <application android:requestLegacyExternalStorage="true" />
32
30
  <application android:fullBackupContent="@xml/my_backup_rules" />
33
31
  </edit-config>
34
32
  <config-file target="res/xml/config.xml" parent="/*">
35
- <feature name="mInterface" >
33
+ <feature name="mInterface">
36
34
  <param name="android-package" value="com.selfservit.util.mInterface"/>
37
35
  </feature>
38
36
  </config-file>
@@ -54,8 +52,7 @@
54
52
  </config-file>
55
53
  <config-file target="AndroidManifest.xml" parent="/manifest/application">
56
54
  <service android:name="com.selfservit.util.mInterfaceService" android:foregroundServiceType="location" android:enabled="true" android:exported="true"/>
57
- <meta-data android:name="com.onesignal.NotificationServiceExtension"
58
- android:value="com.selfservit.util.backgroundNotification" />
55
+ <meta-data android:name="com.onesignal.NotificationServiceExtension" android:value="com.selfservit.util.backgroundNotification" />
59
56
  <receiver android:name="com.selfservit.util.mInterfaceReceiver" android:enabled="true" android:exported="true">
60
57
  <intent-filter>
61
58
  <action android:name="android.intent.action.BOOT_COMPLETED"/>
@@ -71,8 +68,8 @@
71
68
  <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/opener_paths" />
72
69
  </provider>
73
70
  </config-file>
74
- <source-file src="src/android/mInterfaceService.java" target-dir="src/com/selfservit/util/" />
75
- <source-file src="src/android/backgroundNotification.java" target-dir="src/com/selfservit/util/" />
71
+ <source-file src="src/android/mInterfaceService.java" target-dir="src/com/selfservit/util/" />
72
+ <source-file src="src/android/backgroundNotification.java" target-dir="src/com/selfservit/util/" />
76
73
  <source-file src="src/android/mInterfaceReceiver.java" target-dir="src/com/selfservit/util/" />
77
74
  <source-file src="src/android/mInterface.java" target-dir="src/com/selfservit/util/" />
78
75
  <source-file src="src/android/GeofenceBroadcastReceiver.java" target-dir="src/com/selfservit/util/" />
@@ -80,14 +77,14 @@
80
77
  <source-file src="src/android/CallbackProgressDialog.java" target-dir="src/com/selfservit/util/" />
81
78
  <source-file src="src/android/FileProvider.java" target-dir="src/com/selfservit/util/" />
82
79
  <source-file src="src/android/res/xml/opener_paths.xml" target-dir="res/xml" />
83
- <source-file src="src/android/res/xml/network_security_config.xml" target-dir="res/xml" />
84
- <source-file src="src/android/res/xml/my_backup_rules.xml" target-dir="res/xml" />
80
+ <source-file src="src/android/res/xml/network_security_config.xml" target-dir="res/xml" />
81
+ <source-file src="src/android/res/xml/my_backup_rules.xml" target-dir="res/xml" />
85
82
  </platform>
86
83
  <platform name="ios">
87
- <config-file target="*-Info.plist" parent="NSCameraUsageDescription">
84
+ <config-file target="*-Info.plist" parent="NSCameraUsageDescription">
88
85
  <string>Equipcare wants to access your camera and gallery to attach the images for service reports and photo proofs.</string>
89
86
  </config-file>
90
-
87
+
91
88
  <config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
92
89
  <string>Equipcare wants to access your camera and gallery to attach the images for service reports and photo proofs.</string>
93
90
  </config-file>
@@ -104,7 +101,7 @@
104
101
  <source-file src="src/ios/InternetConnection.m"/>
105
102
  <header-file src="src/ios/XMLConverter.h"/>
106
103
  <source-file src="src/ios/XMLConverter.m"/>
107
- <header-file src="src/ios/UICKeyChainStore.h" />
104
+ <header-file src="src/ios/UICKeyChainStore.h" />
108
105
  <source-file src="src/ios/UICKeyChainStore.m" />
109
106
  <source-file src="src/ios/SSZipArchive.h" />
110
107
  <source-file src="src/ios/SSZipArchive.m" />
@@ -154,6 +151,6 @@
154
151
  <framework src="AssetsLibrary.framework" />
155
152
  <framework src="AVFoundation.framework" />
156
153
  <framework src="libz.dylib" />
157
- <framework src="Security.framework" />
154
+ <framework src="Security.framework" />
158
155
  </platform>
159
156
  </plugin>
@@ -9,14 +9,11 @@ import android.content.Intent;
9
9
  import android.os.Build;
10
10
  import android.util.Log;
11
11
  import android.widget.Toast;
12
-
13
12
  import androidx.core.app.NotificationCompat;
14
13
  import androidx.core.app.NotificationManagerCompat;
15
14
 
16
15
  import com.google.android.gms.location.Geofence;
17
16
  import com.google.android.gms.location.GeofencingEvent;
18
- import com.selfservit.pegdev.MainActivity;
19
- import com.selfservit.pegdev.R;
20
17
 
21
18
  import org.json.JSONObject;
22
19
 
@@ -85,14 +82,27 @@ public class GeofenceBroadcastReceiver extends BroadcastReceiver {
85
82
  }
86
83
 
87
84
  private void sendNotification(Context context, String title, String message) {
88
- Intent intent = new Intent(context, MainActivity.class);
85
+ try {
86
+ String notification_icon, notification_color, app_name;
87
+ int imageResource,notification_color_id;
88
+ String packageName = context.getPackageName();
89
+ String mainActivityClassName = packageName + ".MainActivity";
90
+ Class<?> mainActivityName = null;
91
+ mainActivityName = Class.forName(mainActivityClassName);
92
+ Intent intent = new Intent(context, mainActivityName);
89
93
  intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
90
94
  PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
95
+ notification_icon = "@drawable/ic_notification";
96
+ notification_color = "@color/notification_accent";
97
+ app_name = "@string/app_name";
98
+ imageResource = context.getResources().getIdentifier(notification_icon, null, context.getPackageName());
99
+ notification_color_id = context.getResources().getIdentifier(notification_color, null, context.getPackageName());
91
100
  NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, CHANNEL_ID)
92
- .setSmallIcon(R.drawable.ic_notification)
101
+ .setSmallIcon(imageResource)
93
102
  .setContentTitle(title)
94
103
  .setContentText(message)
95
104
  .setAutoCancel(true)
105
+ .setColor(context.getResources().getColor(notification_color_id))
96
106
  .setContentIntent(pendingIntent);
97
107
  NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
98
108
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
@@ -101,6 +111,9 @@ public class GeofenceBroadcastReceiver extends BroadcastReceiver {
101
111
  };
102
112
  int notificationId = UUID.randomUUID().hashCode();
103
113
  notificationManager.notify(notificationId, notificationBuilder.build());
114
+ } catch (ClassNotFoundException e) {
115
+ throw new RuntimeException(e);
116
+ }
104
117
  }
105
118
 
106
119
  private void createNotificationChannel(Context context) {