react-native-mytatva-rn-sdk 1.2.31 → 1.2.33
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/build.gradle +144 -141
- package/android/src/main/AndroidManifest.xml +4 -1
- package/android/src/main/AndroidManifestNew.xml +141 -138
- package/android/src/main/java/com/mytatvarnsdk/CgmTrackyLibModule.kt +71 -71
- package/android/src/main/java/com/mytatvarnsdk/MainApplication.kt +4 -4
- package/android/src/main/java/com/mytatvarnsdk/activity/ConnectSensorActivity.kt +13 -2
- package/android/src/main/java/com/mytatvarnsdk/activity/PermissionActivity.kt +6 -0
- package/android/src/main/java/com/mytatvarnsdk/activity/PlaceSensorActivity.kt +82 -65
- package/android/src/main/java/com/mytatvarnsdk/activity/PlaceTransmitterActivity.kt +106 -89
- package/android/src/main/java/com/mytatvarnsdk/activity/SearchTransmitterActivity.kt +13 -7
- package/android/src/main/java/com/mytatvarnsdk/activity/SensorConnectSuccessActivity.kt +6 -0
- package/android/src/main/java/com/mytatvarnsdk/activity/StartCGMActivity.kt +63 -57
- package/android/src/main/java/com/mytatvarnsdk/activity/VideoActivity.kt +94 -0
- package/android/src/main/res/drawable/radio_button_background.xml +1 -1
- package/android/src/main/res/drawable/radio_checked.xml +1 -1
- package/android/src/main/res/layout/activity_connect_sensor.xml +497 -495
- package/android/src/main/res/layout/activity_place_sensor.xml +250 -238
- package/android/src/main/res/layout/activity_place_transmitter.xml +219 -207
- package/android/src/main/res/layout/activity_search_transmitter.xml +716 -714
- package/android/src/main/res/layout/activity_start_cgmactivity.xml +153 -153
- package/android/src/main/res/layout/activity_video.xml +32 -0
- package/android/src/main/res/values/styles.xml +1 -3
- package/ios/Database/KLTDatabaseHandler.m +8 -0
- package/lib/commonjs/CGMConnect.js +2 -2
- package/lib/commonjs/CGMConnect.js.map +1 -1
- package/lib/module/CGMConnect.js +2 -2
- package/lib/module/CGMConnect.js.map +1 -1
- package/lib/typescript/CGMConnect.d.ts +1 -1
- package/package.json +1 -1
- package/src/CGMConnect.ts +2 -2
|
@@ -126,111 +126,111 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
126
126
|
@ReactMethod
|
|
127
127
|
fun observeTransmitterUnbindStatus(token: String, apiResponse: String) {
|
|
128
128
|
try {
|
|
129
|
-
|
|
129
|
+
if (apiResponse != null && apiResponse.isNotEmpty()) {
|
|
130
|
+
userToken = token
|
|
130
131
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
/*authenticateSDKService.getCGMData(
|
|
133
|
+
environment = if ("uat".uppercase() == "PROD") TATVA_ENVIRONMENT.PROD else TATVA_ENVIRONMENT.STAGE,
|
|
134
|
+
token = userToken,
|
|
135
|
+
responseListener = object : AuthenticateSDKService.ResponseListener {
|
|
136
|
+
override fun onResponseSuccess(response: String) {
|
|
136
137
|
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
val response = Gson().fromJson(response, CgmSensorResponse::class.java)
|
|
139
|
+
val sensor = response.data?.firstOrNull()
|
|
139
140
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
if (sensor != null && !sensor.startDate.isNullOrEmpty() && !sensor.endDate.isNullOrEmpty()) {
|
|
142
|
+
val startDate = sensor.startDate
|
|
143
|
+
val endDate = sensor.endDate
|
|
144
|
+
val sensorId = sensor.sensorId
|
|
144
145
|
|
|
145
|
-
|
|
146
|
-
|
|
146
|
+
println("Start Date: $startDate")
|
|
147
|
+
println("End Date: $endDate")
|
|
147
148
|
|
|
148
|
-
|
|
149
|
+
if (isCurrentDateInRange(startDate, endDate)) {
|
|
150
|
+
|
|
151
|
+
println("Current date is in range")
|
|
149
152
|
|
|
150
|
-
|
|
153
|
+
val pocDevice =
|
|
154
|
+
RepositoryDevice.getInstance(BApplication.getContext()).latestDeviceIoThread
|
|
151
155
|
|
|
152
|
-
|
|
153
|
-
|
|
156
|
+
if (pocDevice != null) {
|
|
157
|
+
Log.d("pocDevice logsss", pocDevice.toString())
|
|
158
|
+
|
|
159
|
+
if (pocDevice.isUnBind) {
|
|
160
|
+
postEventDataToAPI(
|
|
161
|
+
pocDevice,
|
|
162
|
+
DeviceStatus.TRANSMITTER_DISCONNECT.id,
|
|
163
|
+
pocDevice.qrMessage
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
} else {
|
|
167
|
+
Log.d("pocDevice logsss", "Data null")
|
|
154
168
|
|
|
155
|
-
|
|
156
|
-
|
|
169
|
+
postEventDataToAPI(
|
|
170
|
+
pocDevice,
|
|
171
|
+
DeviceStatus.TRANSMITTER_DISCONNECT.id,
|
|
172
|
+
sensorId
|
|
173
|
+
)
|
|
174
|
+
}
|
|
157
175
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
pocDevice,
|
|
161
|
-
DeviceStatus.TRANSMITTER_DISCONNECT.id,
|
|
162
|
-
pocDevice.qrMessage
|
|
163
|
-
)
|
|
176
|
+
} else {
|
|
177
|
+
println("Current date is out of range")
|
|
164
178
|
}
|
|
165
179
|
} else {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
postEventDataToAPI(
|
|
169
|
-
pocDevice,
|
|
170
|
-
DeviceStatus.TRANSMITTER_DISCONNECT.id,
|
|
171
|
-
sensorId
|
|
172
|
-
)
|
|
180
|
+
println("Start or End date not available")
|
|
173
181
|
}
|
|
182
|
+
}
|
|
174
183
|
|
|
175
|
-
|
|
176
|
-
println("Current date is out of range")
|
|
184
|
+
override fun onResponseFail() {
|
|
177
185
|
}
|
|
178
|
-
} else {
|
|
179
|
-
println("Start or End date not available")
|
|
180
186
|
}
|
|
181
|
-
|
|
187
|
+
)*/
|
|
182
188
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
)*/
|
|
189
|
+
val response = Gson().fromJson(apiResponse, CgmSensorResponse::class.java)
|
|
190
|
+
val sensor = response.data?.firstOrNull()
|
|
187
191
|
|
|
188
|
-
|
|
189
|
-
|
|
192
|
+
if (sensor != null && !sensor.startDate.isNullOrEmpty() && !sensor.endDate.isNullOrEmpty()) {
|
|
193
|
+
val startDate = sensor.startDate
|
|
194
|
+
val endDate = sensor.endDate
|
|
195
|
+
val sensorId = sensor.sensorId
|
|
190
196
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
val endDate = sensor.endDate
|
|
194
|
-
val sensorId = sensor.sensorId
|
|
197
|
+
println("Start Date: $startDate")
|
|
198
|
+
println("End Date: $endDate")
|
|
195
199
|
|
|
196
|
-
|
|
197
|
-
println("End Date: $endDate")
|
|
200
|
+
if (isCurrentDateInRange(startDate, endDate)) {
|
|
198
201
|
|
|
199
|
-
|
|
202
|
+
println("Current date is in range")
|
|
200
203
|
|
|
201
|
-
|
|
204
|
+
val pocDevice =
|
|
205
|
+
RepositoryDevice.getInstance(BApplication.getContext()).latestDeviceIoThread
|
|
202
206
|
|
|
203
|
-
|
|
204
|
-
|
|
207
|
+
if (pocDevice != null) {
|
|
208
|
+
Log.d("pocDevice logsss", pocDevice.toString())
|
|
205
209
|
|
|
206
|
-
|
|
207
|
-
|
|
210
|
+
if (pocDevice.isUnBind) {
|
|
211
|
+
postEventDataToAPI(
|
|
212
|
+
pocDevice,
|
|
213
|
+
DeviceStatus.TRANSMITTER_DISCONNECT.id,
|
|
214
|
+
pocDevice.qrMessage
|
|
215
|
+
)
|
|
216
|
+
}
|
|
217
|
+
} else {
|
|
218
|
+
Log.d("pocDevice logsss", "Data null")
|
|
208
219
|
|
|
209
|
-
if (pocDevice.isUnBind) {
|
|
210
220
|
postEventDataToAPI(
|
|
211
221
|
pocDevice,
|
|
212
222
|
DeviceStatus.TRANSMITTER_DISCONNECT.id,
|
|
213
|
-
|
|
223
|
+
sensorId
|
|
214
224
|
)
|
|
215
225
|
}
|
|
216
|
-
} else {
|
|
217
|
-
Log.d("pocDevice logsss", "Data null")
|
|
218
226
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
DeviceStatus.TRANSMITTER_DISCONNECT.id,
|
|
222
|
-
sensorId
|
|
223
|
-
)
|
|
227
|
+
} else {
|
|
228
|
+
println("Current date is out of range")
|
|
224
229
|
}
|
|
225
|
-
|
|
226
230
|
} else {
|
|
227
|
-
println("
|
|
231
|
+
println("Start or End date not available")
|
|
228
232
|
}
|
|
229
|
-
} else {
|
|
230
|
-
println("Start or End date not available")
|
|
231
233
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
234
|
} catch (e: Exception) {
|
|
235
235
|
Log.e("observeTransmitterUnbindStatus", "observeTransmitterUnbindStatus: ${e.message}")
|
|
236
236
|
}
|
|
@@ -35,10 +35,6 @@ class MainApplication : BApplication(), ReactApplication {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
// ✅ FIXED: property override instead of method
|
|
39
|
-
override val reactNativeHost: ReactNativeHost
|
|
40
|
-
get() = mReactNativeHost
|
|
41
|
-
|
|
42
38
|
override fun onCreate() {
|
|
43
39
|
super.onCreate()
|
|
44
40
|
Log.d("MainApplication", "MainApplication onCreate called")
|
|
@@ -46,4 +42,8 @@ class MainApplication : BApplication(), ReactApplication {
|
|
|
46
42
|
BleService.startService(this)
|
|
47
43
|
BSharedPreferences.init(this)
|
|
48
44
|
}
|
|
45
|
+
|
|
46
|
+
override fun getReactNativeHost(): ReactNativeHost {
|
|
47
|
+
return mReactNativeHost
|
|
48
|
+
}
|
|
49
49
|
}
|
|
@@ -92,6 +92,12 @@ class ConnectSensorActivity : BaseBleActivity() {
|
|
|
92
92
|
startActivity(Intent(this, HelpActivity::class.java))
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
binding.toolbar.btnWatchDemo.setOnClickListener {
|
|
96
|
+
startActivity(
|
|
97
|
+
Intent(this, VideoActivity::class.java).putExtra("VideoId", "r5Zemc4R044")
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
95
101
|
val callback: OnBackPressedCallback = object : OnBackPressedCallback(true) {
|
|
96
102
|
override fun handleOnBackPressed() {
|
|
97
103
|
openExitDialog()
|
|
@@ -130,8 +136,13 @@ class ConnectSensorActivity : BaseBleActivity() {
|
|
|
130
136
|
binding.btnSupport.tvProceed.text = "Contact Support"
|
|
131
137
|
binding.btnRetry.tvProceed.text = "Retry"
|
|
132
138
|
|
|
133
|
-
binding.btnWatchDemo.
|
|
134
|
-
|
|
139
|
+
binding.btnWatchDemo.post {
|
|
140
|
+
binding.btnWatchDemo.setOnClickListener {
|
|
141
|
+
Log.d("CLICK", "Layout Clicked")
|
|
142
|
+
startActivity(
|
|
143
|
+
Intent(this, VideoActivity::class.java).putExtra("VideoId", "zRlFFdr-QD4")
|
|
144
|
+
)
|
|
145
|
+
}
|
|
135
146
|
}
|
|
136
147
|
|
|
137
148
|
binding.btnSupport.btnProceed.setOnClickListener {
|
|
@@ -149,6 +149,12 @@ class PermissionActivity : BasePermissionActivity() {
|
|
|
149
149
|
startActivity(Intent(this, HelpActivity::class.java))
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
binding.toolbar.btnWatchDemo.setOnClickListener {
|
|
153
|
+
startActivity(
|
|
154
|
+
Intent(this, VideoActivity::class.java).putExtra("VideoId", "r5Zemc4R044")
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
|
|
152
158
|
binding.tvKnowMore.setOnClickListener {
|
|
153
159
|
openBluetoothDialog()
|
|
154
160
|
}
|
|
@@ -19,85 +19,102 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
|
|
19
19
|
import com.mytatvarnsdk.R
|
|
20
20
|
import com.mytatvarnsdk.databinding.ActivityPlaceSensorBinding
|
|
21
21
|
import com.mytatvarnsdk.databinding.ExitDialogBottomsheetBinding
|
|
22
|
+
import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.YouTubePlayer
|
|
23
|
+
import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.listeners.AbstractYouTubePlayerListener
|
|
24
|
+
import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.listeners.FullscreenListener
|
|
25
|
+
import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.options.IFramePlayerOptions
|
|
22
26
|
|
|
23
27
|
class PlaceSensorActivity : AppCompatActivity() {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
private fun init() {
|
|
40
|
-
Glide.with(this)
|
|
41
|
-
.load(R.drawable.img_male)
|
|
42
|
-
.transform(RoundedCorners(50))
|
|
43
|
-
.into(binding.ivTransmitter)
|
|
44
|
-
|
|
45
|
-
Glide.with(this)
|
|
46
|
-
.asGif()
|
|
47
|
-
.load(R.drawable.ic_play_gif)
|
|
48
|
-
.into(binding.ivPlay)
|
|
49
|
-
|
|
50
|
-
binding.toolbar.btnWhatsapp.setOnClickListener {
|
|
51
|
-
startActivity(Intent(this, HelpActivity::class.java))
|
|
28
|
+
private lateinit var binding: ActivityPlaceSensorBinding
|
|
29
|
+
|
|
30
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
|
31
|
+
super.onCreate(savedInstanceState)
|
|
32
|
+
binding = ActivityPlaceSensorBinding.inflate(layoutInflater)
|
|
33
|
+
enableEdgeToEdge()
|
|
34
|
+
setContentView(binding.root)
|
|
35
|
+
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
|
|
36
|
+
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
|
|
37
|
+
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
|
|
38
|
+
insets
|
|
39
|
+
}
|
|
40
|
+
init()
|
|
52
41
|
}
|
|
53
42
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
43
|
+
private fun init() {
|
|
44
|
+
Glide.with(this)
|
|
45
|
+
.load(R.drawable.img_male)
|
|
46
|
+
.transform(RoundedCorners(50))
|
|
47
|
+
.into(binding.ivTransmitter)
|
|
48
|
+
|
|
49
|
+
Glide.with(this)
|
|
50
|
+
.asGif()
|
|
51
|
+
.load(R.drawable.ic_play_gif)
|
|
52
|
+
.into(binding.ivPlay)
|
|
53
|
+
|
|
54
|
+
binding.toolbar.btnWhatsapp.setOnClickListener {
|
|
55
|
+
startActivity(Intent(this, HelpActivity::class.java))
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
binding.toolbar.btnWatchDemo.setOnClickListener {
|
|
59
|
+
startActivity(
|
|
60
|
+
Intent(this, VideoActivity::class.java).putExtra("VideoId", "r5Zemc4R044")
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
binding.commonButton.tvProceed.text = "I Have Placed The Sensor"
|
|
65
|
+
binding.commonButton.btnProceed.setOnClickListener {
|
|
66
|
+
startActivity(Intent(this, PlaceTransmitterActivity::class.java))
|
|
67
|
+
finish()
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
binding.toolbar.btnClose.setOnClickListener {
|
|
71
|
+
openExitDialog()
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
binding.ivPlay.setOnClickListener {
|
|
75
|
+
startActivity(
|
|
76
|
+
Intent(this, VideoActivity::class.java).putExtra("VideoId", "1C7VK2d5niY")
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
val callback: OnBackPressedCallback = object : OnBackPressedCallback(true) {
|
|
81
|
+
override fun handleOnBackPressed() {
|
|
82
|
+
openExitDialog()
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
onBackPressedDispatcher.addCallback(this, callback)
|
|
58
86
|
}
|
|
59
87
|
|
|
60
|
-
binding.toolbar.btnClose.setOnClickListener {
|
|
61
|
-
openExitDialog()
|
|
62
|
-
}
|
|
63
88
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
openExitDialog()
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
onBackPressedDispatcher.addCallback(this, callback)
|
|
70
|
-
}
|
|
89
|
+
private fun openExitDialog() {
|
|
90
|
+
val binding = ExitDialogBottomsheetBinding.inflate(layoutInflater)
|
|
71
91
|
|
|
72
|
-
|
|
73
|
-
|
|
92
|
+
val dialog = Dialog(this)
|
|
93
|
+
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
|
|
94
|
+
dialog.setContentView(binding.root)
|
|
74
95
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
96
|
+
val window = dialog.window
|
|
97
|
+
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
|
98
|
+
window?.setGravity(Gravity.BOTTOM)
|
|
99
|
+
window?.setBackgroundDrawable(Color.TRANSPARENT.toDrawable())
|
|
78
100
|
|
|
79
|
-
|
|
80
|
-
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
|
81
|
-
window?.setGravity(Gravity.BOTTOM)
|
|
82
|
-
window?.setBackgroundDrawable(Color.TRANSPARENT.toDrawable())
|
|
101
|
+
binding.btnExit.tvProceed.text = "Exit"
|
|
83
102
|
|
|
84
|
-
|
|
103
|
+
binding.btnExit.root.setOnClickListener(View.OnClickListener { v: View? ->
|
|
104
|
+
finish()
|
|
105
|
+
dialog.dismiss()
|
|
106
|
+
})
|
|
85
107
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
})
|
|
108
|
+
binding.btnCancel.root.setOnClickListener(View.OnClickListener { v: View? ->
|
|
109
|
+
dialog.dismiss()
|
|
110
|
+
})
|
|
90
111
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
112
|
+
binding.closeButton.setOnClickListener(View.OnClickListener { v: View? ->
|
|
113
|
+
dialog.dismiss()
|
|
114
|
+
})
|
|
94
115
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
dialog.show()
|
|
100
|
-
}
|
|
116
|
+
dialog.show()
|
|
117
|
+
}
|
|
101
118
|
|
|
102
119
|
|
|
103
120
|
}
|
|
@@ -25,121 +25,138 @@ import com.mytatvarnsdk.CgmTrackyLibModule
|
|
|
25
25
|
import com.mytatvarnsdk.R
|
|
26
26
|
import com.mytatvarnsdk.databinding.ActivityPlaceTransmitterBinding
|
|
27
27
|
import com.mytatvarnsdk.databinding.ExitDialogBottomsheetBinding
|
|
28
|
+
import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.YouTubePlayer
|
|
29
|
+
import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.listeners.AbstractYouTubePlayerListener
|
|
30
|
+
import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.listeners.FullscreenListener
|
|
31
|
+
import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.options.IFramePlayerOptions
|
|
28
32
|
|
|
29
33
|
class PlaceTransmitterActivity : AppCompatActivity() {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
private lateinit var binding: ActivityPlaceTransmitterBinding
|
|
35
|
+
private val reactContext = CgmTrackyLibModule.mReactContext
|
|
36
|
+
|
|
37
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
|
38
|
+
super.onCreate(savedInstanceState)
|
|
39
|
+
binding = ActivityPlaceTransmitterBinding.inflate(layoutInflater)
|
|
40
|
+
enableEdgeToEdge()
|
|
41
|
+
setContentView(binding.root)
|
|
42
|
+
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
|
|
43
|
+
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
|
|
44
|
+
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
|
|
45
|
+
insets
|
|
46
|
+
}
|
|
47
|
+
init()
|
|
42
48
|
}
|
|
43
|
-
init()
|
|
44
|
-
}
|
|
45
49
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
private fun init() {
|
|
51
|
+
Glide.with(this)
|
|
52
|
+
.load(R.drawable.img_female)
|
|
53
|
+
.transform(RoundedCorners(50))
|
|
54
|
+
.into(binding.ivTransmitter)
|
|
51
55
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
Glide.with(this)
|
|
57
|
+
.asGif()
|
|
58
|
+
.load(R.drawable.ic_play_gif)
|
|
59
|
+
.into(binding.ivPlay)
|
|
56
60
|
|
|
57
|
-
|
|
61
|
+
binding.commonButton.tvProceed.text = "Complete"
|
|
58
62
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
binding.commonButton.btnProceed.setOnClickListener {
|
|
64
|
+
sendDataToRN("")
|
|
65
|
+
finish()
|
|
66
|
+
}
|
|
63
67
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
binding.toolbar.btnWhatsapp.setOnClickListener {
|
|
69
|
+
startActivity(Intent(this, HelpActivity::class.java))
|
|
70
|
+
}
|
|
67
71
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
binding.toolbar.btnWatchDemo.setOnClickListener {
|
|
73
|
+
startActivity(
|
|
74
|
+
Intent(this, VideoActivity::class.java).putExtra("VideoId", "r5Zemc4R044")
|
|
75
|
+
)
|
|
76
|
+
}
|
|
71
77
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
binding.toolbar.btnClose.setOnClickListener {
|
|
79
|
+
openExitDialog()
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
binding.ivPlay.setOnClickListener {
|
|
83
|
+
startActivity(
|
|
84
|
+
Intent(this, VideoActivity::class.java).putExtra("VideoId", "1C7VK2d5niY")
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
val callback: OnBackPressedCallback = object : OnBackPressedCallback(true) {
|
|
89
|
+
override fun handleOnBackPressed() {
|
|
90
|
+
openExitDialog()
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
onBackPressedDispatcher.addCallback(this, callback)
|
|
76
94
|
}
|
|
77
|
-
onBackPressedDispatcher.addCallback(this, callback)
|
|
78
|
-
}
|
|
79
95
|
|
|
80
|
-
private fun openExitDialog() {
|
|
81
|
-
val binding = ExitDialogBottomsheetBinding.inflate(layoutInflater)
|
|
82
96
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
dialog.setContentView(binding.root)
|
|
97
|
+
private fun openExitDialog() {
|
|
98
|
+
val binding = ExitDialogBottomsheetBinding.inflate(layoutInflater)
|
|
86
99
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
window?.setBackgroundDrawable(Color.TRANSPARENT.toDrawable())
|
|
100
|
+
val dialog = Dialog(this)
|
|
101
|
+
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
|
|
102
|
+
dialog.setContentView(binding.root)
|
|
91
103
|
|
|
92
|
-
|
|
104
|
+
val window = dialog.window
|
|
105
|
+
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
|
106
|
+
window?.setGravity(Gravity.BOTTOM)
|
|
107
|
+
window?.setBackgroundDrawable(Color.TRANSPARENT.toDrawable())
|
|
93
108
|
|
|
94
|
-
|
|
95
|
-
finish()
|
|
96
|
-
dialog.dismiss()
|
|
97
|
-
})
|
|
109
|
+
binding.btnExit.tvProceed.text = "Exit"
|
|
98
110
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
111
|
+
binding.btnExit.root.setOnClickListener(View.OnClickListener { v: View? ->
|
|
112
|
+
finish()
|
|
113
|
+
dialog.dismiss()
|
|
114
|
+
})
|
|
102
115
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
116
|
+
binding.btnCancel.root.setOnClickListener(View.OnClickListener { v: View? ->
|
|
117
|
+
dialog.dismiss()
|
|
118
|
+
})
|
|
106
119
|
|
|
107
|
-
|
|
108
|
-
|
|
120
|
+
binding.closeButton.setOnClickListener(View.OnClickListener { v: View? ->
|
|
121
|
+
dialog.dismiss()
|
|
122
|
+
})
|
|
109
123
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
try {
|
|
113
|
-
val catalystInstance: CatalystInstance = reactContext.catalystInstance
|
|
114
|
-
val module = catalystInstance.getNativeModule(CgmTrackyLibModule::class.java)
|
|
124
|
+
dialog.show()
|
|
125
|
+
}
|
|
115
126
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
127
|
+
private fun sendDataToRN(data: String) {
|
|
128
|
+
if (reactContext != null) {
|
|
129
|
+
try {
|
|
130
|
+
val catalystInstance: CatalystInstance = reactContext.catalystInstance
|
|
131
|
+
val module = catalystInstance.getNativeModule(CgmTrackyLibModule::class.java)
|
|
132
|
+
|
|
133
|
+
if (module == null) {
|
|
134
|
+
sendDataToRNDirectly("", "WARM_PERIOD_STARTED")
|
|
135
|
+
Log.d("sendDataToRN: ", "Module null")
|
|
136
|
+
} else {
|
|
137
|
+
module.sendDataToReact(data, "WARM_PERIOD_STARTED", "cgmDeviceEvent")
|
|
138
|
+
Log.d("sendDataToRN: ", "Module is not null")
|
|
139
|
+
}
|
|
140
|
+
} catch (e: Exception) {
|
|
141
|
+
Log.e("sendDataToRN: Error ", e.message.toString())
|
|
142
|
+
}
|
|
119
143
|
} else {
|
|
120
|
-
|
|
121
|
-
Log.d("sendDataToRN: ", "Module is not null")
|
|
144
|
+
Log.e("TrackyActivity", "ReactApplicationContext is null")
|
|
122
145
|
}
|
|
123
|
-
} catch (e: Exception) {
|
|
124
|
-
Log.e("sendDataToRN: Error ", e.message.toString())
|
|
125
|
-
}
|
|
126
|
-
} else {
|
|
127
|
-
Log.e("TrackyActivity", "ReactApplicationContext is null")
|
|
128
146
|
}
|
|
129
|
-
}
|
|
130
147
|
|
|
131
148
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
149
|
+
private fun sendDataToRNDirectly(data: String, status: String) {
|
|
150
|
+
try {
|
|
151
|
+
val map: WritableMap = Arguments.createMap().apply {
|
|
152
|
+
putString("data", data)
|
|
153
|
+
putString("status", status)
|
|
154
|
+
}
|
|
138
155
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
156
|
+
reactContext?.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
157
|
+
?.emit("cgmDeviceEvent", map)
|
|
158
|
+
} catch (e: Exception) {
|
|
159
|
+
Log.e("sendDataToRNDirectly", "Error sending data to React", e)
|
|
160
|
+
}
|
|
143
161
|
}
|
|
144
|
-
}
|
|
145
162
|
}
|