react-native-mytatva-rn-sdk 1.2.48 → 1.2.50
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/CgmTrackyLibModule.kt +21 -29
- package/android/src/main/java/com/mytatvarnsdk/activity/BtManageActivity.java +345 -345
- package/android/src/main/java/com/mytatvarnsdk/activity/ConnectSensorActivity.kt +17 -38
- package/android/src/main/java/com/mytatvarnsdk/activity/ExitJourneyBottomSheet.kt +51 -51
- package/android/src/main/java/com/mytatvarnsdk/activity/PermissionActivity.kt +10 -5
- package/android/src/main/java/com/mytatvarnsdk/activity/PlaceSensorActivity.kt +4 -5
- package/android/src/main/java/com/mytatvarnsdk/activity/PlaceTransmitterActivity.kt +4 -5
- package/android/src/main/java/com/mytatvarnsdk/activity/QRActivity.kt +96 -92
- package/android/src/main/java/com/mytatvarnsdk/activity/SearchTransmitterActivity.kt +1 -1
- package/android/src/main/java/com/mytatvarnsdk/activity/SensorConnectSuccessActivity.kt +2 -2
- package/android/src/main/java/com/mytatvarnsdk/activity/StartCGMActivity.kt +4 -2
- package/android/src/main/java/com/mytatvarnsdk/activity/VideoActivity.kt +0 -1
- package/android/src/main/java/com/mytatvarnsdk/utils/TatvaEncryptionConfig.kt +0 -5
- package/ios/Database/KLTBluetoothManager.m +9 -4
- package/ios/Database/KLTDatabaseHandler.m +53 -6
- package/ios/MyReactNativeBridge.h +4 -1
- package/ios/MyReactNativeBridge.m +433 -191
- package/ios/Support/API.swift +0 -1
- package/ios/Support/Global.swift +12 -0
- package/ios/ViewControllers/AttachTransmitterViewController.swift +33 -2
- package/ios/ViewControllers/ChatWithExpertViewController.swift +33 -3
- package/ios/ViewControllers/ConnectToSensorViewController.swift +101 -12
- package/ios/ViewControllers/ConnectToTransmitterViewController.swift +121 -5
- package/ios/ViewControllers/ProvidePermissionViewController.swift +37 -5
- package/ios/ViewControllers/PutOnTheSensorViewController.swift +22 -2
- package/ios/ViewControllers/StartConnectionViewController.swift +31 -3
- package/ios/ViewModel/FinalViewModel.swift +155 -48
- package/package.json +1 -1
package/ios/Support/API.swift
CHANGED
|
@@ -173,7 +173,6 @@ class API {
|
|
|
173
173
|
if sensorId.isEmpty { return }
|
|
174
174
|
|
|
175
175
|
let url = URL(string: "https://api-feature2.mytatva.in/api/v8/cgm/connection")!
|
|
176
|
-
print("===>Api: https://api-feature2.mytatva.in/api/v8/cgm/connection")
|
|
177
176
|
var request = URLRequest(url: url)
|
|
178
177
|
request.httpMethod = "POST"
|
|
179
178
|
|
package/ios/Support/Global.swift
CHANGED
|
@@ -15,6 +15,7 @@ enum Enum_stroyboard: String {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
var watchCGMVideo = "https://www.youtube.com/embed/r5Zemc4R044?si=RPvayD39VzsZuXsA"
|
|
18
|
+
var reconnectionwatchCGMVideo = "https://www.youtube.com/embed/n_pUrFoZ1wQ?si=miYcKnqHo-kXU8OP"
|
|
18
19
|
var applyingTheSensor = "https://www.youtube.com/embed/O01BBxzxGmE?si=SblmJ14boqu7Y4qM"
|
|
19
20
|
var applyingTheTransmitter = "https://www.youtube.com/embed/6m3pxl5BK9A?si=08OGnUJf2BdvAYfd"
|
|
20
21
|
var connectionJourneyError = "https://www.youtube.com/embed/mVMBdUeTlhc?si=ODZSiDW96UqyFiZb"
|
|
@@ -32,4 +33,15 @@ func loadImage(named: String) -> UIImage? {
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
|
|
36
|
+
class SupportClickPayload: NSObject {
|
|
37
|
+
let screenName: String
|
|
38
|
+
let status: String
|
|
39
|
+
|
|
40
|
+
init(screenName: String, status: String) {
|
|
41
|
+
self.screenName = screenName
|
|
42
|
+
self.status = status
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
35
47
|
|
|
@@ -45,8 +45,29 @@ class AttachTransmitterViewController: UIViewController {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
|
|
48
|
+
let payload = [
|
|
49
|
+
"status": "cgm_place_transmitter_landing",
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
NotificationCenter.default.post(
|
|
53
|
+
name: Notification.Name("cgmplacetransmitterlanding"),
|
|
54
|
+
object: nil,
|
|
55
|
+
userInfo: payload
|
|
56
|
+
)
|
|
57
|
+
|
|
48
58
|
bottomButton.labelText = "Complete"
|
|
49
59
|
bottomButton.buttonTapCallback = {
|
|
60
|
+
let payload = [
|
|
61
|
+
"status": "cgm_connection_complete_clicked",
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
NotificationCenter.default.post(
|
|
65
|
+
name: Notification.Name("cgmconnectioncompleteclicked"),
|
|
66
|
+
object: nil,
|
|
67
|
+
userInfo: payload
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
50
71
|
let data = KLTDatabaseHandler.shared().queryAllReceiveData() as! [ReceiveData]
|
|
51
72
|
print(data)
|
|
52
73
|
print("===> all data count: ", data.count)
|
|
@@ -72,10 +93,20 @@ class AttachTransmitterViewController: UIViewController {
|
|
|
72
93
|
}
|
|
73
94
|
|
|
74
95
|
customTopView.onDemoTapped = {
|
|
75
|
-
|
|
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
|
+
|
|
76
107
|
let webVC = WebViewController()
|
|
77
108
|
webVC.modalPresentationStyle = .formSheet
|
|
78
|
-
webVC.videoURL = URL(string: watchCGMVideo)
|
|
109
|
+
webVC.videoURL = URL(string: isForReconnect == true ? reconnectionwatchCGMVideo : watchCGMVideo)
|
|
79
110
|
self.present(webVC, animated: true, completion: nil)
|
|
80
111
|
}
|
|
81
112
|
customTopView.onCloseTapped = {
|
|
@@ -45,10 +45,40 @@ class ChatWithExpertViewController: UIViewController {
|
|
|
45
45
|
bottomButton.labelText = "Proceed"
|
|
46
46
|
bottomButton.showLeftWhatsappImage()
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
let payload = [
|
|
49
|
+
"screen_name": "support screen",
|
|
50
|
+
"status": "cgm_WA_support_clicked"
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
NotificationCenter.default.post(
|
|
54
|
+
name: Notification.Name("cgmWAsupportclicked"),
|
|
55
|
+
object: nil,
|
|
56
|
+
userInfo: payload
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
50
60
|
bottomButton.buttonTapCallback = {
|
|
51
|
-
|
|
61
|
+
var help = ""
|
|
62
|
+
if self.selectedIndex == 0 {
|
|
63
|
+
help = "purchasing new cgm"
|
|
64
|
+
} else if self.selectedIndex == 1{
|
|
65
|
+
help = "connecting my cgm"
|
|
66
|
+
} else {
|
|
67
|
+
help = "having troubles after connection"
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
let payload = [
|
|
71
|
+
"help": help,
|
|
72
|
+
"status": "cgm_WA_support_proceed_clicked"
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
NotificationCenter.default.post(
|
|
76
|
+
name: Notification.Name("cgmWAsupportproceedclicked"),
|
|
77
|
+
object: nil,
|
|
78
|
+
userInfo: payload
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
|
|
52
82
|
if let url = URL(string: "https://wa.aisensy.com/aaa1qv") {
|
|
53
83
|
if UIApplication.shared.canOpenURL(url) {
|
|
54
84
|
UIApplication.shared.open(url, options: [:], completionHandler: nil)
|
|
@@ -80,13 +80,46 @@ class ConnectToSensorViewController: UIViewController {
|
|
|
80
80
|
contactSupport.buttonTapCallback = {
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
|
|
84
|
+
let payload = [
|
|
85
|
+
"status": "cgm_permissions_proceed_clicked",
|
|
86
|
+
]
|
|
87
|
+
|
|
88
|
+
NotificationCenter.default.post(
|
|
89
|
+
name: Notification.Name("cgmconnectsensorscanlanding"),
|
|
90
|
+
object: nil,
|
|
91
|
+
userInfo: payload
|
|
92
|
+
)
|
|
93
|
+
|
|
83
94
|
bottomButton.labelText = screenType == .error ? "Retry" : "Proceed"
|
|
84
95
|
|
|
85
96
|
if screenType == .error {
|
|
86
97
|
bottomButton.hideRightArrow()
|
|
87
98
|
}
|
|
88
|
-
|
|
99
|
+
|
|
89
100
|
bottomButton.buttonTapCallback = {
|
|
101
|
+
if self.bottomButton.labelText == "Retry" {
|
|
102
|
+
let payload = [
|
|
103
|
+
"status": "cgm_retry_connect_sensor_clicked",
|
|
104
|
+
]
|
|
105
|
+
|
|
106
|
+
NotificationCenter.default.post(
|
|
107
|
+
name: Notification.Name("cgmretryconnectsensorclicked"),
|
|
108
|
+
object: nil,
|
|
109
|
+
userInfo: payload
|
|
110
|
+
)
|
|
111
|
+
} else {
|
|
112
|
+
let payload = [
|
|
113
|
+
"status": "cgm_connect_sensor_proceed_clicked",
|
|
114
|
+
]
|
|
115
|
+
|
|
116
|
+
NotificationCenter.default.post(
|
|
117
|
+
name: Notification.Name("cgmconnectsensorproceedclicked"),
|
|
118
|
+
object: nil,
|
|
119
|
+
userInfo: payload
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
90
123
|
let isForReconnect = UserDefaults.standard.bool(forKey: "isForReconnect")
|
|
91
124
|
if isForReconnect{
|
|
92
125
|
let vc = AttachTransmitterViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|
|
@@ -99,12 +132,22 @@ class ConnectToSensorViewController: UIViewController {
|
|
|
99
132
|
}
|
|
100
133
|
|
|
101
134
|
customTopView.onDemoTapped = {
|
|
102
|
-
|
|
135
|
+
let isForReconnect = UserDefaults.standard.bool(forKey: "isForReconnect")
|
|
136
|
+
let payload = [
|
|
137
|
+
"status": "cgm_watch_demo_clicked"
|
|
138
|
+
]
|
|
139
|
+
|
|
140
|
+
NotificationCenter.default.post(
|
|
141
|
+
name: Notification.Name("cgmwatchdemoclicked"),
|
|
142
|
+
object: nil,
|
|
143
|
+
userInfo: payload
|
|
144
|
+
)
|
|
103
145
|
let webVC = WebViewController()
|
|
104
146
|
webVC.modalPresentationStyle = .formSheet
|
|
105
|
-
webVC.videoURL = URL(string: watchCGMVideo)
|
|
147
|
+
webVC.videoURL = URL(string: isForReconnect == true ? reconnectionwatchCGMVideo : watchCGMVideo)
|
|
106
148
|
self.present(webVC, animated: true, completion: nil)
|
|
107
149
|
}
|
|
150
|
+
|
|
108
151
|
customTopView.onCloseTapped = {
|
|
109
152
|
let vc = ExitJourneyViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|
|
110
153
|
vc.modalPresentationStyle = .overFullScreen
|
|
@@ -204,6 +247,7 @@ class ConnectToSensorViewController: UIViewController {
|
|
|
204
247
|
|
|
205
248
|
//controller.resumeScanning()
|
|
206
249
|
}
|
|
250
|
+
|
|
207
251
|
func connectThisSensor() {
|
|
208
252
|
// Connect the transmitter
|
|
209
253
|
manager?.connectPeripheral(manager?.readyToConnectedPeripheral)
|
|
@@ -230,6 +274,7 @@ class ConnectToSensorViewController: UIViewController {
|
|
|
230
274
|
|
|
231
275
|
connectThisSensor()
|
|
232
276
|
}
|
|
277
|
+
|
|
233
278
|
override func observeValue(forKeyPath keyPath: String?,
|
|
234
279
|
of object: Any?,
|
|
235
280
|
change: [NSKeyValueChangeKey : Any]?,
|
|
@@ -242,25 +287,69 @@ class ConnectToSensorViewController: UIViewController {
|
|
|
242
287
|
if btStatus == .initialStart {
|
|
243
288
|
self.connectedTime = Date()
|
|
244
289
|
print("Success")
|
|
290
|
+
|
|
291
|
+
let payload = [
|
|
292
|
+
"status": "cgm_sensor_connection_successful",
|
|
293
|
+
]
|
|
294
|
+
|
|
295
|
+
NotificationCenter.default.post(
|
|
296
|
+
name: Notification.Name("cgmsensorconnectionsuccessful"),
|
|
297
|
+
object: nil,
|
|
298
|
+
userInfo: payload
|
|
299
|
+
)
|
|
300
|
+
|
|
245
301
|
screenType = .success
|
|
246
302
|
tableView.reloadData()
|
|
247
303
|
bottomButton.enable()
|
|
248
304
|
if self.isFromReconnect {
|
|
249
305
|
let _ = FinalViewModelManager.shared
|
|
250
306
|
NotificationCenter.default.post(name: Notification.Name("cgmDeviceEvent"), object: nil, userInfo: ["a":"a"])
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
307
|
+
|
|
308
|
+
let vc = AttachTransmitterViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|
|
309
|
+
self.navigationController?.pushViewController(vc, animated: false)
|
|
310
|
+
|
|
311
|
+
// if let rootVC = UIApplication.shared.connectedScenes
|
|
312
|
+
// .compactMap({ ($0 as? UIWindowScene)?.windows.first?.rootViewController })
|
|
313
|
+
// .first {
|
|
314
|
+
// rootVC.dismiss(animated: true, completion: nil)
|
|
315
|
+
// } else if let rootViewController = UIApplication.shared.keyWindow?.rootViewController {
|
|
316
|
+
// rootViewController.dismiss(animated: true, completion: nil)
|
|
317
|
+
// }
|
|
318
|
+
|
|
319
|
+
} else {
|
|
320
|
+
let vc = PutOnTheSensorViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|
|
321
|
+
self.navigationController?.pushViewController(vc, animated: false)
|
|
258
322
|
}
|
|
259
323
|
} else if btStatus == .closed || btStatus == .modifyVoltageFailed {
|
|
260
|
-
|
|
261
|
-
|
|
324
|
+
var errorDescription = ""
|
|
325
|
+
var errorCode = ""
|
|
326
|
+
|
|
327
|
+
switch btStatus {
|
|
328
|
+
case .closed:
|
|
329
|
+
errorDescription = "Sensor connection was closed"
|
|
330
|
+
errorCode = "SENSOR_CONNECTION_CLOSED"
|
|
331
|
+
case .modifyVoltageFailed:
|
|
332
|
+
errorDescription = "Failed to modify sensor voltage"
|
|
333
|
+
errorCode = "SENSOR_MODIFY_VOLTAGE_FAILED"
|
|
334
|
+
default:
|
|
335
|
+
break
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
let payload = [
|
|
339
|
+
"status": "cgm_sensor_connection_failed",
|
|
340
|
+
"error_description": errorDescription,
|
|
341
|
+
"error_code": errorCode
|
|
342
|
+
]
|
|
343
|
+
|
|
344
|
+
NotificationCenter.default.post(
|
|
345
|
+
name: Notification.Name("cgmsensorconnectionfailed"),
|
|
346
|
+
object: nil,
|
|
347
|
+
userInfo: payload
|
|
348
|
+
)
|
|
349
|
+
|
|
262
350
|
navigationController?.popToRootViewController(animated: true)
|
|
263
351
|
}
|
|
352
|
+
|
|
264
353
|
}
|
|
265
354
|
} else if keyPath == "status", context != nil {
|
|
266
355
|
if let playerItem = object as? AVPlayerItem {
|
|
@@ -86,8 +86,19 @@ class ConnectToTransmitterViewController: UIViewController, KLTBluetoothDelegate
|
|
|
86
86
|
contactSupport.labelText = "Contact Support"
|
|
87
87
|
contactSupport.setBorderOnly()
|
|
88
88
|
contactSupport.buttonTapCallback = {
|
|
89
|
+
let vc = ChatWithExpertViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|
|
90
|
+
self.navigationController?.pushViewController(vc, animated: false)
|
|
89
91
|
}
|
|
90
92
|
|
|
93
|
+
let payload = [
|
|
94
|
+
"status": "cgm_connect_transmitter_landing",
|
|
95
|
+
]
|
|
96
|
+
|
|
97
|
+
NotificationCenter.default.post(
|
|
98
|
+
name: Notification.Name("cgmconnecttransmitterlanding"),
|
|
99
|
+
object: nil,
|
|
100
|
+
userInfo: payload
|
|
101
|
+
)
|
|
91
102
|
|
|
92
103
|
bottomButton.labelText = screenType == .error ? "Retry" : "Proceed"
|
|
93
104
|
|
|
@@ -97,6 +108,17 @@ class ConnectToTransmitterViewController: UIViewController, KLTBluetoothDelegate
|
|
|
97
108
|
bottomButton.buttonTapCallback = {
|
|
98
109
|
if self.isForReconnect {
|
|
99
110
|
if self.bottomButton.labelText == "Retry" {
|
|
111
|
+
let payload = [
|
|
112
|
+
"status": "cgm_retry_connect_transmitter_clicked",
|
|
113
|
+
]
|
|
114
|
+
|
|
115
|
+
NotificationCenter.default.post(
|
|
116
|
+
name: Notification.Name("cgmretryconnecttransmitterclicked"),
|
|
117
|
+
object: nil,
|
|
118
|
+
userInfo: payload
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
|
|
100
122
|
self.manager?.bluetoothDelegate = self
|
|
101
123
|
self.manager?.startScan()
|
|
102
124
|
self.screenType = .searching
|
|
@@ -137,10 +159,19 @@ class ConnectToTransmitterViewController: UIViewController, KLTBluetoothDelegate
|
|
|
137
159
|
}
|
|
138
160
|
|
|
139
161
|
customTopView.onDemoTapped = {
|
|
140
|
-
|
|
162
|
+
let payload = [
|
|
163
|
+
"status": "cgm_watch_demo_clicked"
|
|
164
|
+
]
|
|
165
|
+
|
|
166
|
+
NotificationCenter.default.post(
|
|
167
|
+
name: Notification.Name("cgmwatchdemoclicked"),
|
|
168
|
+
object: nil,
|
|
169
|
+
userInfo: payload
|
|
170
|
+
)
|
|
171
|
+
|
|
141
172
|
let webVC = WebViewController()
|
|
142
173
|
webVC.modalPresentationStyle = .formSheet
|
|
143
|
-
webVC.videoURL = URL(string: watchCGMVideo)
|
|
174
|
+
webVC.videoURL = URL(string: self.isForReconnect == true ? reconnectionwatchCGMVideo : watchCGMVideo)
|
|
144
175
|
self.present(webVC, animated: true, completion: nil)
|
|
145
176
|
}
|
|
146
177
|
|
|
@@ -167,20 +198,30 @@ class ConnectToTransmitterViewController: UIViewController, KLTBluetoothDelegate
|
|
|
167
198
|
|
|
168
199
|
func onFindDevices(_ array: NSMutableArray!, connectedDevice peripheral: CBPeripheral!) {
|
|
169
200
|
if array.count > 0 {
|
|
201
|
+
let payload = [
|
|
202
|
+
"status": "cgm_transmitter_detected",
|
|
203
|
+
]
|
|
204
|
+
|
|
205
|
+
NotificationCenter.default.post(
|
|
206
|
+
name: Notification.Name("cgmtransmitterdetected"),
|
|
207
|
+
object: nil,
|
|
208
|
+
userInfo: payload
|
|
209
|
+
)
|
|
210
|
+
bottomButton.labelText = screenType == .error ? "Retry" : "Proceed"
|
|
170
211
|
self.foundDevices = array
|
|
171
212
|
self.screenType = .listOfDevice
|
|
172
213
|
self.tableView.reloadData()
|
|
173
214
|
}
|
|
174
215
|
}
|
|
216
|
+
|
|
175
217
|
override func observeValue(forKeyPath keyPath: String?,
|
|
176
218
|
of object: Any?,
|
|
177
219
|
change: [NSKeyValueChangeKey : Any]?,
|
|
178
220
|
context: UnsafeMutableRawPointer?) {
|
|
179
221
|
if keyPath == "status" && context == nil {
|
|
180
222
|
if let newValue = change?[.newKey] as? Int {
|
|
181
|
-
//let btStatus = newValue
|
|
182
223
|
let btStatus: BluetoothManagerStatus = BluetoothManagerStatus(rawValue: newValue) ?? .scanStart
|
|
183
|
-
|
|
224
|
+
|
|
184
225
|
if btStatus == .timeOut ||
|
|
185
226
|
btStatus == .disconnected ||
|
|
186
227
|
btStatus == .handshakeFail ||
|
|
@@ -189,12 +230,66 @@ class ConnectToTransmitterViewController: UIViewController, KLTBluetoothDelegate
|
|
|
189
230
|
btStatus == .modifyVoltageFailed ||
|
|
190
231
|
btStatus == .sensorLostPower ||
|
|
191
232
|
btStatus == .bindWatchTimeOut {
|
|
233
|
+
|
|
234
|
+
var errorDescription = ""
|
|
235
|
+
var errorCode = ""
|
|
236
|
+
|
|
237
|
+
switch btStatus {
|
|
238
|
+
case .timeOut:
|
|
239
|
+
errorDescription = "Connection timed out"
|
|
240
|
+
errorCode = "BT_TIMEOUT"
|
|
241
|
+
|
|
242
|
+
case .disconnected:
|
|
243
|
+
errorDescription = "Device disconnected unexpectedly"
|
|
244
|
+
errorCode = "BT_DISCONNECTED"
|
|
245
|
+
|
|
246
|
+
case .handshakeFail:
|
|
247
|
+
errorDescription = "Handshake with transmitter failed"
|
|
248
|
+
errorCode = "BT_HANDSHAKE_FAIL"
|
|
249
|
+
|
|
250
|
+
case .selfCheckFail:
|
|
251
|
+
errorDescription = "Self-check failed"
|
|
252
|
+
errorCode = "BT_SELF_CHECK_FAIL"
|
|
253
|
+
|
|
254
|
+
case .closed:
|
|
255
|
+
errorDescription = "Bluetooth manager closed"
|
|
256
|
+
errorCode = "BT_CLOSED"
|
|
257
|
+
|
|
258
|
+
case .modifyVoltageFailed:
|
|
259
|
+
errorDescription = "Voltage adjustment failed"
|
|
260
|
+
errorCode = "BT_MODIFY_VOLTAGE_FAIL"
|
|
261
|
+
|
|
262
|
+
case .sensorLostPower:
|
|
263
|
+
errorDescription = "Sensor lost power"
|
|
264
|
+
errorCode = "BT_SENSOR_LOST_POWER"
|
|
265
|
+
|
|
266
|
+
case .bindWatchTimeOut:
|
|
267
|
+
errorDescription = "Binding with watch timed out"
|
|
268
|
+
errorCode = "BT_BIND_TIMEOUT"
|
|
269
|
+
|
|
270
|
+
default:
|
|
271
|
+
break
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
let payload = [
|
|
275
|
+
"status": "cgm_transmitter_detection_failed",
|
|
276
|
+
"error_description": errorDescription,
|
|
277
|
+
"error_code": errorCode
|
|
278
|
+
]
|
|
279
|
+
|
|
280
|
+
NotificationCenter.default.post(
|
|
281
|
+
name: Notification.Name("cgmtransmitterdetectionfailed"),
|
|
282
|
+
object: nil,
|
|
283
|
+
userInfo: payload
|
|
284
|
+
)
|
|
285
|
+
|
|
192
286
|
self.screenType = .error
|
|
193
287
|
bottomButton.labelText = screenType == .error ? "Retry" : "Proceed"
|
|
194
288
|
bottomButton.enable()
|
|
195
289
|
self.tableView.reloadData()
|
|
196
290
|
}
|
|
197
291
|
}
|
|
292
|
+
|
|
198
293
|
} else if keyPath == "status", context != nil {
|
|
199
294
|
|
|
200
295
|
} else {
|
|
@@ -261,7 +356,7 @@ extension ConnectToTransmitterViewController: UITableViewDelegate, UITableViewDa
|
|
|
261
356
|
case .success:
|
|
262
357
|
switch enumSuccessTableRow(rawValue: indexPath.row) {
|
|
263
358
|
case .importantNote:
|
|
264
|
-
|
|
359
|
+
// if isForReconnect { return 0 }
|
|
265
360
|
return UITableView.automaticDimension
|
|
266
361
|
default:
|
|
267
362
|
return UITableView.automaticDimension
|
|
@@ -322,6 +417,16 @@ extension ConnectToTransmitterViewController: UITableViewDelegate, UITableViewDa
|
|
|
322
417
|
if self.foundDevices.count > indexPath.row {
|
|
323
418
|
let peripheral = self.foundDevices[indexPath.row] as! CBPeripheral
|
|
324
419
|
if let device = KLTDatabaseHandler.shared().queryDevice(withId: peripheral.identifier.uuidString) {
|
|
420
|
+
let payload = [
|
|
421
|
+
"status": "cgm_transmitter_connection_successful",
|
|
422
|
+
]
|
|
423
|
+
|
|
424
|
+
NotificationCenter.default.post(
|
|
425
|
+
name: Notification.Name("cgmtransmitterconnectionsuccessful"),
|
|
426
|
+
object: nil,
|
|
427
|
+
userInfo: payload
|
|
428
|
+
)
|
|
429
|
+
|
|
325
430
|
//let snLocalName = device.advertise?.localName?.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
326
431
|
self.connectedTime = Date()
|
|
327
432
|
print("Connected device", device)
|
|
@@ -330,6 +435,17 @@ extension ConnectToTransmitterViewController: UITableViewDelegate, UITableViewDa
|
|
|
330
435
|
//API.shared.sendStatus(status: .connected)
|
|
331
436
|
self.bottomButton.enable()
|
|
332
437
|
tableView.reloadData()
|
|
438
|
+
} else {
|
|
439
|
+
let errorPayload = [
|
|
440
|
+
"status": "cgm_transmitter_detection_failed",
|
|
441
|
+
"error_description": "Device not found in database",
|
|
442
|
+
"error_code": "BT_DEVICE_NOT_IN_DB"
|
|
443
|
+
]
|
|
444
|
+
NotificationCenter.default.post(
|
|
445
|
+
name: Notification.Name("cgmtransmitterdetectionfailed"),
|
|
446
|
+
object: nil,
|
|
447
|
+
userInfo: errorPayload
|
|
448
|
+
)
|
|
333
449
|
}
|
|
334
450
|
}
|
|
335
451
|
}
|
|
@@ -17,7 +17,7 @@ class ProvidePermissionViewController: UIViewController {
|
|
|
17
17
|
// Declare the CBCentralManager
|
|
18
18
|
var centralManager: CBCentralManager?
|
|
19
19
|
var isBluetoothEnabled: Bool = false
|
|
20
|
-
|
|
20
|
+
let isForReconnect = UserDefaults.standard.bool(forKey: "isForReconnect")
|
|
21
21
|
// Declare the CLLocationManager
|
|
22
22
|
var locationManager: CLLocationManager?
|
|
23
23
|
var isLocationEnabled: Bool = false
|
|
@@ -45,17 +45,49 @@ class ProvidePermissionViewController: UIViewController {
|
|
|
45
45
|
|
|
46
46
|
bottomButton.labelText = "Proceed"
|
|
47
47
|
bottomButton.buttonTapCallback = {
|
|
48
|
-
|
|
48
|
+
|
|
49
|
+
let payload = [
|
|
50
|
+
"status": "cgm_permissions_proceed_clicked",
|
|
51
|
+
"bluetooth_toggle_status": self.isBluetoothEnabled == true ? "ON" : "OFF",
|
|
52
|
+
"location_toggle_status": self.isLocationEnabled == true ? "ON" : "OFF"
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
NotificationCenter.default.post(
|
|
56
|
+
name: Notification.Name("cgmpermissionsproceedclicked"),
|
|
57
|
+
object: nil,
|
|
58
|
+
userInfo: payload
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
|
|
49
62
|
let vc = ConnectToTransmitterViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|
|
50
|
-
vc.isForReconnect = isForReconnect
|
|
63
|
+
vc.isForReconnect = self.isForReconnect
|
|
51
64
|
self.navigationController?.pushViewController(vc, animated: false)
|
|
52
65
|
}
|
|
53
66
|
|
|
67
|
+
let payload = [
|
|
68
|
+
"status": "cgm_start_connection_journey_clicked"
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
NotificationCenter.default.post(
|
|
72
|
+
name: Notification.Name("cgmpermissionspagelanding"),
|
|
73
|
+
object: nil,
|
|
74
|
+
userInfo: payload
|
|
75
|
+
)
|
|
76
|
+
|
|
54
77
|
customTopView.onDemoTapped = {
|
|
55
|
-
|
|
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
|
+
)
|
|
56
88
|
let webVC = WebViewController()
|
|
57
89
|
webVC.modalPresentationStyle = .formSheet
|
|
58
|
-
webVC.videoURL = URL(string: watchCGMVideo)
|
|
90
|
+
webVC.videoURL = URL(string: self.isForReconnect == true ? reconnectionwatchCGMVideo : watchCGMVideo)
|
|
59
91
|
self.present(webVC, animated: true, completion: nil)
|
|
60
92
|
}
|
|
61
93
|
|
|
@@ -34,6 +34,17 @@ class PutOnTheSensorViewController: UIViewController {
|
|
|
34
34
|
VideoTVC.self,
|
|
35
35
|
NoteTVC.self])
|
|
36
36
|
tableView.reloadData()
|
|
37
|
+
let payload = [
|
|
38
|
+
"status": "cgm_place_sensor_landing",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
NotificationCenter.default.post(
|
|
42
|
+
name: Notification.Name("cgmplacesensorlanding"),
|
|
43
|
+
object: nil,
|
|
44
|
+
userInfo: payload
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
37
48
|
|
|
38
49
|
bottomButton.labelText = "I Have Placed The Sensor"
|
|
39
50
|
bottomButton.buttonTapCallback = {
|
|
@@ -42,10 +53,19 @@ class PutOnTheSensorViewController: UIViewController {
|
|
|
42
53
|
}
|
|
43
54
|
|
|
44
55
|
customTopView.onDemoTapped = {
|
|
45
|
-
|
|
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
|
+
)
|
|
46
66
|
let webVC = WebViewController()
|
|
47
67
|
webVC.modalPresentationStyle = .formSheet
|
|
48
|
-
webVC.videoURL = URL(string: watchCGMVideo)
|
|
68
|
+
webVC.videoURL = URL(string: isForReconnect == true ? reconnectionwatchCGMVideo : watchCGMVideo)
|
|
49
69
|
self.present(webVC, animated: true, completion: nil)
|
|
50
70
|
}
|
|
51
71
|
|
|
@@ -52,6 +52,16 @@ class StartConnectionViewController: UIViewController {
|
|
|
52
52
|
ChargingIndicatorTVC.self])
|
|
53
53
|
tableView.reloadData()
|
|
54
54
|
|
|
55
|
+
let payload = [
|
|
56
|
+
"status": "cgm_start_connection_landing"
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
NotificationCenter.default.post(
|
|
60
|
+
name: Notification.Name("cgmstartconnectionlanding"),
|
|
61
|
+
object: nil,
|
|
62
|
+
userInfo: payload
|
|
63
|
+
)
|
|
64
|
+
|
|
55
65
|
let isForReconnect = UserDefaults.standard.bool(forKey: "isForReconnect")
|
|
56
66
|
if isForReconnect{
|
|
57
67
|
checkLocationPermission()
|
|
@@ -67,16 +77,35 @@ class StartConnectionViewController: UIViewController {
|
|
|
67
77
|
if isForReconnect {
|
|
68
78
|
self.updateBottomButtonState()
|
|
69
79
|
} else {
|
|
80
|
+
let payload = [
|
|
81
|
+
"status": "cgm_start_connection_journey_clicked"
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
NotificationCenter.default.post(
|
|
85
|
+
name: Notification.Name("cgmstartconnectionjourneyclicked"),
|
|
86
|
+
object: nil,
|
|
87
|
+
userInfo: payload
|
|
88
|
+
)
|
|
89
|
+
|
|
70
90
|
let vc = ProvidePermissionViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|
|
71
91
|
self.navigationController?.pushViewController(vc, animated: false)
|
|
72
92
|
}
|
|
73
93
|
}
|
|
74
94
|
|
|
75
95
|
customTopView.onDemoTapped = {
|
|
76
|
-
|
|
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
|
+
)
|
|
77
106
|
let webVC = WebViewController()
|
|
78
107
|
webVC.modalPresentationStyle = .formSheet // or .pageSheet, .fullScreen
|
|
79
|
-
webVC.videoURL = URL(string: watchCGMVideo)
|
|
108
|
+
webVC.videoURL = URL(string: isForReconnect == true ? reconnectionwatchCGMVideo : watchCGMVideo)
|
|
80
109
|
self.present(webVC, animated: true, completion: nil)
|
|
81
110
|
|
|
82
111
|
}
|
|
@@ -116,7 +145,6 @@ class StartConnectionViewController: UIViewController {
|
|
|
116
145
|
print("Bluetooth is unsupported on this device.")
|
|
117
146
|
case .unauthorized:
|
|
118
147
|
print("Bluetooth is unauthorized.")
|
|
119
|
-
|
|
120
148
|
case .poweredOff:
|
|
121
149
|
print("Bluetooth is powered off.")
|
|
122
150
|
case .poweredOn:
|