@glympse-inc/com.glympse.enroute 2.106.243 → 2.107.245

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.106.243",
3
+ "version": "2.107.245",
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.106.243">
2
+ <plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" id="com.glympse.enroute" version="2.107.245">
3
3
 
4
4
  <name>Glympse En Route</name>
5
5
 
@@ -152,13 +152,6 @@
152
152
  android:label="GlympseApiService" >
153
153
  </service>
154
154
 
155
- <service
156
- android:name="com.glympse.enroute.hybrid.android.NotificationService"
157
- android:enabled="true"
158
- android:exported="false"
159
- android:label="GlympseNotificationService">
160
- </service>
161
-
162
155
  <meta-data android:name="glympse_fcm_application_id" android:value="$GLYMPSE_FIREBASE_APP_ID" />
163
156
 
164
157
  <receiver
@@ -196,7 +189,6 @@
196
189
  <source-file src="src/android/ManagerWrapper.java" target-dir="src/com/glympse/enroute/hybrid/android"/>
197
190
  <source-file src="src/android/EnRoutePlugin.java" target-dir="src/com/glympse/enroute/hybrid/android"/>
198
191
  <source-file src="src/android/PushReceiver.java" target-dir="src/com/glympse/enroute/hybrid/android"/>
199
- <source-file src="src/android/NotificationService.java" target-dir="src/com/glympse/enroute/hybrid/android"/>
200
192
  <source-file src="src/android/BootReceiver.java" target-dir="src/com/glympse/enroute/hybrid/android"/>
201
193
  <source-file src="src/android/HealthCheckJobService.java" target-dir="src/com/glympse/enroute/hybrid/android"/>
202
194
  <source-file src="src/android/LocationAccuracyChecker.java" target-dir="src/com/glympse/enroute/hybrid/android"/>
@@ -241,7 +233,7 @@
241
233
  <source url="https://github.com/CocoaPods/Specs.git"/>
242
234
  </config>
243
235
  <pods use-frameworks="true">
244
- <pod name="EnRouteApi" spec="~> 2.106.239"/>
236
+ <pod name="EnRouteApi" spec="~> 2.107.243"/>
245
237
  </pods>
246
238
  </podspec>
247
239
  <!-- RELEASE END -->
@@ -198,11 +198,6 @@ public class EnRoutePlugin extends CordovaPlugin implements GListener
198
198
  sendMessageToTask(args, callbackContext);
199
199
  return true;
200
200
  }
201
- else if (action.equals("confirmMessageRead"))
202
- {
203
- confirmMessageRead(args, callbackContext);
204
- return true;
205
- }
206
201
  else if (action.equals("syncSessionsState"))
207
202
  {
208
203
  syncSessionsState(args, callbackContext);
@@ -1009,42 +1004,6 @@ public class EnRoutePlugin extends CordovaPlugin implements GListener
1009
1004
  chatManager.setRoomAsRead(chatRoomId);
1010
1005
  }
1011
1006
 
1012
- // Deprecated
1013
- private synchronized void confirmMessageRead(final JSONArray args, final CallbackContext callbackContext)
1014
- {
1015
- GEnRouteManager manager = ManagerWrapper.instance().manager();
1016
- long taskId = -1;
1017
- String messageId = null;
1018
-
1019
- try
1020
- {
1021
- taskId = args.getLong(0);
1022
- messageId = args.getString(1);
1023
- }
1024
- catch (JSONException e)
1025
- {
1026
- }
1027
-
1028
- if ( null == messageId )
1029
- {
1030
- return;
1031
- }
1032
-
1033
- GTask task = manager.getTaskManager().findTaskById(taskId);
1034
- if ( null == task )
1035
- {
1036
- return;
1037
- }
1038
-
1039
- GCardMessages cardMessages = manager.getTaskManager().getCardMessagesForTask(task);
1040
- if ( null == cardMessages )
1041
- {
1042
- return;
1043
- }
1044
-
1045
- cardMessages.confirmRead(messageId);
1046
- }
1047
-
1048
1007
  private synchronized void syncSessionsState(final JSONArray args, final CallbackContext callbackContext)
1049
1008
  {
1050
1009
  GEnRouteManager manager = ManagerWrapper.instance().manager();
@@ -1708,34 +1667,6 @@ public class EnRoutePlugin extends CordovaPlugin implements GListener
1708
1667
  boolean success = ( param1 == null );
1709
1668
  tasksChanged(success);
1710
1669
  }
1711
- if ( 0 != ( EE.TASKS_TASK_CARD_MESSAGE_STATUS & events ) )
1712
- {
1713
- String eventId = (String) param1;
1714
- String uniqueId = (String) param2;
1715
- if ( null != uniqueId )
1716
- {
1717
- CallbackContext callbackContext = _callbacks.get(uniqueId);
1718
- if ( null != callbackContext )
1719
- {
1720
- // Send status result
1721
- PluginResult pluginResult;
1722
- if ( null != eventId )
1723
- {
1724
- pluginResult = new PluginResult(Status.OK, eventId);
1725
- }
1726
- else
1727
- {
1728
- pluginResult = new PluginResult(Status.ERROR, "failed");
1729
- }
1730
-
1731
- pluginResult.setKeepCallback(false);
1732
- callbackContext.sendPluginResult(pluginResult);
1733
-
1734
- // No longer expecting updates for this message
1735
- _callbacks.remove(uniqueId);
1736
- }
1737
- }
1738
- }
1739
1670
  }
1740
1671
  }
1741
1672
 
@@ -1,26 +1,34 @@
1
1
  package com.glympse.enroute.hybrid.android;
2
2
 
3
- import android.app.job.JobInfo;
4
- import android.app.job.JobScheduler;
5
3
  import android.app.Notification;
6
4
  import android.app.NotificationChannel;
7
5
  import android.app.NotificationManager;
8
6
  import android.app.PendingIntent;
7
+ import android.app.job.JobInfo;
8
+ import android.app.job.JobScheduler;
9
9
  import android.content.ComponentName;
10
10
  import android.content.Context;
11
11
  import android.content.Intent;
12
+ import android.content.pm.ActivityInfo;
13
+ import android.content.pm.ResolveInfo;
12
14
  import android.os.Build;
13
- import androidx.core.app.NotificationCompat;
14
- import androidx.core.app.NotificationManagerCompat;
15
15
 
16
- import com.glympse.android.core.GPrimitive;
17
16
  import com.glympse.android.api.R;
17
+ import com.glympse.android.core.GPrimitive;
18
18
  import com.glympse.android.hal.GlympseService;
19
19
  import com.glympse.android.toolbox.listener.GListener;
20
20
  import com.glympse.android.toolbox.listener.GSource;
21
- import com.glympse.enroute.android.api.*;
21
+ import com.glympse.enroute.android.api.EE;
22
+ import com.glympse.enroute.android.api.EnRouteConstants;
23
+ import com.glympse.enroute.android.api.EnRouteFactory;
24
+ import com.glympse.enroute.android.api.GEnRouteManager;
25
+
26
+ import java.util.List;
27
+
28
+ import androidx.core.app.NotificationCompat;
29
+ import androidx.core.app.NotificationManagerCompat;
22
30
 
23
- import com.glympse.enroute.hybrid.android.HealthCheckJobService;
31
+ import static com.glympse.android.hal.GlympseService.NOTIFICATION_ACTION;
24
32
 
25
33
  public class ManagerWrapper implements GListener
26
34
  {
@@ -50,13 +58,13 @@ public class ManagerWrapper implements GListener
50
58
  _context = context;
51
59
  _manager = EnRouteFactory.createEnRouteManager(_context);
52
60
  _manager.addListener(this);
53
-
61
+
54
62
  // We will provide our own arrival notifications
55
63
  GlympseService.enableXoaNotifications(false);
56
64
  createNotificationChannel();
57
65
  scheduleHealthCheck(_context);
58
66
  }
59
-
67
+
60
68
  public GEnRouteManager manager()
61
69
  {
62
70
  if ( _stopped )
@@ -132,12 +140,10 @@ public class ManagerWrapper implements GListener
132
140
  String pickupId = config.getString("pickup_id");
133
141
  if ( null != pickupId )
134
142
  {
135
- Intent intent = new Intent(_context, NotificationService.class);
136
- intent.setPackage(_context.getPackageName());
137
- intent.setAction("{\"GLYMPSE_ACTION\":\"pickup_notification\",\"nid\":" + notificationId + "}");
143
+ Intent intent = createNotificationHandlerIntent(_context);
138
144
  intent.putExtra("PICKUP_ID", pickupId);
139
145
 
140
- PendingIntent pendingIntent = createPendingServiceIntent(_context, intent, REQUEST_CODE_PICKUP_NOTIFICATION);
146
+ PendingIntent pendingIntent = PendingIntent.getActivity(_context, REQUEST_CODE_PICKUP_NOTIFICATION, intent, PendingIntent.FLAG_IMMUTABLE);
141
147
  builder.setContentIntent(pendingIntent);
142
148
  }
143
149
 
@@ -146,7 +152,7 @@ public class ManagerWrapper implements GListener
146
152
 
147
153
  public void started()
148
154
  {
149
-
155
+
150
156
  }
151
157
 
152
158
  public void stopped()
@@ -156,7 +162,7 @@ public class ManagerWrapper implements GListener
156
162
 
157
163
  public void loggedOut(int reason)
158
164
  {
159
-
165
+
160
166
  }
161
167
 
162
168
  protected void scheduleHealthCheck(Context context)
@@ -177,9 +183,9 @@ public class ManagerWrapper implements GListener
177
183
  }
178
184
  }
179
185
 
180
- private void createNotificationChannel()
186
+ private void createNotificationChannel()
181
187
  {
182
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
188
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
183
189
  {
184
190
  NotificationChannel channel = new NotificationChannel(CHANNEL_ID, "Glympse EnRoute", NotificationManager.IMPORTANCE_DEFAULT);
185
191
  channel.setDescription("Glympse EnRoute status notifications");
@@ -188,18 +194,36 @@ public class ManagerWrapper implements GListener
188
194
  }
189
195
  }
190
196
 
191
- private static PendingIntent createPendingServiceIntent(Context context, Intent intent, final int requestCode)
197
+ private static Intent createNotificationHandlerIntent(Context context)
192
198
  {
193
- final int flags = PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE;
194
- final PendingIntent pendingIntent = PendingIntent.getService(context, requestCode, intent, flags);
195
- if ( Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2 )
199
+ // Check to see if host application has an activity for handling
200
+ // notification taps
201
+ ResolveInfo activity = getActivityForAction(context, NOTIFICATION_ACTION);
202
+ if ( null != activity )
203
+ {
204
+ ActivityInfo activityInfo = activity.activityInfo;
205
+ Intent intent = new Intent();
206
+ intent.setClassName(activityInfo.applicationInfo.packageName, activityInfo.name);
207
+ return intent;
208
+ }
209
+ else
196
210
  {
197
- // Cancel the pending intent and return an identical one to work around a bug in Kitkat.
198
- // See https://code.google.com/p/android/issues/detail?id=61850
199
- pendingIntent.cancel();
200
- return PendingIntent.getService(context, requestCode, intent, flags);
211
+ return context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
201
212
  }
202
- return pendingIntent;
213
+ }
214
+
215
+ private static List<ResolveInfo> getActivities(Context context, String action)
216
+ {
217
+ Intent intent = new Intent(action, null);
218
+ intent.setPackage(context.getPackageName());
219
+ return context.getPackageManager().queryIntentActivities(intent, 0);
220
+ }
221
+
222
+ private static ResolveInfo getActivityForAction(Context context, String action)
223
+ {
224
+ // Query activities that can handle the specified action.
225
+ List<ResolveInfo> packages = getActivities(context, action);
226
+ return 0 != packages.size() ? packages.get(0) : null;
203
227
  }
204
228
 
205
229
  }
@@ -17,7 +17,7 @@ android {
17
17
  }
18
18
 
19
19
  dependencies {
20
- def GLYMPSE_VERSION = '2.106.239'
20
+ def GLYMPSE_VERSION = '2.107.243'
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"
@@ -76,8 +76,6 @@
76
76
 
77
77
  - (void) markTaskMessagesAsRead:(CDVInvokedUrlCommand *)command;
78
78
 
79
- - (void) confirmMessageRead:(CDVInvokedUrlCommand *)command;
80
-
81
79
  - (void) syncSessionsState:(CDVInvokedUrlCommand *)command;
82
80
 
83
81
  - (void) syncSessionsStateLight:(CDVInvokedUrlCommand *)command;
@@ -531,28 +531,6 @@
531
531
  chatManager->setRoomAsRead(chatRoomId);
532
532
  }
533
533
 
534
- // Deprecated
535
- - (void) confirmMessageRead:(CDVInvokedUrlCommand *)command
536
- {
537
- Glympse::int64 taskId = [[command argumentAtIndex:0] longLongValue];
538
- NSString *messageId = (NSString *)[command argumentAtIndex:1];
539
- Glympse::GString messageIdString = [GETHelpers toGString:messageId];
540
-
541
- Glympse::EnRoute::GTask task = [EnRouteWrapper instance].manager->getTaskManager()->findTaskById(taskId);
542
- if ( NULL == task )
543
- {
544
- return;
545
- }
546
-
547
- Glympse::GCardMessages cardMessages = [EnRouteWrapper instance].manager->getTaskManager()->getCardMessagesForTask(task);
548
- if ( NULL == cardMessages )
549
- {
550
- return;
551
- }
552
-
553
- cardMessages->confirmRead(messageIdString);
554
- }
555
-
556
534
  - (void) syncSessionsState:(CDVInvokedUrlCommand *)command
557
535
  {
558
536
  Glympse::GPrimitive result = Glympse::CoreFactory::createPrimitive(Glympse::CC::PRIMITIVE_TYPE_OBJECT);
@@ -1099,32 +1077,6 @@
1099
1077
  bool success = ( param1 == NULL );
1100
1078
  [self tasksChanged:success];
1101
1079
  }
1102
- if ( 0 != ( events & Glympse::EnRoute::EE::TASKS_TASK_CARD_MESSAGE_STATUS ) )
1103
- {
1104
- Glympse::GString eventId = (Glympse::GString) param1;
1105
- Glympse::GString uniqueId = (Glympse::GString) param2;
1106
- if ( NULL != uniqueId )
1107
- {
1108
- CDVInvokedUrlCommand* command = [_cordovaCommands objectForKey:[NSString stringWithGString:uniqueId]];
1109
- if ( NULL != command )
1110
- {
1111
- CDVPluginResult* pluginResult = nil;
1112
- if ( NULL != eventId )
1113
- {
1114
- pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:[NSString stringWithGString:eventId]];
1115
- }
1116
- else
1117
- {
1118
- pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"failed"];
1119
- }
1120
-
1121
- [pluginResult setKeepCallback:[NSNumber numberWithBool:NO]];
1122
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
1123
-
1124
- [_cordovaCommands removeObjectForKey:[NSString stringWithGString:uniqueId]];
1125
- }
1126
- }
1127
- }
1128
1080
  }
1129
1081
  else if ( Glympse::EnRoute::EE::LISTENER_SESSIONS == listener )
1130
1082
  {
package/www/Native.js CHANGED
@@ -108,11 +108,6 @@ module.exports = {
108
108
  cordova.exec(successCallback, errorCallback, "EnRoutePlugin", "markTaskMessagesAsRead", [taskId]);
109
109
  },
110
110
 
111
- // Deprecated (CardMessages)
112
- confirmMessageRead: function (taskId, messageId, successCallback, errorCallback) {
113
- cordova.exec(successCallback, errorCallback, "EnRoutePlugin", "confirmMessageRead", [taskId, messageId]);
114
- },
115
-
116
111
  syncSessionsState: function (successCallback, errorCallback) {
117
112
  cordova.exec(successCallback, errorCallback, "EnRoutePlugin", "syncSessionsState", []);
118
113
  },
@@ -5,6 +5,7 @@
5
5
  var TASKS_TASK_LIST_CHANGED = 0x00000001;
6
6
  var TASKS_TASK_STARTED = 0x00000002;
7
7
  var TASKS_OPERATION_COMPLETED = 0x00000008;
8
+ var TASKS_OPERATION_COMPLETION_FAILED = 0x00000010;
8
9
  var TASKS_TASK_PHASE_CHANGED = 0x00000020;
9
10
  var TASKS_TASK_CARD_MESSAGE_CHANGED = 0x00000200;
10
11
  var TASKS_TASK_CHAT_MESSAGES_CHANGED = 0x00008000;
@@ -57,6 +58,11 @@
57
58
  spreadOperationCompleted(param1 && param1.taskId);
58
59
  });
59
60
  }
61
+ if ( 0 !== ( TASKS_OPERATION_COMPLETION_FAILED & events ) ) {
62
+ refreshState(false, function() {
63
+ spreadOperationCompleteFailed(param1 && param1.taskId);
64
+ });
65
+ }
60
66
  if ( 0 !== ( TASKS_TASK_PHASE_CHANGED & events ) ) {
61
67
  refreshState(false, function() {
62
68
  var task;
@@ -126,6 +132,11 @@
126
132
  spreadEvent('operationCompleted', [taskId]);
127
133
  }
128
134
 
135
+ function spreadOperationCompleteFailed(taskId) {
136
+ console.log("[TaskManager] spreadOperationCompleteFailed");
137
+ spreadEvent('operationCompleteFailed', [taskId]);
138
+ }
139
+
129
140
  function spreadTaskPhaseChanged(task, phase) {
130
141
  console.log("[TaskManager] spreadTaskPhaseChanged");
131
142
  spreadEvent('taskPhaseChanged', [task, phase]);
@@ -1,81 +0,0 @@
1
- package com.glympse.enroute.hybrid.android;
2
-
3
- import android.app.Service;
4
- import android.content.Intent;
5
- import android.os.Bundle;
6
- import android.os.IBinder;
7
- import androidx.annotation.Nullable;
8
-
9
- import com.glympse.android.core.GPrimitive;
10
- import com.glympse.android.lib.json.JsonSerializer;
11
-
12
- public class NotificationService extends Service
13
- {
14
- public static final String PICKUP_NOTIFICATION_ACTION = "com.glympse.android.PICKUP_NOTIFICATION";
15
-
16
- @Nullable
17
- @Override
18
- public IBinder onBind(Intent intent)
19
- {
20
- return null;
21
- }
22
-
23
- @SuppressWarnings("deprecation")
24
- @Override public void onStart(Intent intent, int nStartId)
25
- {
26
- try
27
- {
28
- super.onStart(intent, nStartId);
29
-
30
- // If we have an intent, then go process it.
31
- if (null != intent)
32
- {
33
- processIntent(intent);
34
- }
35
- }
36
- catch (Throwable e)
37
- {
38
- }
39
- }
40
-
41
- private void processIntent(Intent intent) {
42
- // Get the action and see if it is something we recognize.
43
- String strAction = intent.getAction();
44
- if (null == strAction || !strAction.startsWith("{\"GLYMPSE_ACTION"))
45
- {
46
- return;
47
- }
48
-
49
- // Parse action string.
50
- GPrimitive action = JsonSerializer.toPrimitive(strAction);
51
- if (null == action)
52
- {
53
- return;
54
- }
55
-
56
- String type = action.getString("GLYMPSE_ACTION");
57
- int notificationId = (int)action.getLong("nid");
58
-
59
- // Bail if we don't have a type.
60
- if (null == type)
61
- {
62
- return;
63
- }
64
-
65
- if (type.equalsIgnoreCase("pickup_notification"))
66
- {
67
- Bundle bundle = intent.getExtras();
68
- if ( bundle == null )
69
- {
70
- return;
71
- }
72
-
73
- // Notify host app if it is listening
74
- String pickupId = bundle.getString("PICKUP_ID");
75
- Intent pickupIntent = new Intent(PICKUP_NOTIFICATION_ACTION);
76
- pickupIntent.setPackage(this.getPackageName());
77
- pickupIntent.putExtra("PICKUP_ID", pickupId);
78
- sendBroadcast(pickupIntent);
79
- }
80
- }
81
- }