@glympse-inc/com.glympse.enroute 2.109.298 → 2.109.300

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.298",
3
+ "version": "2.109.300",
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.298">
2
+ <plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" id="com.glympse.enroute" version="2.109.300">
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.298"/>
235
+ <pod name="EnRouteApi" spec="~> 2.109.300"/>
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();
@@ -1209,6 +1256,7 @@ public class EnRoutePlugin extends CordovaPlugin implements GListener
1209
1256
 
1210
1257
  long sessionId = args.optLong(0, -1);
1211
1258
  long taskId = args.optLong(1, -1);
1259
+ String statusCode = args.optString(2, "");
1212
1260
  GSession session = sessionManager.findSessionById(sessionId);
1213
1261
  if ( null == session )
1214
1262
  {
@@ -1221,7 +1269,7 @@ public class EnRoutePlugin extends CordovaPlugin implements GListener
1221
1269
  return;
1222
1270
  }
1223
1271
 
1224
- sessionManager.departTaskForSession(session, task);
1272
+ sessionManager.departTaskForSession(session, task, statusCode);
1225
1273
  }
1226
1274
 
1227
1275
  private synchronized void completeSession(final JSONArray args, final CallbackContext callbackContext)
@@ -17,7 +17,7 @@ android {
17
17
  }
18
18
 
19
19
  dependencies {
20
- def GLYMPSE_VERSION = '2.109.298'
20
+ def GLYMPSE_VERSION = '2.109.300'
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"
@@ -688,6 +688,8 @@
688
688
  {
689
689
  Glympse::int64 sessionId = [[command argumentAtIndex:0] longLongValue];
690
690
  Glympse::int64 taskId = [[command argumentAtIndex:1] longLongValue];
691
+ NSString *statusCode = (NSString *)[command argumentAtIndex:2];
692
+
691
693
  Glympse::EnRoute::GSession session = [EnRouteWrapper instance].manager->getSessionManager()->findSessionById(sessionId);
692
694
  if ( NULL == session )
693
695
  {
@@ -700,7 +702,7 @@
700
702
  return;
701
703
  }
702
704
 
703
- [EnRouteWrapper instance].manager->getSessionManager()->departTaskForSession(session, task);
705
+ [EnRouteWrapper instance].manager->getSessionManager()->departTaskForSession(session, task, [GETHelpers toGString:statusCode]);
704
706
  }
705
707
 
706
708
  - (void) completeSession:(CDVInvokedUrlCommand *)command
@@ -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
  },
@@ -136,8 +145,8 @@ module.exports = {
136
145
  cordova.exec(successCallback, errorCallback, "EnRoutePlugin", "arriveTaskForSession", [sessionId, taskId]);
137
146
  },
138
147
 
139
- departTaskForSession: function(sessionId, taskId, successCallback, errorCallback) {
140
- cordova.exec(successCallback, errorCallback, "EnRoutePlugin", "departTaskForSession", [sessionId, taskId]);
148
+ departTaskForSession: function(sessionId, taskId, statusCode, successCallback, errorCallback) {
149
+ cordova.exec(successCallback, errorCallback, "EnRoutePlugin", "departTaskForSession", [sessionId, taskId, statusCode]);
141
150
  },
142
151
 
143
152
  completeSession: function(sessionId, successCallback, errorCallback) {
@@ -444,8 +444,8 @@
444
444
  Native.arriveTaskForSession(session.getId(), task.getId(), _noop, _noop);
445
445
  },
446
446
 
447
- departTaskForSession: function(session, task) {
448
- Native.departTaskForSession(session.getId(), task.getId(), _noop, _noop);
447
+ departTaskForSession: function(session, task, statusCode) {
448
+ Native.departTaskForSession(session.getId(), task.getId(), statusCode, _noop, _noop);
449
449
  },
450
450
 
451
451
  completeSession: function(session) {