@glympse-inc/com.glympse.enroute 2.109.299 → 2.109.301

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": "@glympse-inc/com.glympse.enroute",
3
- "version": "2.109.299",
3
+ "version": "2.109.301",
4
4
  "description": "Glympse En Route Cordova Plugin",
5
5
  "cordova": {
6
6
  "id": "com.glympse.enroute",
package/plugin.xml CHANGED
@@ -1,5 +1,5 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
- <plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" id="com.glympse.enroute" version="2.109.299">
2
+ <plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" id="com.glympse.enroute" version="2.109.301">
3
3
 
4
4
  <name>Glympse En Route</name>
5
5
 
@@ -232,7 +232,7 @@
232
232
  <source url="https://github.com/CocoaPods/Specs.git"/>
233
233
  </config>
234
234
  <pods use-frameworks="true">
235
- <pod name="EnRouteApi" spec="~> 2.109.299"/>
235
+ <pod name="EnRouteApi" spec="~> 2.109.301"/>
236
236
  </pods>
237
237
  </podspec>
238
238
  <!-- RELEASE END -->
@@ -1,5 +1,10 @@
1
1
  package com.glympse.enroute.hybrid.android;
2
2
 
3
+ import android.os.Build;
4
+ import android.app.NotificationChannel;
5
+ import android.app.NotificationManager;
6
+ import android.app.Service;
7
+
3
8
  import com.glympse.android.api.*;
4
9
  import com.glympse.android.core.*;
5
10
  import com.glympse.android.lib.*;
@@ -106,6 +111,11 @@ public class EnRoutePlugin extends CordovaPlugin implements GListener
106
111
  syncHealthReport(args, callbackContext);
107
112
  return true;
108
113
  }
114
+ else if (action.equals("syncNotificationChannelReport"))
115
+ {
116
+ syncNotificationChannelReport(args, callbackContext);
117
+ return true;
118
+ }
109
119
  else if (action.equals("start"))
110
120
  {
111
121
  start(args, callbackContext);
@@ -588,6 +598,43 @@ public class EnRoutePlugin extends CordovaPlugin implements GListener
588
598
  callbackContext.sendPluginResult(pluginResult);
589
599
  }
590
600
 
601
+ private synchronized void syncNotificationChannelReport(final JSONArray args, final CallbackContext callbackContext)
602
+ {
603
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O)
604
+ {
605
+ PluginResult pluginResult = new PluginResult(Status.OK, "");
606
+ callbackContext.sendPluginResult(pluginResult);
607
+ return;
608
+ }
609
+
610
+ GPrimitive result = CoreFactory.createPrimitive(CC.PRIMITIVE_TYPE_ARRAY);
611
+ NotificationManager notificationManager = (NotificationManager)this.cordova.getActivity().getApplicationContext().getSystemService(Service.NOTIFICATION_SERVICE);
612
+ String[] channelIds = {"glympse_enroute_channel", "glympse_channel", "glympse_message_channel", "glympse_user_msg_channel"};
613
+
614
+ for ( String channelId : channelIds )
615
+ {
616
+ NotificationChannel notificationChannel = notificationManager.getNotificationChannel(channelId);
617
+ if ( null != notificationChannel )
618
+ {
619
+ GPrimitive channelSettings = CoreFactory.createPrimitive(CC.PRIMITIVE_TYPE_OBJECT);
620
+ channelSettings.put("id", notificationChannel.getId());
621
+ channelSettings.put("name", notificationChannel.getName().toString());
622
+ channelSettings.put("importance", notificationChannel.getImportance());
623
+ channelSettings.put("lights", notificationChannel.shouldShowLights());
624
+ channelSettings.put("dnd_bypass", notificationChannel.canBypassDnd());
625
+ channelSettings.put("isBlockable", notificationChannel.isBlockable());
626
+ channelSettings.put("hasUserSetImportance", notificationChannel.hasUserSetImportance());
627
+ channelSettings.put("hasUserSetSound", notificationChannel.hasUserSetSound());
628
+
629
+ result.put(channelSettings);
630
+ }
631
+ }
632
+
633
+ String jsonString = CoreTools.primitiveToString(result);
634
+ PluginResult pluginResult = new PluginResult(Status.OK, jsonString);
635
+ callbackContext.sendPluginResult(pluginResult);
636
+ }
637
+
591
638
  private synchronized void start(final JSONArray args, final CallbackContext callbackContext)
592
639
  {
593
640
  subscribeToListeners();
@@ -17,7 +17,7 @@ android {
17
17
  }
18
18
 
19
19
  dependencies {
20
- def GLYMPSE_VERSION = '2.109.299'
20
+ def GLYMPSE_VERSION = '2.109.301'
21
21
  implementation "com.glympse:enrouteapi:$GLYMPSE_VERSION"
22
22
  implementation "com.glympse:glympseapi:$GLYMPSE_VERSION"
23
23
  implementation "com.glympse:glympseapi-push:$GLYMPSE_VERSION"
@@ -534,9 +534,9 @@
534
534
  };
535
535
 
536
536
  var failure = function() {
537
- if ( failureCallback )
537
+ if ( errorCallback )
538
538
  {
539
- failureCallback();
539
+ errorCallback();
540
540
  }
541
541
  };
542
542
 
@@ -547,6 +547,18 @@
547
547
  return _healthReport;
548
548
  },
549
549
 
550
+ getNotificationChannelReport: function(successCallback) {
551
+ var success = function(data) {
552
+ var report = JSON.parse(data);
553
+ if ( successCallback )
554
+ {
555
+ successCallback(report);
556
+ }
557
+ };
558
+
559
+ Native.syncNotificationChannelReport(success, _noop);
560
+ },
561
+
550
562
  startShift: function(successCallback, errorCallback) {
551
563
  Native.startShift(successCallback, errorCallback);
552
564
  },
package/www/Native.js CHANGED
@@ -24,6 +24,15 @@ module.exports = {
24
24
  cordova.exec(successCallback, errorCallback, "EnRoutePlugin", "syncHealthReport", []);
25
25
  },
26
26
 
27
+ syncNotificationChannelReport: function(successCallback, errorCallback) {
28
+ if ( cordova.platformId == 'android' ) {
29
+ cordova.exec(successCallback, errorCallback, "EnRoutePlugin", "syncNotificationChannelReport", []);
30
+ }
31
+ else {
32
+ successCallback("");
33
+ }
34
+ },
35
+
27
36
  start: function (successCallback, errorCallback) {
28
37
  cordova.exec(successCallback, errorCallback, "EnRoutePlugin", "start", []);
29
38
  },