@transistorsoft/capacitor-background-geolocation 4.9.3 → 4.9.5

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 (80) hide show
  1. package/android/build.gradle +2 -2
  2. package/android/libs/com/transistorsoft/tslocationmanager/{3.2.8/tslocationmanager-3.2.8.aar → 3.2.10/tslocationmanager-3.2.10.aar} +0 -0
  3. package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.aar.md5 +1 -0
  4. package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.aar.sha1 +1 -0
  5. package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.aar.sha256 +1 -0
  6. package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.aar.sha512 +1 -0
  7. package/android/libs/com/transistorsoft/tslocationmanager/{3.2.8/tslocationmanager-3.2.8.pom → 3.2.10/tslocationmanager-3.2.10.pom} +1 -1
  8. package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.pom.md5 +1 -0
  9. package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.pom.sha1 +1 -0
  10. package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.pom.sha256 +1 -0
  11. package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.pom.sha512 +1 -0
  12. package/android/libs/com/transistorsoft/tslocationmanager/maven-metadata.xml +5 -3
  13. package/android/libs/com/transistorsoft/tslocationmanager-reverse/{3.2.8/tslocationmanager-reverse-3.2.8.aar → 3.2.10/tslocationmanager-reverse-3.2.10.aar} +0 -0
  14. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.aar.md5 +1 -0
  15. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.aar.sha1 +1 -0
  16. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.aar.sha256 +1 -0
  17. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.aar.sha512 +1 -0
  18. package/android/libs/com/transistorsoft/tslocationmanager-reverse/{3.2.8/tslocationmanager-reverse-3.2.8.pom → 3.2.10/tslocationmanager-reverse-3.2.10.pom} +1 -1
  19. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.pom.md5 +1 -0
  20. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.pom.sha1 +1 -0
  21. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.pom.sha256 +1 -0
  22. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.pom.sha512 +1 -0
  23. package/android/libs/com/transistorsoft/tslocationmanager-reverse/maven-metadata.xml +5 -3
  24. package/dist/declarations/interfaces/Authorization.d.ts +2 -1
  25. package/dist/declarations/interfaces/Location.d.ts +25 -1
  26. package/dist/declarations/interfaces/MotionActivityEvent.d.ts +5 -2
  27. package/dist/declarations/types.d.ts +17 -1
  28. package/ios/TSLocationManager.xcframework/Info.plist +6 -6
  29. package/ios/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Info.plist +0 -0
  30. package/ios/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/TSLocationManager +0 -0
  31. package/ios/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Info.plist +0 -0
  32. package/ios/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/TSLocationManager +0 -0
  33. package/ios/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/_CodeSignature/CodeDirectory +0 -0
  34. package/ios/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/_CodeSignature/CodeRequirements-1 +0 -0
  35. package/ios/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/_CodeSignature/CodeResources +1 -1
  36. package/ios/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Resources/Info.plist +2 -2
  37. package/ios/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/TSLocationManager +0 -0
  38. package/package.json +1 -1
  39. package/android/libs/com/transistorsoft/tslocationmanager/3.2.8/tslocationmanager-3.2.8.aar.md5 +0 -1
  40. package/android/libs/com/transistorsoft/tslocationmanager/3.2.8/tslocationmanager-3.2.8.aar.sha1 +0 -1
  41. package/android/libs/com/transistorsoft/tslocationmanager/3.2.8/tslocationmanager-3.2.8.aar.sha256 +0 -1
  42. package/android/libs/com/transistorsoft/tslocationmanager/3.2.8/tslocationmanager-3.2.8.aar.sha512 +0 -1
  43. package/android/libs/com/transistorsoft/tslocationmanager/3.2.8/tslocationmanager-3.2.8.pom.md5 +0 -1
  44. package/android/libs/com/transistorsoft/tslocationmanager/3.2.8/tslocationmanager-3.2.8.pom.sha1 +0 -1
  45. package/android/libs/com/transistorsoft/tslocationmanager/3.2.8/tslocationmanager-3.2.8.pom.sha256 +0 -1
  46. package/android/libs/com/transistorsoft/tslocationmanager/3.2.8/tslocationmanager-3.2.8.pom.sha512 +0 -1
  47. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.8/tslocationmanager-reverse-3.2.8.aar.md5 +0 -1
  48. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.8/tslocationmanager-reverse-3.2.8.aar.sha1 +0 -1
  49. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.8/tslocationmanager-reverse-3.2.8.aar.sha256 +0 -1
  50. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.8/tslocationmanager-reverse-3.2.8.aar.sha512 +0 -1
  51. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.8/tslocationmanager-reverse-3.2.8.pom.md5 +0 -1
  52. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.8/tslocationmanager-reverse-3.2.8.pom.sha1 +0 -1
  53. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.8/tslocationmanager-reverse-3.2.8.pom.sha256 +0 -1
  54. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.8/tslocationmanager-reverse-3.2.8.pom.sha512 +0 -1
  55. package/dist/declarations/Authorization.d.ts +0 -184
  56. package/dist/declarations/AuthorizationEvent.d.ts +0 -30
  57. package/dist/declarations/Config.d.ts +0 -2457
  58. package/dist/declarations/ConnectivityChangeEvent.d.ts +0 -18
  59. package/dist/declarations/CurrentPositionRequest.d.ts +0 -45
  60. package/dist/declarations/DeviceInfo.d.ts +0 -33
  61. package/dist/declarations/DeviceSettings.d.ts +0 -223
  62. package/dist/declarations/Geofence.d.ts +0 -255
  63. package/dist/declarations/GeofenceEvent.d.ts +0 -30
  64. package/dist/declarations/GeofencesChangeEvent.d.ts +0 -22
  65. package/dist/declarations/HeartbeatEvent.d.ts +0 -20
  66. package/dist/declarations/HttpEvent.d.ts +0 -313
  67. package/dist/declarations/Location.d.ts +0 -225
  68. package/dist/declarations/LocationAuthorizationAlert.d.ts +0 -41
  69. package/dist/declarations/Logger.d.ts +0 -359
  70. package/dist/declarations/MotionActivityEvent.d.ts +0 -31
  71. package/dist/declarations/MotionChangeEvent.d.ts +0 -15
  72. package/dist/declarations/Notification.d.ts +0 -491
  73. package/dist/declarations/PermissionRationale.d.ts +0 -31
  74. package/dist/declarations/ProviderChangeEvent.d.ts +0 -74
  75. package/dist/declarations/SQLQuery.d.ts +0 -60
  76. package/dist/declarations/Sensors.d.ts +0 -31
  77. package/dist/declarations/State.d.ts +0 -51
  78. package/dist/declarations/Subscription.d.ts +0 -104
  79. package/dist/declarations/TransistorAuthorizationToken.d.ts +0 -63
  80. package/dist/declarations/WatchPositionRequest.d.ts +0 -45
@@ -99,8 +99,8 @@ dependencies {
99
99
  implementation "com.google.android.gms:play-services-location:$playServicesLocationVersion"
100
100
  api "org.greenrobot:eventbus:$eventBusVersion"
101
101
  api "com.squareup.okhttp3:okhttp:$okHttpVersion"
102
- implementation 'org.slf4j:slf4j-api:1.7.25'
103
- implementation 'com.github.tony19:logback-android:2.0.0'
102
+ implementation 'org.slf4j:slf4j-api:1.7.36'
103
+ implementation 'com.github.tony19:logback-android:2.0.1'
104
104
  implementation "io.github.nishkarsh:android-permissions:$androidPermissionsVersion"
105
105
  // LifeCycleObserver
106
106
  implementation "androidx.lifecycle:lifecycle-runtime:$lifeCycleRuntimeVersion"
@@ -0,0 +1 @@
1
+ 077830f87774dd0e5a0adb5748621de6ab86883f
@@ -0,0 +1 @@
1
+ 10174adfe8662f9c7bac8eb575515eb8485848d1851d7186db3aae06c63d91ad
@@ -0,0 +1 @@
1
+ 7a61c6536ecb5f4a103b5eeaa3b411b4bb5d596e3044302c9623227a7091104f1daf2d48676695a0015b3053787378562840eca2135a98f594d3da5f305da959
@@ -4,6 +4,6 @@
4
4
  <modelVersion>4.0.0</modelVersion>
5
5
  <groupId>com.transistorsoft</groupId>
6
6
  <artifactId>tslocationmanager</artifactId>
7
- <version>3.2.8</version>
7
+ <version>3.2.10</version>
8
8
  <packaging>aar</packaging>
9
9
  </project>
@@ -0,0 +1 @@
1
+ 9a11922ab398d24e5484e9fb094eaa580b2e182b
@@ -0,0 +1 @@
1
+ d3778894c34d3707ea0e5e49384931ae4d550d807c6642049d2d09a3a50d91f8
@@ -0,0 +1 @@
1
+ 6bec4e3658451aaa08ce95ec4fdd1f6f2fa74e2910206e1b2fa3b70b5f2b97c102e576bee672aa51c576fc9120e0c88a97d00660061757c30a6c6cd92344ec4d
@@ -3,13 +3,15 @@
3
3
  <groupId>com.transistorsoft</groupId>
4
4
  <artifactId>tslocationmanager</artifactId>
5
5
  <versioning>
6
- <latest>3.2.8</latest>
7
- <release>3.2.8</release>
6
+ <latest>3.2.10</latest>
7
+ <release>3.2.10</release>
8
8
  <versions>
9
9
  <version>3.2.6</version>
10
10
  <version>3.2.7</version>
11
11
  <version>3.2.8</version>
12
+ <version>3.2.9</version>
13
+ <version>3.2.10</version>
12
14
  </versions>
13
- <lastUpdated>20221027170027</lastUpdated>
15
+ <lastUpdated>20221220164543</lastUpdated>
14
16
  </versioning>
15
17
  </metadata>
@@ -0,0 +1 @@
1
+ a8a06fdc6ac4942cb284b70611fcb6b112e7979744ab7317dbeac38dc702ca0f
@@ -0,0 +1 @@
1
+ cd81a3a31c5ef4e769afe5a7bd1fd3cde17cc0dd73222d2d643faf16287fe1245dd190504e8fdead00a5be2b9b194963f4bd46873df5c18a4b161aa888460504
@@ -4,6 +4,6 @@
4
4
  <modelVersion>4.0.0</modelVersion>
5
5
  <groupId>com.transistorsoft</groupId>
6
6
  <artifactId>tslocationmanager-reverse</artifactId>
7
- <version>3.2.8</version>
7
+ <version>3.2.10</version>
8
8
  <packaging>aar</packaging>
9
9
  </project>
@@ -0,0 +1 @@
1
+ 7dfd0ff571618895a18de13d556a367a5ceaf2f7de525f29ec3c0fcc9b092e59
@@ -0,0 +1 @@
1
+ 642475d3434e300c033809a5e934c5c876f5d4ea79472dc98c591390040ced8d2ba22cd261ac23cda990a99cffcbddb369afb3a9baf27bcf3ebb9bd09698b201
@@ -3,13 +3,15 @@
3
3
  <groupId>com.transistorsoft</groupId>
4
4
  <artifactId>tslocationmanager-reverse</artifactId>
5
5
  <versioning>
6
- <latest>3.2.8</latest>
7
- <release>3.2.8</release>
6
+ <latest>3.2.10</latest>
7
+ <release>3.2.10</release>
8
8
  <versions>
9
9
  <version>3.2.6</version>
10
10
  <version>3.2.7</version>
11
11
  <version>3.2.8</version>
12
+ <version>3.2.9</version>
13
+ <version>3.2.10</version>
12
14
  </versions>
13
- <lastUpdated>20221027170027</lastUpdated>
15
+ <lastUpdated>20221220164543</lastUpdated>
14
16
  </versioning>
15
17
  </metadata>
@@ -32,7 +32,7 @@ declare module "@transistorsoft/capacitor-background-geolocation" {
32
32
  * authorization: {
33
33
  * strategy: "JWT",
34
34
  * accessToken: myToken.accessToken,
35
- * refreshToken: myToken.refreshToken
35
+ * refreshToken: myToken.refreshToken,
36
36
  * refreshUrl: "https://auth.your.server.com/tokens",
37
37
  * refreshPayload: {
38
38
  * the_refresh_token_field_name: "{refreshToken}"
@@ -157,6 +157,7 @@ declare module "@transistorsoft/capacitor-background-geolocation" {
157
157
  *
158
158
  * ## Example
159
159
  *
160
+ * ```typescript
160
161
  * BackgroundGeolocation.ready({
161
162
  * authorization: {
162
163
  * accessToken: "XXX.YYY.ZZZ",
@@ -92,6 +92,30 @@ declare module "@transistorsoft/capacitor-background-geolocation" {
92
92
  level: number;
93
93
  }
94
94
 
95
+ /**
96
+ * The last known motion-activity when this location was recorded.
97
+ */
98
+ interface MotionActivity {
99
+ /**
100
+ * The reported device motion activity.
101
+ *
102
+ * | Activity Name |
103
+ * |----------------|
104
+ * | `still` |
105
+ * | `walking` |
106
+ * | `on_foot` |
107
+ * | `running` |
108
+ * | `on_bicycle` |
109
+ * | `in_vehicle` |
110
+ * | `unknown` |
111
+ */
112
+ type: MotionActivityType;
113
+ /**
114
+ * Confidence of the reported device motion activity in %.
115
+ */
116
+ confidence: number;
117
+ }
118
+
95
119
  /**
96
120
  * ## Javascript Callback Schema
97
121
  * @example
@@ -216,7 +240,7 @@ declare module "@transistorsoft/capacitor-background-geolocation" {
216
240
  /**
217
241
  * Device motion-activity when this location was recorded (eg: `still`, `on_foot`, `in_vehicle`).
218
242
  */
219
- activity: MotionActivityEvent;
243
+ activity: MotionActivity;
220
244
  /**
221
245
  * If this location was recorded due to [[ProviderChangeEvent]], this is a reference to the location-provider state.
222
246
  */
@@ -1,6 +1,8 @@
1
+ /// <reference path="../types.d.ts" />
2
+
1
3
  declare module "@transistorsoft/capacitor-background-geolocation" {
2
4
  /**
3
- * The event-object provided to [[BackgroundGeolocation.onActivityChange]]. Also attached to each recorded [[Location]].
5
+ * The event-object provided to [[BackgroundGeolocation.onActivityChange]].
4
6
  *
5
7
  * @example
6
8
  * ```typescript
@@ -21,8 +23,9 @@ declare module "@transistorsoft/capacitor-background-geolocation" {
21
23
  * | `running` |
22
24
  * | `on_bicycle` |
23
25
  * | `in_vehicle` |
26
+ * | `unknown` |
24
27
  */
25
- activity: string;
28
+ activity: MotionActivityType;
26
29
  /**
27
30
  * Confidence of the reported device motion activity in %.
28
31
  */
@@ -109,7 +109,7 @@ declare module "@transistorsoft/capacitor-background-geolocation" {
109
109
  * | [[AUTHORIZATION_STATUS_RESTRICTED]] | iOS only |
110
110
  * | [[AUTHORIZATION_STATUS_DENIED]] | iOS & Android |
111
111
  * | [[AUTHORIZATION_STATUS_ALWAYS]] | iOS & Android |
112
- * | [[AUTHORIZATION_STATUS_WHEN_IN_USE]] | iOS only |
112
+ * | [[AUTHORIZATION_STATUS_WHEN_IN_USE]] | iOS & Android 10+ |
113
113
  */
114
114
  type AuthorizationStatus = 0 | 1 | 2 | 3 | 4;
115
115
 
@@ -168,4 +168,20 @@ declare module "@transistorsoft/capacitor-background-geolocation" {
168
168
  */
169
169
  type SQLQueryOrder = -1 | 1;
170
170
 
171
+ /**
172
+ * List of valid Motion-activity types
173
+ *
174
+ * | Activity Name |
175
+ * |----------------|
176
+ * | `still` |
177
+ * | `walking` |
178
+ * | `on_foot` |
179
+ * | `running` |
180
+ * | `on_bicycle` |
181
+ * | `in_vehicle` |
182
+ * | `unknown` |
183
+ *
184
+ * - See [[onActivityChange]] and [[Location.activity]].
185
+ */
186
+ type MotionActivityType = "unknown" | "still" | "walking" | "on_foot" | "running" | "on_bicycle" | "in_vehicle";
171
187
  }
@@ -6,31 +6,31 @@
6
6
  <array>
7
7
  <dict>
8
8
  <key>LibraryIdentifier</key>
9
- <string>ios-arm64_armv7</string>
9
+ <string>ios-arm64_x86_64-maccatalyst</string>
10
10
  <key>LibraryPath</key>
11
11
  <string>TSLocationManager.framework</string>
12
12
  <key>SupportedArchitectures</key>
13
13
  <array>
14
14
  <string>arm64</string>
15
- <string>armv7</string>
15
+ <string>x86_64</string>
16
16
  </array>
17
17
  <key>SupportedPlatform</key>
18
18
  <string>ios</string>
19
+ <key>SupportedPlatformVariant</key>
20
+ <string>maccatalyst</string>
19
21
  </dict>
20
22
  <dict>
21
23
  <key>LibraryIdentifier</key>
22
- <string>ios-arm64_x86_64-maccatalyst</string>
24
+ <string>ios-arm64_armv7</string>
23
25
  <key>LibraryPath</key>
24
26
  <string>TSLocationManager.framework</string>
25
27
  <key>SupportedArchitectures</key>
26
28
  <array>
27
29
  <string>arm64</string>
28
- <string>x86_64</string>
30
+ <string>armv7</string>
29
31
  </array>
30
32
  <key>SupportedPlatform</key>
31
33
  <string>ios</string>
32
- <key>SupportedPlatformVariant</key>
33
- <string>maccatalyst</string>
34
34
  </dict>
35
35
  <dict>
36
36
  <key>LibraryIdentifier</key>
@@ -138,7 +138,7 @@
138
138
  </data>
139
139
  <key>Info.plist</key>
140
140
  <data>
141
- s5vsrtTl12zwWaO61fpcxIwNozw=
141
+ ao8MpL4pZ1Tp7lSNiXrn30ILFdc=
142
142
  </data>
143
143
  <key>Modules/module.modulemap</key>
144
144
  <data>
@@ -17,13 +17,13 @@
17
17
  <key>CFBundlePackageType</key>
18
18
  <string>FMWK</string>
19
19
  <key>CFBundleShortVersionString</key>
20
- <string>4.1.5</string>
20
+ <string>4.1.6</string>
21
21
  <key>CFBundleSupportedPlatforms</key>
22
22
  <array>
23
23
  <string>MacOSX</string>
24
24
  </array>
25
25
  <key>CFBundleVersion</key>
26
- <string>387</string>
26
+ <string>388</string>
27
27
  <key>DTCompiler</key>
28
28
  <string>com.apple.compilers.llvm.clang.1_0</string>
29
29
  <key>DTPlatformBuild</key>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transistorsoft/capacitor-background-geolocation",
3
- "version": "4.9.3",
3
+ "version": "4.9.5",
4
4
  "description": "The most sophisticated cross platform Capacitor background location tracking & geofencing module with battery-conscious motion-detection intelligence",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/index.js",
@@ -1 +0,0 @@
1
- 4eba8ed56e085ea64ccab00c870e759441c09d20
@@ -1 +0,0 @@
1
- a34af4712935d743ace7e5d0a222763e2d45987cafdafb8827f20a6586d38624
@@ -1 +0,0 @@
1
- ceba98fe8ce96766b058e9d9d164aec47f8efe2fa164f98fa2fdaadf771fde55c73f103e6b96dca7e256d39e03d1f88861a0565a0ff6f1a10c71d3ebc3c41545
@@ -1 +0,0 @@
1
- a425b56663080c21d4a6057132f0cd3e361aeb28
@@ -1 +0,0 @@
1
- 4352c2c9986eef674d0f02c62aed7e14d72cd2aed35060f6399694e16872869f
@@ -1 +0,0 @@
1
- 72723742d69fd8fb35e8d1af62b8f5e6f99c8491a109a8875938d431b9db087868ff399ccd234e83a1ace8ea44c6c1add12577715b09b294e1fa3d601307b9aa
@@ -1 +0,0 @@
1
- b0f4e296a0570ef37537db956c2a45927ba0e279dbf8480398d3a71c567afed5
@@ -1 +0,0 @@
1
- 811f89c757451aeb02921d089642f0446f38f5d5174eb1205eb17e571fca9b873da075910e6f838601eca6fc22c927df822b6fdd437ed66b8efa2c882f738423
@@ -1 +0,0 @@
1
- 1f33a98dedc77d1a215e1c44226c5c45cf83d3208cfff86fa34fb4358fcf6b74
@@ -1 +0,0 @@
1
- 914bb641fb6afa6d6b57a3cc92b3eddc53d0f47dcd18cde2663a87fd542dfa5bfacc8a058ef164879c8380202e5a5830e2e9c358636bdd33030d37a641c60b09
@@ -1,184 +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
- * BackgroundGeolocation.ready({
161
- * authorization: {
162
- * accessToken: "XXX.YYY.ZZZ",
163
- * refreshUrl: "https://auth.domain.com/tokens",
164
- * refreshToken: "smTsfaspfgaadsfgqZerUt0wueflasdfkaxjdfeKIacb",
165
- * refreshPayload: {
166
- * "my_refresh_token": "{refreshToken}", // <-- replaced with configured refreshToken above.
167
- * "grant_type": "refresh_token", // <-- arbitrary fields required by your auth server
168
- * "foo": "another arbitrary field"
169
- * },
170
- * refreshHeaders: {} // <-- Empty {} to provide no refreshHeaders.
171
- * )
172
- * ));
173
- * ```
174
- *
175
- */
176
- refreshHeaders?:any;
177
-
178
- /**
179
- * Token expiry time in seconds.
180
- */
181
- expires?:number;
182
- }
183
- }
184
-
@@ -1,30 +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
- * `true` when an authorization request to [[Authorization.refreshUrl]] was successful.
19
- */
20
- success: boolean;
21
- /**
22
- * When [[success]] is `false`, this is the error message from [[Authorization.refreshUrl]]. Otherwise, `null`.
23
- */
24
- error: string;
25
- /**
26
- * when [[success]] is `true`, this is the decoded JSON response returned from [[Authorization.refreshUrl]]. Otherwise, `null`.
27
- */
28
- response:any;
29
- }
30
- }