@glympse-inc/com.glympse.enroute 2.109.290 → 2.109.292

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.290",
3
+ "version": "2.109.292",
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.290">
2
+ <plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" id="com.glympse.enroute" version="2.109.292">
3
3
 
4
4
  <name>Glympse En Route</name>
5
5
 
@@ -17,9 +17,6 @@
17
17
  <js-module src="www/EnRouteManager.js" name="EnRouteManager">
18
18
  <clobbers target="EnRouteManager" />
19
19
  </js-module>
20
- <js-module src="www/EtaPlanner.js" name="EtaPlanner">
21
- <clobbers target="EtaPlanner" />
22
- </js-module>
23
20
  <js-module src="www/PickupManager.js" name="PickupManager">
24
21
  <clobbers target="PickupManager" />
25
22
  </js-module>
@@ -91,7 +88,6 @@
91
88
  <asset src="www/TaskManager.js" target="js/TaskManager.js" />
92
89
  <asset src="www/SessionManager.js" target="js/SessionManager.js" />
93
90
  <asset src="www/PickupManager.js" target="js/PickupManager.js" />
94
- <asset src="www/EtaPlanner.js" target="js/EtaPlanner.js" />
95
91
  <asset src="www/AgentManager.js" target="js/AgentManager.js" />
96
92
  <asset src="www/Agent.js" target="js/Agent.js" />
97
93
  <asset src="www/CardMessage.js" target="js/CardMessage.js" />
@@ -236,7 +232,7 @@
236
232
  <source url="https://github.com/CocoaPods/Specs.git"/>
237
233
  </config>
238
234
  <pods use-frameworks="true">
239
- <pod name="EnRouteApi" spec="~> 2.109.290"/>
235
+ <pod name="EnRouteApi" spec="~> 2.109.292"/>
240
236
  </pods>
241
237
  </podspec>
242
238
  <!-- RELEASE END -->
@@ -211,11 +211,6 @@ public class EnRoutePlugin extends CordovaPlugin implements GListener
211
211
  refreshSessions(args, callbackContext);
212
212
  return true;
213
213
  }
214
- else if (action.equals("updateSessionTasks"))
215
- {
216
- updateSessionTasks(args, callbackContext);
217
- return true;
218
- }
219
214
  else if (action.equals("startSession"))
220
215
  {
221
216
  startSession(args, callbackContext);
@@ -236,16 +231,6 @@ public class EnRoutePlugin extends CordovaPlugin implements GListener
236
231
  completeSession(args, callbackContext);
237
232
  return true;
238
233
  }
239
- else if (action.equals("startEtaPlannerQuery"))
240
- {
241
- startEtaPlannerQuery(args, callbackContext);
242
- return true;
243
- }
244
- else if (action.equals("abortEtaPlannerQuery"))
245
- {
246
- abortEtaPlannerQuery(args, callbackContext);
247
- return true;
248
- }
249
234
  else if (action.equals("overrideLoggingLevels"))
250
235
  {
251
236
  overrideLoggingLevels(args, callbackContext);
@@ -539,7 +524,20 @@ public class EnRoutePlugin extends CordovaPlugin implements GListener
539
524
  {
540
525
  GEnRouteManager manager = ManagerWrapper.instance().manager();
541
526
  GEnRouteHealthCheck enRouteHealthCheck = manager.getEnRouteHealthCheck();
542
- GCoreHealthCheck coreHealthCheck = manager.getGlympse().getCoreHealthCheck();
527
+ GGlympse glympse = manager.getGlympse();
528
+ if ( null == glympse )
529
+ {
530
+ PluginResult pluginResult = new PluginResult(Status.ERROR, "failed");
531
+ callbackContext.sendPluginResult(pluginResult);
532
+ return;
533
+ }
534
+ GCoreHealthCheck coreHealthCheck = glympse.getCoreHealthCheck();
535
+ if ( null == coreHealthCheck )
536
+ {
537
+ PluginResult pluginResult = new PluginResult(Status.ERROR, "failed");
538
+ callbackContext.sendPluginResult(pluginResult);
539
+ return;
540
+ }
543
541
 
544
542
  GPrimitive result = CoreFactory.createPrimitive(CC.PRIMITIVE_TYPE_OBJECT);
545
543
 
@@ -1075,11 +1073,14 @@ public class EnRoutePlugin extends CordovaPlugin implements GListener
1075
1073
  GArray<GSession> sessions = sessionManager.getSessions();
1076
1074
  if ( null != sessions )
1077
1075
  {
1076
+ GPrimitive config = CoreFactory.createPrimitive(CC.PRIMITIVE_TYPE_OBJECT);
1077
+ config.put("truncate_locations", true);
1078
+
1078
1079
  GPrimitive sessionsPrimitive = CoreFactory.createPrimitive(CC.PRIMITIVE_TYPE_ARRAY);
1079
1080
 
1080
1081
  for ( GSession session : sessions )
1081
1082
  {
1082
- GPrimitive sessionPrimitive = commonObjToPrimitive(session);
1083
+ GPrimitive sessionPrimitive = commonObjToPrimitive(session, config);
1083
1084
  sessionsPrimitive.put(sessionPrimitive);
1084
1085
  }
1085
1086
 
@@ -1121,10 +1122,14 @@ public class EnRoutePlugin extends CordovaPlugin implements GListener
1121
1122
  GPrimitive sessionData = CoreFactory.createPrimitive(CC.PRIMITIVE_TYPE_OBJECT);
1122
1123
  sessionData.put("phase", activeTask.getPhase());
1123
1124
 
1124
- GTicket ticket = activeTask.getOperation().getTicket();
1125
- if ( null != ticket )
1125
+ GOperation operation = activeTask.getOperation();
1126
+ if ( null != operation )
1126
1127
  {
1127
- sessionData.put("ticket", commonObjToPrimitive(ticket, config));
1128
+ GTicket ticket = operation.getTicket();
1129
+ if ( null != ticket )
1130
+ {
1131
+ sessionData.put("ticket", commonObjToPrimitive(ticket, config));
1132
+ }
1128
1133
  }
1129
1134
 
1130
1135
  sessionsPrimitive.put("" + session.getId(), sessionData);
@@ -1151,35 +1156,6 @@ public class EnRoutePlugin extends CordovaPlugin implements GListener
1151
1156
  }
1152
1157
  }
1153
1158
 
1154
- private synchronized void updateSessionTasks(final JSONArray args, final CallbackContext callbackContext)
1155
- {
1156
- GSessionManager sessionManager = ManagerWrapper.instance().manager().getSessionManager();
1157
- if ( null == sessionManager )
1158
- {
1159
- return;
1160
- }
1161
-
1162
- long sessionId = args.optLong(0, -1);
1163
- GSession session = sessionManager.findSessionById(sessionId);
1164
- if ( null == session )
1165
- {
1166
- return;
1167
- }
1168
-
1169
- JSONArray taskArray = args.optJSONArray(1);
1170
-
1171
- GVector<Object> tasks = CoreFactory.createVector();
1172
-
1173
- for ( int i = 0; i < taskArray.length(); i++ )
1174
- {
1175
- long taskId = taskArray.optLong(i, -1);
1176
- GTask task = ManagerWrapper.instance().manager().getTaskManager().findTaskById(taskId);
1177
- tasks.addElement(task);
1178
- }
1179
-
1180
- sessionManager.updateSessionTasks(session, tasks);
1181
- }
1182
-
1183
1159
  private synchronized void startSession(final JSONArray args, final CallbackContext callbackContext)
1184
1160
  {
1185
1161
  GSessionManager sessionManager = ManagerWrapper.instance().manager().getSessionManager();
@@ -1266,48 +1242,6 @@ public class EnRoutePlugin extends CordovaPlugin implements GListener
1266
1242
  sessionManager.completeSession(session);
1267
1243
  }
1268
1244
 
1269
- private synchronized void startEtaPlannerQuery(final JSONArray args, final CallbackContext callbackContext)
1270
- {
1271
- GEnRouteManager manager = ManagerWrapper.instance().manager();
1272
- GEtaPlanner etaPlanner = manager.getEtaPlanner();
1273
- etaPlanner.addListener(this);
1274
-
1275
- JSONObject initial = args.optJSONObject(0);
1276
- JSONArray places = args.optJSONArray(1);
1277
- long stopoverTime = args.optLong(2, 0);
1278
-
1279
- if ( null != initial && null != places )
1280
- {
1281
- double lat = initial.optDouble("latitude", 0);
1282
- double lng = initial.optDouble("longitude", 0);
1283
-
1284
- GLatLng start = CoreFactory.createLocation(lat, lng);
1285
- GVector<Object> stops = CoreFactory.createVector();
1286
-
1287
- for ( int i = 0; i < places.length(); i++ )
1288
- {
1289
- JSONObject place = places.optJSONObject(i);
1290
-
1291
- lat = place.optDouble("latitude", 0);
1292
- lng = place.optDouble("longitude", 0);
1293
-
1294
- GLatLng stop = CoreFactory.createLocation(lat, lng);
1295
- stops.addElement(stop);
1296
- }
1297
-
1298
- etaPlanner.query(start, stops, stopoverTime);
1299
- }
1300
- }
1301
-
1302
- private synchronized void abortEtaPlannerQuery(final JSONArray args, final CallbackContext callbackContext)
1303
- {
1304
- GEnRouteManager manager = ManagerWrapper.instance().manager();
1305
- GEtaPlanner etaPlanner = manager.getEtaPlanner();
1306
- etaPlanner.removeListener(this);
1307
-
1308
- etaPlanner.abort();
1309
- }
1310
-
1311
1245
  private synchronized void overrideLoggingLevels(final JSONArray args, final CallbackContext callbackContext)
1312
1246
  {
1313
1247
  int fileLogLevel = CoreConstants.NONE;
@@ -17,7 +17,7 @@ android {
17
17
  }
18
18
 
19
19
  dependencies {
20
- def GLYMPSE_VERSION = '2.109.290'
20
+ def GLYMPSE_VERSION = '2.109.292'
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"
@@ -18,8 +18,6 @@
18
18
  NSMutableDictionary *_cordovaCommands;
19
19
 
20
20
  NSMutableArray *_listenerCallbacks;
21
-
22
- NSString *_etaPlannerCallback;
23
21
  }
24
22
 
25
23
  /**
@@ -84,8 +82,6 @@
84
82
 
85
83
  - (void) refreshSessions:(CDVInvokedUrlCommand *)command;
86
84
 
87
- - (void) updateSessionTasks:(CDVInvokedUrlCommand *)command;
88
-
89
85
  - (void) startSession:(CDVInvokedUrlCommand *)command;
90
86
 
91
87
  - (void) arriveTaskForSession:(CDVInvokedUrlCommand *)command;
@@ -94,10 +90,6 @@
94
90
 
95
91
  - (void) completeSession:(CDVInvokedUrlCommand *)command;
96
92
 
97
- - (void) startEtaPlannerQuery:(CDVInvokedUrlCommand *)command;
98
-
99
- - (void) abortEtaPlannerQuery:(CDVInvokedUrlCommand *)command;
100
-
101
93
  - (void) overrideLoggingLevels:(CDVInvokedUrlCommand *)command;
102
94
 
103
95
  - (void) setRemoteLoggingEnabled:(CDVInvokedUrlCommand *)command;
@@ -157,7 +157,20 @@
157
157
  {
158
158
  Glympse::EnRoute::GEnRouteManager manager = [EnRouteWrapper instance].manager;
159
159
  Glympse::EnRoute::GEnRouteHealthCheck enRouteHealthCheck = manager->getEnRouteHealthCheck();
160
- Glympse::GCoreHealthCheck coreHealthCheck = manager->getGlympse()->getCoreHealthCheck();
160
+ Glympse::GGlympse glympse = manager->getGlympse();
161
+ if ( NULL == glympse )
162
+ {
163
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"failed"];
164
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
165
+ return;
166
+ }
167
+ Glympse::GCoreHealthCheck coreHealthCheck = glympse->getCoreHealthCheck();
168
+ if ( NULL == coreHealthCheck )
169
+ {
170
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"failed"];
171
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
172
+ return;
173
+ }
161
174
 
162
175
  Glympse::GPrimitive result = Glympse::CoreFactory::createPrimitive(Glympse::CC::PRIMITIVE_TYPE_OBJECT);
163
176
 
@@ -558,11 +571,13 @@
558
571
  Glympse::GArray<Glympse::EnRoute::GSession>::ptr sessions = sessionManager->getSessions();
559
572
  if ( NULL != sessions )
560
573
  {
574
+ Glympse::GPrimitive config = Glympse::CoreFactory::createPrimitive(Glympse::CC::PRIMITIVE_TYPE_OBJECT);
575
+ config->put([GETHelpers toGString:@"truncate_locations"], true);
561
576
  Glympse::GPrimitive sessionsPrimitive = Glympse::CoreFactory::createPrimitive(Glympse::CC::PRIMITIVE_TYPE_ARRAY);
562
577
 
563
578
  for ( Glympse::EnRoute::GSession session : sessions )
564
579
  {
565
- Glympse::GPrimitive sessionPrimitive = [self commonObjToPrimitive:session];
580
+ Glympse::GPrimitive sessionPrimitive = [self commonObjToPrimitive:session withConfig:config];
566
581
 
567
582
  sessionsPrimitive->put(sessionPrimitive);
568
583
  }
@@ -604,10 +619,14 @@
604
619
  Glympse::GPrimitive sessionData = Glympse::CoreFactory::createPrimitive(Glympse::CC::PRIMITIVE_TYPE_OBJECT);
605
620
  sessionData->put([GETHelpers toGString:@"phase"], activeTask->getPhase());
606
621
 
607
- Glympse::GTicket ticket = activeTask->getOperation()->getTicket();
608
- if ( NULL != ticket )
622
+ Glympse::EnRoute::GOperation operation = activeTask->getOperation();
623
+ if ( NULL != operation )
609
624
  {
610
- sessionData->put([GETHelpers toGString:@"ticket"], [self commonObjToPrimitive:ticket withConfig:config]);
625
+ Glympse::GTicket ticket = operation->getTicket();
626
+ if ( NULL != ticket )
627
+ {
628
+ sessionData->put([GETHelpers toGString:@"ticket"], [self commonObjToPrimitive:ticket withConfig:config]);
629
+ }
611
630
  }
612
631
 
613
632
  NSString *idString = [NSString stringWithFormat:@"%lld", session->getId()];
@@ -634,32 +653,6 @@
634
653
  [EnRouteWrapper instance].manager->getSessionManager()->refresh();
635
654
  }
636
655
 
637
- - (void) updateSessionTasks:(CDVInvokedUrlCommand *)command
638
- {
639
- Glympse::int64 sessionId = [[command argumentAtIndex:0] longLongValue];
640
- NSArray *taskIds = [command argumentAtIndex:1 withDefault:NULL];
641
- if ( NULL == taskIds )
642
- {
643
- return;
644
- }
645
-
646
- Glympse::EnRoute::GSession session = [EnRouteWrapper instance].manager->getSessionManager()->findSessionById(sessionId);
647
- if ( NULL == session )
648
- {
649
- return;
650
- }
651
-
652
- Glympse::GVector<Glympse::GCommonObj>::ptr tasks = Glympse::CoreFactory::createVector();
653
- for ( id taskIdObj in taskIds )
654
- {
655
- NSNumber *taskIdNumber = (NSNumber*)taskIdObj;
656
- Glympse::EnRoute::GTask task = [EnRouteWrapper instance].manager->getTaskManager()->findTaskById([taskIdNumber longLongValue]);
657
- tasks->addElement(task);
658
- }
659
-
660
- [EnRouteWrapper instance].manager->getSessionManager()->updateSessionTasks(session, tasks);
661
- }
662
-
663
656
  - (void) startSession:(CDVInvokedUrlCommand *)command
664
657
  {
665
658
  Glympse::int64 sessionId = [[command argumentAtIndex:0] longLongValue];
@@ -722,42 +715,6 @@
722
715
  [EnRouteWrapper instance].manager->getSessionManager()->completeSession(session);
723
716
  }
724
717
 
725
- - (void) startEtaPlannerQuery:(CDVInvokedUrlCommand *)command
726
- {
727
- NSDictionary *initial = [command argumentAtIndex:0 withDefault:NULL];
728
- NSArray *places = [command argumentAtIndex:1 withDefault:NULL];
729
- Glympse::int64 stopoverTime = [[command argumentAtIndex:2] longLongValue];
730
-
731
-
732
- Glympse::EnRoute::GEtaPlanner etaPlanner = [EnRouteWrapper instance].manager->getEtaPlanner();
733
- [GETHelpers subscribe:self onManager:etaPlanner];
734
-
735
- double lat = [[initial objectForKey:@"latitude"] doubleValue];
736
- double lng = [[initial objectForKey:@"longitude"] doubleValue];
737
- Glympse::GLatLng start = Glympse::CoreFactory::createLocation(lat, lng);
738
-
739
- Glympse::GVector<Glympse::GCommonObj>::ptr stops = Glympse::CoreFactory::createVector();
740
- for ( id placeObj in places )
741
- {
742
- NSDictionary *placeDict = (NSDictionary*)placeObj;
743
- lat = [[placeDict objectForKey:@"latitude"] doubleValue];
744
- lng = [[placeDict objectForKey:@"longitude"] doubleValue];
745
- Glympse::GLatLng place = Glympse::CoreFactory::createLocation(lat, lng);
746
- stops->addElement(place);
747
- }
748
-
749
- etaPlanner->query(start, stops, stopoverTime);
750
- }
751
-
752
- - (void) abortEtaPlannerQuery:(CDVInvokedUrlCommand *)command
753
- {
754
-
755
- Glympse::EnRoute::GEtaPlanner etaPlanner = [EnRouteWrapper instance].manager->getEtaPlanner();
756
- [GETHelpers unsubscribe:self onManager:etaPlanner];
757
-
758
- etaPlanner->abort();
759
- }
760
-
761
718
  - (void) overrideLoggingLevels:(CDVInvokedUrlCommand *)command
762
719
  {
763
720
  Glympse::int32 fileLogLevel = [[command argumentAtIndex:0] integerValue];
@@ -1,7 +1,6 @@
1
1
  var TaskManager = require('./TaskManager');
2
2
  var SessionManager = require('./SessionManager');
3
3
  var AgentManager = require('./AgentManager');
4
- var EtaPlanner = require('./EtaPlanner');
5
4
  var PickupManager = require('./PickupManager');
6
5
  var Agent = require('./Agent');
7
6
  var Organization = require('./Organization');
@@ -287,7 +286,6 @@
287
286
  TaskManager.init();
288
287
  SessionManager.init();
289
288
  PickupManager.init();
290
- EtaPlanner.init();
291
289
  _initialized = true;
292
290
  }
293
291
 
@@ -392,10 +390,6 @@
392
390
  return AgentManager;
393
391
  },
394
392
 
395
- getEtaPlanner: function() {
396
- return EtaPlanner;
397
- },
398
-
399
393
  getPickupManager: function() {
400
394
  return PickupManager;
401
395
  },
package/www/Native.js CHANGED
@@ -128,10 +128,6 @@ module.exports = {
128
128
  cordova.exec(successCallback, errorCallback, "EnRoutePlugin", "getSessions", []);
129
129
  },
130
130
 
131
- updateSessionTasks: function (sessionId, taskIds, successCallback, errorCallback) {
132
- cordova.exec(successCallback, errorCallback, "EnRoutePlugin", "updateSessionTasks", [sessionId, taskIds]);
133
- },
134
-
135
131
  startSession: function(sessionId, successCallback, errorCallback) {
136
132
  cordova.exec(successCallback, errorCallback, "EnRoutePlugin", "startSession", [sessionId]);
137
133
  },
@@ -148,14 +144,6 @@ module.exports = {
148
144
  cordova.exec(successCallback, errorCallback, "EnRoutePlugin", "completeSession", [sessionId]);
149
145
  },
150
146
 
151
- startEtaPlannerQuery: function (initial, places, stopoverTime, successCallback, errorCallback) {
152
- cordova.exec(successCallback, errorCallback, "EnRoutePlugin", "startEtaPlannerQuery", [initial, places, stopoverTime]);
153
- },
154
-
155
- abortEtaPlannerQuery: function (successCallback, errorCallback) {
156
- cordova.exec(successCallback, errorCallback, "EnRoutePlugin", "abortEtaPlannerQuery", []);
157
- },
158
-
159
147
  overrideLoggingLevels: function (fileLogLevel, debugLogLevel, successCallback, errorCallback) {
160
148
  cordova.exec(successCallback, errorCallback, "EnRoutePlugin", "overrideLoggingLevels", [fileLogLevel, debugLogLevel]);
161
149
  },
package/www/Session.js CHANGED
@@ -10,9 +10,6 @@
10
10
  this._id = data.id;
11
11
  this._createdTime = data.createdTime;
12
12
  this._description = data.description;
13
- if (null != data.activeTask) {
14
- this._activeTask = new Task(data.activeTask);
15
- }
16
13
  this._activeTaskIndex = data.activeTaskIndex;
17
14
  this._state = data.state;
18
15
  this._startTime = data.startTime;
@@ -40,7 +37,10 @@
40
37
  };
41
38
 
42
39
  Session.prototype.getActiveTask = function () {
43
- return this._activeTask;
40
+ if ( this._activeTaskIndex >= 0 && this._activeTaskIndex < this._tasks.length ) {
41
+ return this._tasks[this._activeTaskIndex];
42
+ }
43
+ return null;
44
44
  };
45
45
 
46
46
  Session.prototype.getActiveTaskIndex = function () {
@@ -250,7 +250,7 @@
250
250
  var sessionInfo = (session && sessionsData[session.getId().toString()]);
251
251
 
252
252
  if ( sessionInfo ) {
253
- var activeTask = session._activeTask;
253
+ var activeTask = session.getActiveTask();
254
254
  if (activeTask) {
255
255
  activeTask._phase = sessionInfo.phase;
256
256
  var op = activeTask._operation;
@@ -264,7 +264,7 @@
264
264
  };
265
265
 
266
266
  function updateStateHeavy(state) {
267
- // console.log('[[ SESSION STATE HEAVY ]] data:', state);
267
+ console.log('[[ SESSION STATE HEAVY ]]');
268
268
  var sessions = state.sessions;
269
269
 
270
270
  if (!sessions) {
@@ -310,15 +310,9 @@
310
310
  if (newTask) {
311
311
  tasks.push(newTask);
312
312
  taskMap[tid] = newTask;
313
- console.log('===!====! Added task to session: ' + tid + ' !====!===')
314
- } else {
315
- console.log('!-!-!-!-!-!-!-! No task found in task service: ' + id + ' !-!-!-!-!-!-!-!-!')
316
313
  }
317
314
  } else {
318
315
  var tidx = tasks.indexOf(task);
319
- console.log(' - - - [id:' + tid + '] - update index=' + j
320
- + ', indexOf=' + tidx
321
- + ((j != tasks.indexOf(taskMap[tid])) ? ' -- MISMATCH' : ''));
322
316
  if (j !== tidx) {
323
317
  var tmp = tasks[tidx];
324
318
  tasks[tidx] = tasks[j];
@@ -332,7 +326,6 @@
332
326
  if (availTasks.indexOf(tid) >= 0) {
333
327
  continue;
334
328
  }
335
- console.log('=-=-=-=-=-= REMOVING SESSION TASK: ' + tid + ' =-=-=-=-=-=-=-=-=');
336
329
  tasks.splice(i, 1);
337
330
  taskMap[tid] = undefined;
338
331
 
@@ -348,7 +341,6 @@
348
341
  if (availSessions.indexOf(sid) >= 0) {
349
342
  continue;
350
343
  }
351
- console.log('=-=-=-=-=-= REMOVING SESSION: ' + sid + ' =-=-=-=-=-=-=-=-=');
352
344
  _sessions.splice(i, 1);
353
345
  _sessionMap[sid] = undefined;
354
346
  }
@@ -357,9 +349,7 @@
357
349
  var currSession = state.currentSession;
358
350
  if (currSession) {
359
351
  _currentSessionId = currSession.id;
360
- console.log('=====> currentSession = ' + _currentSessionId + ' <======')
361
352
  }
362
- console.log('===-=-=- END HEAVY -=-=-===');
363
353
  };
364
354
 
365
355
  function determineSyncTimer() {
@@ -439,20 +429,6 @@
439
429
  Native.refreshSessions(_noop, _noop);
440
430
  },
441
431
 
442
- /**
443
- * @param session Session object to update
444
- * @param tasks Array of Task objects that this session will be updated to contain
445
- */
446
- updateSessionTasks: function(session, tasks) {
447
- var taskIds = [];
448
- for (var index = 0; index < tasks.length; ++index){
449
- var taskId = tasks[index].getId();
450
- taskIds.push(taskId);
451
- }
452
-
453
- Native.updateSessionTasks(session.getId(), taskIds, _noop, _noop);
454
- },
455
-
456
432
  /**
457
433
  * @param sessionId Long unique id for this session
458
434
  */
@@ -231,7 +231,6 @@
231
231
  }
232
232
 
233
233
  function updateStateLight(state) {
234
- console.log('[[ TASKS STATE LIGHT ]]');
235
234
  var tasksData = state.tasks_data;
236
235
  if (tasksData) {
237
236
  for (var i = _tasks.length - 1; i >= 0; i--) {
package/www/EtaPlanner.js DELETED
@@ -1,129 +0,0 @@
1
- var Place = require('./Place');
2
- var LatLng = require('./LatLng');
3
-
4
- var LISTENER_ETA_PLANNER = 7;
5
- var ETA_PLANNER_ETAS_UPDATED = 0x00000001;
6
-
7
- var _listeners = [];
8
-
9
- var _noop = function(){};
10
-
11
- var _nativeListener = function(data){
12
- var result = JSON.parse(data);
13
- var idListener = result.listener;
14
- var events = result.events;
15
- var param1 = result.param1;
16
- var param2 = result.param2;
17
-
18
- if ( LISTENER_ETA_PLANNER == idListener )
19
- {
20
- console.log("[EtaPlanner] Listener: " + idListener + " Events: " + events + " Param1: " + param1 + " Param2: " + param2 + " data: " + data);
21
-
22
- if ( 0 !== ( ETA_PLANNER_ETAS_UPDATED & events ) ) {
23
- var etaValues = param1;
24
-
25
- spreadEtasUpdated(etaValues);
26
- }
27
- }
28
- };
29
-
30
- function spreadEtasUpdated(etas) {
31
- console.log("[EtaPlanner] spreadEtasUpdated");
32
- spreadEvent('etasUpdated', [etas]);
33
- };
34
-
35
- function spreadEvent(event, params) {
36
- console.log("[EtaPlanner] spreadEvent");
37
- if (_listeners) {
38
- for (var index = 0; index < _listeners.length; ++index){
39
- var listener = _listeners[index];
40
- if ( typeof listener[event] == 'function' )
41
- {
42
- listener[event].apply(listener, params);
43
- }
44
- }
45
- }
46
- };
47
-
48
- function createLocation(stop) {
49
- var lat = 0;
50
- var lng = 0;
51
-
52
- if ( typeof stop.getLatitude === 'function' )
53
- {
54
- lat = stop.getLatitude();
55
- }
56
- else if ( stop.hasOwnProperty('_latitude') ) {
57
- lat = stop._latitude;
58
- }
59
- else if ( stop.hasOwnProperty('latitude')) {
60
- lat = stop.latitude;
61
- }
62
-
63
- if ( typeof stop.getLongitude === 'function' )
64
- {
65
- lng = stop.getLongitude();
66
- }
67
- else if ( stop.hasOwnProperty('_longitude') ) {
68
- lng = stop._longitude;
69
- }
70
- else if ( stop.hasOwnProperty('longitude')) {
71
- lng = stop.longitude;
72
- }
73
-
74
- return { "latitude": lat, "longitude": lng };
75
- };
76
-
77
- module.exports = {
78
-
79
- init: function(){
80
- console.log("[EtaPlanner] init");
81
- Native.registerListener(_nativeListener);
82
- },
83
-
84
- addListener: function(listener) {
85
- if ( !listener )
86
- {
87
- console.log('[EtaPlanner] Null listener not supported');
88
- return;
89
- }
90
-
91
- var index = _listeners.indexOf(listener);
92
- if (index > -1)
93
- {
94
- console.log('[EtaPlanner] Listener already registered!');
95
- return;
96
- }
97
-
98
- _listeners.push(listener);
99
- },
100
-
101
- removeListener: function(listener) {
102
- var index = _listeners.indexOf(listener);
103
- if (index > -1) {
104
- _listeners.splice(index, 1);
105
- }
106
- },
107
-
108
- /**
109
- * @param start Location object containing the initial location
110
- * @param stops Array of Locations where each Location is a destination in the route
111
- * @param stopoverTime Long in milliseconds of how much time should be added for each stop
112
- */
113
- query: function(start, stops, stopoverTime){
114
-
115
- var initial = createLocation(start);
116
- var places = [];
117
-
118
- for (var index = 0; index < stops.length; ++index) {
119
- var stop = stops[index];
120
- places.push(createLocation(stop));
121
- }
122
-
123
- Native.startEtaPlannerQuery(initial, places, stopoverTime, _noop, _noop);
124
- },
125
-
126
- abort: function() {
127
- Native.abortEtaPlannerQuery(_noop, _noop);
128
- }
129
- };