@glympse-inc/com.glympse.enroute 2.109.291 → 2.109.293

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.291",
3
+ "version": "2.109.293",
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.291">
2
+ <plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" id="com.glympse.enroute" version="2.109.293">
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.291"/>
235
+ <pod name="EnRouteApi" spec="~> 2.109.293"/>
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);
@@ -1088,11 +1073,14 @@ public class EnRoutePlugin extends CordovaPlugin implements GListener
1088
1073
  GArray<GSession> sessions = sessionManager.getSessions();
1089
1074
  if ( null != sessions )
1090
1075
  {
1076
+ GPrimitive config = CoreFactory.createPrimitive(CC.PRIMITIVE_TYPE_OBJECT);
1077
+ config.put("truncate_locations", true);
1078
+
1091
1079
  GPrimitive sessionsPrimitive = CoreFactory.createPrimitive(CC.PRIMITIVE_TYPE_ARRAY);
1092
1080
 
1093
1081
  for ( GSession session : sessions )
1094
1082
  {
1095
- GPrimitive sessionPrimitive = commonObjToPrimitive(session);
1083
+ GPrimitive sessionPrimitive = commonObjToPrimitive(session, config);
1096
1084
  sessionsPrimitive.put(sessionPrimitive);
1097
1085
  }
1098
1086
 
@@ -1168,35 +1156,6 @@ public class EnRoutePlugin extends CordovaPlugin implements GListener
1168
1156
  }
1169
1157
  }
1170
1158
 
1171
- private synchronized void updateSessionTasks(final JSONArray args, final CallbackContext callbackContext)
1172
- {
1173
- GSessionManager sessionManager = ManagerWrapper.instance().manager().getSessionManager();
1174
- if ( null == sessionManager )
1175
- {
1176
- return;
1177
- }
1178
-
1179
- long sessionId = args.optLong(0, -1);
1180
- GSession session = sessionManager.findSessionById(sessionId);
1181
- if ( null == session )
1182
- {
1183
- return;
1184
- }
1185
-
1186
- JSONArray taskArray = args.optJSONArray(1);
1187
-
1188
- GVector<Object> tasks = CoreFactory.createVector();
1189
-
1190
- for ( int i = 0; i < taskArray.length(); i++ )
1191
- {
1192
- long taskId = taskArray.optLong(i, -1);
1193
- GTask task = ManagerWrapper.instance().manager().getTaskManager().findTaskById(taskId);
1194
- tasks.addElement(task);
1195
- }
1196
-
1197
- sessionManager.updateSessionTasks(session, tasks);
1198
- }
1199
-
1200
1159
  private synchronized void startSession(final JSONArray args, final CallbackContext callbackContext)
1201
1160
  {
1202
1161
  GSessionManager sessionManager = ManagerWrapper.instance().manager().getSessionManager();
@@ -1283,48 +1242,6 @@ public class EnRoutePlugin extends CordovaPlugin implements GListener
1283
1242
  sessionManager.completeSession(session);
1284
1243
  }
1285
1244
 
1286
- private synchronized void startEtaPlannerQuery(final JSONArray args, final CallbackContext callbackContext)
1287
- {
1288
- GEnRouteManager manager = ManagerWrapper.instance().manager();
1289
- GEtaPlanner etaPlanner = manager.getEtaPlanner();
1290
- etaPlanner.addListener(this);
1291
-
1292
- JSONObject initial = args.optJSONObject(0);
1293
- JSONArray places = args.optJSONArray(1);
1294
- long stopoverTime = args.optLong(2, 0);
1295
-
1296
- if ( null != initial && null != places )
1297
- {
1298
- double lat = initial.optDouble("latitude", 0);
1299
- double lng = initial.optDouble("longitude", 0);
1300
-
1301
- GLatLng start = CoreFactory.createLocation(lat, lng);
1302
- GVector<Object> stops = CoreFactory.createVector();
1303
-
1304
- for ( int i = 0; i < places.length(); i++ )
1305
- {
1306
- JSONObject place = places.optJSONObject(i);
1307
-
1308
- lat = place.optDouble("latitude", 0);
1309
- lng = place.optDouble("longitude", 0);
1310
-
1311
- GLatLng stop = CoreFactory.createLocation(lat, lng);
1312
- stops.addElement(stop);
1313
- }
1314
-
1315
- etaPlanner.query(start, stops, stopoverTime);
1316
- }
1317
- }
1318
-
1319
- private synchronized void abortEtaPlannerQuery(final JSONArray args, final CallbackContext callbackContext)
1320
- {
1321
- GEnRouteManager manager = ManagerWrapper.instance().manager();
1322
- GEtaPlanner etaPlanner = manager.getEtaPlanner();
1323
- etaPlanner.removeListener(this);
1324
-
1325
- etaPlanner.abort();
1326
- }
1327
-
1328
1245
  private synchronized void overrideLoggingLevels(final JSONArray args, final CallbackContext callbackContext)
1329
1246
  {
1330
1247
  int fileLogLevel = CoreConstants.NONE;
@@ -17,7 +17,7 @@ android {
17
17
  }
18
18
 
19
19
  dependencies {
20
- def GLYMPSE_VERSION = '2.109.291'
20
+ def GLYMPSE_VERSION = '2.109.293'
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;
@@ -571,11 +571,13 @@
571
571
  Glympse::GArray<Glympse::EnRoute::GSession>::ptr sessions = sessionManager->getSessions();
572
572
  if ( NULL != sessions )
573
573
  {
574
+ Glympse::GPrimitive config = Glympse::CoreFactory::createPrimitive(Glympse::CC::PRIMITIVE_TYPE_OBJECT);
575
+ config->put([GETHelpers toGString:@"truncate_locations"], true);
574
576
  Glympse::GPrimitive sessionsPrimitive = Glympse::CoreFactory::createPrimitive(Glympse::CC::PRIMITIVE_TYPE_ARRAY);
575
577
 
576
578
  for ( Glympse::EnRoute::GSession session : sessions )
577
579
  {
578
- Glympse::GPrimitive sessionPrimitive = [self commonObjToPrimitive:session];
580
+ Glympse::GPrimitive sessionPrimitive = [self commonObjToPrimitive:session withConfig:config];
579
581
 
580
582
  sessionsPrimitive->put(sessionPrimitive);
581
583
  }
@@ -651,32 +653,6 @@
651
653
  [EnRouteWrapper instance].manager->getSessionManager()->refresh();
652
654
  }
653
655
 
654
- - (void) updateSessionTasks:(CDVInvokedUrlCommand *)command
655
- {
656
- Glympse::int64 sessionId = [[command argumentAtIndex:0] longLongValue];
657
- NSArray *taskIds = [command argumentAtIndex:1 withDefault:NULL];
658
- if ( NULL == taskIds )
659
- {
660
- return;
661
- }
662
-
663
- Glympse::EnRoute::GSession session = [EnRouteWrapper instance].manager->getSessionManager()->findSessionById(sessionId);
664
- if ( NULL == session )
665
- {
666
- return;
667
- }
668
-
669
- Glympse::GVector<Glympse::GCommonObj>::ptr tasks = Glympse::CoreFactory::createVector();
670
- for ( id taskIdObj in taskIds )
671
- {
672
- NSNumber *taskIdNumber = (NSNumber*)taskIdObj;
673
- Glympse::EnRoute::GTask task = [EnRouteWrapper instance].manager->getTaskManager()->findTaskById([taskIdNumber longLongValue]);
674
- tasks->addElement(task);
675
- }
676
-
677
- [EnRouteWrapper instance].manager->getSessionManager()->updateSessionTasks(session, tasks);
678
- }
679
-
680
656
  - (void) startSession:(CDVInvokedUrlCommand *)command
681
657
  {
682
658
  Glympse::int64 sessionId = [[command argumentAtIndex:0] longLongValue];
@@ -739,42 +715,6 @@
739
715
  [EnRouteWrapper instance].manager->getSessionManager()->completeSession(session);
740
716
  }
741
717
 
742
- - (void) startEtaPlannerQuery:(CDVInvokedUrlCommand *)command
743
- {
744
- NSDictionary *initial = [command argumentAtIndex:0 withDefault:NULL];
745
- NSArray *places = [command argumentAtIndex:1 withDefault:NULL];
746
- Glympse::int64 stopoverTime = [[command argumentAtIndex:2] longLongValue];
747
-
748
-
749
- Glympse::EnRoute::GEtaPlanner etaPlanner = [EnRouteWrapper instance].manager->getEtaPlanner();
750
- [GETHelpers subscribe:self onManager:etaPlanner];
751
-
752
- double lat = [[initial objectForKey:@"latitude"] doubleValue];
753
- double lng = [[initial objectForKey:@"longitude"] doubleValue];
754
- Glympse::GLatLng start = Glympse::CoreFactory::createLocation(lat, lng);
755
-
756
- Glympse::GVector<Glympse::GCommonObj>::ptr stops = Glympse::CoreFactory::createVector();
757
- for ( id placeObj in places )
758
- {
759
- NSDictionary *placeDict = (NSDictionary*)placeObj;
760
- lat = [[placeDict objectForKey:@"latitude"] doubleValue];
761
- lng = [[placeDict objectForKey:@"longitude"] doubleValue];
762
- Glympse::GLatLng place = Glympse::CoreFactory::createLocation(lat, lng);
763
- stops->addElement(place);
764
- }
765
-
766
- etaPlanner->query(start, stops, stopoverTime);
767
- }
768
-
769
- - (void) abortEtaPlannerQuery:(CDVInvokedUrlCommand *)command
770
- {
771
-
772
- Glympse::EnRoute::GEtaPlanner etaPlanner = [EnRouteWrapper instance].manager->getEtaPlanner();
773
- [GETHelpers unsubscribe:self onManager:etaPlanner];
774
-
775
- etaPlanner->abort();
776
- }
777
-
778
718
  - (void) overrideLoggingLevels:(CDVInvokedUrlCommand *)command
779
719
  {
780
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
- };