react-native-mytatva-rn-sdk 1.2.97 → 1.2.98
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 +25 -0
- package/android/src/main/java/com/mytatvarnsdk/activity/ConnectSensorActivity.kt +12 -12
- package/android/src/main/java/com/mytatvarnsdk/activity/HelpActivity.kt +3 -9
- package/android/src/main/java/com/mytatvarnsdk/activity/PermissionActivity.kt +8 -16
- package/android/src/main/java/com/mytatvarnsdk/activity/PlaceSensorActivity.kt +12 -13
- package/android/src/main/java/com/mytatvarnsdk/activity/PlaceTransmitterActivity.kt +12 -13
- package/android/src/main/java/com/mytatvarnsdk/activity/SearchTransmitterActivity.kt +9 -14
- package/android/src/main/java/com/mytatvarnsdk/activity/SensorConnectSuccessActivity.kt +12 -16
- package/android/src/main/java/com/mytatvarnsdk/activity/StartCGMActivity.kt +9 -15
- package/android/src/main/java/com/mytatvarnsdk/activity/VideoActivity.kt +96 -50
- package/android/src/main/java/com/mytatvarnsdk/network/AuthenticateSDKService.kt +50 -0
- package/android/src/main/java/com/mytatvarnsdk/utils/CustomerSupportConfig.kt +137 -0
- package/android/src/main/java/com/mytatvarnsdk/utils/ToolbarSupportHelper.kt +83 -0
- package/ios/Custom/CustomTopUIView.swift +25 -0
- package/ios/MyReactNativeBridge.m +4 -0
- package/ios/Support/API.swift +117 -18
- package/ios/Support/CustomTopViewSupportHelper.swift +55 -0
- package/ios/Support/CustomerSupportConfig.swift +169 -0
- package/ios/Support/Global.swift +2 -2
- package/ios/Support/GlobalYouTubePlayerView.swift +102 -11
- package/ios/ViewControllers/AttachTransmitterViewController.swift +16 -21
- package/ios/ViewControllers/ChatWithExpertViewController.swift +1 -7
- package/ios/ViewControllers/ConnectToSensorViewController.swift +16 -21
- package/ios/ViewControllers/ConnectToTransmitterViewController.swift +16 -21
- package/ios/ViewControllers/ProvidePermissionViewController.swift +16 -21
- package/ios/ViewControllers/PutOnTheSensorViewController.swift +16 -21
- package/ios/ViewControllers/StartConnectionViewController.swift +18 -25
- package/ios/ViewModel/FinalViewModel.swift +2 -2
- package/package.json +1 -1
|
@@ -44,6 +44,7 @@ import com.mytatvarnsdk.model.GlucoseLogRequest
|
|
|
44
44
|
import com.mytatvarnsdk.model.MainActivityModel
|
|
45
45
|
import com.mytatvarnsdk.network.AuthenticateSDKService
|
|
46
46
|
import com.mytatvarnsdk.network.AuthenticateSDKService.LoaderListener
|
|
47
|
+
import com.mytatvarnsdk.utils.CustomerSupportConfig
|
|
47
48
|
import com.mytatvarnsdk.utils.DeviceStatus
|
|
48
49
|
import com.mytatvarnsdk.utils.TATVA_ENVIRONMENT
|
|
49
50
|
import io.sentry.ScopeCallback
|
|
@@ -379,6 +380,28 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
379
380
|
}
|
|
380
381
|
}
|
|
381
382
|
|
|
383
|
+
private fun fetchCustomerSupportDetails() {
|
|
384
|
+
if (userToken.isEmpty()) {
|
|
385
|
+
CustomerSupportConfig.applyFailureDefaults()
|
|
386
|
+
return
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
val environment =
|
|
390
|
+
if (env.lowercase() == "uat") TATVA_ENVIRONMENT.STAGE else TATVA_ENVIRONMENT.PROD
|
|
391
|
+
|
|
392
|
+
authenticateSDKService.fetchCustomerSupportDetails(
|
|
393
|
+
environment = environment,
|
|
394
|
+
token = userToken,
|
|
395
|
+
onSuccess = { response ->
|
|
396
|
+
CustomerSupportConfig.updateFromResponse(response)
|
|
397
|
+
},
|
|
398
|
+
onFailure = {
|
|
399
|
+
Log.w("fetchCustomerSupportDetails", "Failed to fetch customer support details, using failure defaults")
|
|
400
|
+
CustomerSupportConfig.applyFailureDefaults()
|
|
401
|
+
}
|
|
402
|
+
)
|
|
403
|
+
}
|
|
404
|
+
|
|
382
405
|
@ReactMethod
|
|
383
406
|
fun observeDeviceStatus(token: String, envType: String) {
|
|
384
407
|
try {
|
|
@@ -700,6 +723,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
700
723
|
updateUserData(userData)
|
|
701
724
|
userToken = token
|
|
702
725
|
env = envType.lowercase()
|
|
726
|
+
fetchCustomerSupportDetails()
|
|
703
727
|
val intent = Intent(currentActivity, StartCGMActivity::class.java)
|
|
704
728
|
intent.putExtra("envType", env)
|
|
705
729
|
currentActivity?.startActivity(intent)
|
|
@@ -728,6 +752,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
728
752
|
updateUserData(userData)
|
|
729
753
|
userToken = token
|
|
730
754
|
env = envType.lowercase()
|
|
755
|
+
fetchCustomerSupportDetails()
|
|
731
756
|
currentActivity?.startActivity(
|
|
732
757
|
Intent(currentActivity, StartCGMActivity::class.java).putExtra(
|
|
733
758
|
"IsForReconnect",
|
|
@@ -42,6 +42,7 @@ import com.mytatvarnsdk.myView.progress.ProgressManagement
|
|
|
42
42
|
import com.mytatvarnsdk.myView.progress.ProgressType
|
|
43
43
|
import com.mytatvarnsdk.network.AuthenticateSDKService
|
|
44
44
|
import com.mytatvarnsdk.utils.TATVA_ENVIRONMENT
|
|
45
|
+
import com.mytatvarnsdk.utils.ToolbarSupportHelper
|
|
45
46
|
import com.mytatvarnsdk.utils.CgmModuleSentryLog.logModuleEvent
|
|
46
47
|
import com.mytatvarnsdk.utils.CgmModuleSentryLog.safeLogModuleEvent
|
|
47
48
|
import io.sentry.SentryLogLevel
|
|
@@ -102,19 +103,14 @@ class ConnectSensorActivity : BaseBleActivity() {
|
|
|
102
103
|
openExitDialog()
|
|
103
104
|
}
|
|
104
105
|
|
|
105
|
-
binding.toolbar.btnWhatsapp
|
|
106
|
-
startActivity(
|
|
107
|
-
Intent(this, HelpActivity::class.java).putExtra("ScreenName", "Sensor page")
|
|
108
|
-
)
|
|
109
|
-
}
|
|
106
|
+
ToolbarSupportHelper.bindWhatsappButton(this, binding.toolbar.btnWhatsapp)
|
|
110
107
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
108
|
+
ToolbarSupportHelper.configureWatchDemoButton(
|
|
109
|
+
context = this,
|
|
110
|
+
btnWatchDemo = binding.toolbar.btnWatchDemo,
|
|
111
|
+
isForReconnect = isForReconnect,
|
|
112
|
+
onClickAnalytics = { sendDataToRN("", "cgm_watch_demo_clicked") }
|
|
113
|
+
)
|
|
118
114
|
|
|
119
115
|
val callback: OnBackPressedCallback = object : OnBackPressedCallback(true) {
|
|
120
116
|
override fun handleOnBackPressed() {
|
|
@@ -700,4 +696,8 @@ class ConnectSensorActivity : BaseBleActivity() {
|
|
|
700
696
|
|
|
701
697
|
}
|
|
702
698
|
|
|
699
|
+
override fun onResume() {
|
|
700
|
+
super.onResume()
|
|
701
|
+
}
|
|
702
|
+
|
|
703
703
|
}
|
|
@@ -17,6 +17,8 @@ import com.facebook.react.bridge.WritableMap
|
|
|
17
17
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
18
18
|
import com.mytatvarnsdk.CgmTrackyLibModule
|
|
19
19
|
import com.mytatvarnsdk.R
|
|
20
|
+
import com.mytatvarnsdk.utils.CustomerSupportConfig
|
|
21
|
+
import com.mytatvarnsdk.utils.ToolbarSupportHelper
|
|
20
22
|
import com.mytatvarnsdk.databinding.ActivityHelpBinding
|
|
21
23
|
import org.json.JSONObject
|
|
22
24
|
|
|
@@ -109,15 +111,7 @@ class HelpActivity : AppCompatActivity() {
|
|
|
109
111
|
}
|
|
110
112
|
|
|
111
113
|
private fun openWhatsApp() {
|
|
112
|
-
|
|
113
|
-
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(waBotUrl))
|
|
114
|
-
try {
|
|
115
|
-
// You don't need to set the package for browser-based WhatsApp bots
|
|
116
|
-
startActivity(intent)
|
|
117
|
-
} catch (e: Exception) {
|
|
118
|
-
e.printStackTrace()
|
|
119
|
-
Toast.makeText(this, "Error opening WhatsApp Bot", Toast.LENGTH_SHORT).show()
|
|
120
|
-
}
|
|
114
|
+
ToolbarSupportHelper.openWhatsApp(this, CustomerSupportConfig.effectiveWhatsAppNumber())
|
|
121
115
|
}
|
|
122
116
|
|
|
123
117
|
private fun sendDataToRN(data: String, status: String) {
|
|
@@ -36,6 +36,7 @@ import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
|
36
36
|
import com.mytatvarnsdk.CgmTrackyLibModule
|
|
37
37
|
import com.mytatvarnsdk.R
|
|
38
38
|
import com.mytatvarnsdk.base.BasePermissionActivity
|
|
39
|
+
import com.mytatvarnsdk.utils.ToolbarSupportHelper
|
|
39
40
|
import com.mytatvarnsdk.databinding.ActivityPermissionBinding
|
|
40
41
|
import com.mytatvarnsdk.databinding.BluetoothDialogBottomsheetBinding
|
|
41
42
|
import com.mytatvarnsdk.databinding.ExitDialogBottomsheetBinding
|
|
@@ -170,23 +171,14 @@ class PermissionActivity : BasePermissionActivity() {
|
|
|
170
171
|
finish()
|
|
171
172
|
}
|
|
172
173
|
|
|
173
|
-
binding.toolbar.btnWhatsapp
|
|
174
|
-
startActivity(
|
|
175
|
-
Intent(this, HelpActivity::class.java)
|
|
176
|
-
.putExtra("ScreenName", "connection journey page")
|
|
177
|
-
)
|
|
178
|
-
}
|
|
174
|
+
ToolbarSupportHelper.bindWhatsappButton(this, binding.toolbar.btnWhatsapp)
|
|
179
175
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
if (isForReconnect) "n_pUrFoZ1wQ" else "r5Zemc4R044"
|
|
187
|
-
)
|
|
188
|
-
)
|
|
189
|
-
}
|
|
176
|
+
ToolbarSupportHelper.configureWatchDemoButton(
|
|
177
|
+
context = this,
|
|
178
|
+
btnWatchDemo = binding.toolbar.btnWatchDemo,
|
|
179
|
+
isForReconnect = isForReconnect,
|
|
180
|
+
onClickAnalytics = { sendDataToRN("", "cgm_watch_demo_clicked") }
|
|
181
|
+
)
|
|
190
182
|
|
|
191
183
|
binding.tvKnowMore.setOnClickListener {
|
|
192
184
|
openBluetoothDialog()
|
|
@@ -27,6 +27,7 @@ import com.mytatvarnsdk.databinding.ActivityPlaceSensorBinding
|
|
|
27
27
|
import com.mytatvarnsdk.databinding.ExitDialogBottomsheetBinding
|
|
28
28
|
import com.mytatvarnsdk.utils.CgmModuleSentryLog.logModuleEvent
|
|
29
29
|
import com.mytatvarnsdk.utils.CgmModuleSentryLog.safeLogModuleEvent
|
|
30
|
+
import com.mytatvarnsdk.utils.ToolbarSupportHelper
|
|
30
31
|
import io.sentry.SentryLogLevel
|
|
31
32
|
|
|
32
33
|
class PlaceSensorActivity : AppCompatActivity() {
|
|
@@ -62,20 +63,14 @@ class PlaceSensorActivity : AppCompatActivity() {
|
|
|
62
63
|
.load(R.drawable.ic_play_gif)
|
|
63
64
|
.into(binding.ivPlay)
|
|
64
65
|
|
|
65
|
-
binding.toolbar.btnWhatsapp
|
|
66
|
-
startActivity(
|
|
67
|
-
Intent(this, HelpActivity::class.java)
|
|
68
|
-
.putExtra("ScreenName", "Sensor page")
|
|
69
|
-
)
|
|
70
|
-
}
|
|
66
|
+
ToolbarSupportHelper.bindWhatsappButton(this, binding.toolbar.btnWhatsapp)
|
|
71
67
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
68
|
+
ToolbarSupportHelper.configureWatchDemoButton(
|
|
69
|
+
context = this,
|
|
70
|
+
btnWatchDemo = binding.toolbar.btnWatchDemo,
|
|
71
|
+
isForReconnect = isForReconnect,
|
|
72
|
+
onClickAnalytics = { sendDataToRN("", "cgm_watch_demo_clicked") }
|
|
73
|
+
)
|
|
79
74
|
|
|
80
75
|
binding.commonButton.tvProceed.text = "I Have Placed The Sensor"
|
|
81
76
|
binding.commonButton.btnProceed.setOnClickListener {
|
|
@@ -181,5 +176,9 @@ class PlaceSensorActivity : AppCompatActivity() {
|
|
|
181
176
|
dialog.show()
|
|
182
177
|
}
|
|
183
178
|
|
|
179
|
+
override fun onResume() {
|
|
180
|
+
super.onResume()
|
|
181
|
+
}
|
|
182
|
+
|
|
184
183
|
|
|
185
184
|
}
|
|
@@ -27,6 +27,7 @@ import com.mytatvarnsdk.databinding.ActivityPlaceTransmitterBinding
|
|
|
27
27
|
import com.mytatvarnsdk.databinding.ExitDialogBottomsheetBinding
|
|
28
28
|
import com.mytatvarnsdk.utils.CgmModuleSentryLog.logModuleEvent
|
|
29
29
|
import com.mytatvarnsdk.utils.CgmModuleSentryLog.safeLogModuleEvent
|
|
30
|
+
import com.mytatvarnsdk.utils.ToolbarSupportHelper
|
|
30
31
|
import io.sentry.SentryLogLevel
|
|
31
32
|
|
|
32
33
|
class PlaceTransmitterActivity : AppCompatActivity() {
|
|
@@ -74,20 +75,14 @@ class PlaceTransmitterActivity : AppCompatActivity() {
|
|
|
74
75
|
finish()
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
binding.toolbar.btnWhatsapp
|
|
78
|
-
startActivity(
|
|
79
|
-
Intent(this, HelpActivity::class.java)
|
|
80
|
-
.putExtra("ScreenName", "Transmitter page")
|
|
81
|
-
)
|
|
82
|
-
}
|
|
78
|
+
ToolbarSupportHelper.bindWhatsappButton(this, binding.toolbar.btnWhatsapp)
|
|
83
79
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
80
|
+
ToolbarSupportHelper.configureWatchDemoButton(
|
|
81
|
+
context = this,
|
|
82
|
+
btnWatchDemo = binding.toolbar.btnWatchDemo,
|
|
83
|
+
isForReconnect = isForReconnect,
|
|
84
|
+
onClickAnalytics = { sendDataToRN("", "cgm_watch_demo_clicked") }
|
|
85
|
+
)
|
|
91
86
|
|
|
92
87
|
binding.toolbar.btnClose.setOnClickListener {
|
|
93
88
|
openExitDialog()
|
|
@@ -187,4 +182,8 @@ class PlaceTransmitterActivity : AppCompatActivity() {
|
|
|
187
182
|
Log.e("sendDataToRNDirectly", "Error sending data to React", e)
|
|
188
183
|
}
|
|
189
184
|
}
|
|
185
|
+
|
|
186
|
+
override fun onResume() {
|
|
187
|
+
super.onResume()
|
|
188
|
+
}
|
|
190
189
|
}
|
|
@@ -53,6 +53,7 @@ import com.mytatvarnsdk.myView.progress.ProgressManagement
|
|
|
53
53
|
import com.mytatvarnsdk.myView.progress.ProgressType
|
|
54
54
|
import com.mytatvarnsdk.network.AuthenticateSDKService
|
|
55
55
|
import com.mytatvarnsdk.utils.CgmModuleSentryLog.logModuleEvent
|
|
56
|
+
import com.mytatvarnsdk.utils.ToolbarSupportHelper
|
|
56
57
|
import com.mytatvarnsdk.utils.CgmModuleSentryLog.safeLogModuleEvent
|
|
57
58
|
import io.sentry.SentryLogLevel
|
|
58
59
|
import kotlinx.coroutines.CoroutineScope
|
|
@@ -381,20 +382,14 @@ class SearchTransmitterActivity : BaseBleActivity() {
|
|
|
381
382
|
}
|
|
382
383
|
|
|
383
384
|
private fun setupClickListeners() {
|
|
384
|
-
binding.toolbar.btnWhatsapp
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
sendDataToRN("", "cgm_watch_demo_clicked")
|
|
393
|
-
|
|
394
|
-
startActivity(
|
|
395
|
-
Intent(this, VideoActivity::class.java).putExtra("VideoId", if (isForReconnect) "n_pUrFoZ1wQ" else "r5Zemc4R044")
|
|
396
|
-
)
|
|
397
|
-
}
|
|
385
|
+
ToolbarSupportHelper.bindWhatsappButton(this, binding.toolbar.btnWhatsapp)
|
|
386
|
+
|
|
387
|
+
ToolbarSupportHelper.configureWatchDemoButton(
|
|
388
|
+
context = this,
|
|
389
|
+
btnWatchDemo = binding.toolbar.btnWatchDemo,
|
|
390
|
+
isForReconnect = isForReconnect,
|
|
391
|
+
onClickAnalytics = { sendDataToRN("", "cgm_watch_demo_clicked") }
|
|
392
|
+
)
|
|
398
393
|
|
|
399
394
|
binding.toolbar.btnClose.setOnClickListener {
|
|
400
395
|
openExitDialog()
|
|
@@ -31,6 +31,7 @@ import com.mytatvarnsdk.network.AuthenticateSDKService
|
|
|
31
31
|
import com.mytatvarnsdk.network.AuthenticateSDKService.LoaderListener
|
|
32
32
|
import com.mytatvarnsdk.utils.DeviceStatus
|
|
33
33
|
import com.mytatvarnsdk.utils.TATVA_ENVIRONMENT
|
|
34
|
+
import com.mytatvarnsdk.utils.ToolbarSupportHelper
|
|
34
35
|
import com.mytatvarnsdk.utils.CgmModuleSentryLog.logModuleEvent
|
|
35
36
|
import com.mytatvarnsdk.utils.CgmModuleSentryLog.safeLogModuleEvent
|
|
36
37
|
import io.sentry.SentryLogLevel
|
|
@@ -80,23 +81,14 @@ class SensorConnectSuccessActivity : AppCompatActivity() {
|
|
|
80
81
|
|
|
81
82
|
authenticateSDKService = AuthenticateSDKService(scope = scope)
|
|
82
83
|
|
|
83
|
-
binding.toolbar.btnWhatsapp
|
|
84
|
-
startActivity(
|
|
85
|
-
Intent(this, HelpActivity::class.java)
|
|
86
|
-
.putExtra("ScreenName", "Sensor page")
|
|
87
|
-
)
|
|
88
|
-
}
|
|
84
|
+
ToolbarSupportHelper.bindWhatsappButton(this, binding.toolbar.btnWhatsapp)
|
|
89
85
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if (isForReconnect) "n_pUrFoZ1wQ" else "r5Zemc4R044"
|
|
97
|
-
)
|
|
98
|
-
)
|
|
99
|
-
}
|
|
86
|
+
ToolbarSupportHelper.configureWatchDemoButton(
|
|
87
|
+
context = this,
|
|
88
|
+
btnWatchDemo = binding.toolbar.btnWatchDemo,
|
|
89
|
+
isForReconnect = isForReconnect,
|
|
90
|
+
onClickAnalytics = { sendDataToRN("", "cgm_watch_demo_clicked") }
|
|
91
|
+
)
|
|
100
92
|
|
|
101
93
|
binding.commonButton.btnProceed.setOnClickListener {
|
|
102
94
|
sendDataToRN("", "cgm_connect_sensor_proceed_clicked")
|
|
@@ -255,4 +247,8 @@ class SensorConnectSuccessActivity : AppCompatActivity() {
|
|
|
255
247
|
dialog.show()
|
|
256
248
|
}
|
|
257
249
|
|
|
250
|
+
override fun onResume() {
|
|
251
|
+
super.onResume()
|
|
252
|
+
}
|
|
253
|
+
|
|
258
254
|
}
|
|
@@ -30,6 +30,7 @@ import com.mytatvarnsdk.databinding.ActivityStartCgmactivityBinding
|
|
|
30
30
|
import com.mytatvarnsdk.databinding.ExitDialogBottomsheetBinding
|
|
31
31
|
import com.mytatvarnsdk.utils.CgmModuleSentryLog.logModuleEvent
|
|
32
32
|
import com.mytatvarnsdk.utils.CgmModuleSentryLog.safeLogModuleEvent
|
|
33
|
+
import com.mytatvarnsdk.utils.ToolbarSupportHelper
|
|
33
34
|
import io.sentry.SentryLogLevel
|
|
34
35
|
|
|
35
36
|
|
|
@@ -95,22 +96,15 @@ class StartCGMActivity : AppCompatActivity() {
|
|
|
95
96
|
openExitDialog()
|
|
96
97
|
}
|
|
97
98
|
|
|
98
|
-
binding.toolbar.btnWhatsapp
|
|
99
|
-
startActivity(
|
|
100
|
-
Intent(this, HelpActivity::class.java)
|
|
101
|
-
.putExtra("ScreenName", "connection journey page")
|
|
102
|
-
)
|
|
103
|
-
}
|
|
99
|
+
ToolbarSupportHelper.bindWhatsappButton(this, binding.toolbar.btnWhatsapp)
|
|
104
100
|
|
|
105
|
-
binding.toolbar.btnWatchDemo.setOnClickListener
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
)
|
|
113
|
-
}
|
|
101
|
+
binding.toolbar.btnWatchDemo.setOnClickListener(null)
|
|
102
|
+
ToolbarSupportHelper.configureWatchDemoButton(
|
|
103
|
+
context = this,
|
|
104
|
+
btnWatchDemo = binding.toolbar.btnWatchDemo,
|
|
105
|
+
isForReconnect = isForReconnect,
|
|
106
|
+
onClickAnalytics = { sendDataToRN("", "cgm_watch_demo_clicked") }
|
|
107
|
+
)
|
|
114
108
|
|
|
115
109
|
val callback: OnBackPressedCallback = object : OnBackPressedCallback(true) {
|
|
116
110
|
override fun handleOnBackPressed() {
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
package com.mytatvarnsdk.activity
|
|
2
2
|
|
|
3
|
+
import android.annotation.SuppressLint
|
|
3
4
|
import android.os.Bundle
|
|
4
5
|
import android.view.View
|
|
6
|
+
import android.webkit.WebChromeClient
|
|
7
|
+
import android.webkit.WebView
|
|
8
|
+
import android.webkit.WebViewClient
|
|
5
9
|
import androidx.activity.OnBackPressedCallback
|
|
6
10
|
import androidx.activity.enableEdgeToEdge
|
|
7
11
|
import androidx.appcompat.app.AppCompatActivity
|
|
12
|
+
import androidx.constraintlayout.widget.ConstraintLayout
|
|
8
13
|
import androidx.core.view.ViewCompat
|
|
9
14
|
import androidx.core.view.WindowInsetsCompat
|
|
10
15
|
import com.mytatvarnsdk.R
|
|
11
16
|
import com.mytatvarnsdk.databinding.ActivityVideoBinding
|
|
12
|
-
import com.
|
|
13
|
-
import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.listeners.AbstractYouTubePlayerListener
|
|
14
|
-
import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.listeners.FullscreenListener
|
|
15
|
-
import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.options.IFramePlayerOptions
|
|
17
|
+
import com.mytatvarnsdk.utils.CustomerSupportConfig
|
|
16
18
|
|
|
17
19
|
class VideoActivity : AppCompatActivity() {
|
|
18
20
|
private lateinit var binding: ActivityVideoBinding
|
|
19
|
-
private var
|
|
20
|
-
private lateinit var youTubePlayer: YouTubePlayer
|
|
21
|
+
private var webView: WebView? = null
|
|
21
22
|
private var videoId = ""
|
|
22
23
|
|
|
23
24
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
@@ -34,66 +35,111 @@ class VideoActivity : AppCompatActivity() {
|
|
|
34
35
|
init()
|
|
35
36
|
}
|
|
36
37
|
|
|
38
|
+
@SuppressLint("SetJavaScriptEnabled")
|
|
37
39
|
private fun init() {
|
|
38
|
-
videoId = intent.getStringExtra("VideoId")
|
|
40
|
+
videoId = resolveVideoId(intent.getStringExtra("VideoId"))
|
|
39
41
|
|
|
40
42
|
onBackPressedDispatcher.addCallback(onBackPressedCallback)
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
.fullscreen(1)
|
|
45
|
-
.build()
|
|
46
|
-
binding.youtubePlayerView.enableAutomaticInitialization = false
|
|
44
|
+
binding.youtubePlayerView.visibility = View.GONE
|
|
45
|
+
binding.fullScreenViewContainer.visibility = View.GONE
|
|
47
46
|
|
|
48
47
|
binding.ivClose.setOnClickListener {
|
|
49
|
-
|
|
48
|
+
finish()
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
51
|
+
val playerWebView = WebView(this)
|
|
52
|
+
webView = playerWebView
|
|
53
|
+
playerWebView.settings.apply {
|
|
54
|
+
javaScriptEnabled = true
|
|
55
|
+
domStorageEnabled = true
|
|
56
|
+
mediaPlaybackRequiresUserGesture = false
|
|
57
|
+
}
|
|
58
|
+
playerWebView.webViewClient = WebViewClient()
|
|
59
|
+
playerWebView.webChromeClient = WebChromeClient()
|
|
60
|
+
|
|
61
|
+
val layoutParams = ConstraintLayout.LayoutParams(
|
|
62
|
+
ConstraintLayout.LayoutParams.MATCH_PARENT,
|
|
63
|
+
ConstraintLayout.LayoutParams.MATCH_CONSTRAINT
|
|
64
|
+
).apply {
|
|
65
|
+
topToBottom = R.id.ivClose
|
|
66
|
+
bottomToBottom = R.id.main
|
|
67
|
+
startToStart = R.id.main
|
|
68
|
+
endToEnd = R.id.main
|
|
69
|
+
}
|
|
70
|
+
(binding.root as ConstraintLayout).addView(playerWebView, layoutParams)
|
|
71
|
+
binding.ivClose.bringToFront()
|
|
72
|
+
binding.ivClose.elevation = 12f
|
|
73
|
+
|
|
74
|
+
val html = buildYouTubeEmbedHtml(videoId)
|
|
75
|
+
// Base URL + referrer meta are required by YouTube (errors 152-4 / 153).
|
|
76
|
+
playerWebView.loadDataWithBaseURL(
|
|
77
|
+
EMBED_BASE_URL,
|
|
78
|
+
html,
|
|
79
|
+
"text/html",
|
|
80
|
+
"UTF-8",
|
|
81
|
+
null
|
|
82
|
+
)
|
|
83
|
+
}
|
|
79
84
|
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
private fun resolveVideoId(raw: String?): String {
|
|
86
|
+
val value = raw?.trim().orEmpty()
|
|
87
|
+
if (value.isEmpty() || value == "null") {
|
|
88
|
+
return CustomerSupportConfig.DEFAULT_DEMO_VIDEO_ID
|
|
89
|
+
}
|
|
90
|
+
return CustomerSupportConfig.extractYouTubeVideoId(value) ?: value
|
|
91
|
+
}
|
|
82
92
|
|
|
83
|
-
|
|
93
|
+
private fun buildYouTubeEmbedHtml(videoId: String): String {
|
|
94
|
+
return """
|
|
95
|
+
<!DOCTYPE html>
|
|
96
|
+
<html>
|
|
97
|
+
<head>
|
|
98
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
99
|
+
<meta name="referrer" content="strict-origin-when-cross-origin">
|
|
100
|
+
<style>
|
|
101
|
+
html, body { margin: 0; padding: 0; background: #000; height: 100%; }
|
|
102
|
+
.video-container { position: relative; width: 100%; height: 100%; }
|
|
103
|
+
iframe {
|
|
104
|
+
position: absolute;
|
|
105
|
+
top: 0;
|
|
106
|
+
left: 0;
|
|
107
|
+
width: 100%;
|
|
108
|
+
height: 100%;
|
|
109
|
+
border: 0;
|
|
110
|
+
}
|
|
111
|
+
</style>
|
|
112
|
+
</head>
|
|
113
|
+
<body>
|
|
114
|
+
<div class="video-container">
|
|
115
|
+
<iframe
|
|
116
|
+
src="https://www.youtube-nocookie.com/embed/$videoId?playsinline=1&rel=0&modestbranding=1"
|
|
117
|
+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
|
118
|
+
allowfullscreen
|
|
119
|
+
referrerpolicy="strict-origin-when-cross-origin">
|
|
120
|
+
</iframe>
|
|
121
|
+
</div>
|
|
122
|
+
</body>
|
|
123
|
+
</html>
|
|
124
|
+
""".trimIndent()
|
|
84
125
|
}
|
|
85
126
|
|
|
86
127
|
private val onBackPressedCallback = object : OnBackPressedCallback(true) {
|
|
87
128
|
override fun handleOnBackPressed() {
|
|
88
|
-
|
|
129
|
+
finish()
|
|
89
130
|
}
|
|
90
131
|
}
|
|
91
132
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
finish()
|
|
133
|
+
override fun onDestroy() {
|
|
134
|
+
webView?.apply {
|
|
135
|
+
stopLoading()
|
|
136
|
+
destroy()
|
|
97
137
|
}
|
|
138
|
+
webView = null
|
|
139
|
+
super.onDestroy()
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
companion object {
|
|
143
|
+
private const val EMBED_BASE_URL = "https://www.mytatva.in/"
|
|
98
144
|
}
|
|
99
|
-
}
|
|
145
|
+
}
|
|
@@ -260,6 +260,56 @@ class AuthenticateSDKService(val scope: CoroutineScope) {
|
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
+
fun fetchCustomerSupportDetails(
|
|
264
|
+
environment: TATVA_ENVIRONMENT,
|
|
265
|
+
token: String,
|
|
266
|
+
onSuccess: (String) -> Unit = {},
|
|
267
|
+
onFailure: () -> Unit = {}
|
|
268
|
+
) {
|
|
269
|
+
scope.launch {
|
|
270
|
+
try {
|
|
271
|
+
val apiServiceInterface = RetrofitInstance.getRetroInstance().create(
|
|
272
|
+
ApiServiceInterface::class.java
|
|
273
|
+
)
|
|
274
|
+
|
|
275
|
+
val encryptionKey = getEncryptionKey(
|
|
276
|
+
env = TATVA_ENVIRONMENT.PROD,
|
|
277
|
+
prodEncKey = PROD_ENC_KEY,
|
|
278
|
+
stagEncKey = STAGE_ENC_KEY
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
val encryptionIv = getEncryptionIv(
|
|
282
|
+
env = TATVA_ENVIRONMENT.PROD, prodEncIv = PROD_ENC_IV, stagEncIv = STAGE_ENC_IV
|
|
283
|
+
)
|
|
284
|
+
|
|
285
|
+
val headers = mapOf(
|
|
286
|
+
"api-key" to if (environment == TATVA_ENVIRONMENT.PROD) PROD_API_KEY else STAGE_API_KEY,
|
|
287
|
+
"token" to token
|
|
288
|
+
)
|
|
289
|
+
|
|
290
|
+
val baseUrl = if (environment == TATVA_ENVIRONMENT.PROD) PROD_BASE_URL else STAGE_BASE_URL
|
|
291
|
+
val url = "$baseUrl/helper/customer_support_details"
|
|
292
|
+
|
|
293
|
+
Log.d("API Response", "Customer Support Details URL: $url")
|
|
294
|
+
|
|
295
|
+
val response = apiServiceInterface.getCgmStatus(url, headers).string()
|
|
296
|
+
|
|
297
|
+
val decryptedResponse = getDecryptedData(
|
|
298
|
+
cipherText = response.toString(),
|
|
299
|
+
encryptionKey = encryptionKey,
|
|
300
|
+
encryptionIv = encryptionIv
|
|
301
|
+
) ?: response.toString()
|
|
302
|
+
|
|
303
|
+
Log.d("API Response", "Customer Support Details Response: $decryptedResponse")
|
|
304
|
+
onSuccess(decryptedResponse)
|
|
305
|
+
} catch (e: Exception) {
|
|
306
|
+
Log.d("API Response", "Customer Support Details Exception: ${e.message}")
|
|
307
|
+
e.printStackTrace()
|
|
308
|
+
onFailure()
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
263
313
|
fun verifyDevice(
|
|
264
314
|
environment: TATVA_ENVIRONMENT,
|
|
265
315
|
token: String,
|