@glympse-inc/com.glympse.enroute 2.110.303 → 2.110.304
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 +1 -1
- package/plugin.xml +6 -2
- package/src/android/EnRoutePlugin.java +97 -1
- package/src/android/gradle/build.gradle +1 -1
- package/src/ios/EnRoutePlugin.h +4 -0
- package/src/ios/EnRoutePlugin.mm +68 -1
- package/www/DirectionsManager.js +100 -0
- package/www/EnRouteManager.js +7 -0
- package/www/Native.js +8 -0
package/package.json
CHANGED
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.110.
|
|
2
|
+
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" id="com.glympse.enroute" version="2.110.304">
|
|
3
3
|
|
|
4
4
|
<name>Glympse En Route</name>
|
|
5
5
|
|
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
<js-module src="www/SessionManager.js" name="SessionManager">
|
|
27
27
|
<clobbers target="SessionManager" />
|
|
28
28
|
</js-module>
|
|
29
|
+
<js-module src="www/DirectionsManager.js" name="DirectionsManager">
|
|
30
|
+
<clobbers target="DirectionsManager" />
|
|
31
|
+
</js-module>
|
|
29
32
|
<js-module src="www/Agent.js" name="Agent">
|
|
30
33
|
<clobbers target="Agent" />
|
|
31
34
|
</js-module>
|
|
@@ -89,6 +92,7 @@
|
|
|
89
92
|
<asset src="www/SessionManager.js" target="js/SessionManager.js" />
|
|
90
93
|
<asset src="www/PickupManager.js" target="js/PickupManager.js" />
|
|
91
94
|
<asset src="www/AgentManager.js" target="js/AgentManager.js" />
|
|
95
|
+
<asset src="www/DirectionsManager.js" target="js/DirectionsManager.js" />
|
|
92
96
|
<asset src="www/Agent.js" target="js/Agent.js" />
|
|
93
97
|
<asset src="www/CardMessage.js" target="js/CardMessage.js" />
|
|
94
98
|
<asset src="www/GlobalConfig.js" target="js/GlobalConfig.js" />
|
|
@@ -232,7 +236,7 @@
|
|
|
232
236
|
<source url="https://github.com/CocoaPods/Specs.git"/>
|
|
233
237
|
</config>
|
|
234
238
|
<pods use-frameworks="true">
|
|
235
|
-
<pod name="EnRouteApi" spec="~> 2.110.
|
|
239
|
+
<pod name="EnRouteApi" spec="~> 2.110.304"/>
|
|
236
240
|
</pods>
|
|
237
241
|
</podspec>
|
|
238
242
|
<!-- RELEASE END -->
|
|
@@ -29,7 +29,7 @@ import java.util.List;
|
|
|
29
29
|
import com.glympse.enroute.hybrid.android.ManagerWrapper;
|
|
30
30
|
import com.glympse.enroute.hybrid.android.LocationAccuracyChecker;
|
|
31
31
|
|
|
32
|
-
public class EnRoutePlugin extends CordovaPlugin implements GListener
|
|
32
|
+
public class EnRoutePlugin extends CordovaPlugin implements GListener, GEventListener
|
|
33
33
|
{
|
|
34
34
|
private static final String COMMAND_KEY_LOGIN = "LOGIN";
|
|
35
35
|
private static final String COMMAND_KEY_LOGOUT = "LOGOUT";
|
|
@@ -346,6 +346,16 @@ public class EnRoutePlugin extends CordovaPlugin implements GListener
|
|
|
346
346
|
setAutoStartTasksAfterAutoCompletion(args, callbackContext);
|
|
347
347
|
return true;
|
|
348
348
|
}
|
|
349
|
+
else if (action.equals("setDirectionsAsMetric"))
|
|
350
|
+
{
|
|
351
|
+
setDirectionsAsMetric(args, callbackContext);
|
|
352
|
+
return true;
|
|
353
|
+
}
|
|
354
|
+
else if (action.equals("selectTaskForTurnByTurn"))
|
|
355
|
+
{
|
|
356
|
+
selectTaskForTurnByTurn(args, callbackContext);
|
|
357
|
+
return true;
|
|
358
|
+
}
|
|
349
359
|
|
|
350
360
|
return false;
|
|
351
361
|
}
|
|
@@ -1770,6 +1780,87 @@ public class EnRoutePlugin extends CordovaPlugin implements GListener
|
|
|
1770
1780
|
manager.getTaskManager().setAutoStartTasksAfterAutoCompletion(enabled);
|
|
1771
1781
|
}
|
|
1772
1782
|
|
|
1783
|
+
private synchronized void setDirectionsAsMetric(final JSONArray args, final CallbackContext callbackContext)
|
|
1784
|
+
{
|
|
1785
|
+
boolean isMetric = false;
|
|
1786
|
+
try
|
|
1787
|
+
{
|
|
1788
|
+
isMetric = args.getBoolean(0);
|
|
1789
|
+
}
|
|
1790
|
+
catch (JSONException e)
|
|
1791
|
+
{
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
GGlympse glympse = ManagerWrapper.instance().manager().getGlympse();
|
|
1795
|
+
if ( null != glympse )
|
|
1796
|
+
{
|
|
1797
|
+
glympse.getConfig().setMetricDirections(isMetric);
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
private synchronized void selectTaskForTurnByTurn(final JSONArray args, final CallbackContext callbackContext)
|
|
1802
|
+
{
|
|
1803
|
+
GEnRouteManager manager = ManagerWrapper.instance().manager();
|
|
1804
|
+
long taskId = -1;
|
|
1805
|
+
|
|
1806
|
+
try
|
|
1807
|
+
{
|
|
1808
|
+
taskId = args.getLong(0);
|
|
1809
|
+
}
|
|
1810
|
+
catch (JSONException e)
|
|
1811
|
+
{
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1814
|
+
// Negative number is used to deactivate all turn by turn
|
|
1815
|
+
if (taskId < 0)
|
|
1816
|
+
{
|
|
1817
|
+
manager.getGlympse().getDirectionsManager().selectTicketForTurnByTurn(null);
|
|
1818
|
+
return;
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
GTask task = manager.getTaskManager().findTaskById(taskId);
|
|
1822
|
+
if ( null != task )
|
|
1823
|
+
{
|
|
1824
|
+
GOperation operation = task.getOperation();
|
|
1825
|
+
if ( null != operation )
|
|
1826
|
+
{
|
|
1827
|
+
GTicket ticket = operation.getTicket();
|
|
1828
|
+
if ( null != ticket )
|
|
1829
|
+
{
|
|
1830
|
+
manager.getGlympse().getDirectionsManager().selectTicketForTurnByTurn(ticket);
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
// GEventListener
|
|
1837
|
+
public void eventsOccurred(GGlympse glympse, int listener, int events, Object obj)
|
|
1838
|
+
{
|
|
1839
|
+
GPrimitive result = CoreFactory.createPrimitive(CC.PRIMITIVE_TYPE_OBJECT);
|
|
1840
|
+
|
|
1841
|
+
result.put("listener", listener);
|
|
1842
|
+
result.put("events", events);
|
|
1843
|
+
|
|
1844
|
+
if ( null != obj )
|
|
1845
|
+
{
|
|
1846
|
+
GPrimitive prim = commonObjToPrimitive(obj);
|
|
1847
|
+
if ( null != prim )
|
|
1848
|
+
{
|
|
1849
|
+
result.put("param1", prim);
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1853
|
+
String jsonString = CoreTools.primitiveToString(result);
|
|
1854
|
+
|
|
1855
|
+
for ( CallbackContext callbackContext : _listeners )
|
|
1856
|
+
{
|
|
1857
|
+
PluginResult pluginResult = new PluginResult(Status.OK, jsonString);
|
|
1858
|
+
pluginResult.setKeepCallback(true);
|
|
1859
|
+
callbackContext.sendPluginResult(pluginResult);
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
// GListener
|
|
1773
1864
|
public void eventsOccurred(GSource source, int listener, int events, Object param1, Object param2)
|
|
1774
1865
|
{
|
|
1775
1866
|
GPrimitive result = CoreFactory.createPrimitive(CC.PRIMITIVE_TYPE_OBJECT);
|
|
@@ -1976,6 +2067,11 @@ public class EnRoutePlugin extends CordovaPlugin implements GListener
|
|
|
1976
2067
|
{
|
|
1977
2068
|
pickupManager.addListener(this);
|
|
1978
2069
|
}
|
|
2070
|
+
GDirectionsManager directionsManager = ManagerWrapper.instance().manager().getGlympse().getDirectionsManager();
|
|
2071
|
+
if ( null != directionsManager )
|
|
2072
|
+
{
|
|
2073
|
+
directionsManager.addListener(this);
|
|
2074
|
+
}
|
|
1979
2075
|
}
|
|
1980
2076
|
|
|
1981
2077
|
public void shiftToggleCompleted(boolean onShift, boolean success)
|
|
@@ -17,7 +17,7 @@ android {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
dependencies {
|
|
20
|
-
def GLYMPSE_VERSION = '2.110.
|
|
20
|
+
def GLYMPSE_VERSION = '2.110.304'
|
|
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"
|
package/src/ios/EnRoutePlugin.h
CHANGED
|
@@ -130,6 +130,10 @@
|
|
|
130
130
|
|
|
131
131
|
- (void) setAutoStartTasksAfterAutoCompletion:(CDVInvokedUrlCommand *)command;
|
|
132
132
|
|
|
133
|
+
- (void) setDirectionsAsMetric:(CDVInvokedUrlCommand *)command;
|
|
134
|
+
|
|
135
|
+
- (void) selectTaskForTurnByTurn:(CDVInvokedUrlCommand *)command;
|
|
136
|
+
|
|
133
137
|
- (void) started;
|
|
134
138
|
|
|
135
139
|
@end
|
package/src/ios/EnRoutePlugin.mm
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
|
|
39
39
|
@end
|
|
40
40
|
|
|
41
|
-
@interface EnRoutePlugin () < GETListener >
|
|
41
|
+
@interface EnRoutePlugin () < GETListener, GLYEventListener >
|
|
42
42
|
|
|
43
43
|
@end
|
|
44
44
|
|
|
@@ -1083,6 +1083,67 @@
|
|
|
1083
1083
|
[EnRouteWrapper instance].manager->getTaskManager()->setAutoStartTasksAfterAutoCompletion(enabled);
|
|
1084
1084
|
}
|
|
1085
1085
|
|
|
1086
|
+
- (void) setDirectionsAsMetric:(CDVInvokedUrlCommand *)command
|
|
1087
|
+
{
|
|
1088
|
+
BOOL isMetric = [[command argumentAtIndex:0] boolValue];
|
|
1089
|
+
Glympse::GGlympse glympse = [EnRouteWrapper instance].manager->getGlympse();
|
|
1090
|
+
if ( NULL != glympse )
|
|
1091
|
+
{
|
|
1092
|
+
glympse->getConfig()->setMetricDirections(isMetric);
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
- (void) selectTaskForTurnByTurn:(CDVInvokedUrlCommand *)command
|
|
1097
|
+
{
|
|
1098
|
+
Glympse::int64 taskId = [[command argumentAtIndex:0] longLongValue];
|
|
1099
|
+
|
|
1100
|
+
// Negative number is used to deactivate all turn by turn
|
|
1101
|
+
if (taskId < 0)
|
|
1102
|
+
{
|
|
1103
|
+
[EnRouteWrapper instance].manager->getGlympse()->getDirectionsManager()->selectTicketForTurnByTurn(NULL);
|
|
1104
|
+
return;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
Glympse::EnRoute::GTask task = [EnRouteWrapper instance].manager->getTaskManager()->findTaskById(taskId);
|
|
1108
|
+
if ( NULL != task )
|
|
1109
|
+
{
|
|
1110
|
+
Glympse::EnRoute::GOperation operation = task->getOperation();
|
|
1111
|
+
if ( NULL != operation )
|
|
1112
|
+
{
|
|
1113
|
+
Glympse::GTicket ticket = operation->getTicket();
|
|
1114
|
+
if ( NULL != ticket )
|
|
1115
|
+
{
|
|
1116
|
+
[EnRouteWrapper instance].manager->getGlympse()->getDirectionsManager()->selectTicketForTurnByTurn(ticket);
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
- (void)glympseEvent:(const Glympse::GGlympse&)glympse listener:(int)listener events:(int)events object:(const Glympse::GCommon&)object
|
|
1123
|
+
{
|
|
1124
|
+
Glympse::GPrimitive result = Glympse::CoreFactory::createPrimitive(Glympse::CC::PRIMITIVE_TYPE_OBJECT);
|
|
1125
|
+
result->put([GETHelpers toGString:@"listener"], (Glympse::int64)listener);
|
|
1126
|
+
result->put([GETHelpers toGString:@"events"], (Glympse::int64)events);
|
|
1127
|
+
|
|
1128
|
+
if ( NULL != object )
|
|
1129
|
+
{
|
|
1130
|
+
Glympse::GPrimitive primitive = [self commonObjToPrimitive:object];
|
|
1131
|
+
if ( NULL != primitive )
|
|
1132
|
+
{
|
|
1133
|
+
result->put([GETHelpers toGString:@"param1"], primitive);
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
NSString *jsonString = [NSString stringWithUTF8String:Glympse::CoreTools::primitiveToString(result)->getBytes()];
|
|
1138
|
+
|
|
1139
|
+
for ( NSString *callbackId : _listenerCallbacks )
|
|
1140
|
+
{
|
|
1141
|
+
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:jsonString];
|
|
1142
|
+
[pluginResult setKeepCallback:[NSNumber numberWithBool:YES]];
|
|
1143
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1086
1147
|
- (void)eventsOccurred:(const Glympse::GSource&)source listener:(Glympse::int32)listener events:(Glympse::int32)events param1:(const Glympse::GCommonObj&)param1 param2:(const Glympse::GCommonObj&)param2
|
|
1087
1148
|
{
|
|
1088
1149
|
Glympse::GPrimitive result = Glympse::CoreFactory::createPrimitive(Glympse::CC::PRIMITIVE_TYPE_OBJECT);
|
|
@@ -1266,6 +1327,12 @@
|
|
|
1266
1327
|
{
|
|
1267
1328
|
[GETHelpers subscribe:self onManager:pickupManager];
|
|
1268
1329
|
}
|
|
1330
|
+
|
|
1331
|
+
Glympse::GDirectionsManager directionsManager = [EnRouteWrapper instance].manager->getGlympse()->getDirectionsManager();
|
|
1332
|
+
if ( NULL != directionsManager )
|
|
1333
|
+
{
|
|
1334
|
+
[GLYGlympse subscribe:self onSink:directionsManager];
|
|
1335
|
+
}
|
|
1269
1336
|
}
|
|
1270
1337
|
|
|
1271
1338
|
- (void)shiftToggleCompletedWithOnShift:(bool)onShift success:(bool)success
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
var LISTENER_DIRECTIONS_MANAGER = 35;
|
|
2
|
+
|
|
3
|
+
var DIRECTIONS_MANAGER_ANNOUCEMENT = 0X00000001;
|
|
4
|
+
var DIRECTIONS_MANAGER_OFF_ROUTE = 0X00000002;
|
|
5
|
+
var DIRECTIONS_MANAGER_STEPS_UPDATED = 0X00000004;
|
|
6
|
+
var DIRECTIONS_MANAGER_DISPLAY_UPDATED = 0X00000008;
|
|
7
|
+
|
|
8
|
+
var _listeners = [];
|
|
9
|
+
|
|
10
|
+
var _latestAnnouncement = '';
|
|
11
|
+
var _currentDisplay = {};
|
|
12
|
+
var _noop = function(){};
|
|
13
|
+
|
|
14
|
+
var _nativeListener = function(data){
|
|
15
|
+
var result = JSON.parse(data);
|
|
16
|
+
var idListener = result.listener;
|
|
17
|
+
var events = result.events;
|
|
18
|
+
var param1 = result.param1;
|
|
19
|
+
|
|
20
|
+
if ( LISTENER_DIRECTIONS_MANAGER == idListener )
|
|
21
|
+
{
|
|
22
|
+
if ( 0 !== ( DIRECTIONS_MANAGER_ANNOUCEMENT & events ) ) {
|
|
23
|
+
_latestAnnouncement = param1;
|
|
24
|
+
spreadAnnouncement(param1);
|
|
25
|
+
}
|
|
26
|
+
if ( 0 !== ( DIRECTIONS_MANAGER_DISPLAY_UPDATED & events ) ) {
|
|
27
|
+
_currentDisplay = param1;
|
|
28
|
+
spreadDisplayUpdated(param1);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
function spreadAnnouncement(announcement) {
|
|
34
|
+
spreadEvent('directionsAnnouncement', [announcement]);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function spreadDisplayUpdated(displayData) {
|
|
38
|
+
spreadEvent('directionsDisplayUpdated', [displayData]);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function spreadEvent(event, params) {
|
|
42
|
+
if (_listeners) {
|
|
43
|
+
for (var index = 0; index < _listeners.length; ++index){
|
|
44
|
+
var listener = _listeners[index];
|
|
45
|
+
if ( typeof listener[event] == 'function' )
|
|
46
|
+
{
|
|
47
|
+
listener[event].apply(listener, params);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
module.exports = {
|
|
54
|
+
|
|
55
|
+
init: function(){
|
|
56
|
+
console.log("directionsmanager init");
|
|
57
|
+
Native.registerListener(_nativeListener);
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
addListener: function(listener) {
|
|
61
|
+
if ( !listener )
|
|
62
|
+
{
|
|
63
|
+
console.log('Null listener not supported');
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
var index = _listeners.indexOf(listener);
|
|
68
|
+
if (index > -1)
|
|
69
|
+
{
|
|
70
|
+
console.log('Listener already registered!');
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
_listeners.push(listener);
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
removeListener: function(listener) {
|
|
78
|
+
var index = _listeners.indexOf(listener);
|
|
79
|
+
if (index > -1) {
|
|
80
|
+
_listeners.splice(index, 1);
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
getLatestAnnouncement: function() {
|
|
85
|
+
return _latestAnnouncement;
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
getCurrentDisplay: function() {
|
|
89
|
+
return _currentDisplay;
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
setDirectionsAsMetric: function(isMetric) {
|
|
93
|
+
Native.setDirectionsAsMetric(isMetric, _noop, _noop);
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
selectTaskForTurnByTurn: function(taskId) {
|
|
97
|
+
Native.selectTaskForTurnByTurn(taskId, _noop, _noop);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
};
|
package/www/EnRouteManager.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
var SessionManager = require('./SessionManager');
|
|
3
3
|
var AgentManager = require('./AgentManager');
|
|
4
4
|
var PickupManager = require('./PickupManager');
|
|
5
|
+
var DirectionsManager = require('./DirectionsManager');
|
|
5
6
|
var Agent = require('./Agent');
|
|
6
7
|
var Organization = require('./Organization');
|
|
7
8
|
var LISTENER_ENROUTE_MANAGER = 1;
|
|
@@ -286,6 +287,8 @@
|
|
|
286
287
|
TaskManager.init();
|
|
287
288
|
SessionManager.init();
|
|
288
289
|
PickupManager.init();
|
|
290
|
+
DirectionsManager.init();
|
|
291
|
+
|
|
289
292
|
_initialized = true;
|
|
290
293
|
}
|
|
291
294
|
|
|
@@ -394,6 +397,10 @@
|
|
|
394
397
|
return PickupManager;
|
|
395
398
|
},
|
|
396
399
|
|
|
400
|
+
getDirectionsManager: function() {
|
|
401
|
+
return DirectionsManager;
|
|
402
|
+
},
|
|
403
|
+
|
|
397
404
|
isStarted: function() {
|
|
398
405
|
return _started;
|
|
399
406
|
},
|
package/www/Native.js
CHANGED
|
@@ -240,4 +240,12 @@ module.exports = {
|
|
|
240
240
|
setAutoStartTasksAfterAutoCompletion: function (enabled, successCallback, errorCallback) {
|
|
241
241
|
cordova.exec(successCallback, errorCallback, "EnRoutePlugin", "setAutoStartTasksAfterAutoCompletion", [enabled]);
|
|
242
242
|
},
|
|
243
|
+
|
|
244
|
+
setDirectionsAsMetric: function (isMetric, successCallback, errorCallback) {
|
|
245
|
+
cordova.exec(successCallback, errorCallback, "EnRoutePlugin", "setDirectionsAsMetric", [isMetric]);
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
selectTaskForTurnByTurn: function (taskId, successCallback, errorCallback) {
|
|
249
|
+
cordova.exec(successCallback, errorCallback, "EnRoutePlugin", "selectTaskForTurnByTurn", [taskId]);
|
|
250
|
+
},
|
|
243
251
|
};
|