react-native-mytatva-rn-sdk 1.2.81 → 1.2.82
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/src/main/java/com/mytatvarnsdk/activity/ConnectSensorActivity.kt +7 -3
- package/android/src/main/java/com/mytatvarnsdk/model/DiasensSensorsResponse.kt +1 -1
- package/ios/Support/API.swift +6 -1
- package/ios/ViewControllers/ConnectToSensorViewController.swift +2 -2
- package/package.json +1 -1
|
@@ -341,7 +341,11 @@ class ConnectSensorActivity : BaseBleActivity() {
|
|
|
341
341
|
Log.d("ConnectSensor", "Device verification API response: $response")
|
|
342
342
|
|
|
343
343
|
val verificationResponse = Gson().fromJson(response, DeviceVerificationResponse::class.java)
|
|
344
|
-
val code = verificationResponse.code
|
|
344
|
+
val code = when (val rawCode = verificationResponse.code) {
|
|
345
|
+
is Number -> rawCode.toInt()
|
|
346
|
+
is String -> rawCode.toIntOrNull() ?: 0
|
|
347
|
+
else -> 0
|
|
348
|
+
}
|
|
345
349
|
val data = verificationResponse.data
|
|
346
350
|
val msg = verificationResponse.msg
|
|
347
351
|
|
|
@@ -353,9 +357,9 @@ class ConnectSensorActivity : BaseBleActivity() {
|
|
|
353
357
|
Log.d("ConnectSensor", "Device verification successful for sensor: $scannedSensorId")
|
|
354
358
|
bind(device)
|
|
355
359
|
} else if (code == 1 && data == false) {
|
|
356
|
-
// Device verification failed - show
|
|
360
|
+
// Device verification failed - show fixed message in red
|
|
357
361
|
Log.e("ConnectSensor", "Device verification failed: $msg")
|
|
358
|
-
manageDeviceVerificationError(
|
|
362
|
+
manageDeviceVerificationError("Please connect with Diasens sensor")
|
|
359
363
|
} else {
|
|
360
364
|
// code 0 or unexpected - show Try Again
|
|
361
365
|
Log.e("ConnectSensor", "Device verification error, code: $code")
|
package/ios/Support/API.swift
CHANGED
|
@@ -368,7 +368,12 @@ class API {
|
|
|
368
368
|
return
|
|
369
369
|
}
|
|
370
370
|
|
|
371
|
-
|
|
371
|
+
var code = 0
|
|
372
|
+
if let intCode = json["code"] as? Int {
|
|
373
|
+
code = intCode
|
|
374
|
+
} else if let strCode = json["code"] as? String, let parsed = Int(strCode) {
|
|
375
|
+
code = parsed
|
|
376
|
+
}
|
|
372
377
|
let msg = json["msg"] as? String ?? ""
|
|
373
378
|
let dataValue = json["data"] as? Bool ?? false
|
|
374
379
|
|
|
@@ -281,9 +281,9 @@ class ConnectToSensorViewController: UIViewController {
|
|
|
281
281
|
self.viewModel.debouncer.update(with: .connected)
|
|
282
282
|
self.showConfirmInsulinUser()
|
|
283
283
|
} else if code == 1 && dataValue == false {
|
|
284
|
-
// Device verification failed - show
|
|
284
|
+
// Device verification failed - show fixed message in red
|
|
285
285
|
print("Device verification failed: \(msg)")
|
|
286
|
-
self.showDeviceVerificationError(message:
|
|
286
|
+
self.showDeviceVerificationError(message: "Please connect with Diasens sensor")
|
|
287
287
|
} else {
|
|
288
288
|
// code 0 or unexpected - show Try Again
|
|
289
289
|
print("Device verification error, code: \(code)")
|