@glympse-inc/com.glympse.enroute 2.105.232

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.
Files changed (45) hide show
  1. package/package.json +34 -0
  2. package/plugin.xml +262 -0
  3. package/scripts/iosFixPCH.js +38 -0
  4. package/src/android/BootReceiver.java +13 -0
  5. package/src/android/EnRoutePlugin.java +1867 -0
  6. package/src/android/HealthCheckJobService.java +225 -0
  7. package/src/android/LocationAccuracyChecker.java +49 -0
  8. package/src/android/ManagerWrapper.java +205 -0
  9. package/src/android/NotificationService.java +81 -0
  10. package/src/android/PushReceiver.java +90 -0
  11. package/src/android/enroute/aars/enrouteapi-aar.gradle +17 -0
  12. package/src/android/enroute/aars/glympseapi-aar.gradle +17 -0
  13. package/src/android/enroute/aars/glympseapipush-aar.gradle +17 -0
  14. package/src/android/enroute/aars/glympseapitoolbox-aar.gradle +17 -0
  15. package/src/android/gradle/build.gradle +25 -0
  16. package/src/ios/EnRoutePlugin.h +128 -0
  17. package/src/ios/EnRoutePlugin.mm +1258 -0
  18. package/src/ios/EnRouteWrapper.h +30 -0
  19. package/src/ios/EnRouteWrapper.mm +176 -0
  20. package/www/Agent.js +48 -0
  21. package/www/AgentManager.js +422 -0
  22. package/www/CardMessage.js +49 -0
  23. package/www/ChatMessage.js +29 -0
  24. package/www/CustomerMessage.js +18 -0
  25. package/www/EnRouteManager.js +613 -0
  26. package/www/EtaPlanner.js +129 -0
  27. package/www/GlobalConfig.js +13 -0
  28. package/www/Invite.js +93 -0
  29. package/www/LatLng.js +28 -0
  30. package/www/Location.js +63 -0
  31. package/www/Native.js +215 -0
  32. package/www/Operation.js +67 -0
  33. package/www/OrderItem.js +43 -0
  34. package/www/OrgConfig.js +184 -0
  35. package/www/Organization.js +88 -0
  36. package/www/Pickup.js +119 -0
  37. package/www/PickupArrivalData.js +38 -0
  38. package/www/PickupManager.js +512 -0
  39. package/www/Place.js +33 -0
  40. package/www/Session.js +87 -0
  41. package/www/SessionManager.js +431 -0
  42. package/www/Task.js +106 -0
  43. package/www/TaskManager.js +443 -0
  44. package/www/Ticket.js +205 -0
  45. package/www/Track.js +75 -0
@@ -0,0 +1,443 @@
1
+ var Task = require('./Task');
2
+
3
+ var LISTENER_TASKS = 2;
4
+
5
+ var TASKS_TASK_LIST_CHANGED = 0x00000001;
6
+ var TASKS_TASK_STARTED = 0x00000002;
7
+ var TASKS_OPERATION_COMPLETED = 0x00000008;
8
+ var TASKS_TASK_PHASE_CHANGED = 0x00000020;
9
+ var TASKS_TASK_CARD_MESSAGE_CHANGED = 0x00000200;
10
+ var TASKS_TASK_CHAT_MESSAGES_CHANGED = 0x00008000;
11
+ var TASKS_TASK_ROUTE_CHANGED = 0x00010000;
12
+ var TASKS_TASK_CREATED = 0x00020000;
13
+ var TASKS_TASK_CREATE_FAILED = 0x00040000;
14
+
15
+ var LIGHT_SYNC_INTERVAL = 1000;
16
+
17
+ var OPERATION_STATE_ACTIVE = 1;
18
+
19
+ var _active = false;
20
+ var _listeners = [];
21
+ var _tasks = [];
22
+ var _taskMap = {};
23
+
24
+ var _syncing = false;
25
+ var _lightRefreshTimer;
26
+
27
+ var _noop = function(){};
28
+
29
+ var _nativeListener = function(data){
30
+ var result = JSON.parse(data);
31
+ var idListener = result.listener;
32
+ var events = result.events;
33
+ var param1 = result.param1;
34
+ var param2 = result.param2;
35
+
36
+ if ( LISTENER_TASKS === idListener )
37
+ {
38
+ // console.log("TaskManager Listener: " + idListener + " Events: " + events + " Param1: " + param1 + " Param2: " + param2 + " data: " + data);
39
+
40
+ if ( 0 !== ( TASKS_TASK_LIST_CHANGED & events ) ) {
41
+ refreshState(false, function() {
42
+ spreadTasksChanged();
43
+ });
44
+ }
45
+ if ( 0 !== ( TASKS_TASK_STARTED & events ) ) {
46
+ refreshState(false, function() {
47
+ var task;
48
+ if ( param1 && param1.id )
49
+ {
50
+ task = _taskMap[param1.id];
51
+ }
52
+ spreadTaskStarted(task);
53
+ });
54
+ }
55
+ if ( 0 !== ( TASKS_OPERATION_COMPLETED & events ) ) {
56
+ refreshState(false, function() {
57
+ spreadOperationCompleted(param1 && param1.taskId);
58
+ });
59
+ }
60
+ if ( 0 !== ( TASKS_TASK_PHASE_CHANGED & events ) ) {
61
+ refreshState(false, function() {
62
+ var task;
63
+ if ( param1 && param1.id )
64
+ {
65
+ task = _taskMap[param1.id];
66
+ }
67
+ var phase = "";
68
+ if ( param2 )
69
+ {
70
+ phase = param2;
71
+ }
72
+ spreadTaskPhaseChanged(task, phase);
73
+ });
74
+ }
75
+ if ( 0 !== ( TASKS_TASK_CARD_MESSAGE_CHANGED & events ) ) {
76
+ refreshState(false, function() {
77
+ var task;
78
+ if ( param1 && param1.operation && param1.operation.taskId )
79
+ {
80
+ task = _taskMap[param1.operation.taskId];
81
+ }
82
+ spreadTaskCardMessagesChanged(task);
83
+ });
84
+ }
85
+ if ( 0 !== ( TASKS_TASK_CHAT_MESSAGES_CHANGED & events ) ) {
86
+ refreshState(false, function() {
87
+ var task;
88
+ if ( param1 && param1.id)
89
+ {
90
+ task = _taskMap[param1.id];
91
+ }
92
+ spreadTaskChatMessagesChanged(task);
93
+ });
94
+ }
95
+ if ( 0 !== ( TASKS_TASK_ROUTE_CHANGED & events ) ) {
96
+ refreshState(false, function() {
97
+ var task;
98
+ if ( param1 && param1.id)
99
+ {
100
+ task = _taskMap[param1.id];
101
+ }
102
+ spreadTaskRouteChanged(task);
103
+ });
104
+ }
105
+ if ( 0 !== ( TASKS_TASK_CREATED & events ) ) {
106
+ spreadTaskCreated(param1);
107
+ }
108
+ if ( 0 !== ( TASKS_TASK_CREATE_FAILED & events ) ) {
109
+ spreadTaskCreateFailed(param1, param2);
110
+ }
111
+ }
112
+ };
113
+
114
+ function spreadTasksChanged() {
115
+ console.log("[TaskManager]spreadTasksChanged");
116
+ spreadEvent('taskListChanged');
117
+ }
118
+
119
+ function spreadTaskStarted(task) {
120
+ console.log("[TaskManager] spreadTaskStarted");
121
+ spreadEvent('taskStarted', [task]);
122
+ }
123
+
124
+ function spreadOperationCompleted(taskId) {
125
+ console.log("[TaskManager] spreadOperationCompleted");
126
+ spreadEvent('operationCompleted', [taskId]);
127
+ }
128
+
129
+ function spreadTaskPhaseChanged(task, phase) {
130
+ console.log("[TaskManager] spreadTaskPhaseChanged");
131
+ spreadEvent('taskPhaseChanged', [task, phase]);
132
+ }
133
+
134
+ function spreadTaskCardMessagesChanged(task) {
135
+ console.log("[TaskManager] spreadTaskCardMessagesChanged");
136
+ spreadEvent('taskCardMessagesChanged', [task]);
137
+ }
138
+
139
+ function spreadTaskChatMessagesChanged(task) {
140
+ console.log("[TaskManager] spreadTaskChatMessagesChanged");
141
+ spreadEvent('taskChatMessagesChanged', [task]);
142
+ }
143
+
144
+ function spreadTaskTravelModeUpdated(task) {
145
+ console.log("[TaskManager] spreadTaskTravelModeUpdated");
146
+ spreadEvent('taskTravelModeUpdated', [task]);
147
+ }
148
+
149
+ function spreadTaskRouteChanged(task) {
150
+ console.log("[TaskManager] spreadTaskRouteChanged");
151
+ spreadEvent('taskRouteChanged', [task]);
152
+ }
153
+
154
+ function spreadTaskCreated(taskData) {
155
+ console.log("[TaskManager] spreadTaskCreated");
156
+ spreadEvent('taskCreated', [taskData]);
157
+ }
158
+
159
+ function spreadTaskCreateFailed(taskData, error) {
160
+ console.log("[TaskManager] spreadTaskCreateFailed");
161
+ spreadEvent('taskCreateFailed', [taskData, error]);
162
+ }
163
+
164
+ function spreadEvent(event, params) {
165
+ // console.log("spreadEvent");
166
+ if (_listeners) {
167
+ for (var index = 0; index < _listeners.length; ++index){
168
+ var listener = _listeners[index];
169
+ if ( typeof listener[event] == 'function' )
170
+ {
171
+ listener[event].apply(listener, params);
172
+ }
173
+ }
174
+ }
175
+ }
176
+
177
+ function refreshState(light, callback) {
178
+ var success = function(data)
179
+ {
180
+ updateState(light, data);
181
+
182
+ if ( callback )
183
+ {
184
+ callback();
185
+ }
186
+ };
187
+
188
+ var failure = function() {
189
+ if ( callback )
190
+ {
191
+ callback();
192
+ }
193
+ };
194
+
195
+ if ( light ) {
196
+ Native.syncTasksStateLight(success, failure);
197
+ }
198
+ else {
199
+ Native.syncTasksState(success, failure);
200
+ }
201
+ }
202
+
203
+ function updateState(light, data) {
204
+ var state = JSON.parse(data);
205
+
206
+ if ( light ) {
207
+ updateStateLight(state);
208
+ }
209
+ else {
210
+ updateStateHeavy(state);
211
+ }
212
+
213
+ determineSyncTimer();
214
+ }
215
+
216
+ function updateStateLight(state) {
217
+ console.log('[[ TASKS STATE LIGHT ]]');
218
+ var tasksData = state.tasks_data;
219
+ if (tasksData) {
220
+ for (var i = _tasks.length - 1; i >= 0; i--) {
221
+ var task = _tasks[i];
222
+ var taskInfo = (task && tasksData[task.getId().toString()]);
223
+
224
+ if (taskInfo) {
225
+ var op = task.getOperation();
226
+
227
+ if (op) {
228
+ task._phase = taskInfo.phase;
229
+ op._ticketVisible = taskInfo.ticketVisible;
230
+ op._updateTicket(taskInfo.ticket);
231
+ }
232
+ }
233
+ }
234
+ }
235
+ }
236
+
237
+ function updateStateHeavy(state) {
238
+ console.log('[[ TASKS STATE HEAVY ]]');
239
+ var tasks = state.tasks;
240
+
241
+ if (!tasks) {
242
+ return;
243
+ }
244
+
245
+ var i, len, availTasks = [];
246
+
247
+ for (i = 0, len = tasks.length; i < len; i++) {
248
+ var t = tasks[i];
249
+ var id = t.id;
250
+ var task = _taskMap[id];
251
+
252
+ availTasks.push(id);
253
+ if (!task) {
254
+ task = new Task(t);
255
+ _tasks.push(task);
256
+ _taskMap[id] = task;
257
+ console.log('-----=---=--- adding task: ' + id)
258
+ } else {
259
+ task.update(t);
260
+ }
261
+ }
262
+
263
+ // Cull out old tasks
264
+ for (i = _tasks.length - 1; i >= 0; i--) {
265
+ var tid = _tasks[i]._id;
266
+ if (availTasks.indexOf(tid) >= 0) {
267
+ continue;
268
+ }
269
+ // console.log('=-=-=-=-=-= REMOVING TASK: ' + tid + ' =-=-=-=-=-=-=-=-=');
270
+ _tasks.splice(i, 1);
271
+ _taskMap[tid] = undefined;
272
+ }
273
+ }
274
+
275
+
276
+ function determineSyncTimer() {
277
+
278
+ if ( _active ) {
279
+ if ( !_syncing ) {
280
+ _syncing = true;
281
+ _lightRefreshTimer = setInterval(doLightSync, LIGHT_SYNC_INTERVAL);
282
+ }
283
+ }
284
+ else {
285
+ if ( _syncing ) {
286
+ _syncing = false;
287
+ clearInterval(_lightRefreshTimer);
288
+ }
289
+ }
290
+ }
291
+
292
+ function doLightSync() {
293
+ refreshState(true, function() {
294
+
295
+ });
296
+ }
297
+
298
+ module.exports = {
299
+
300
+ init: function(){
301
+ console.log("taskManager init");
302
+ Native.registerListener(_nativeListener);
303
+ refreshState(false, function() {
304
+ spreadTasksChanged();
305
+ });
306
+ },
307
+
308
+ /**
309
+ * @param Bool true if the app is now in the foreground
310
+ */
311
+ setActive: function(active) {
312
+ if ( active === _active ) {
313
+ return;
314
+ }
315
+ _active = active;
316
+
317
+ determineSyncTimer();
318
+ },
319
+
320
+ addListener: function(listener) {
321
+ if ( !listener )
322
+ {
323
+ console.log('Null listener not supported');
324
+ return;
325
+ }
326
+
327
+ var index = _listeners.indexOf(listener);
328
+ if (index > -1)
329
+ {
330
+ console.log('Listener already registered!');
331
+ return;
332
+ }
333
+
334
+ _listeners.push(listener);
335
+ },
336
+
337
+ removeListener: function(listener) {
338
+ var index = _listeners.indexOf(listener);
339
+ if (index > -1) {
340
+ _listeners.splice(index, 1);
341
+ }
342
+ },
343
+
344
+ getTasks: function(){
345
+ return _tasks;
346
+ },
347
+
348
+ refreshTasks: function(){
349
+ // console.log("taskManager refreshTasks");
350
+ Native.refreshTasks(_noop, _noop);
351
+ },
352
+
353
+ /**
354
+ * @param task Task object to start
355
+ * @param duration Long duration for this task
356
+ */
357
+ startTask: function(task, duration){
358
+ Native.startTask(task.getId(), duration, _noop, _noop);
359
+ },
360
+
361
+ /**
362
+ * @param taskData Task data as a JSON formatted string
363
+ */
364
+ createTask: function(taskData){
365
+ Native.createTask(taskData, _noop, _noop);
366
+ },
367
+
368
+ /**
369
+ * @param task Task object to modify
370
+ * @param phase String phase to apply to this Task
371
+ */
372
+ setTaskPhase: function(task, phase){
373
+ Native.setTaskPhase(task.getId(), phase, _noop, _noop);
374
+ },
375
+
376
+ /**
377
+ * @param task Task object to modify
378
+ * @param visible String representation of the new visibility state
379
+ * available visibility options: "visible", "cloaked", "hidden"
380
+ */
381
+ setTaskVisibility: function(task, visible){
382
+ Native.setTaskVisibility(task.getId(), visible, _noop, _noop);
383
+ },
384
+
385
+ /**
386
+ * @param task Task object to complete
387
+ */
388
+ completeTask: function(task){
389
+ Native.completeTask(task.getId(), _noop, _noop);
390
+ },
391
+
392
+ /**
393
+ * @param taskId Long id of the Task to find
394
+ */
395
+ findTaskById: function(taskId){
396
+ return _taskMap[taskId];
397
+ },
398
+
399
+ /**
400
+ * @param task Task object to update
401
+ * @param key String key of the metadata item
402
+ * @param value Primitive value of the metadata item. Can be a String, Long, Bool, Double
403
+ */
404
+ addOrUpdateMetadataItem: function(task, key, value){
405
+ Native.addOrUpdateMetadataItem(task.getId(), key, value, _noop, _noop);
406
+ },
407
+
408
+ /**
409
+ * @param task Task object to update
410
+ * @param travelMode String of the travel mode to use
411
+ * available travelModes: "drive", "walk", "transit", "cycle"
412
+ */
413
+ setTravelModeForTask: function(task, travelMode) {
414
+ Native.setTravelModeForTask(task.getId(), travelMode, _noop, _noop);
415
+ refreshState(false, function() {
416
+ spreadTaskTravelModeUpdated(task);
417
+ });
418
+ },
419
+
420
+ // DEPRECATED - no longer functional
421
+ confirmMessageRead: function(task, cardMessage) {
422
+ Native.confirmMessageRead(task.getId(), cardMessage.getId(), _noop, _noop);
423
+ },
424
+
425
+ /**
426
+ * @param task Task object to send a message to
427
+ * @param message String containing the message
428
+ */
429
+ sendMessageToTask: function(task, message, predefinedMessageId, successCallback, errorCallback) {
430
+ Native.sendMessageToTask(task.getId(), message, predefinedMessageId, successCallback, errorCallback);
431
+ },
432
+
433
+ /**
434
+ * @param task Task object associated with the messages that we want to mark as read
435
+ */
436
+ markMessagesAsRead: function(task) {
437
+ Native.markTaskMessagesAsRead(task.getId(), _noop, _noop);
438
+
439
+ refreshState(false, function() {
440
+ spreadTaskChatMessagesChanged(task);
441
+ });
442
+ }
443
+ };
package/www/Ticket.js ADDED
@@ -0,0 +1,205 @@
1
+ var Track = require('./Track');
2
+ var Place = require('./Place');
3
+ var Invite = require('./Invite');
4
+
5
+ function Ticket(data) {
6
+ this._invites = [];
7
+ this.update(data);
8
+ }
9
+
10
+ Ticket.prototype.update = function(data) {
11
+ this._id = data.id;
12
+ this._watching = data.watching;
13
+ this._mine = data.mine;
14
+ this._sibling = data.sibling;
15
+ this._visibility = data.visibility;
16
+ this._visible = data.visible;
17
+ this._code = data.code;
18
+ this._reference = data.reference;
19
+ this._state = data.state;
20
+ this._owner = data.owner;
21
+ this._user = data.user;
22
+ this._active = data.active;
23
+ this._completed = data.completed;
24
+ this._duration = data.duration;
25
+ this._startTime = data.startTime;
26
+ this._expireTime = data.expireTime;
27
+ this._message = data.message;
28
+ this._eta = data.eta;
29
+ this._travelMode = data.travelMode;
30
+ this._someoneWatching = data.someoneWatching;
31
+ this._requestNoReply = data.requestNoReply;
32
+ this._requestScenario = data.requestScenario;
33
+ this._name = data.name;
34
+ this._partnerIds = data.partnerIds;
35
+
36
+ var o = data.destination;
37
+ if (o) {
38
+ if (this._destination) {
39
+ this._destination.update(o);
40
+ } else {
41
+ this._destination = new Place(o);
42
+ }
43
+ }
44
+
45
+ o = data.track;
46
+ if (o) {
47
+ if (this._track) {
48
+ this._track.update(o);
49
+ } else {
50
+ this._track = new Track(o);
51
+ }
52
+ }
53
+
54
+ o = data.route;
55
+ if (o) {
56
+ if (this._route) {
57
+ this._route.update(o);
58
+ } else {
59
+ this._route = new Track(o);
60
+ }
61
+ }
62
+
63
+ o = data.requestTicket;
64
+ if (o) {
65
+ if (this._requestTicket) {
66
+ this._requestTicket.update(o);
67
+ } else {
68
+ this._requestTicket = new Ticket(o);
69
+ }
70
+ }
71
+
72
+ o = data.invites;
73
+ if (o) {
74
+ var invites = this._invites;
75
+ o.forEach(function(val, index, o) {
76
+ for (var i = 0, len = invites.length; i < len; i++) {
77
+ var t = invites[i];
78
+ if (t._code == val.code) {
79
+ t.update(val);
80
+ return;
81
+ }
82
+ }
83
+ // New task
84
+ invites.push(new Invite(val));
85
+ });
86
+ }
87
+ };
88
+
89
+ Ticket.prototype.getId = function() {
90
+ return this._id;
91
+ };
92
+
93
+ Ticket.prototype.isWatching = function() {
94
+ return this._watching;
95
+ };
96
+
97
+ Ticket.prototype.isMine = function() {
98
+ return this._mine;
99
+ };
100
+
101
+ Ticket.prototype.isSibling = function() {
102
+ return this._sibling;
103
+ };
104
+
105
+ Ticket.prototype.getVisibility = function() {
106
+ return this._visibility;
107
+ };
108
+
109
+ Ticket.prototype.isVisible = function() {
110
+ return this._visible;
111
+ };
112
+
113
+ Ticket.prototype.getCode = function() {
114
+ return this._code;
115
+ };
116
+
117
+ Ticket.prototype.getReference = function() {
118
+ return this._reference;
119
+ };
120
+
121
+ Ticket.prototype.getState = function() {
122
+ return this._state;
123
+ };
124
+
125
+ Ticket.prototype.getOwner = function() {
126
+ return this._owner;
127
+ };
128
+
129
+ Ticket.prototype.getUser = function() {
130
+ return this._user;
131
+ };
132
+
133
+ Ticket.prototype.isActive = function() {
134
+ return this._active;
135
+ };
136
+
137
+ Ticket.prototype.isCompleted = function() {
138
+ return this._completed;
139
+ };
140
+
141
+ Ticket.prototype.getInvites = function() {
142
+ return this._invites;
143
+ };
144
+
145
+ Ticket.prototype.getDuration = function() {
146
+ return this._duration;
147
+ };
148
+
149
+ Ticket.prototype.getStartTime = function() {
150
+ return this._startTime;
151
+ };
152
+
153
+ Ticket.prototype.getExpireTime = function() {
154
+ return this._expireTime;
155
+ };
156
+
157
+ Ticket.prototype.getMessage = function() {
158
+ return this._message;
159
+ };
160
+
161
+ Ticket.prototype.getDestination = function() {
162
+ return this._destination;
163
+ };
164
+
165
+ Ticket.prototype.getTrack = function() {
166
+ return this._track;
167
+ };
168
+
169
+ Ticket.prototype.getEta = function() {
170
+ return this._eta;
171
+ };
172
+
173
+ Ticket.prototype.getRoute = function() {
174
+ return this._route;
175
+ };
176
+
177
+ Ticket.prototype.getTravelMode = function() {
178
+ return this._travelMode;
179
+ };
180
+
181
+ Ticket.prototype.isSomeoneWatching = function() {
182
+ return this._someoneWatching;
183
+ };
184
+
185
+ Ticket.prototype.getRequestTicket = function() {
186
+ return this._requestTicket;
187
+ };
188
+
189
+ Ticket.prototype.getRequestNoReply = function() {
190
+ return this._requestNoReply;
191
+ };
192
+
193
+ Ticket.prototype.getRequestScenario = function() {
194
+ return this._requestScenario;
195
+ };
196
+
197
+ Ticket.prototype.getName = function() {
198
+ return this._name;
199
+ };
200
+
201
+ Ticket.prototype.getPartnerIds = function() {
202
+ return this._partnerIds;
203
+ };
204
+
205
+ module.exports = Ticket;
package/www/Track.js ADDED
@@ -0,0 +1,75 @@
1
+ var Location = require('./Location');
2
+
3
+ function Track(data) {
4
+ this.update(data);
5
+ }
6
+
7
+ Track.prototype.update = function(data) {
8
+ this._distance = data.distance;
9
+
10
+ // FIXME: Should we reset the array instead if data is present?
11
+ var o = data.locations;
12
+ if (o) {
13
+ /*var locations = this._locations;
14
+ if (locations) {
15
+ o.forEach(function(val, index, o) {
16
+ for (var i = 0, len = locations.length; i < len; i++) {
17
+ var t = locations[i];
18
+ if (t._longitude === val._longitude && t._latitude === val._latitude) {
19
+ return;
20
+ }
21
+ }
22
+
23
+ // New location
24
+ console.log('New location!! ' + val._latitude + ',' + val._longitude);
25
+ locations.push(new Location(val));
26
+ });
27
+
28
+ // FIXME: Deal with deleted/missing locations in data.locations compared to this._locations array
29
+ } else {*/
30
+ this._locations = o.map(function(item_data) {
31
+ return new Location(item_data);
32
+ });
33
+ //}
34
+ }
35
+
36
+ // FIXME: Should we reset the array instead if data is present?
37
+ o = data.newLocations;
38
+ if (o) {
39
+ /*var newLocations = this._newLocations;
40
+ if (newLocations) {
41
+ o.forEach(function(val, index, o) {
42
+ for (var i = 0, len = newLocations.length; i < len; i++) {
43
+ var t = newLocations[i];
44
+ if (t._longitude === val.longitude && t._latitude === val.latitude) {
45
+ return;
46
+ }
47
+ }
48
+
49
+ // New newLocation
50
+ console.log('New newLocation!! ' + val.latitude + ',' + val.longitude);
51
+ newLocations.push(new Location(val));
52
+ });
53
+
54
+ // FIXME: Deal with deleted/missing tasks in data.locations compared to this._locations array
55
+ } else {*/
56
+ this._newLocations = o.map(function(item_data) {
57
+ return new Location(item_data);
58
+ });
59
+ //}
60
+ }
61
+ }
62
+
63
+ Track.prototype.getLocations = function() {
64
+ return this._locations;
65
+ };
66
+
67
+ Track.prototype.getNewLocations = function() {
68
+ return this._newLocations;
69
+ };
70
+
71
+ Track.prototype.getDistance = function() {
72
+ return this._distance;
73
+ };
74
+
75
+ module.exports = Track;