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.
package/android/build.gradle
CHANGED
|
@@ -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
|
-
|
|
175
|
-
|
|
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?.
|
|
178
|
-
|
|
179
|
-
|
|
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
|
-
|
|
455
|
-
|
|
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
|
|