react-native-mytatva-rn-sdk 1.2.44 → 1.2.46
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 -4
- package/android/src/main/java/com/mytatvarnsdk/activity/ConnectSensorActivity.kt +18 -3
- package/android/src/main/java/com/mytatvarnsdk/activity/HelpActivity.kt +118 -59
- package/android/src/main/java/com/mytatvarnsdk/activity/PermissionActivity.kt +370 -351
- package/android/src/main/java/com/mytatvarnsdk/activity/PlaceSensorActivity.kt +7 -2
- package/android/src/main/java/com/mytatvarnsdk/activity/PlaceTransmitterActivity.kt +10 -4
- package/android/src/main/java/com/mytatvarnsdk/activity/SearchTransmitterActivity.kt +30 -53
- package/android/src/main/java/com/mytatvarnsdk/activity/SensorConnectSuccessActivity.kt +9 -2
- package/android/src/main/java/com/mytatvarnsdk/activity/StartCGMActivity.kt +11 -3
- package/android/src/main/java/com/mytatvarnsdk/model/BaseViewModel.java +1 -1
- package/ios/MyReactNativeBridge.m +60 -55
- package/ios/Support/API.swift +1 -1
- package/ios/ViewControllers/AttachTransmitterViewController.swift +1 -0
- package/ios/ViewControllers/ChatWithExpertViewController.swift +4 -0
- package/ios/ViewControllers/ConnectToSensorViewController.swift +1 -0
- package/ios/ViewControllers/ConnectToTransmitterViewController.swift +19 -6
- package/ios/ViewControllers/ProvidePermissionViewController.swift +3 -0
- package/ios/ViewControllers/PutOnTheSensorViewController.swift +1 -0
- package/ios/ViewControllers/StartConnectionViewController.swift +4 -2
- package/ios/ViewModel/FinalViewModel.swift +15 -22
- package/package.json +1 -1
|
@@ -48,6 +48,8 @@ class PlaceSensorActivity : AppCompatActivity() {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
private fun init() {
|
|
51
|
+
sendDataToRN("", "cgm_place_sensor_landing")
|
|
52
|
+
|
|
51
53
|
Glide.with(this)
|
|
52
54
|
.load(R.drawable.img_male)
|
|
53
55
|
.transform(RoundedCorners(50))
|
|
@@ -59,7 +61,10 @@ class PlaceSensorActivity : AppCompatActivity() {
|
|
|
59
61
|
.into(binding.ivPlay)
|
|
60
62
|
|
|
61
63
|
binding.toolbar.btnWhatsapp.setOnClickListener {
|
|
62
|
-
startActivity(
|
|
64
|
+
startActivity(
|
|
65
|
+
Intent(this, HelpActivity::class.java)
|
|
66
|
+
.putExtra("ScreenName", "Attach Sensor Screen")
|
|
67
|
+
)
|
|
63
68
|
}
|
|
64
69
|
|
|
65
70
|
binding.toolbar.btnWatchDemo.setOnClickListener {
|
|
@@ -101,7 +106,7 @@ class PlaceSensorActivity : AppCompatActivity() {
|
|
|
101
106
|
val module = catalystInstance.getNativeModule(CgmTrackyLibModule::class.java)
|
|
102
107
|
|
|
103
108
|
if (module == null) {
|
|
104
|
-
sendDataToRNDirectly(
|
|
109
|
+
sendDataToRNDirectly(data, status)
|
|
105
110
|
Log.d("sendDataToRN: ", "Module null")
|
|
106
111
|
} else {
|
|
107
112
|
module.sendDataToReact(data, status, "cgmDeviceEvent")
|
|
@@ -48,6 +48,8 @@ class PlaceTransmitterActivity : AppCompatActivity() {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
private fun init() {
|
|
51
|
+
sendDataToRN("", "cgm_place_transmitter_landing")
|
|
52
|
+
|
|
51
53
|
Glide.with(this)
|
|
52
54
|
.load(R.drawable.img_female)
|
|
53
55
|
.transform(RoundedCorners(50))
|
|
@@ -61,16 +63,20 @@ class PlaceTransmitterActivity : AppCompatActivity() {
|
|
|
61
63
|
binding.commonButton.tvProceed.text = "Complete"
|
|
62
64
|
|
|
63
65
|
binding.commonButton.btnProceed.setOnClickListener {
|
|
64
|
-
sendDataToRN("","
|
|
66
|
+
sendDataToRN("", "cgm_connection_complete_clicked")
|
|
67
|
+
sendDataToRN("", "WARM_PERIOD_STARTED")
|
|
65
68
|
finish()
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
binding.toolbar.btnWhatsapp.setOnClickListener {
|
|
69
|
-
startActivity(
|
|
72
|
+
startActivity(
|
|
73
|
+
Intent(this, HelpActivity::class.java)
|
|
74
|
+
.putExtra("ScreenName", "Attach Transmitter Screen")
|
|
75
|
+
)
|
|
70
76
|
}
|
|
71
77
|
|
|
72
78
|
binding.toolbar.btnWatchDemo.setOnClickListener {
|
|
73
|
-
sendDataToRN("","cgm_watch_demo_clicked")
|
|
79
|
+
sendDataToRN("", "cgm_watch_demo_clicked")
|
|
74
80
|
|
|
75
81
|
startActivity(
|
|
76
82
|
Intent(this, VideoActivity::class.java).putExtra("VideoId", "r5Zemc4R044")
|
|
@@ -133,7 +139,7 @@ class PlaceTransmitterActivity : AppCompatActivity() {
|
|
|
133
139
|
val module = catalystInstance.getNativeModule(CgmTrackyLibModule::class.java)
|
|
134
140
|
|
|
135
141
|
if (module == null) {
|
|
136
|
-
sendDataToRNDirectly(
|
|
142
|
+
sendDataToRNDirectly(data, status)
|
|
137
143
|
Log.d("sendDataToRN: ", "Module null")
|
|
138
144
|
} else {
|
|
139
145
|
module.sendDataToReact(data, status, "cgmDeviceEvent")
|
|
@@ -55,6 +55,7 @@ import com.mytatvarnsdk.network.AuthenticateSDKService
|
|
|
55
55
|
import kotlinx.coroutines.CoroutineScope
|
|
56
56
|
import kotlinx.coroutines.Dispatchers
|
|
57
57
|
import kotlinx.coroutines.Job
|
|
58
|
+
import org.json.JSONObject
|
|
58
59
|
import java.text.SimpleDateFormat
|
|
59
60
|
import java.util.Date
|
|
60
61
|
import java.util.Locale
|
|
@@ -107,6 +108,8 @@ class SearchTransmitterActivity : BaseBleActivity() {
|
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
private fun setupInitialState() {
|
|
111
|
+
sendDataToRN("", "cgm_connect_transmitter_landing")
|
|
112
|
+
|
|
110
113
|
isForReconnect = intent.getBooleanExtra("IsForReconnect", false)
|
|
111
114
|
|
|
112
115
|
// Set initial states
|
|
@@ -146,16 +149,27 @@ class SearchTransmitterActivity : BaseBleActivity() {
|
|
|
146
149
|
}
|
|
147
150
|
|
|
148
151
|
binding.btnSupport.btnProceed.setOnClickListener {
|
|
149
|
-
startActivity(
|
|
152
|
+
startActivity(
|
|
153
|
+
Intent(this, HelpActivity::class.java)
|
|
154
|
+
.putExtra("ScreenName", "Transmitter Screen")
|
|
155
|
+
)
|
|
150
156
|
}
|
|
151
157
|
|
|
152
158
|
binding.btnRetry.btnProceed.setOnClickListener {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
159
|
+
sendDataToRN("", "cgm_retry_connect_transmitter_clicked")
|
|
160
|
+
|
|
161
|
+
Handler().postDelayed({
|
|
162
|
+
val intent = intent
|
|
163
|
+
finish()
|
|
164
|
+
startActivity(intent)
|
|
165
|
+
}, 500)
|
|
156
166
|
}
|
|
157
167
|
|
|
158
168
|
if (errorStatus.isNotEmpty()) {
|
|
169
|
+
val jsonObject = JSONObject()
|
|
170
|
+
jsonObject.put("error_description", errorStatus)
|
|
171
|
+
sendDataToRN(jsonObject.toString(), "cgm_transmitter_connection_failed")
|
|
172
|
+
|
|
159
173
|
binding.tvReason.visibility = View.VISIBLE
|
|
160
174
|
binding.tvReason.text = "Reason - ${errorStatus}"
|
|
161
175
|
} else {
|
|
@@ -219,6 +233,8 @@ class SearchTransmitterActivity : BaseBleActivity() {
|
|
|
219
233
|
if (transmitterDeviceInfo != null && !binding.tvReason.isVisible) {
|
|
220
234
|
manageErrorState(false, "")
|
|
221
235
|
} else {
|
|
236
|
+
sendDataToRN("", "cgm_transmitter_detection_failed")
|
|
237
|
+
|
|
222
238
|
manageErrorState(true, "")
|
|
223
239
|
}
|
|
224
240
|
Log.d("Search Transmitter Error--> ", "Search Transmitter Error--> scanEnd")
|
|
@@ -226,6 +242,7 @@ class SearchTransmitterActivity : BaseBleActivity() {
|
|
|
226
242
|
|
|
227
243
|
override fun bluetoothStateOFF() {
|
|
228
244
|
super.bluetoothStateOFF()
|
|
245
|
+
|
|
229
246
|
manageErrorState(true, "Bluetooth Off")
|
|
230
247
|
Log.d("Search Transmitter Error--> ", "Search Transmitter Error--> bluetoothStateOFF")
|
|
231
248
|
}
|
|
@@ -246,6 +263,7 @@ class SearchTransmitterActivity : BaseBleActivity() {
|
|
|
246
263
|
ProgressManagement.getInstance().dismissWait(this)
|
|
247
264
|
manageErrorState(true, "Bind Failure")
|
|
248
265
|
Log.d("Search Transmitter Error--> ", "Search Transmitter Error--> bindFail")
|
|
266
|
+
sendDataToRN("", "cgm_transmitter_connection_failed")
|
|
249
267
|
}
|
|
250
268
|
|
|
251
269
|
public override fun bindSuccess() {
|
|
@@ -260,54 +278,8 @@ class SearchTransmitterActivity : BaseBleActivity() {
|
|
|
260
278
|
binding.commonButton.btnProceed.alpha = 1.0f
|
|
261
279
|
binding.view2.background = ContextCompat.getDrawable(this, R.drawable.bg_green_progress)
|
|
262
280
|
binding.tvDivide2.setTextColor("#299D6B".toColorInt())
|
|
263
|
-
}
|
|
264
281
|
|
|
265
|
-
|
|
266
|
-
val dto: GlucoseLog = GlucoseLog()
|
|
267
|
-
dto.timeInMillis = glucose.getTimeInMillis()
|
|
268
|
-
dto.countdownMinutes = glucose.getCountdownMinutes()
|
|
269
|
-
dto.countdownHours = glucose.getCountdownHours()
|
|
270
|
-
dto.countdownDays = glucose.getCountdownDays()
|
|
271
|
-
dto.hypoglycemiaEarlyWarnMinutes = glucose.getHypoglycemiaEarlyWarnMinutes()
|
|
272
|
-
dto.showGlucoseMG = glucose.getShowGlucoseMG()
|
|
273
|
-
dto.glucoseId = glucose.getGlucoseId()
|
|
274
|
-
dto.name = glucose.getName()
|
|
275
|
-
dto.showGlucose = glucose.getShowGlucose()
|
|
276
|
-
dto.Ib = glucose.getIb()
|
|
277
|
-
dto.Iw = glucose.getIw()
|
|
278
|
-
dto.T = glucose.getT()
|
|
279
|
-
dto.year = glucose.getYear()
|
|
280
|
-
dto.month = glucose.getMonth()
|
|
281
|
-
dto.day = glucose.getDay()
|
|
282
|
-
dto.hour = glucose.getHour()
|
|
283
|
-
dto.minute = glucose.getMinute()
|
|
284
|
-
|
|
285
|
-
// Convert byte[] to List<Integer>
|
|
286
|
-
dto.bytes = ArrayList()
|
|
287
|
-
for (b in glucose.getBytes()) {
|
|
288
|
-
dto.bytes?.add(b.toInt() and 0xFF) // Prevent negative values
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
// Trend
|
|
292
|
-
val trendObj: TrendObject = TrendObject()
|
|
293
|
-
trendObj.trendId = glucose.getTrend().getTrendId()
|
|
294
|
-
trendObj.drawableId = glucose.getTrend().getDrawableId()
|
|
295
|
-
trendObj.widgetImg = glucose.getTrend().getWidgetImg()
|
|
296
|
-
trendObj.apsChangeRate = glucose.getTrend().getApsChangeRate()
|
|
297
|
-
dto.trendObject = trendObj
|
|
298
|
-
|
|
299
|
-
// Status
|
|
300
|
-
val statusObj: GlucoseStatusObject = GlucoseStatusObject()
|
|
301
|
-
statusObj.statusId = glucose.getGlucoseStatus().getStatusId()
|
|
302
|
-
dto.glucoseStatusObject = statusObj
|
|
303
|
-
|
|
304
|
-
// Error
|
|
305
|
-
val errorObj: ErrorObject = ErrorObject()
|
|
306
|
-
errorObj.errorId = glucose.getErrorCode().getErrorId()
|
|
307
|
-
errorObj.sound = glucose.getErrorCode().getSound().toString()
|
|
308
|
-
dto.errorObject = errorObj
|
|
309
|
-
|
|
310
|
-
return dto
|
|
282
|
+
sendDataToRN("", "cgm_transmitter_connection_successful")
|
|
311
283
|
}
|
|
312
284
|
|
|
313
285
|
|
|
@@ -352,7 +324,10 @@ class SearchTransmitterActivity : BaseBleActivity() {
|
|
|
352
324
|
|
|
353
325
|
private fun setupClickListeners() {
|
|
354
326
|
binding.toolbar.btnWhatsapp.setOnClickListener {
|
|
355
|
-
startActivity(
|
|
327
|
+
startActivity(
|
|
328
|
+
Intent(this, HelpActivity::class.java)
|
|
329
|
+
.putExtra("ScreenName", "Transmitter Screen")
|
|
330
|
+
)
|
|
356
331
|
}
|
|
357
332
|
|
|
358
333
|
binding.toolbar.btnWatchDemo.setOnClickListener {
|
|
@@ -472,7 +447,7 @@ class SearchTransmitterActivity : BaseBleActivity() {
|
|
|
472
447
|
val module = catalystInstance.getNativeModule(CgmTrackyLibModule::class.java)
|
|
473
448
|
|
|
474
449
|
if (module == null) {
|
|
475
|
-
sendDataToRNDirectly(
|
|
450
|
+
sendDataToRNDirectly(data, status)
|
|
476
451
|
Log.d("sendDataToRN: ", "Module null")
|
|
477
452
|
} else {
|
|
478
453
|
module.sendDataToReact(data, status, "cgmDeviceEvent")
|
|
@@ -562,6 +537,8 @@ class SearchTransmitterActivity : BaseBleActivity() {
|
|
|
562
537
|
})
|
|
563
538
|
|
|
564
539
|
binding.searchingLayout.startAnimation(fadeOut)
|
|
540
|
+
|
|
541
|
+
sendDataToRN("", "cgm_transmitter_detected")
|
|
565
542
|
}
|
|
566
543
|
|
|
567
544
|
private fun connectToTransmitter() {
|
|
@@ -65,6 +65,8 @@ class SensorConnectSuccessActivity : AppCompatActivity() {
|
|
|
65
65
|
private fun init() {
|
|
66
66
|
isForReconnect = intent.getBooleanExtra("IsForReconnect", false)
|
|
67
67
|
|
|
68
|
+
sendDataToRN("", "cgm_sensor_connection_successful")
|
|
69
|
+
|
|
68
70
|
val formatter = SimpleDateFormat("hh:mm a", Locale.getDefault())
|
|
69
71
|
binding.tvDateTime.text = "Connected on ${formatter.format(Date()).uppercase()}"
|
|
70
72
|
|
|
@@ -76,7 +78,10 @@ class SensorConnectSuccessActivity : AppCompatActivity() {
|
|
|
76
78
|
authenticateSDKService = AuthenticateSDKService(scope = scope)
|
|
77
79
|
|
|
78
80
|
binding.toolbar.btnWhatsapp.setOnClickListener {
|
|
79
|
-
startActivity(
|
|
81
|
+
startActivity(
|
|
82
|
+
Intent(this, HelpActivity::class.java)
|
|
83
|
+
.putExtra("ScreenName", "Sensor Screen")
|
|
84
|
+
)
|
|
80
85
|
}
|
|
81
86
|
|
|
82
87
|
binding.toolbar.btnWatchDemo.setOnClickListener {
|
|
@@ -88,6 +93,8 @@ class SensorConnectSuccessActivity : AppCompatActivity() {
|
|
|
88
93
|
}
|
|
89
94
|
|
|
90
95
|
binding.commonButton.btnProceed.setOnClickListener {
|
|
96
|
+
sendDataToRN("", "cgm_connect_sensor_proceed_clicked")
|
|
97
|
+
|
|
91
98
|
if (isForReconnect) {
|
|
92
99
|
startActivity(Intent(this, PlaceTransmitterActivity::class.java))
|
|
93
100
|
} else {
|
|
@@ -117,7 +124,7 @@ class SensorConnectSuccessActivity : AppCompatActivity() {
|
|
|
117
124
|
val module = catalystInstance.getNativeModule(CgmTrackyLibModule::class.java)
|
|
118
125
|
|
|
119
126
|
if (module == null) {
|
|
120
|
-
sendDataToRNDirectly(
|
|
127
|
+
sendDataToRNDirectly(data, status)
|
|
121
128
|
Log.d("sendDataToRN: ", "Module null")
|
|
122
129
|
} else {
|
|
123
130
|
module.sendDataToReact(data, status, "cgmDeviceEvent")
|
|
@@ -27,6 +27,7 @@ import com.mytatvarnsdk.CgmTrackyLibModule.Companion.mReactContext
|
|
|
27
27
|
import com.mytatvarnsdk.R
|
|
28
28
|
import com.mytatvarnsdk.databinding.ActivityStartCgmactivityBinding
|
|
29
29
|
import com.mytatvarnsdk.databinding.ExitDialogBottomsheetBinding
|
|
30
|
+
import org.json.JSONObject
|
|
30
31
|
|
|
31
32
|
|
|
32
33
|
class StartCGMActivity : AppCompatActivity() {
|
|
@@ -51,6 +52,8 @@ class StartCGMActivity : AppCompatActivity() {
|
|
|
51
52
|
private fun init() {
|
|
52
53
|
isForReconnect = intent.getBooleanExtra("IsForReconnect", false)
|
|
53
54
|
|
|
55
|
+
sendDataToRN("", "cgm_start_connection_landing")
|
|
56
|
+
|
|
54
57
|
if (isForReconnect) {
|
|
55
58
|
binding.commonButton.tvProceed.text = "Start Reconnection Journey"
|
|
56
59
|
} else {
|
|
@@ -58,6 +61,8 @@ class StartCGMActivity : AppCompatActivity() {
|
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
binding.commonButton.btnProceed.setOnClickListener {
|
|
64
|
+
sendDataToRN("", "cgm_start_connection_journey_clicked")
|
|
65
|
+
|
|
61
66
|
if (isForReconnect) {
|
|
62
67
|
val intent = if (areAllPermissionsGranted()) {
|
|
63
68
|
Intent(this, SearchTransmitterActivity::class.java).putExtra(
|
|
@@ -82,11 +87,14 @@ class StartCGMActivity : AppCompatActivity() {
|
|
|
82
87
|
}
|
|
83
88
|
|
|
84
89
|
binding.toolbar.btnWhatsapp.setOnClickListener {
|
|
85
|
-
startActivity(
|
|
90
|
+
startActivity(
|
|
91
|
+
Intent(this, HelpActivity::class.java)
|
|
92
|
+
.putExtra("ScreenName", "Start CGM Screen")
|
|
93
|
+
)
|
|
86
94
|
}
|
|
87
95
|
|
|
88
96
|
binding.toolbar.btnWatchDemo.setOnClickListener {
|
|
89
|
-
sendDataToRN("","cgm_watch_demo_clicked")
|
|
97
|
+
sendDataToRN("", "cgm_watch_demo_clicked")
|
|
90
98
|
startActivity(
|
|
91
99
|
Intent(this, VideoActivity::class.java).putExtra("VideoId", "r5Zemc4R044")
|
|
92
100
|
)
|
|
@@ -157,7 +165,7 @@ class StartCGMActivity : AppCompatActivity() {
|
|
|
157
165
|
val module = catalystInstance.getNativeModule(CgmTrackyLibModule::class.java)
|
|
158
166
|
|
|
159
167
|
if (module == null) {
|
|
160
|
-
sendDataToRNDirectly(
|
|
168
|
+
sendDataToRNDirectly(data, status)
|
|
161
169
|
Log.d("sendDataToRN: ", "Module null")
|
|
162
170
|
} else {
|
|
163
171
|
module.sendDataToReact(data, status, "cgmDeviceEvent")
|
|
@@ -99,7 +99,7 @@ public class BaseViewModel extends AndroidViewModel {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
public List<PocGlucose> getGlucoseBetweenTime(long startTime) {
|
|
102
|
-
return mRepositoryGlucose.getGlucoseByTimeMillis(startTime,
|
|
102
|
+
return mRepositoryGlucose.getGlucoseByTimeMillis(startTime, System.currentTimeMillis());
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
public PocDevice getDeviceInfo(int deviceId) {
|
|
@@ -20,7 +20,7 @@ RCT_EXPORT_MODULE();
|
|
|
20
20
|
|
|
21
21
|
// Define the supported events
|
|
22
22
|
- (NSArray<NSString *> *)supportedEvents {
|
|
23
|
-
return @[@"cgmDeviceEvent"]; // Event names to listen to in JS
|
|
23
|
+
return @[@"cgmDeviceEvent", @"cgmwatchdemoclicked", @"cgmWAsupportclicked"]; // Event names to listen to in JS
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
// Example method to emit an event from native to JS
|
|
@@ -39,7 +39,7 @@ RCT_EXPORT_MODULE();
|
|
|
39
39
|
// This method returns the list of events the module supports
|
|
40
40
|
- (NSArray<NSString *> *)supportedEvents
|
|
41
41
|
{
|
|
42
|
-
return @[@"cgmDeviceEvent"];
|
|
42
|
+
return @[@"cgmDeviceEvent", @"cgmwatchdemoclicked", @"cgmWAsupportclicked"];
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
// Start listening for notifications
|
|
@@ -51,6 +51,17 @@ RCT_EXPORT_MODULE();
|
|
|
51
51
|
selector:@selector(handleNotification:)
|
|
52
52
|
name:@"cgmDeviceEvent"
|
|
53
53
|
object:nil];
|
|
54
|
+
|
|
55
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
56
|
+
selector:@selector(handleNotification:)
|
|
57
|
+
name:@"cgmwatchdemoclicked"
|
|
58
|
+
object:nil];
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
62
|
+
selector:@selector(handleNotification:)
|
|
63
|
+
name:@"cgmWAsupportclicked"
|
|
64
|
+
object:nil];
|
|
54
65
|
}
|
|
55
66
|
return self;
|
|
56
67
|
}
|
|
@@ -64,6 +75,9 @@ RCT_EXPORT_MODULE();
|
|
|
64
75
|
|
|
65
76
|
// Send the data to React Native via event emitter
|
|
66
77
|
[self sendEventWithName:@"cgmDeviceEvent" body:@{@"status": @"WARM_PERIOD_STARTED"}];
|
|
78
|
+
[self sendEventWithName:@"cgmwatchdemoclicked" body:@{@"status": @"cgm_watch_demo_clicked"}];
|
|
79
|
+
[self sendEventWithName:@"cgmWAsupportclicked" body:@{@"status": @"cgm_WA_support_clicked"}];
|
|
80
|
+
|
|
67
81
|
}
|
|
68
82
|
|
|
69
83
|
// Private helper
|
|
@@ -259,68 +273,59 @@ RCT_EXPORT_METHOD(observeAllGlucoseData:(NSString *)token)
|
|
|
259
273
|
});
|
|
260
274
|
}
|
|
261
275
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
276
|
+
//--------------OLD FUNCTION-----------------
|
|
277
|
+
//RCT_EXPORT_METHOD(observeTransmitterUnbindStatus:(NSString *)token)
|
|
278
|
+
//{
|
|
279
|
+
// NSLog(@"Received token: %@", token);
|
|
280
|
+
// [[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
|
|
281
|
+
// [[NSUserDefaults standardUserDefaults] synchronize];
|
|
282
|
+
// FinalViewModelManager *manager = [FinalViewModelManager shared];
|
|
283
|
+
// [manager callForObserveTransmitterUnbindStatus];
|
|
284
|
+
//}
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
RCT_EXPORT_METHOD(observeTransmitterUnbindStatus:(NSString *)token
|
|
289
|
+
response:(NSString *)responseJsonString
|
|
290
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
291
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
266
292
|
{
|
|
293
|
+
if (responseJsonString == nil || ![responseJsonString isKindOfClass:[NSString class]]) {
|
|
294
|
+
NSError *error = [NSError errorWithDomain:@"CgmTrackyLib"
|
|
295
|
+
code:1001
|
|
296
|
+
userInfo:@{NSLocalizedDescriptionKey: @"Invalid or nil JSON string passed from JS"}];
|
|
297
|
+
reject(@"invalid_params", @"Response JSON string is nil or invalid", error);
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// Parse JSON string to NSDictionary
|
|
302
|
+
NSData *data = [responseJsonString dataUsingEncoding:NSUTF8StringEncoding];
|
|
303
|
+
NSError *parseError = nil;
|
|
304
|
+
NSDictionary *responseDict = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
|
|
305
|
+
|
|
306
|
+
if (parseError || ![responseDict isKindOfClass:[NSDictionary class]]) {
|
|
307
|
+
reject(@"json_parse_error", @"Failed to parse JSON string to dictionary", parseError);
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
|
|
267
311
|
// Save token
|
|
268
312
|
[[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
|
|
269
|
-
[[NSUserDefaults standardUserDefaults] synchronize];
|
|
270
313
|
|
|
271
|
-
// Save
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
[[NSUserDefaults standardUserDefaults] setObject:jsonData forKey:@"CGMStatusItem"];
|
|
275
|
-
[[NSUserDefaults standardUserDefaults] synchronize];
|
|
276
|
-
}
|
|
314
|
+
// Save response data
|
|
315
|
+
[[NSUserDefaults standardUserDefaults] setObject:data forKey:@"CGMStatusItem"];
|
|
316
|
+
[[NSUserDefaults standardUserDefaults] synchronize];
|
|
277
317
|
|
|
278
|
-
// Call
|
|
318
|
+
// Call manager logic
|
|
279
319
|
FinalViewModelManager *manager = [FinalViewModelManager shared];
|
|
280
320
|
[manager callForObserveTransmitterUnbindStatusWithCompletion:^(NSDictionary *response, NSError *error) {
|
|
281
|
-
if (
|
|
282
|
-
|
|
321
|
+
if (error) {
|
|
322
|
+
reject([NSString stringWithFormat:@"%ld", (long)error.code], error.localizedDescription, error);
|
|
323
|
+
} else {
|
|
324
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
325
|
+
resolve(response ?: @{});
|
|
326
|
+
});
|
|
283
327
|
}
|
|
284
328
|
}];
|
|
285
329
|
}
|
|
286
330
|
|
|
287
|
-
//RCT_EXPORT_METHOD(observeTransmitterUnbindStatus:(NSString *)token response:(NSString *)responseJsonString)
|
|
288
|
-
//{
|
|
289
|
-
// // Optional: Parse the JSON string if needed
|
|
290
|
-
// NSData *jsonData = [responseJsonString dataUsingEncoding:NSUTF8StringEncoding];
|
|
291
|
-
// NSError *jsonError;
|
|
292
|
-
// NSDictionary *responseDict = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&jsonError];
|
|
293
|
-
//
|
|
294
|
-
// if (jsonError) {
|
|
295
|
-
// NSLog(@"Failed to parse JSON: %@", jsonError.localizedDescription);
|
|
296
|
-
// [self sendEventWithName:@"observeTransmitterUnbindStatusHandler" body:@{
|
|
297
|
-
// @"token": token ?: @"",
|
|
298
|
-
// @"success": @NO,
|
|
299
|
-
// @"error": @"Invalid JSON response from JS"
|
|
300
|
-
// }];
|
|
301
|
-
// return;
|
|
302
|
-
// }
|
|
303
|
-
//
|
|
304
|
-
// // Now you have responseDict, you can use it
|
|
305
|
-
// [self observeTransmitterUnbindStatusInternal:token response:responseDict completion:^(NSDictionary *response, NSError *error) {
|
|
306
|
-
// if (error) {
|
|
307
|
-
// NSDictionary *errorPayload = @{
|
|
308
|
-
// @"token": token ?: @"",
|
|
309
|
-
// @"success": @NO,
|
|
310
|
-
// @"error": error.localizedDescription ?: @"Unknown error"
|
|
311
|
-
// };
|
|
312
|
-
// [self sendEventWithName:@"observeTransmitterUnbindStatusHandler" body:errorPayload];
|
|
313
|
-
// } else {
|
|
314
|
-
// NSDictionary *successPayload = @{
|
|
315
|
-
// @"token": token ?: @"",
|
|
316
|
-
// @"responseFromBackend": response ?: @{},
|
|
317
|
-
// @"responseFromJS": responseDict ?: @{},
|
|
318
|
-
// @"success": @YES
|
|
319
|
-
// };
|
|
320
|
-
// [self sendEventWithName:@"observeTransmitterUnbindStatusHandler" body:successPayload];
|
|
321
|
-
// }
|
|
322
|
-
// }];
|
|
323
|
-
//
|
|
324
|
-
//}
|
|
325
|
-
|
|
326
331
|
@end
|
package/ios/Support/API.swift
CHANGED
|
@@ -72,6 +72,7 @@ class AttachTransmitterViewController: UIViewController {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
customTopView.onDemoTapped = {
|
|
75
|
+
NotificationCenter.default.post(name: Notification.Name("cgmwatchdemoclicked"), object: nil, userInfo: ["a":"a"])
|
|
75
76
|
let webVC = WebViewController()
|
|
76
77
|
webVC.modalPresentationStyle = .formSheet
|
|
77
78
|
webVC.videoURL = URL(string: watchCGMVideo)
|
|
@@ -27,6 +27,7 @@ class ChatWithExpertViewController: UIViewController {
|
|
|
27
27
|
super.viewDidLoad()
|
|
28
28
|
// Do any additional setup after loading the view.
|
|
29
29
|
setupLayout()
|
|
30
|
+
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
func setupLayout() {
|
|
@@ -43,6 +44,9 @@ class ChatWithExpertViewController: UIViewController {
|
|
|
43
44
|
buttonBack.titleLabel?.font = FontManager.font(ofSize: 16, weight: .medium)
|
|
44
45
|
bottomButton.labelText = "Proceed"
|
|
45
46
|
bottomButton.showLeftWhatsappImage()
|
|
47
|
+
|
|
48
|
+
NotificationCenter.default.post(name: Notification.Name("cgmWAsupportclicked"), object: nil, userInfo: ["a":"a"])
|
|
49
|
+
|
|
46
50
|
bottomButton.buttonTapCallback = {
|
|
47
51
|
|
|
48
52
|
if let url = URL(string: "https://wa.aisensy.com/aaa1qv") {
|
|
@@ -99,6 +99,7 @@ class ConnectToSensorViewController: UIViewController {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
customTopView.onDemoTapped = {
|
|
102
|
+
NotificationCenter.default.post(name: Notification.Name("cgmwatchdemoclicked"), object: nil, userInfo: ["a":"a"])
|
|
102
103
|
let webVC = WebViewController()
|
|
103
104
|
webVC.modalPresentationStyle = .formSheet
|
|
104
105
|
webVC.videoURL = URL(string: watchCGMVideo)
|
|
@@ -96,12 +96,21 @@ class ConnectToTransmitterViewController: UIViewController, KLTBluetoothDelegate
|
|
|
96
96
|
}
|
|
97
97
|
bottomButton.buttonTapCallback = {
|
|
98
98
|
if self.isForReconnect {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
if self.bottomButton.labelText == "Retry" {
|
|
100
|
+
self.manager?.bluetoothDelegate = self
|
|
101
|
+
self.manager?.startScan()
|
|
102
|
+
self.screenType = .searching
|
|
103
|
+
self.tableView.reloadData()
|
|
104
|
+
self.bottomButton.hideRightArrow()
|
|
105
|
+
} else {
|
|
106
|
+
let vc = ConnectToSensorViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|
|
107
|
+
vc.connected = {
|
|
108
|
+
//self.showConfirmInsulinUser()
|
|
109
|
+
}
|
|
110
|
+
vc.isFromReconnect = true
|
|
111
|
+
self.navigationController?.pushViewController(vc, animated: false)
|
|
102
112
|
}
|
|
103
|
-
|
|
104
|
-
self.navigationController?.pushViewController(vc, animated: false)
|
|
113
|
+
|
|
105
114
|
// NotificationCenter.default.post(name: Notification.Name("cgmDeviceEvent"), object: nil, userInfo: ["a":"a"])
|
|
106
115
|
// if let rootVC = UIApplication.shared.connectedScenes
|
|
107
116
|
// .compactMap({ ($0 as? UIWindowScene)?.windows.first?.rootViewController })
|
|
@@ -112,6 +121,8 @@ class ConnectToTransmitterViewController: UIViewController, KLTBluetoothDelegate
|
|
|
112
121
|
// }
|
|
113
122
|
} else {
|
|
114
123
|
if self.screenType == .error {
|
|
124
|
+
self.manager?.bluetoothDelegate = self
|
|
125
|
+
self.manager?.startScan()
|
|
115
126
|
self.bottomButton.disable()
|
|
116
127
|
self.screenType = .searching
|
|
117
128
|
self.tableView.reloadData()
|
|
@@ -126,6 +137,7 @@ class ConnectToTransmitterViewController: UIViewController, KLTBluetoothDelegate
|
|
|
126
137
|
}
|
|
127
138
|
|
|
128
139
|
customTopView.onDemoTapped = {
|
|
140
|
+
NotificationCenter.default.post(name: Notification.Name("cgmwatchdemoclicked"), object: nil, userInfo: ["a":"a"])
|
|
129
141
|
let webVC = WebViewController()
|
|
130
142
|
webVC.modalPresentationStyle = .formSheet
|
|
131
143
|
webVC.videoURL = URL(string: watchCGMVideo)
|
|
@@ -297,6 +309,7 @@ extension ConnectToTransmitterViewController: UITableViewDelegate, UITableViewDa
|
|
|
297
309
|
|
|
298
310
|
//cell.labelDesc.text = "Sno:\(devices[indexPath.row].name)"
|
|
299
311
|
cell.button.buttonTapCallback = {
|
|
312
|
+
|
|
300
313
|
if self.isForReconnect {
|
|
301
314
|
self.sensorForceEnd()
|
|
302
315
|
}
|
|
@@ -304,7 +317,7 @@ extension ConnectToTransmitterViewController: UITableViewDelegate, UITableViewDa
|
|
|
304
317
|
if !KLTLocalSettingManager.shareInstance().canConnectOtherDevice {
|
|
305
318
|
return
|
|
306
319
|
}
|
|
307
|
-
|
|
320
|
+
|
|
308
321
|
self.manager?.stopScan()
|
|
309
322
|
if self.foundDevices.count > indexPath.row {
|
|
310
323
|
let peripheral = self.foundDevices[indexPath.row] as! CBPeripheral
|
|
@@ -45,11 +45,14 @@ class ProvidePermissionViewController: UIViewController {
|
|
|
45
45
|
|
|
46
46
|
bottomButton.labelText = "Proceed"
|
|
47
47
|
bottomButton.buttonTapCallback = {
|
|
48
|
+
let isForReconnect = UserDefaults.standard.bool(forKey: "isForReconnect")
|
|
48
49
|
let vc = ConnectToTransmitterViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|
|
50
|
+
vc.isForReconnect = isForReconnect
|
|
49
51
|
self.navigationController?.pushViewController(vc, animated: false)
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
customTopView.onDemoTapped = {
|
|
55
|
+
NotificationCenter.default.post(name: Notification.Name("cgmwatchdemoclicked"), object: nil, userInfo: ["a":"a"])
|
|
53
56
|
let webVC = WebViewController()
|
|
54
57
|
webVC.modalPresentationStyle = .formSheet
|
|
55
58
|
webVC.videoURL = URL(string: watchCGMVideo)
|
|
@@ -42,6 +42,7 @@ class PutOnTheSensorViewController: UIViewController {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
customTopView.onDemoTapped = {
|
|
45
|
+
NotificationCenter.default.post(name: Notification.Name("cgmwatchdemoclicked"), object: nil, userInfo: ["a":"a"])
|
|
45
46
|
let webVC = WebViewController()
|
|
46
47
|
webVC.modalPresentationStyle = .formSheet
|
|
47
48
|
webVC.videoURL = URL(string: watchCGMVideo)
|
|
@@ -51,8 +51,7 @@ class StartConnectionViewController: UIViewController {
|
|
|
51
51
|
ImageTVC.self,
|
|
52
52
|
ChargingIndicatorTVC.self])
|
|
53
53
|
tableView.reloadData()
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
|
|
56
55
|
let isForReconnect = UserDefaults.standard.bool(forKey: "isForReconnect")
|
|
57
56
|
if isForReconnect{
|
|
58
57
|
checkLocationPermission()
|
|
@@ -74,6 +73,7 @@ class StartConnectionViewController: UIViewController {
|
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
customTopView.onDemoTapped = {
|
|
76
|
+
NotificationCenter.default.post(name: Notification.Name("cgmwatchdemoclicked"), object: nil, userInfo: ["a":"a"])
|
|
77
77
|
let webVC = WebViewController()
|
|
78
78
|
webVC.modalPresentationStyle = .formSheet // or .pageSheet, .fullScreen
|
|
79
79
|
webVC.videoURL = URL(string: watchCGMVideo)
|
|
@@ -95,7 +95,9 @@ class StartConnectionViewController: UIViewController {
|
|
|
95
95
|
|
|
96
96
|
private func updateBottomButtonState() {
|
|
97
97
|
if isBluetoothEnabled && isLocationEnabled {
|
|
98
|
+
let isForReconnect = UserDefaults.standard.bool(forKey: "isForReconnect")
|
|
98
99
|
let vc = ConnectToTransmitterViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|
|
100
|
+
vc.isForReconnect = isForReconnect
|
|
99
101
|
self.navigationController?.pushViewController(vc, animated: false)
|
|
100
102
|
} else {
|
|
101
103
|
let vc = ProvidePermissionViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|