@@ -17,7 +17,7 @@ import { error } from 'console';
17
17
plugin : 'cordova-plugin-hypertrack-v3' ,
18
18
pluginRef : 'hypertrack' ,
19
19
repo : 'https://github.com/hypertrack/cordova-plugin-hypertrack.git' ,
20
- platforms : [ 'Android' ] ,
20
+ platforms : [ 'Android, iOS ' ] ,
21
21
} )
22
22
@Injectable ( )
23
23
export class HyperTrackPlugin extends IonicNativePlugin {
@@ -26,6 +26,11 @@ export class HyperTrackPlugin extends IonicNativePlugin {
26
26
return ;
27
27
}
28
28
29
+ @Cordova ( )
30
+ getBlockers ( ) : Promise < Set < Blocker > > {
31
+ return ;
32
+ }
33
+
29
34
@Cordova ( )
30
35
enableDebugLogging ( ) : Promise < any > {
31
36
return ;
@@ -59,10 +64,17 @@ interface HyperTrackCordova {
59
64
success : SuccessHandler ,
60
65
error : FailureHandler
61
66
) : void ;
62
- addGeoTag ( geotagData : Object , expectedLocation : Coordinates , success : SuccessHandler , error : FailureHandler ) : void ;
67
+ addGeoTag (
68
+ geotagData : Object ,
69
+ expectedLocation : Coordinates | undefined ,
70
+ success : SuccessHandler ,
71
+ error : FailureHandler
72
+ ) : void ;
63
73
requestPermissionsIfNecessary ( success : SuccessHandler , error : FailureHandler ) : void ;
64
74
allowMockLocations ( success : SuccessHandler , error : FailureHandler ) : void ;
65
75
syncDeviceSettings ( success : SuccessHandler , error : FailureHandler ) : void ;
76
+ start ( success : SuccessHandler , error : FailureHandler ) : void ;
77
+ stop ( success : SuccessHandler , error : FailureHandler ) : void ;
66
78
}
67
79
68
80
export class CoordinatesValidationError extends Error { }
@@ -76,6 +88,18 @@ export class Coordinates {
76
88
}
77
89
}
78
90
91
+ /** A blocker is an obstacle that needs to be resolved to achieve reliable tracking. */
92
+ export interface Blocker {
93
+ /** Recommended name for a user action, that needs to be performed to resolve the blocker. */
94
+ userActionTitle : String ;
95
+ /** Recommended name for a button, that will navigate user to the place where he can resolve the blocker */
96
+ userActionCTA : String ;
97
+ /** User action explanation */
98
+ userActionExplanation : String ;
99
+ /** An action that navigates user to the dedicated settings menu. */
100
+ resolve : ( ) => void ;
101
+ }
102
+
79
103
/**
80
104
* @usage
81
105
* ```typescript
@@ -128,6 +152,15 @@ export class HyperTrack {
128
152
} ) ;
129
153
}
130
154
155
+ /**
156
+ * Get the list of blockers that needs to be resolved for reliable tracking.
157
+ *
158
+ * @see {Blocker}
159
+ */
160
+ static getBlockers ( ) : Promise < Set < Blocker > > {
161
+ return new HyperTrackPlugin ( ) . getBlockers ( ) ;
162
+ }
163
+
131
164
/** Resolves device ID that could be used to identify the device. */
132
165
getDeviceId ( ) : Promise < string > {
133
166
return new Promise ( ( resolve , reject ) => {
@@ -230,5 +263,25 @@ export class HyperTrack {
230
263
} ) ;
231
264
}
232
265
266
+ /** Start tracking. */
267
+ start ( ) : Promise < any > {
268
+ return new Promise ( ( resolve , reject ) => {
269
+ this . cordovaInstanceHandle . start (
270
+ ( ) => resolve ( ) ,
271
+ err => reject ( err )
272
+ ) ;
273
+ } ) ;
274
+ }
275
+
276
+ /** Stop tracking. */
277
+ stop ( ) : Promise < any > {
278
+ return new Promise ( ( resolve , reject ) => {
279
+ this . cordovaInstanceHandle . stop (
280
+ ( ) => resolve ( ) ,
281
+ err => reject ( err )
282
+ ) ;
283
+ } ) ;
284
+ }
285
+
233
286
private constructor ( private cordovaInstanceHandle : HyperTrackCordova ) { }
234
287
}
0 commit comments