spotny-sdk 1.0.14 → 1.0.16

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.
@@ -59,7 +59,7 @@ public class SpotnyBeaconScanner: NSObject {
59
59
  private var maxDetectionDistance: Double = 8.0
60
60
  /// Multiplier applied to raw RSSI-derived distance to compensate for low TX power.
61
61
  /// Overridable via configure(). Default 0.5 matches Kontakt.io -12 dBm beacons.
62
- private var distanceCorrectionFactor: Double = 0.5
62
+ private var distanceCorrectionFactor: Double = 1.0
63
63
  /// API key identifying the SDK consumer (e.g. "nike"). Set during initialize().
64
64
  private var apiKey: String?
65
65
  /// JWT returned by /api/app/sdk/verify. Injected as Authorization header on all subsequent calls.
@@ -150,6 +150,10 @@ public class SpotnyBeaconScanner: NSObject {
150
150
  sdkTokenExpiry = Date(timeIntervalSince1970: expTs)
151
151
  }
152
152
  print("🔄 SpotnySDK: Resuming session (device: \(getDeviceId()))")
153
+ let resumeStatus = locationManager.authorizationStatus
154
+ if resumeStatus == .notDetermined || resumeStatus == .authorizedWhenInUse {
155
+ locationManager.requestAlwaysAuthorization()
156
+ }
153
157
  startPersistentScanning()
154
158
  scanning = true
155
159
  }
@@ -167,6 +171,11 @@ public class SpotnyBeaconScanner: NSObject {
167
171
  withResolve resolve: @escaping (Any?) -> Void,
168
172
  reject: @escaping (String?, String?, Error?) -> Void
169
173
  ) {
174
+ let status = locationManager.authorizationStatus
175
+ if status == .notDetermined || status == .authorizedWhenInUse {
176
+ locationManager.requestAlwaysAuthorization()
177
+ }
178
+
170
179
  if scanning {
171
180
  resolve("Already scanning")
172
181
  return
@@ -176,11 +185,6 @@ public class SpotnyBeaconScanner: NSObject {
176
185
  UserDefaults.standard.synchronize()
177
186
  keychainWrite(key: "SpotnySDK_sessionActive", value: "1")
178
187
 
179
- let status = locationManager.authorizationStatus
180
- if status == .notDetermined {
181
- locationManager.requestAlwaysAuthorization()
182
- }
183
-
184
188
  startPersistentScanning()
185
189
  scanning = true
186
190
  print("✅ SpotnySDK: Started scanning (device: \(getDeviceId()))")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spotny-sdk",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "Beacon Scanner",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",