react-native-mytatva-rn-sdk 1.2.82 → 1.2.84
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 +17 -7
- package/android/src/main/java/com/mytatvarnsdk/network/AuthenticateSDKService.kt +1 -1
- package/ios/Support/API.swift +1 -1
- package/ios/ViewControllers/ConnectToSensorViewController.swift +25 -3
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ import android.content.pm.PackageManager
|
|
|
9
9
|
import android.graphics.Color
|
|
10
10
|
import android.os.Bundle
|
|
11
11
|
import android.util.Log
|
|
12
|
+
import android.util.TypedValue
|
|
12
13
|
import android.view.Gravity
|
|
13
14
|
import android.view.View
|
|
14
15
|
import android.view.ViewGroup
|
|
@@ -144,6 +145,11 @@ class ConnectSensorActivity : BaseBleActivity() {
|
|
|
144
145
|
|
|
145
146
|
Glide.with(this).asGif().load(R.drawable.warning).into(binding.ivGif)
|
|
146
147
|
|
|
148
|
+
// Restore original text size (24sp) for non-validation API errors
|
|
149
|
+
binding.tvFailTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 24f)
|
|
150
|
+
binding.tvFailTitle.text = "Unable to detect sensor"
|
|
151
|
+
binding.tvFailTitle.setTextColor(Color.parseColor("#101828"))
|
|
152
|
+
|
|
147
153
|
binding.btnSupport.tvProceed.text = "Contact Support"
|
|
148
154
|
binding.btnRetry.tvProceed.text = "Retry"
|
|
149
155
|
|
|
@@ -301,7 +307,7 @@ class ConnectSensorActivity : BaseBleActivity() {
|
|
|
301
307
|
validateDiasensSensor(device)
|
|
302
308
|
} else {
|
|
303
309
|
// Non-Diasens user - proceed directly
|
|
304
|
-
|
|
310
|
+
bind(device)
|
|
305
311
|
}
|
|
306
312
|
}
|
|
307
313
|
}
|
|
@@ -357,9 +363,10 @@ class ConnectSensorActivity : BaseBleActivity() {
|
|
|
357
363
|
Log.d("ConnectSensor", "Device verification successful for sensor: $scannedSensorId")
|
|
358
364
|
bind(device)
|
|
359
365
|
} else if (code == 1 && data == false) {
|
|
360
|
-
// Device verification failed - show
|
|
366
|
+
// Device verification failed - show API msg in red (with fallback)
|
|
361
367
|
Log.e("ConnectSensor", "Device verification failed: $msg")
|
|
362
|
-
|
|
368
|
+
val errorMessage = if (msg.isNotEmpty()) msg else "This is not a Diasens CGM sensor. Please connect a Diasens sensor to continue."
|
|
369
|
+
manageDeviceVerificationError(errorMessage)
|
|
363
370
|
} else {
|
|
364
371
|
// code 0 or unexpected - show Try Again
|
|
365
372
|
Log.e("ConnectSensor", "Device verification error, code: $code")
|
|
@@ -424,10 +431,13 @@ class ConnectSensorActivity : BaseBleActivity() {
|
|
|
424
431
|
}
|
|
425
432
|
}
|
|
426
433
|
|
|
427
|
-
//
|
|
428
|
-
binding.
|
|
429
|
-
binding.
|
|
430
|
-
|
|
434
|
+
// Replace "Unable to detect sensor" title with the error message in RED
|
|
435
|
+
binding.tvFailTitle.text = message
|
|
436
|
+
binding.tvFailTitle.setTextColor(Color.RED)
|
|
437
|
+
// Set text size to 16sp (same as iOS) for validation API error message
|
|
438
|
+
binding.tvFailTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16f)
|
|
439
|
+
binding.tvFailInstructions.visibility = View.GONE
|
|
440
|
+
binding.tvReason.visibility = View.GONE
|
|
431
441
|
|
|
432
442
|
val jsonObject = JSONObject()
|
|
433
443
|
jsonObject.put("error_description", message)
|
|
@@ -253,7 +253,7 @@ class AuthenticateSDKService(val scope: CoroutineScope) {
|
|
|
253
253
|
)
|
|
254
254
|
|
|
255
255
|
val baseUrl = if (environment == TATVA_ENVIRONMENT.PROD) PROD_BASE_URL else STAGE_BASE_URL
|
|
256
|
-
val url = "$baseUrl/device-verification?deviceId=$sensorId&deviceType=CGM"
|
|
256
|
+
val url = "$baseUrl/helper/device-verification?deviceId=$sensorId&deviceType=CGM&vendor=diasens"
|
|
257
257
|
|
|
258
258
|
Log.d("API Response", "Device Verification URL: $url")
|
|
259
259
|
|
package/ios/Support/API.swift
CHANGED
|
@@ -322,7 +322,7 @@ class API {
|
|
|
322
322
|
onSuccess: @escaping (Int, Bool, String) -> Void,
|
|
323
323
|
onFailure: @escaping () -> Void
|
|
324
324
|
) {
|
|
325
|
-
let urlString = (envType.lowercased() == "uat" ? STAGE_BASE_URL : PROD_BASE_URL) + "/device-verification?deviceId=\(sensorId)&deviceType=CGM"
|
|
325
|
+
let urlString = (envType.lowercased() == "uat" ? STAGE_BASE_URL : PROD_BASE_URL) + "/helper/device-verification?deviceId=\(sensorId)&deviceType=CGM&vendor=diasens"
|
|
326
326
|
|
|
327
327
|
guard let url = URL(string: urlString) else {
|
|
328
328
|
print("===>verifyDevice: Invalid URL")
|
|
@@ -281,9 +281,10 @@ 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 API msg in red (with fallback)
|
|
285
285
|
print("Device verification failed: \(msg)")
|
|
286
|
-
|
|
286
|
+
let errorMessage = msg.isEmpty ? "This is not a Diasens CGM sensor. Please connect a Diasens sensor to continue." : msg
|
|
287
|
+
self.showDeviceVerificationError(message: errorMessage)
|
|
287
288
|
} else {
|
|
288
289
|
// code 0 or unexpected - show Try Again
|
|
289
290
|
print("Device verification error, code: \(code)")
|
|
@@ -468,7 +469,8 @@ extension ConnectToSensorViewController: UITableViewDelegate, UITableViewDataSou
|
|
|
468
469
|
case .error:
|
|
469
470
|
switch enumFailureTableRow(rawValue: indexPath.row) {
|
|
470
471
|
case .failAnimation:
|
|
471
|
-
|
|
472
|
+
// Reduced height for validation API error, normal for other errors
|
|
473
|
+
return (deviceVerificationErrorMessage != nil) ? 80 : 120
|
|
472
474
|
case .image:
|
|
473
475
|
return (UIScreen.main.bounds.width * 120 / 390) + 20
|
|
474
476
|
default:
|
|
@@ -547,6 +549,17 @@ extension ConnectToSensorViewController: UITableViewDelegate, UITableViewDataSou
|
|
|
547
549
|
let cell: ImageTVC = tableView.dequeueReusableCell(for: indexPath)
|
|
548
550
|
cell.displayImageView.loadGif(named: "failure")
|
|
549
551
|
cell.bottomConstraint.constant = 11
|
|
552
|
+
// Hide camera view to prevent it from overlapping error content (cell reuse)
|
|
553
|
+
cell.cameraView.isHidden = true
|
|
554
|
+
cell.displayImageView.isHidden = false
|
|
555
|
+
// Scale down only for validation API error (65% of original size)
|
|
556
|
+
if deviceVerificationErrorMessage != nil {
|
|
557
|
+
cell.displayImageView.contentMode = .scaleAspectFit
|
|
558
|
+
cell.displayImageView.clipsToBounds = true
|
|
559
|
+
cell.displayImageView.transform = CGAffineTransform(scaleX: 0.65, y: 0.65)
|
|
560
|
+
} else {
|
|
561
|
+
cell.displayImageView.transform = .identity
|
|
562
|
+
}
|
|
550
563
|
return cell
|
|
551
564
|
case .details:
|
|
552
565
|
let cell: VerticalLabelsTVC = tableView.dequeueReusableCell(for: indexPath)
|
|
@@ -555,9 +568,15 @@ extension ConnectToSensorViewController: UITableViewDelegate, UITableViewDataSou
|
|
|
555
568
|
if let verificationError = deviceVerificationErrorMessage {
|
|
556
569
|
cell.label2.text = verificationError
|
|
557
570
|
cell.label2.textColor = .red
|
|
571
|
+
// Use smaller font for validation API error message (default title is 32pt)
|
|
572
|
+
cell.label2.font = FontManager.font(ofSize: 16, weight: .medium)
|
|
573
|
+
cell.label2.numberOfLines = 0
|
|
558
574
|
cell.label3.text = ""
|
|
559
575
|
} else {
|
|
560
576
|
cell.label2.text = "Unable to detect sensor"
|
|
577
|
+
// Restore default title font for normal error
|
|
578
|
+
cell.label2.font = FontManager.title
|
|
579
|
+
cell.label2.textColor = CustomColor.shared.primaryBlack
|
|
561
580
|
cell.label3.text = "Make sure there is proper lighting in the room"
|
|
562
581
|
}
|
|
563
582
|
return cell
|
|
@@ -566,6 +585,9 @@ extension ConnectToSensorViewController: UITableViewDelegate, UITableViewDataSou
|
|
|
566
585
|
cell.topConstraint.constant = 0
|
|
567
586
|
cell.displayImageView.image = loadImage(named: "flip_the_reference")
|
|
568
587
|
cell.displayImageView.contentMode = .scaleAspectFill
|
|
588
|
+
// Hide camera view to prevent it from overlapping error content (cell reuse)
|
|
589
|
+
cell.cameraView.isHidden = true
|
|
590
|
+
cell.displayImageView.isHidden = false
|
|
569
591
|
return cell
|
|
570
592
|
case .watchVideo:
|
|
571
593
|
let cell: WatchVideoTVC = tableView.dequeueReusableCell(for: indexPath)
|