spotny-sdk 1.0.32 → 1.0.34

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.
@@ -67,7 +67,4 @@ dependencies {
67
67
 
68
68
  // AltBeacon — iBeacon scanning for Android
69
69
  implementation "org.altbeacon:android-beacon-library:2.20.5"
70
-
71
- // Encrypted storage — mirrors iOS Keychain security level
72
- implementation "androidx.security:security-crypto:1.0.0"
73
70
  }
@@ -7,8 +7,6 @@ import android.os.Build
7
7
  import android.os.RemoteException
8
8
  import android.util.Log
9
9
  import androidx.core.app.NotificationCompat
10
- import androidx.security.crypto.EncryptedSharedPreferences
11
- import androidx.security.crypto.MasterKey
12
10
  import com.facebook.react.bridge.*
13
11
  import com.facebook.react.modules.core.DeviceEventManagerModule
14
12
  import org.altbeacon.beacon.*
@@ -171,12 +169,13 @@ class SpotnySdkModule(private val reactContext: ReactApplicationContext) :
171
169
  override fun isScanning(promise: Promise) = promise.resolve(scanning)
172
170
 
173
171
  override fun initialize(config: ReadableMap?, promise: Promise) {
174
- config?.getDouble("maxDetectionDistance").takeIf { config?.hasKey("maxDetectionDistance") == true }
175
- ?.let { maxDetectionDistance = it; Log.d(TAG, "maxDetectionDistance = $it m") }
172
+ if (config?.hasKey("maxDetectionDistance") == true)
173
+ config.getDouble("maxDetectionDistance").let { maxDetectionDistance = it; Log.d(TAG, "maxDetectionDistance = $it m") }
176
174
  config?.getString("apiKey")?.let { apiKey = it; Log.d(TAG, "apiKey = $it") }
177
- config?.getDouble("distanceCorrectionFactor")
178
- .takeIf { config?.hasKey("distanceCorrectionFactor") == true && (it ?: 0.0) > 0 }
179
- ?.let { distanceCorrectionFactor = it; Log.d(TAG, "distanceCorrectionFactor = $it") }
175
+ if (config?.hasKey("distanceCorrectionFactor") == true) {
176
+ val factor = config.getDouble("distanceCorrectionFactor")
177
+ if (factor > 0) { distanceCorrectionFactor = factor; Log.d(TAG, "distanceCorrectionFactor = $factor") }
178
+ }
180
179
  if (config?.hasKey("debug") == true) {
181
180
  debugMode = config.getBoolean("debug")
182
181
  Log.d(TAG, "debugMode = $debugMode")
@@ -451,25 +450,8 @@ class SpotnySdkModule(private val reactContext: ReactApplicationContext) :
451
450
 
452
451
  // ── Helpers ───────────────────────────────────────────────────────────────
453
452
 
454
- /** Returns EncryptedSharedPreferences backed by Android Keystore (AES-256).
455
- * Falls back to plain SharedPreferences on the rare Keystore initialisation failure. */
456
- private fun prefs(): android.content.SharedPreferences {
457
- return try {
458
- val masterKey = MasterKey.Builder(reactContext)
459
- .setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
460
- .build()
461
- EncryptedSharedPreferences.create(
462
- reactContext,
463
- "SpotnySDK_secure",
464
- masterKey,
465
- EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
466
- EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
467
- )
468
- } catch (e: Exception) {
469
- Log.w(TAG, "EncryptedSharedPreferences unavailable, using plain prefs: ${e.message}")
470
- reactContext.getSharedPreferences("SpotnySDK", Context.MODE_PRIVATE)
471
- }
472
- }
453
+ private fun prefs(): android.content.SharedPreferences =
454
+ reactContext.getSharedPreferences("SpotnySDK", Context.MODE_PRIVATE)
473
455
 
474
456
  private fun beaconKey(major: Int, minor: Int) = "${major}_${minor}"
475
457
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spotny-sdk",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "description": "Beacon Scanner",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",