@transistorsoft/capacitor-background-geolocation 8.0.0 → 9.0.0

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 (67) hide show
  1. package/Package.swift +10 -16
  2. package/README.md +99 -211
  3. package/TransistorsoftCapacitorBackgroundGeolocation.podspec +7 -5
  4. package/android/build.gradle +16 -54
  5. package/android/src/main/java/com/transistorsoft/bggeo/capacitor/BackgroundGeolocationPlugin.java +132 -70
  6. package/dist/index.js +198 -189
  7. package/dist/index.js.map +1 -1
  8. package/dist/plugin.cjs.js +255 -205
  9. package/dist/plugin.cjs.js.map +1 -1
  10. package/dist/plugin.js +1141 -1092
  11. package/dist/plugin.js.map +1 -1
  12. package/ios/Sources/BackgroundGeolocationPlugin/BackgroundGeolocationPlugin.swift +353 -306
  13. package/package.json +11 -12
  14. package/src/index.d.ts +10 -0
  15. package/android/libs/com/transistorsoft/tslocationmanager/3.7.0/tslocationmanager-3.7.0.aar +0 -0
  16. package/android/libs/com/transistorsoft/tslocationmanager/3.7.0/tslocationmanager-3.7.0.aar.md5 +0 -1
  17. package/android/libs/com/transistorsoft/tslocationmanager/3.7.0/tslocationmanager-3.7.0.aar.sha1 +0 -1
  18. package/android/libs/com/transistorsoft/tslocationmanager/3.7.0/tslocationmanager-3.7.0.aar.sha256 +0 -1
  19. package/android/libs/com/transistorsoft/tslocationmanager/3.7.0/tslocationmanager-3.7.0.aar.sha512 +0 -1
  20. package/android/libs/com/transistorsoft/tslocationmanager/3.7.0/tslocationmanager-3.7.0.pom +0 -9
  21. package/android/libs/com/transistorsoft/tslocationmanager/3.7.0/tslocationmanager-3.7.0.pom.md5 +0 -1
  22. package/android/libs/com/transistorsoft/tslocationmanager/3.7.0/tslocationmanager-3.7.0.pom.sha1 +0 -1
  23. package/android/libs/com/transistorsoft/tslocationmanager/3.7.0/tslocationmanager-3.7.0.pom.sha256 +0 -1
  24. package/android/libs/com/transistorsoft/tslocationmanager/3.7.0/tslocationmanager-3.7.0.pom.sha512 +0 -1
  25. package/android/libs/com/transistorsoft/tslocationmanager/maven-metadata.xml +0 -13
  26. package/android/libs/com/transistorsoft/tslocationmanager-v21/3.7.0/tslocationmanager-v21-3.7.0.aar +0 -0
  27. package/android/libs/com/transistorsoft/tslocationmanager-v21/3.7.0/tslocationmanager-v21-3.7.0.aar.md5 +0 -1
  28. package/android/libs/com/transistorsoft/tslocationmanager-v21/3.7.0/tslocationmanager-v21-3.7.0.aar.sha1 +0 -1
  29. package/android/libs/com/transistorsoft/tslocationmanager-v21/3.7.0/tslocationmanager-v21-3.7.0.aar.sha256 +0 -1
  30. package/android/libs/com/transistorsoft/tslocationmanager-v21/3.7.0/tslocationmanager-v21-3.7.0.aar.sha512 +0 -1
  31. package/android/libs/com/transistorsoft/tslocationmanager-v21/3.7.0/tslocationmanager-v21-3.7.0.pom +0 -9
  32. package/android/libs/com/transistorsoft/tslocationmanager-v21/3.7.0/tslocationmanager-v21-3.7.0.pom.md5 +0 -1
  33. package/android/libs/com/transistorsoft/tslocationmanager-v21/3.7.0/tslocationmanager-v21-3.7.0.pom.sha1 +0 -1
  34. package/android/libs/com/transistorsoft/tslocationmanager-v21/3.7.0/tslocationmanager-v21-3.7.0.pom.sha256 +0 -1
  35. package/android/libs/com/transistorsoft/tslocationmanager-v21/3.7.0/tslocationmanager-v21-3.7.0.pom.sha512 +0 -1
  36. package/android/libs/com/transistorsoft/tslocationmanager-v21/maven-metadata.xml +0 -13
  37. package/dist/Events.js +0 -19
  38. package/dist/Events.js.map +0 -1
  39. package/dist/declarations/BackgroundGeolocation.d.ts +0 -1632
  40. package/dist/declarations/interfaces/Authorization.d.ts +0 -185
  41. package/dist/declarations/interfaces/AuthorizationEvent.d.ts +0 -34
  42. package/dist/declarations/interfaces/Config.d.ts +0 -2474
  43. package/dist/declarations/interfaces/ConnectivityChangeEvent.d.ts +0 -18
  44. package/dist/declarations/interfaces/CurrentPositionRequest.d.ts +0 -45
  45. package/dist/declarations/interfaces/DeviceInfo.d.ts +0 -33
  46. package/dist/declarations/interfaces/DeviceSettings.d.ts +0 -223
  47. package/dist/declarations/interfaces/Geofence.d.ts +0 -319
  48. package/dist/declarations/interfaces/GeofenceEvent.d.ts +0 -35
  49. package/dist/declarations/interfaces/GeofencesChangeEvent.d.ts +0 -22
  50. package/dist/declarations/interfaces/HeartbeatEvent.d.ts +0 -20
  51. package/dist/declarations/interfaces/HttpEvent.d.ts +0 -313
  52. package/dist/declarations/interfaces/Location.d.ts +0 -257
  53. package/dist/declarations/interfaces/LocationAuthorizationAlert.d.ts +0 -41
  54. package/dist/declarations/interfaces/Logger.d.ts +0 -359
  55. package/dist/declarations/interfaces/MotionActivityEvent.d.ts +0 -34
  56. package/dist/declarations/interfaces/MotionChangeEvent.d.ts +0 -15
  57. package/dist/declarations/interfaces/Notification.d.ts +0 -491
  58. package/dist/declarations/interfaces/PermissionRationale.d.ts +0 -31
  59. package/dist/declarations/interfaces/ProviderChangeEvent.d.ts +0 -74
  60. package/dist/declarations/interfaces/SQLQuery.d.ts +0 -60
  61. package/dist/declarations/interfaces/Sensors.d.ts +0 -31
  62. package/dist/declarations/interfaces/State.d.ts +0 -51
  63. package/dist/declarations/interfaces/Subscription.d.ts +0 -104
  64. package/dist/declarations/interfaces/TransistorAuthorizationToken.d.ts +0 -63
  65. package/dist/declarations/interfaces/WatchPositionRequest.d.ts +0 -45
  66. package/dist/declarations/types.d.ts +0 -188
  67. package/dist/index.d.ts +0 -3
@@ -1,185 +0,0 @@
1
- declare module "@transistorsoft/capacitor-background-geolocation" {
2
- /**
3
- * Configures the SDK for authorization wtih your server's [[accessToken]] token (eg: [JSON Web Token](https://jwt.io/)) and automatically requests new tokens when server returns HTTP status `"401 Unauthorized"`.
4
- *
5
- * __Note:__ Only *[JSON Web Token](https://jwt.io/)* (JWT) is currently supported.
6
- *
7
- * The SDK will automatically apply the configured [[accessToken]] to each HTTP request's `Authorization` header, eg:
8
- *
9
- * `"Authorization": "Bearer XXX.YYY.ZZZ"`
10
- *
11
- * When using [[Config.authorization]], you do **not** need to manually configure [[Config.headers]] with the `Authorization` parameter. It is all **automatic**.
12
- *
13
- * If provided with [[refreshUrl]], [[refreshToken]] and [[refreshPayload]], the SDK can automatically re-register for a new token after expiration, such as when an HTTP response `401 Unauthorized` is received.
14
- *
15
- * ## Configuration
16
- *
17
- * @example
18
- * ```typescript
19
- * let myToken = this.getMyAuthorizationToken();
20
- *
21
- * BackgroundGeolocation.onAuthorization((event) => {
22
- * if (event.success) {
23
- * console.log("[authorization] ERROR: ", event.error);
24
- * } else {
25
- * console.log("[authorization] SUCCESS: ", event.response);
26
- * }
27
- * });
28
- *
29
- * BackgroundGeolocation.ready({
30
- * url: "https://app.your.server.com/users/locations",
31
- * autoSync: true,
32
- * authorization: {
33
- * strategy: "JWT",
34
- * accessToken: myToken.accessToken,
35
- * refreshToken: myToken.refreshToken,
36
- * refreshUrl: "https://auth.your.server.com/tokens",
37
- * refreshPayload: {
38
- * the_refresh_token_field_name: "{refreshToken}"
39
- * },
40
- * expires: myToken.expiresAt
41
- * }
42
- * });
43
- * ```
44
- *
45
- * ## Receiving the Response from [[refreshUrl]].
46
- *
47
- * Whenever a response is received from [[refreshUrl]], the SDK will fire the [[BackgroundGeolocation.onAuthorization]] event. Your callback will be provided an [[AuthorizationEvent]]. Check [[AuthorizationEvent.success]]:
48
- * - When successful, [[AuthorizationEvent.response]] will contain the decoded JSON from [[refreshUrl]].
49
- * - When a failure occurs, [[AuthorizationEvent.error]] will contain an error message.
50
- *
51
- * @example
52
- * ```typescript
53
- * BackgroundGeolocation.onAuthorization((event) => {
54
- * if (event.success) {
55
- * console.log("[authorization] ERROR: ", event.error);
56
- * } else {
57
- * console.log("[authorization] SUCCESS: ", event.response);
58
- * }
59
- * });
60
- * ```
61
- */
62
- interface Authorization {
63
- /**
64
- * Authorization strategy. Only [JWT](https://jwt.io/) is supported.
65
- */
66
- strategy:string;
67
- /**
68
- * Authorization token (eg: [JWT](https://jwt.io/)) required for authorization by your server at [[Config.url]].
69
- *
70
- * The SDK will automatically apply the configured `accessToken` to each HTTP request's `Authorization` header, eg:
71
- *
72
- * `"Authorization": "Bearer XXX.YYY.ZZZ"`
73
- *
74
- * You do **not** need to manually configure [[Config.headers]] with the `Authorization` parameter. It is all **automatic**.
75
- */
76
- accessToken:string;
77
- /**
78
- * The token to be POSTed to [[refreshUrl]], encoded into the [[refreshPayload]], when a new [[accessToken]] is required after [[expires]] or when HTTP `401 Unauthorized` is received.
79
- */
80
- refreshToken?:string;
81
- /**
82
- * The url to your authorization server that provides new [[accessToken]] when expired.
83
- *
84
- * When the SDK receives a response the server, it will decode the JSON and recursively iterate through the keys, performing regular expressions and other String-analysis *to "taste"* the data in search of the following 3 items:
85
- *
86
- * 1. "access token"
87
- * 2. "refresh token"
88
- * 3. "expiry time"
89
- *
90
- * The SDK is designed to operate with *any* response data-structure. For example, one authorization server might return a complex response such as:
91
- *
92
- * ```json
93
- * {
94
- * "token": {
95
- * "access_token": "XXX.YYY.ZZZ",
96
- * "expires_at": 3900
97
- * },
98
- * "refresh_token": "smTsfaspfgaadsfgqZerUt0wueflasdfkaxjdfeKIacb"
99
- * }
100
- * ```
101
- *
102
- * While another server might return a flat response, such as:
103
- *
104
- * ```json
105
- * {
106
- * "accessToken": "XXX.YYY.ZZZ",
107
- * "refreshToken": "smTsfaspfgaadsfgqZerUt0wueflasdfkaxjdfeKIacb",
108
- * "expiry": 3900
109
- * }
110
- * ```
111
- *
112
- * When the response from the server is received, the event [[BackgroundGeolocation.onAuthorization]] will be fired, provided with the [[AuthorizationEvent]].
113
- */
114
- refreshUrl?:string;
115
- /**
116
- * Refresh payload will be encoded into the FORM POST to the [[refreshUrl]] when requesting a new [[accessToken]] after expiration.
117
- *
118
- * You *must* provide one field-template which will represent your "refresh token" using the value: __`{refreshToken}`__. The SDK will
119
- * _automatically_ replace this simple template with the configured [[refreshToken]].
120
- *
121
- * @example
122
- *
123
- * ```typescript
124
- * BackgroundGeolocation.ready({
125
- * authorization: {
126
- * strategy: "JWT",
127
- * accessToken: "XXX.YYY.ZZZ",
128
- * refreshUrl: "https://auth.your.server.com/tokens",
129
- * refreshToken: "smTsfaspfgaadsfgqZerUt0wueflasdfkaxjdfeKIacb",
130
- * refreshPayload: {
131
- * my_refresh_token: "{refreshToken}",
132
- * grant_type: "refresh_token",
133
- * foo: "another arbitrary field"
134
- * }
135
- * }
136
- * });
137
- * ```
138
- *
139
- * with the configuration above, a **`curl`** representation of the SDK's FORM POST, might look like this:
140
- * ```bash
141
- * $ curl -X POST \
142
- * -F 'my_refresh_token=smTsfaspfgaadsfgqZerUt0wueflasdfkaxjdfeKIacb' \
143
- * -F 'grant_type=refresh_token' \
144
- * -F 'foo=another arbitrary field' \
145
- * https://auth.your.server.com/tokens
146
- * ```
147
- *
148
- */
149
- refreshPayload?:any;
150
- /**
151
- * Optional headers applied on requests to [[refreshUrl]]
152
- * Defaults to: `{"Authorization": "Bearer {accessToken}"}`
153
- *
154
- * The template variable `{accessToken}` will automatically be replaced with your app's current auth token.
155
- *
156
- * If you do not want *any* headers applied on requests to {refreshUrl}, provide an empty `{}`.
157
- *
158
- * ## Example
159
- *
160
- * ```typescript
161
- * BackgroundGeolocation.ready({
162
- * authorization: {
163
- * accessToken: "XXX.YYY.ZZZ",
164
- * refreshUrl: "https://auth.domain.com/tokens",
165
- * refreshToken: "smTsfaspfgaadsfgqZerUt0wueflasdfkaxjdfeKIacb",
166
- * refreshPayload: {
167
- * "my_refresh_token": "{refreshToken}", // <-- replaced with configured refreshToken above.
168
- * "grant_type": "refresh_token", // <-- arbitrary fields required by your auth server
169
- * "foo": "another arbitrary field"
170
- * },
171
- * refreshHeaders: {} // <-- Empty {} to provide no refreshHeaders.
172
- * )
173
- * ));
174
- * ```
175
- *
176
- */
177
- refreshHeaders?:any;
178
-
179
- /**
180
- * Token expiry time in seconds.
181
- */
182
- expires?:number;
183
- }
184
- }
185
-
@@ -1,34 +0,0 @@
1
- declare module "@transistorsoft/capacitor-background-geolocation" {
2
- /**
3
- * The event-object provided to [[BackgroundGeolocation.onAuthorization]]
4
- *
5
- * @example
6
- * ```typescript
7
- * BackgroundGeolocation.onAuthorization(authorizationEvent => {
8
- * if (authorizationEvent.success) {
9
- * console.log("[authorization] SUCCESS: ", authorizationEvent.response);
10
- * else {
11
- * console.log("[authorization] FAILURE: ", authorizationEvent.error);
12
- * }
13
- * });
14
- * ```
15
- */
16
- interface AuthorizationEvent {
17
- /**
18
- * HTTP Status returned from your [[Authorization.refreshUrl]] (or `0` if the HTTP request failed).
19
- */
20
- status:number;
21
- /**
22
- * `true` when an authorization request to [[Authorization.refreshUrl]] was successful.
23
- */
24
- success: boolean;
25
- /**
26
- * When [[success]] is `false`, this is the error message from [[Authorization.refreshUrl]]. Otherwise, `null`.
27
- */
28
- error: string;
29
- /**
30
- * when [[success]] is `true`, this is the decoded JSON response returned from [[Authorization.refreshUrl]]. Otherwise, `null`.
31
- */
32
- response:any;
33
- }
34
- }