@glympse-inc/com.glympse.enroute 2.107.251 → 2.107.253

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.107.251",
3
+ "version": "2.107.253",
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.107.251">
2
+ <plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" id="com.glympse.enroute" version="2.107.253">
3
3
 
4
4
  <name>Glympse En Route</name>
5
5
 
@@ -233,7 +233,7 @@
233
233
  <source url="https://github.com/CocoaPods/Specs.git"/>
234
234
  </config>
235
235
  <pods use-frameworks="true">
236
- <pod name="EnRouteApi" spec="~> 2.107.251"/>
236
+ <pod name="EnRouteApi" spec="~> 2.107.253"/>
237
237
  </pods>
238
238
  </podspec>
239
239
  <!-- RELEASE END -->
@@ -56,49 +56,42 @@ public class EnRoutePlugin extends CordovaPlugin implements GListener
56
56
 
57
57
  public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException
58
58
  {
59
- // cordova.getThreadPool().execute(new Runnable()
60
- // {
61
- // public void run()
62
- // {
63
-
64
- // }
65
- // });
66
59
  if (action.equals("setActive"))
67
60
  {
68
61
  setActive(args, callbackContext);
69
62
  return true;
70
63
  }
71
- if (action.equals("setBaseUrl"))
64
+ else if (action.equals("setBaseUrl"))
72
65
  {
73
66
  setBaseUrl(args, callbackContext);
74
67
  return true;
75
68
  }
76
- if (action.equals("setAuthenticationMode"))
69
+ else if (action.equals("setAuthenticationMode"))
77
70
  {
78
71
  setAuthenticationMode(args, callbackContext);
79
72
  return true;
80
73
  }
81
- if (action.equals("setFetchCompletedTasks"))
74
+ else if (action.equals("setFetchCompletedTasks"))
82
75
  {
83
76
  setFetchCompletedTasks(args, callbackContext);
84
77
  return true;
85
78
  }
86
- if (action.equals("setForegroundNotificationMessage"))
79
+ else if (action.equals("setForegroundNotificationMessage"))
87
80
  {
88
81
  setForegroundNotificationMessage(args, callbackContext);
89
82
  return true;
90
83
  }
91
- if (action.equals("registerDeviceToken"))
84
+ else if (action.equals("registerDeviceToken"))
92
85
  {
93
86
  registerDeviceToken(args, callbackContext);
94
87
  return true;
95
88
  }
96
- if (action.equals("handleRemoteNotification"))
89
+ else if (action.equals("handleRemoteNotification"))
97
90
  {
98
91
  handleRemoteNotification(args, callbackContext);
99
92
  return true;
100
93
  }
101
- if (action.equals("registerListener"))
94
+ else if (action.equals("registerListener"))
102
95
  {
103
96
  registerListener(args, callbackContext);
104
97
  return true;
@@ -318,6 +311,21 @@ public class EnRoutePlugin extends CordovaPlugin implements GListener
318
311
  checkCellularDataAvailable(args, callbackContext);
319
312
  return true;
320
313
  }
314
+ else if (action.equals("saveManualSortOrder"))
315
+ {
316
+ saveManualSortOrder(args, callbackContext);
317
+ return true;
318
+ }
319
+ else if (action.equals("syncManualSortOrder"))
320
+ {
321
+ syncManualSortOrder(args, callbackContext);
322
+ return true;
323
+ }
324
+ else if (action.equals("setAutoStartTasksAfterAutoCompletion"))
325
+ {
326
+ setAutoStartTasksAfterAutoCompletion(args, callbackContext);
327
+ return true;
328
+ }
321
329
 
322
330
  return false;
323
331
  }
@@ -1586,6 +1594,62 @@ public class EnRoutePlugin extends CordovaPlugin implements GListener
1586
1594
  callbackContext.sendPluginResult(pluginResult);
1587
1595
  }
1588
1596
 
1597
+ private synchronized void saveManualSortOrder(final JSONArray args, final CallbackContext callbackContext)
1598
+ {
1599
+ GEnRouteManager manager = ManagerWrapper.instance().manager();
1600
+ GPrimitive taskIdArray = CoreFactory.createPrimitive(CC.PRIMITIVE_TYPE_ARRAY);
1601
+ try
1602
+ {
1603
+ JSONArray taskIds = args.getJSONArray(0);
1604
+
1605
+ for ( int i = 0; i < taskIds.length(); i++ )
1606
+ {
1607
+ taskIdArray.put(taskIds.getLong(i));
1608
+ }
1609
+ }
1610
+ catch (JSONException e)
1611
+ {
1612
+ }
1613
+
1614
+ manager.getTaskManager().saveManualSortOrder(taskIdArray);
1615
+ }
1616
+
1617
+ private synchronized void syncManualSortOrder(final JSONArray args, final CallbackContext callbackContext)
1618
+ {
1619
+ GEnRouteManager manager = ManagerWrapper.instance().manager();
1620
+
1621
+ GPrimitive manuallySortedIds = null;
1622
+
1623
+ if ( manager.isStarted() )
1624
+ {
1625
+ manuallySortedIds = manager.getTaskManager().getManualSortOrder();
1626
+ }
1627
+
1628
+ String jsonString = null;
1629
+ if ( null != manuallySortedIds )
1630
+ {
1631
+ jsonString = CoreTools.primitiveToString(manuallySortedIds);
1632
+ }
1633
+ PluginResult pluginResult = new PluginResult(Status.OK, jsonString);
1634
+ callbackContext.sendPluginResult(pluginResult);
1635
+ }
1636
+
1637
+ private synchronized void setAutoStartTasksAfterAutoCompletion(final JSONArray args, final CallbackContext callbackContext)
1638
+ {
1639
+ GEnRouteManager manager = ManagerWrapper.instance().manager();
1640
+
1641
+ boolean enabled = false;
1642
+ try
1643
+ {
1644
+ enabled = args.getBoolean(0);
1645
+ }
1646
+ catch (JSONException e)
1647
+ {
1648
+ }
1649
+
1650
+ manager.getTaskManager().setAutoStartTasksAfterAutoCompletion(enabled);
1651
+ }
1652
+
1589
1653
  public void eventsOccurred(GSource source, int listener, int events, Object param1, Object param2)
1590
1654
  {
1591
1655
  GPrimitive result = CoreFactory.createPrimitive(CC.PRIMITIVE_TYPE_OBJECT);
@@ -17,7 +17,7 @@ android {
17
17
  }
18
18
 
19
19
  dependencies {
20
- def GLYMPSE_VERSION = '2.107.251'
20
+ def GLYMPSE_VERSION = '2.107.253'
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"
@@ -122,6 +122,12 @@
122
122
 
123
123
  - (void) checkCellularDataAvailable:(CDVInvokedUrlCommand *)command;
124
124
 
125
+ - (void) saveManualSortOrder:(CDVInvokedUrlCommand *)command;
126
+
127
+ - (void) syncManualSortOrder:(CDVInvokedUrlCommand *)command;
128
+
129
+ - (void) setAutoStartTasksAfterAutoCompletion:(CDVInvokedUrlCommand *)command;
130
+
125
131
  - (void) started;
126
132
 
127
133
  @end
@@ -1005,6 +1005,45 @@
1005
1005
  [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
1006
1006
  }
1007
1007
 
1008
+ - (void) saveManualSortOrder:(CDVInvokedUrlCommand *)command
1009
+ {
1010
+ Glympse::EnRoute::GEnRouteManager manager = [EnRouteWrapper instance].manager;
1011
+ Glympse::GPrimitive taskIdArray = Glympse::CoreFactory::createPrimitive(Glympse::CC::PRIMITIVE_TYPE_ARRAY);
1012
+ NSArray *taskIds = [command argumentAtIndex:0 withDefault:NULL];
1013
+
1014
+ for ( id taskIdObj in taskIds )
1015
+ {
1016
+ NSNumber *taskIdNumber = (NSNumber*)taskIdObj;
1017
+ taskIdArray->put([taskIdNumber longLongValue]);
1018
+ }
1019
+
1020
+ [EnRouteWrapper instance].manager->getTaskManager()->saveManualSortOrder(taskIdArray);
1021
+ }
1022
+
1023
+ - (void) syncManualSortOrder:(CDVInvokedUrlCommand *)command
1024
+ {
1025
+ Glympse::EnRoute::GEnRouteManager manager = [EnRouteWrapper instance].manager;
1026
+ Glympse::GPrimitive manuallySortedIds = NULL;
1027
+ if ( manager->isStarted() )
1028
+ {
1029
+ manuallySortedIds = manager->getTaskManager()->getManualSortOrder();
1030
+ }
1031
+ NSString *jsonString = NULL;
1032
+ if ( NULL != manuallySortedIds )
1033
+ {
1034
+ jsonString = [NSString stringWithUTF8String:Glympse::CoreTools::primitiveToString(manuallySortedIds)->getBytes()];
1035
+ }
1036
+
1037
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:jsonString];
1038
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
1039
+ }
1040
+
1041
+ - (void) setAutoStartTasksAfterAutoCompletion:(CDVInvokedUrlCommand *)command
1042
+ {
1043
+ BOOL enabled = [[command argumentAtIndex:0] boolValue];
1044
+ [EnRouteWrapper instance].manager->getTaskManager()->setAutoStartTasksAfterAutoCompletion(enabled);
1045
+ }
1046
+
1008
1047
  - (void)eventsOccurred:(const Glympse::GSource&)source listener:(Glympse::int32)listener events:(Glympse::int32)events param1:(const Glympse::GCommonObj&)param1 param2:(const Glympse::GCommonObj&)param2
1009
1048
  {
1010
1049
  Glympse::GPrimitive result = Glympse::CoreFactory::createPrimitive(Glympse::CC::PRIMITIVE_TYPE_OBJECT);
@@ -612,6 +612,10 @@
612
612
  Native.setForegroundNotificationMessage(message);
613
613
  },
614
614
 
615
+ setAutoStartTasksAfterAutoCompletion: function(enabled) {
616
+ Native.setAutoStartTasksAfterAutoCompletion(enabled);
617
+ },
618
+
615
619
  AUTH_MODE_NONE: AUTH_MODE_NONE,
616
620
  AUTH_MODE_CREDENTIALS: AUTH_MODE_CREDENTIALS,
617
621
  AUTH_MODE_TOKEN: AUTH_MODE_TOKEN
package/www/Native.js CHANGED
@@ -210,5 +210,17 @@ module.exports = {
210
210
 
211
211
  checkCellularDataAvailable: function (successCallback, errorCallback) {
212
212
  cordova.exec(successCallback, errorCallback, "EnRoutePlugin", "checkCellularDataAvailable", []);
213
- }
213
+ },
214
+
215
+ saveManualSortOrder: function (taskIds, successCallback, errorCallback) {
216
+ cordova.exec(successCallback, errorCallback, "EnRoutePlugin", "saveManualSortOrder", [taskIds]);
217
+ },
218
+
219
+ syncManualSortOrder: function (successCallback, errorCallback) {
220
+ cordova.exec(successCallback, errorCallback, "EnRoutePlugin", "syncManualSortOrder", []);
221
+ },
222
+
223
+ setAutoStartTasksAfterAutoCompletion: function (enabled, successCallback, errorCallback) {
224
+ cordova.exec(successCallback, errorCallback, "EnRoutePlugin", "setAutoStartTasksAfterAutoCompletion", [enabled]);
225
+ },
214
226
  };
@@ -20,6 +20,7 @@
20
20
  var _active = false;
21
21
  var _listeners = [];
22
22
  var _tasks = [];
23
+ var _manualSortedTaskIds = [];
23
24
  var _taskMap = {};
24
25
 
25
26
  var _syncing = false;
@@ -314,6 +315,9 @@
314
315
  refreshState(false, function() {
315
316
  spreadTasksChanged();
316
317
  });
318
+ Native.syncManualSortOrder(function(sortedTaskIds) {
319
+ _manualSortedTaskIds = JSON.parse(sortedTaskIds);
320
+ }, _noop);
317
321
  },
318
322
 
319
323
  /**
@@ -450,5 +454,14 @@
450
454
  refreshState(false, function() {
451
455
  spreadTaskChatMessagesChanged(task);
452
456
  });
457
+ },
458
+
459
+ saveManualSortOrder: function(taskIds){
460
+ _manualSortedTaskIds = taskIds;
461
+ Native.saveManualSortOrder(taskIds, _noop, _noop);
462
+ },
463
+
464
+ getManualSortOrder: function() {
465
+ return _manualSortedTaskIds;
453
466
  }
454
467
  };