react-native-mytatva-rn-sdk 1.2.97 → 1.2.99

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.
Files changed (32) hide show
  1. package/android/src/main/java/com/mytatvarnsdk/CgmTrackyLibModule.kt +25 -0
  2. package/android/src/main/java/com/mytatvarnsdk/activity/ConnectSensorActivity.kt +164 -18
  3. package/android/src/main/java/com/mytatvarnsdk/activity/HelpActivity.kt +3 -9
  4. package/android/src/main/java/com/mytatvarnsdk/activity/PermissionActivity.kt +8 -16
  5. package/android/src/main/java/com/mytatvarnsdk/activity/PlaceSensorActivity.kt +12 -13
  6. package/android/src/main/java/com/mytatvarnsdk/activity/PlaceTransmitterActivity.kt +12 -13
  7. package/android/src/main/java/com/mytatvarnsdk/activity/SearchTransmitterActivity.kt +9 -14
  8. package/android/src/main/java/com/mytatvarnsdk/activity/SensorConnectSuccessActivity.kt +12 -16
  9. package/android/src/main/java/com/mytatvarnsdk/activity/StartCGMActivity.kt +9 -15
  10. package/android/src/main/java/com/mytatvarnsdk/activity/VideoActivity.kt +96 -50
  11. package/android/src/main/java/com/mytatvarnsdk/network/AuthenticateSDKService.kt +50 -0
  12. package/android/src/main/java/com/mytatvarnsdk/utils/CustomerSupportConfig.kt +137 -0
  13. package/android/src/main/java/com/mytatvarnsdk/utils/ToolbarSupportHelper.kt +83 -0
  14. package/android/src/main/res/layout/activity_connect_sensor.xml +117 -2
  15. package/ios/Custom/CustomTopUIView.swift +25 -0
  16. package/ios/Database/KLTBluetoothManager.m +69 -14
  17. package/ios/MyReactNativeBridge.m +4 -0
  18. package/ios/Support/API.swift +117 -18
  19. package/ios/Support/CustomTopViewSupportHelper.swift +55 -0
  20. package/ios/Support/CustomerSupportConfig.swift +169 -0
  21. package/ios/Support/Global.swift +2 -2
  22. package/ios/Support/GlobalYouTubePlayerView.swift +102 -11
  23. package/ios/TableViewCell/ImageTVC/ImageTVC.swift +147 -15
  24. package/ios/ViewControllers/AttachTransmitterViewController.swift +16 -21
  25. package/ios/ViewControllers/ChatWithExpertViewController.swift +1 -7
  26. package/ios/ViewControllers/ConnectToSensorViewController.swift +213 -34
  27. package/ios/ViewControllers/ConnectToTransmitterViewController.swift +16 -21
  28. package/ios/ViewControllers/ProvidePermissionViewController.swift +16 -21
  29. package/ios/ViewControllers/PutOnTheSensorViewController.swift +16 -21
  30. package/ios/ViewControllers/StartConnectionViewController.swift +18 -25
  31. package/ios/ViewModel/FinalViewModel.swift +2 -2
  32. package/package.json +1 -1
@@ -26,6 +26,7 @@ class ConnectToSensorViewController: UIViewController {
26
26
  case verticalLabel
27
27
  case image
28
28
  case camera
29
+ case manualEntryBar
29
30
  }
30
31
 
31
32
  enum enumSuccessTableRow: Int, CaseIterable {
@@ -52,15 +53,34 @@ class ConnectToSensorViewController: UIViewController {
52
53
  var screenType: enumScreenType = .camera
53
54
  var isCodeDetected = false
54
55
  var isPermissionGiven: Bool = false
56
+ var isManualEntryMode: Bool = false
57
+ private var keyboardInset: CGFloat = 0
58
+ private var keyboardObserversRegistered = false
55
59
  let manager = KLTBluetoothManager.shared()
56
60
  let debouncer = EnumDebouncer<CGMConnectionStatus>()
57
61
  var deviceVerificationErrorMessage: String? = nil
58
62
 
59
63
  override func viewDidLoad() {
60
64
  super.viewDidLoad()
61
- // Do any additional setup after loading the view.
62
65
  setupLayout()
63
66
  }
67
+
68
+ override func viewWillAppear(_ animated: Bool) {
69
+ super.viewWillAppear(animated)
70
+ CustomTopViewSupportHelper.configureWhatsapp(customTopView: customTopView)
71
+ registerKeyboardObserversIfNeeded()
72
+ }
73
+
74
+ override func viewWillDisappear(_ animated: Bool) {
75
+ super.viewWillDisappear(animated)
76
+ removeKeyboardObservers()
77
+ resetKeyboardInsets()
78
+ view.endEditing(true)
79
+ }
80
+
81
+ deinit {
82
+ removeKeyboardObservers()
83
+ }
64
84
 
65
85
  func setupLayout() {
66
86
  manager?.addObserver(self, forKeyPath: "status", options: [.new], context: nil)
@@ -68,6 +88,7 @@ class ConnectToSensorViewController: UIViewController {
68
88
 
69
89
  tableView.delegate = self
70
90
  tableView.dataSource = self
91
+ tableView.keyboardDismissMode = .interactive
71
92
  tableView.registerNibs([VerticalLabelsTVC.self,
72
93
  SeparatorTVC.self,
73
94
  ImageTVC.self,
@@ -77,6 +98,7 @@ class ConnectToSensorViewController: UIViewController {
77
98
  NoteTVC.self,
78
99
  PodDetailsTVC.self,
79
100
  WatchVideoTVC.self])
101
+ tableView.register(UITableViewCell.self, forCellReuseIdentifier: "ManualEntryBarCell")
80
102
  tableView.reloadData()
81
103
  contactSupport.isHidden = screenType != .error
82
104
  contactSupport.labelText = "Contact Support"
@@ -144,32 +166,22 @@ class ConnectToSensorViewController: UIViewController {
144
166
 
145
167
  }
146
168
 
147
- customTopView.onDemoTapped = {
148
- let isForReconnect = UserDefaults.standard.bool(forKey: "isForReconnect")
149
- let payload = [
150
- "status": "cgm_watch_demo_clicked"
151
- ]
152
-
153
- NotificationCenter.default.post(
154
- name: Notification.Name("cgmwatchdemoclicked"),
155
- object: nil,
156
- userInfo: payload
157
- )
158
- let webVC = WebViewController()
159
- webVC.modalPresentationStyle = .formSheet
160
- webVC.videoURL = URL(string: isForReconnect == true ? reconnectionwatchCGMVideo : watchCGMVideo)
161
- self.present(webVC, animated: true, completion: nil)
162
- }
163
-
169
+ CustomTopViewSupportHelper.configureWhatsapp(customTopView: customTopView)
170
+ CustomTopViewSupportHelper.bindDemoAction(
171
+ customTopView: customTopView,
172
+ isForReconnect: UserDefaults.standard.bool(forKey: "isForReconnect"),
173
+ presenter: self
174
+ )
175
+ CustomTopViewSupportHelper.bindWhatsappAction(
176
+ customTopView: customTopView,
177
+ navigationController: navigationController
178
+ )
179
+
164
180
  customTopView.onCloseTapped = {
165
181
  let vc = ExitJourneyViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
166
182
  vc.modalPresentationStyle = .overFullScreen
167
183
  self.present(vc, animated: true, completion: nil)
168
184
  }
169
- customTopView.onWhatsAppTapped = {
170
- let vc = ChatWithExpertViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
171
- self.navigationController?.pushViewController(vc, animated: false)
172
- }
173
185
  checkCameraPermission()
174
186
  bottomButton.disable()
175
187
  }
@@ -247,7 +259,7 @@ class ConnectToSensorViewController: UIViewController {
247
259
  let data = AlgorithmTools.decodeCT(value)
248
260
 
249
261
  if data.k > 0 || data.r > 0 {
250
- //KLTLocalSettingManager.shareInstance.deviceInfoSensor = value
262
+ KLTLocalSettingManager.shareInstance().deviceInfoSensor = value
251
263
  UserDefaults.standard.set(data.k, forKey: "algo_k")
252
264
  UserDefaults.standard.set(data.r, forKey: "algo_r")
253
265
  UserDefaults.standard.synchronize()
@@ -255,18 +267,22 @@ class ConnectToSensorViewController: UIViewController {
255
267
  let lastConnectCgm = UserDefaults.standard.string(forKey: "lastConnectCgm") ?? ""
256
268
 
257
269
  if lastConnectCgm.lowercased() == "diasens" {
258
- // Diasens user - validate sensor via API before connecting
259
270
  validateDiasensSensor(sensorId: value)
260
271
  } else {
261
- // Non-Diasens user - proceed directly
262
272
  viewModel.debouncer.update(with: .connected)
263
273
  self.showConfirmInsulinUser()
264
274
  }
265
275
  return
266
276
  }
277
+
278
+ // decodeCT returned k=0 and r=0 — sensor QR is not effective for this transmitter
279
+ showSensorInvalidAlert(message: "This sensor is not compatible with your transmitter. Please verify the sensor QR.")
280
+ isCodeDetected = false
281
+ return
267
282
  }
268
283
 
269
- //controller.resumeScanning()
284
+ // Sensor ID format is invalid
285
+ showSensorInvalidAlert(message: "The scanned sensor ID is not valid. Please try again or enter the sensor ID manually.")
270
286
  }
271
287
 
272
288
  func validateDiasensSensor(sensorId: String) {
@@ -324,7 +340,99 @@ class ConnectToSensorViewController: UIViewController {
324
340
  // Connect the transmitter
325
341
  manager?.connectPeripheral(manager?.readyToConnectedPeripheral)
326
342
  }
343
+
344
+ @objc func toggleManualEntry() {
345
+ isManualEntryMode.toggle()
346
+ if !isManualEntryMode {
347
+ resetKeyboardInsets()
348
+ view.endEditing(true)
349
+ }
350
+ tableView.reloadData()
351
+ }
352
+
353
+ private var manualEntryIndexPath: IndexPath {
354
+ IndexPath(row: enumTableRow.camera.rawValue, section: enumTableSection.details.rawValue)
355
+ }
356
+
357
+ private func registerKeyboardObserversIfNeeded() {
358
+ guard !keyboardObserversRegistered else { return }
359
+ keyboardObserversRegistered = true
360
+ NotificationCenter.default.addObserver(
361
+ self,
362
+ selector: #selector(keyboardWillShow(_:)),
363
+ name: UIResponder.keyboardWillShowNotification,
364
+ object: nil
365
+ )
366
+ NotificationCenter.default.addObserver(
367
+ self,
368
+ selector: #selector(keyboardWillHide(_:)),
369
+ name: UIResponder.keyboardWillHideNotification,
370
+ object: nil
371
+ )
372
+ }
373
+
374
+ private func removeKeyboardObservers() {
375
+ guard keyboardObserversRegistered else { return }
376
+ keyboardObserversRegistered = false
377
+ NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillShowNotification, object: nil)
378
+ NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillHideNotification, object: nil)
379
+ }
380
+
381
+ private func resetKeyboardInsets() {
382
+ keyboardInset = 0
383
+ tableView.contentInset.bottom = 0
384
+ tableView.verticalScrollIndicatorInsets.bottom = 0
385
+ }
386
+
387
+ @objc private func keyboardWillShow(_ notification: Notification) {
388
+ guard isManualEntryMode,
389
+ let userInfo = notification.userInfo,
390
+ let keyboardFrame = userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect else {
391
+ return
392
+ }
393
+
394
+ let convertedFrame = view.convert(keyboardFrame, from: nil)
395
+ let inset = max(0, view.bounds.maxY - convertedFrame.minY - view.safeAreaInsets.bottom)
396
+ keyboardInset = inset
397
+ tableView.contentInset.bottom = inset
398
+ tableView.verticalScrollIndicatorInsets.bottom = inset
399
+
400
+ let duration = (userInfo[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber)?.doubleValue ?? 0.25
401
+ UIView.animate(withDuration: duration) {
402
+ self.scrollManualEntryTextFieldAboveKeyboard(animated: false)
403
+ }
404
+ }
405
+
406
+ @objc private func keyboardWillHide(_ notification: Notification) {
407
+ guard let userInfo = notification.userInfo else {
408
+ resetKeyboardInsets()
409
+ return
410
+ }
411
+ let duration = (userInfo[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber)?.doubleValue ?? 0.25
412
+ UIView.animate(withDuration: duration) {
413
+ self.resetKeyboardInsets()
414
+ }
415
+ }
416
+
417
+ private func scrollManualEntryTextFieldAboveKeyboard(animated: Bool) {
418
+ guard isManualEntryMode,
419
+ let cell = tableView.cellForRow(at: manualEntryIndexPath) as? ImageTVC,
420
+ let textField = cell.activeSensorIdTextField else {
421
+ return
422
+ }
423
+
424
+ let fieldRect = textField.convert(textField.bounds, to: tableView)
425
+ tableView.scrollRectToVisible(fieldRect.insetBy(dx: 0, dy: -12), animated: animated)
426
+ }
327
427
 
428
+ private func showSensorInvalidAlert(message: String) {
429
+ DispatchQueue.main.async {
430
+ let alert = UIAlertController(title: "Invalid Sensor", message: message, preferredStyle: .alert)
431
+ alert.addAction(UIAlertAction(title: "OK", style: .default))
432
+ self.present(alert, animated: true)
433
+ }
434
+ }
435
+
328
436
  func showConfirmInsulinUser() {
329
437
  let typeOfDiabetes = UserDefaults.standard.object(forKey: "profilePatientType") as? NSNumber
330
438
 
@@ -462,7 +570,9 @@ extension ConnectToSensorViewController: UITableViewDelegate, UITableViewDataSou
462
570
  case .image:
463
571
  return (UIScreen.main.bounds.width * 120 / 390) + 40
464
572
  case .camera:
465
- return 220
573
+ return isManualEntryMode ? 200 : 220
574
+ case .manualEntryBar:
575
+ return 60
466
576
  default:
467
577
  return UITableView.automaticDimension
468
578
  }
@@ -496,17 +606,35 @@ extension ConnectToSensorViewController: UITableViewDelegate, UITableViewDataSou
496
606
  return cell
497
607
  case .image:
498
608
  let cell: ImageTVC = tableView.dequeueReusableCell(for: indexPath)
609
+ cell.configureAsStaticImage()
499
610
  cell.displayImageView.image = loadImage(named: "flip_the_reference")
500
611
  cell.displayImageView.contentMode = .scaleAspectFill
501
612
  cell.displayImageView.isHidden = false
502
- cell.cameraView.isHidden = true
503
613
  return cell
504
614
  case .camera:
505
615
  let cell: ImageTVC = tableView.dequeueReusableCell(for: indexPath)
506
616
  cell.displayImageView.contentMode = .scaleAspectFill
507
617
  cell.displayImageView.isHidden = true
508
- cell.cameraView.isHidden = false
509
- if isPermissionGiven {
618
+ cell.configure(isManualEntry: isManualEntryMode)
619
+ if isManualEntryMode {
620
+ cell.onTextFieldDidBeginEditing = { [weak self] in
621
+ self?.scrollManualEntryTextFieldAboveKeyboard(animated: true)
622
+ }
623
+ cell.onConnectTapped = { [weak self] sensorId in
624
+ guard let self = self else { return }
625
+ guard !sensorId.isEmpty else {
626
+ let alert = UIAlertController(
627
+ title: nil,
628
+ message: "Please enter a Sensor ID",
629
+ preferredStyle: .alert
630
+ )
631
+ alert.addAction(UIAlertAction(title: "OK", style: .default))
632
+ self.present(alert, animated: true)
633
+ return
634
+ }
635
+ self.connectSensor(value: sensorId, controller: self)
636
+ }
637
+ } else if isPermissionGiven {
510
638
  DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
511
639
  cell.setupQRView()
512
640
  cell.scannerView?.onCodeDetected = { data in
@@ -518,6 +646,59 @@ extension ConnectToSensorViewController: UITableViewDelegate, UITableViewDataSou
518
646
  }
519
647
  }
520
648
  return cell
649
+ case .manualEntryBar:
650
+ let cell = tableView.dequeueReusableCell(withIdentifier: "ManualEntryBarCell")!
651
+ cell.selectionStyle = .none
652
+ cell.backgroundColor = .clear
653
+ cell.contentView.subviews.forEach { $0.removeFromSuperview() }
654
+
655
+ let bar = UIView()
656
+ bar.translatesAutoresizingMaskIntoConstraints = false
657
+ bar.backgroundColor = UIColor(red: 240/255, green: 244/255, blue: 255/255, alpha: 1)
658
+ bar.layer.cornerRadius = 10
659
+ bar.layer.borderWidth = 1
660
+ bar.layer.borderColor = UIColor(red: 220/255, green: 225/255, blue: 245/255, alpha: 1).cgColor
661
+
662
+ let prefixText = isManualEntryMode ? "Scan the QR." : "Can't scan the sensor QR?"
663
+ let linkText = isManualEntryMode ? " Scan QR" : " Enter ID Manually"
664
+
665
+ let prefixLabel = UILabel()
666
+ prefixLabel.text = prefixText
667
+ prefixLabel.font = FontManager.font(ofSize: 14, weight: .regular)
668
+ prefixLabel.textColor = UIColor(red: 45/255, green: 50/255, blue: 130/255, alpha: 1)
669
+
670
+ let linkLabel = UILabel()
671
+ let attr = NSMutableAttributedString(string: linkText, attributes: [
672
+ .font: FontManager.font(ofSize: 14, weight: .bold),
673
+ .foregroundColor: CustomColor.shared.lightGreen,
674
+ .underlineStyle: NSUnderlineStyle.single.rawValue,
675
+ ])
676
+ linkLabel.attributedText = attr
677
+
678
+ let stack = UIStackView(arrangedSubviews: [prefixLabel, linkLabel])
679
+ stack.translatesAutoresizingMaskIntoConstraints = false
680
+ stack.axis = .horizontal
681
+ stack.alignment = .center
682
+ stack.spacing = 4
683
+ bar.addSubview(stack)
684
+
685
+ // Tap the entire bar so the hit area is large and reliable
686
+ bar.isUserInteractionEnabled = true
687
+ let tap = UITapGestureRecognizer(target: self, action: #selector(toggleManualEntry))
688
+ bar.addGestureRecognizer(tap)
689
+
690
+ cell.contentView.addSubview(bar)
691
+ NSLayoutConstraint.activate([
692
+ stack.centerXAnchor.constraint(equalTo: bar.centerXAnchor),
693
+ stack.centerYAnchor.constraint(equalTo: bar.centerYAnchor),
694
+ stack.leadingAnchor.constraint(greaterThanOrEqualTo: bar.leadingAnchor, constant: 12),
695
+ stack.trailingAnchor.constraint(lessThanOrEqualTo: bar.trailingAnchor, constant: -12),
696
+ bar.leadingAnchor.constraint(equalTo: cell.contentView.leadingAnchor, constant: 24),
697
+ bar.trailingAnchor.constraint(equalTo: cell.contentView.trailingAnchor, constant: -24),
698
+ bar.topAnchor.constraint(equalTo: cell.contentView.topAnchor, constant: 4),
699
+ bar.bottomAnchor.constraint(equalTo: cell.contentView.bottomAnchor, constant: -4),
700
+ ])
701
+ return cell
521
702
  }
522
703
  case .success:
523
704
  switch enumSuccessTableRow(rawValue: indexPath.row)! {
@@ -547,10 +728,9 @@ extension ConnectToSensorViewController: UITableViewDelegate, UITableViewDataSou
547
728
  switch enumFailureTableRow(rawValue: indexPath.row)! {
548
729
  case .failAnimation:
549
730
  let cell: ImageTVC = tableView.dequeueReusableCell(for: indexPath)
731
+ cell.configureAsStaticImage()
550
732
  cell.displayImageView.loadGif(named: "failure")
551
733
  cell.bottomConstraint.constant = 11
552
- // Hide camera view to prevent it from overlapping error content (cell reuse)
553
- cell.cameraView.isHidden = true
554
734
  cell.displayImageView.isHidden = false
555
735
  // Scale down only for validation API error (65% of original size)
556
736
  if deviceVerificationErrorMessage != nil {
@@ -582,11 +762,10 @@ extension ConnectToSensorViewController: UITableViewDelegate, UITableViewDataSou
582
762
  return cell
583
763
  case .image:
584
764
  let cell: ImageTVC = tableView.dequeueReusableCell(for: indexPath)
765
+ cell.configureAsStaticImage()
585
766
  cell.topConstraint.constant = 0
586
767
  cell.displayImageView.image = loadImage(named: "flip_the_reference")
587
768
  cell.displayImageView.contentMode = .scaleAspectFill
588
- // Hide camera view to prevent it from overlapping error content (cell reuse)
589
- cell.cameraView.isHidden = true
590
769
  cell.displayImageView.isHidden = false
591
770
  return cell
592
771
  case .watchVideo:
@@ -63,6 +63,11 @@ class ConnectToTransmitterViewController: UIViewController, KLTBluetoothDelegate
63
63
  setupLayout()
64
64
  }
65
65
 
66
+ override func viewWillAppear(_ animated: Bool) {
67
+ super.viewWillAppear(animated)
68
+ CustomTopViewSupportHelper.configureWhatsapp(customTopView: customTopView)
69
+ }
70
+
66
71
  deinit {
67
72
  if let observer = bluetoothEnableObserver {
68
73
  NotificationCenter.default.removeObserver(observer)
@@ -181,32 +186,22 @@ class ConnectToTransmitterViewController: UIViewController, KLTBluetoothDelegate
181
186
  }
182
187
  }
183
188
 
184
- customTopView.onDemoTapped = {
185
- let payload = [
186
- "status": "cgm_watch_demo_clicked"
187
- ]
188
-
189
- NotificationCenter.default.post(
190
- name: Notification.Name("cgmwatchdemoclicked"),
191
- object: nil,
192
- userInfo: payload
193
- )
194
-
195
- let webVC = WebViewController()
196
- webVC.modalPresentationStyle = .formSheet
197
- webVC.videoURL = URL(string: self.isForReconnect == true ? reconnectionwatchCGMVideo : watchCGMVideo)
198
- self.present(webVC, animated: true, completion: nil)
199
- }
200
-
189
+ CustomTopViewSupportHelper.configureWhatsapp(customTopView: customTopView)
190
+ CustomTopViewSupportHelper.bindDemoAction(
191
+ customTopView: customTopView,
192
+ isForReconnect: self.isForReconnect,
193
+ presenter: self
194
+ )
195
+ CustomTopViewSupportHelper.bindWhatsappAction(
196
+ customTopView: customTopView,
197
+ navigationController: navigationController
198
+ )
199
+
201
200
  customTopView.onCloseTapped = {
202
201
  let vc = ExitJourneyViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
203
202
  vc.modalPresentationStyle = .overFullScreen
204
203
  self.present(vc, animated: true, completion: nil)
205
204
  }
206
- customTopView.onWhatsAppTapped = {
207
- let vc = ChatWithExpertViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
208
- self.navigationController?.pushViewController(vc, animated: false)
209
- }
210
205
 
211
206
  if isForReconnect {
212
207
  //customTopView.showOnlyClose()
@@ -35,6 +35,11 @@ class ProvidePermissionViewController: UIViewController {
35
35
  setupLayout()
36
36
  }
37
37
 
38
+ override func viewWillAppear(_ animated: Bool) {
39
+ super.viewWillAppear(animated)
40
+ CustomTopViewSupportHelper.configureWhatsapp(customTopView: customTopView)
41
+ }
42
+
38
43
  func setupLayout() {
39
44
  tableView.delegate = self
40
45
  tableView.dataSource = self
@@ -74,32 +79,22 @@ class ProvidePermissionViewController: UIViewController {
74
79
  userInfo: payload
75
80
  )
76
81
 
77
- customTopView.onDemoTapped = {
78
-
79
- let payload = [
80
- "status": "cgm_permissions_page_landing"
81
- ]
82
-
83
- NotificationCenter.default.post(
84
- name: Notification.Name("cgmwatchdemoclicked"),
85
- object: nil,
86
- userInfo: payload
87
- )
88
- let webVC = WebViewController()
89
- webVC.modalPresentationStyle = .formSheet
90
- webVC.videoURL = URL(string: self.isForReconnect == true ? reconnectionwatchCGMVideo : watchCGMVideo)
91
- self.present(webVC, animated: true, completion: nil)
92
- }
93
-
82
+ CustomTopViewSupportHelper.configureWhatsapp(customTopView: customTopView)
83
+ CustomTopViewSupportHelper.bindDemoAction(
84
+ customTopView: customTopView,
85
+ isForReconnect: isForReconnect,
86
+ presenter: self
87
+ )
88
+ CustomTopViewSupportHelper.bindWhatsappAction(
89
+ customTopView: customTopView,
90
+ navigationController: navigationController
91
+ )
92
+
94
93
  customTopView.onCloseTapped = {
95
94
  let vc = ExitJourneyViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
96
95
  vc.modalPresentationStyle = .overFullScreen
97
96
  self.present(vc, animated: true, completion: nil)
98
97
  }
99
- customTopView.onWhatsAppTapped = {
100
- let vc = ChatWithExpertViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
101
- self.navigationController?.pushViewController(vc, animated: false)
102
- }
103
98
  updateBottomButtonState()
104
99
 
105
100
  // Initialize the CBCentralManager with the current view controller as the delegate
@@ -25,6 +25,11 @@ class PutOnTheSensorViewController: UIViewController {
25
25
  // Do any additional setup after loading the view.
26
26
  setupLayout()
27
27
  }
28
+
29
+ override func viewWillAppear(_ animated: Bool) {
30
+ super.viewWillAppear(animated)
31
+ CustomTopViewSupportHelper.configureWhatsapp(customTopView: customTopView)
32
+ }
28
33
 
29
34
  func setupLayout() {
30
35
  tableView.delegate = self
@@ -52,32 +57,22 @@ class PutOnTheSensorViewController: UIViewController {
52
57
  self.navigationController?.pushViewController(vc, animated: false)
53
58
  }
54
59
 
55
- customTopView.onDemoTapped = {
56
- let isForReconnect = UserDefaults.standard.bool(forKey: "isForReconnect")
57
- let payload = [
58
- "status": "cgm_watch_demo_clicked"
59
- ]
60
-
61
- NotificationCenter.default.post(
62
- name: Notification.Name("cgmwatchdemoclicked"),
63
- object: nil,
64
- userInfo: payload
65
- )
66
- let webVC = WebViewController()
67
- webVC.modalPresentationStyle = .formSheet
68
- webVC.videoURL = URL(string: isForReconnect == true ? reconnectionwatchCGMVideo : watchCGMVideo)
69
- self.present(webVC, animated: true, completion: nil)
70
- }
71
-
60
+ CustomTopViewSupportHelper.configureWhatsapp(customTopView: customTopView)
61
+ CustomTopViewSupportHelper.bindDemoAction(
62
+ customTopView: customTopView,
63
+ isForReconnect: UserDefaults.standard.bool(forKey: "isForReconnect"),
64
+ presenter: self
65
+ )
66
+ CustomTopViewSupportHelper.bindWhatsappAction(
67
+ customTopView: customTopView,
68
+ navigationController: navigationController
69
+ )
70
+
72
71
  customTopView.onCloseTapped = {
73
72
  let vc = ExitJourneyViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
74
73
  vc.modalPresentationStyle = .overFullScreen
75
74
  self.present(vc, animated: true, completion: nil)
76
75
  }
77
- customTopView.onWhatsAppTapped = {
78
- let vc = ChatWithExpertViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
79
- self.navigationController?.pushViewController(vc, animated: false)
80
- }
81
76
  }
82
77
 
83
78
  }
@@ -37,10 +37,15 @@ class StartConnectionViewController: UIViewController {
37
37
 
38
38
  override func viewDidLoad() {
39
39
  super.viewDidLoad()
40
- // Do any additional setup after loading the view.
40
+ CustomerSupportConfig.shared.fetchIfNeeded()
41
41
  setupLayout()
42
42
  //checkForDevice()
43
43
  }
44
+
45
+ override func viewWillAppear(_ animated: Bool) {
46
+ super.viewWillAppear(animated)
47
+ CustomTopViewSupportHelper.configureWhatsapp(customTopView: customTopView)
48
+ }
44
49
 
45
50
  func setupLayout() {
46
51
  navigationController?.navigationBar.isHidden = true
@@ -92,36 +97,24 @@ class StartConnectionViewController: UIViewController {
92
97
  }
93
98
  }
94
99
 
95
- customTopView.onDemoTapped = {
96
- let isForReconnect = UserDefaults.standard.bool(forKey: "isForReconnect")
97
- let payload = [
98
- "status": "cgm_watch_demo_clicked"
99
- ]
100
-
101
- NotificationCenter.default.post(
102
- name: Notification.Name("cgmwatchdemoclicked"),
103
- object: nil,
104
- userInfo: payload
105
- )
106
- let webVC = WebViewController()
107
- webVC.modalPresentationStyle = .formSheet // or .pageSheet, .fullScreen
108
- webVC.videoURL = URL(string: isForReconnect == true ? reconnectionwatchCGMVideo : watchCGMVideo)
109
- self.present(webVC, animated: true, completion: nil)
110
-
111
- }
112
-
100
+ CustomTopViewSupportHelper.configureWhatsapp(customTopView: customTopView)
101
+ CustomTopViewSupportHelper.bindDemoAction(
102
+ customTopView: customTopView,
103
+ isForReconnect: isForReconnect,
104
+ presenter: self
105
+ )
106
+ CustomTopViewSupportHelper.bindWhatsappAction(
107
+ customTopView: customTopView,
108
+ navigationController: navigationController
109
+ )
110
+
113
111
  customTopView.onCloseTapped = {
114
112
  let vc = ExitJourneyViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
115
113
  vc.modalPresentationStyle = .overFullScreen
116
114
  self.present(vc, animated: true, completion: nil)
117
115
  }
118
-
119
- customTopView.onWhatsAppTapped = {
120
- let vc = ChatWithExpertViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
121
- self.navigationController?.pushViewController(vc, animated: false)
122
- }
123
116
  }
124
-
117
+
125
118
  private func updateBottomButtonState() {
126
119
  if isBluetoothEnabled && isLocationEnabled {
127
120
  let isForReconnect = UserDefaults.standard.bool(forKey: "isForReconnect")
@@ -254,7 +254,7 @@ class FinalViewModel: NSObject {
254
254
 
255
255
  func getStatus(encryptionKey: String = PROD_ENC_KEY,
256
256
  encryptionIv: String = PROD_ENC_IV) {
257
- print("ios token:", TOKEN)
257
+ print("ios token:", currentAuthToken())
258
258
  let url = URL(string: "https://api-feature2.mytatva.in/api/v8/cgm/status")!
259
259
  var request = URLRequest(url: url)
260
260
  request.httpMethod = "GET"
@@ -262,7 +262,7 @@ class FinalViewModel: NSObject {
262
262
  // Set headers
263
263
  //request.addValue("application/json", forHTTPHeaderField: "Content-Type")
264
264
  request.addValue(PROD_API_KEY, forHTTPHeaderField: "api-key")
265
- request.addValue(TOKEN, forHTTPHeaderField: "token")
265
+ request.addValue(currentAuthToken(), forHTTPHeaderField: "token")
266
266
 
267
267
 
268
268
  // Set request body
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-mytatva-rn-sdk",
3
- "version": "1.2.97",
3
+ "version": "1.2.99",
4
4
  "description": "a package to inject data into visit health pwa",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",