react-native-mytatva-rn-sdk 1.2.32 → 1.2.34
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 +74 -101
- package/android/src/main/java/com/mytatvarnsdk/MainApplication.kt +4 -4
- package/android/src/main/java/com/mytatvarnsdk/activity/ConnectSensorActivity.kt +20 -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 +113 -96
- package/android/src/main/java/com/mytatvarnsdk/activity/StartCGMActivity.kt +110 -54
- package/android/src/main/java/com/mytatvarnsdk/activity/VideoActivity.kt +94 -0
- package/android/src/main/res/drawable/img_sensor_cross.png +0 -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 +714 -712
- package/android/src/main/res/layout/activity_sensor_connect_success.xml +250 -179
- 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/package.json +1 -1
|
@@ -2,7 +2,9 @@ package com.mytatvarnsdk.activity
|
|
|
2
2
|
|
|
3
3
|
import android.app.Dialog
|
|
4
4
|
import android.content.Intent
|
|
5
|
+
import android.content.pm.PackageManager
|
|
5
6
|
import android.graphics.Color
|
|
7
|
+
import android.os.Build
|
|
6
8
|
import android.os.Bundle
|
|
7
9
|
import android.view.Gravity
|
|
8
10
|
import android.view.View
|
|
@@ -11,82 +13,136 @@ import android.view.Window
|
|
|
11
13
|
import androidx.activity.OnBackPressedCallback
|
|
12
14
|
import androidx.activity.enableEdgeToEdge
|
|
13
15
|
import androidx.appcompat.app.AppCompatActivity
|
|
16
|
+
import androidx.core.content.ContextCompat
|
|
14
17
|
import androidx.core.graphics.drawable.toDrawable
|
|
15
18
|
import androidx.core.view.ViewCompat
|
|
16
19
|
import androidx.core.view.WindowInsetsCompat
|
|
20
|
+
import com.mytatvarnsdk.CgmTrackyLibModule.Companion.mReactContext
|
|
17
21
|
import com.mytatvarnsdk.R
|
|
18
22
|
import com.mytatvarnsdk.databinding.ActivityStartCgmactivityBinding
|
|
19
23
|
import com.mytatvarnsdk.databinding.ExitDialogBottomsheetBinding
|
|
20
24
|
|
|
21
25
|
|
|
22
26
|
class StartCGMActivity : AppCompatActivity() {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
private fun init() {
|
|
40
|
-
binding.commonButton.tvProceed.text = "Start Connection Journey"
|
|
41
|
-
binding.commonButton.btnProceed.setOnClickListener {
|
|
42
|
-
startActivity(Intent(this@StartCGMActivity, PermissionActivity::class.java))
|
|
43
|
-
finish()
|
|
27
|
+
private lateinit var binding: ActivityStartCgmactivityBinding
|
|
28
|
+
private var isForReconnect: Boolean = false
|
|
29
|
+
|
|
30
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
|
31
|
+
super.onCreate(savedInstanceState)
|
|
32
|
+
binding = ActivityStartCgmactivityBinding.inflate(layoutInflater)
|
|
33
|
+
setContentView(binding.root)
|
|
34
|
+
|
|
35
|
+
enableEdgeToEdge()
|
|
36
|
+
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
|
|
37
|
+
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
|
|
38
|
+
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
|
|
39
|
+
insets
|
|
40
|
+
}
|
|
41
|
+
init()
|
|
44
42
|
}
|
|
45
43
|
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
private fun init() {
|
|
45
|
+
isForReconnect = intent.getBooleanExtra("IsForReconnect", false)
|
|
46
|
+
|
|
47
|
+
if (isForReconnect) {
|
|
48
|
+
binding.commonButton.tvProceed.text = "Start Reconnection Journey"
|
|
49
|
+
} else {
|
|
50
|
+
binding.commonButton.tvProceed.text = "Start Connection Journey"
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
binding.commonButton.btnProceed.setOnClickListener {
|
|
54
|
+
if (isForReconnect) {
|
|
55
|
+
val intent = if (areAllPermissionsGranted()) {
|
|
56
|
+
Intent(this, SearchTransmitterActivity::class.java).putExtra(
|
|
57
|
+
"IsForReconnect",
|
|
58
|
+
true
|
|
59
|
+
)
|
|
60
|
+
} else {
|
|
61
|
+
Intent(this, PermissionActivity::class.java).putExtra(
|
|
62
|
+
"IsForReconnect",
|
|
63
|
+
true
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
startActivity(intent)
|
|
67
|
+
} else {
|
|
68
|
+
startActivity(Intent(this@StartCGMActivity, PermissionActivity::class.java))
|
|
69
|
+
}
|
|
70
|
+
finish()
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
binding.toolbar.btnClose.setOnClickListener {
|
|
74
|
+
openExitDialog()
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
binding.toolbar.btnWhatsapp.setOnClickListener {
|
|
78
|
+
startActivity(Intent(this, HelpActivity::class.java))
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
binding.toolbar.btnWatchDemo.setOnClickListener {
|
|
82
|
+
startActivity(
|
|
83
|
+
Intent(this, VideoActivity::class.java).putExtra("VideoId", "r5Zemc4R044")
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
val callback: OnBackPressedCallback = object : OnBackPressedCallback(true) {
|
|
88
|
+
override fun handleOnBackPressed() {
|
|
89
|
+
openExitDialog()
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
onBackPressedDispatcher.addCallback(this, callback)
|
|
48
93
|
}
|
|
49
94
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
95
|
+
private fun areAllPermissionsGranted(): Boolean {
|
|
96
|
+
val requiredPermissions = mutableListOf<String>()
|
|
97
|
+
|
|
98
|
+
// Add Bluetooth permissions
|
|
99
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
|
100
|
+
requiredPermissions.addAll(PermissionUtils.BLUETOOTH_S)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Add location permissions
|
|
104
|
+
requiredPermissions.addAll(PermissionUtils.LOCAL_PERMISSION)
|
|
53
105
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
106
|
+
// Add camera permission
|
|
107
|
+
requiredPermissions.addAll(PermissionUtils.CAMERA_PERMISSION)
|
|
108
|
+
|
|
109
|
+
return requiredPermissions.all {
|
|
110
|
+
ContextCompat.checkSelfPermission(
|
|
111
|
+
mReactContext!!,
|
|
112
|
+
it
|
|
113
|
+
) == PackageManager.PERMISSION_GRANTED
|
|
114
|
+
}
|
|
58
115
|
}
|
|
59
|
-
onBackPressedDispatcher.addCallback(this, callback)
|
|
60
|
-
}
|
|
61
116
|
|
|
62
|
-
private fun openExitDialog() {
|
|
63
|
-
val binding = ExitDialogBottomsheetBinding.inflate(layoutInflater)
|
|
64
117
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
118
|
+
private fun openExitDialog() {
|
|
119
|
+
val binding = ExitDialogBottomsheetBinding.inflate(layoutInflater)
|
|
120
|
+
|
|
121
|
+
val dialog = Dialog(this)
|
|
122
|
+
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
|
|
123
|
+
dialog.setContentView(binding.root)
|
|
68
124
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
125
|
+
val window = dialog.window
|
|
126
|
+
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
|
127
|
+
window?.setGravity(Gravity.BOTTOM)
|
|
128
|
+
window?.setBackgroundDrawable(Color.TRANSPARENT.toDrawable())
|
|
73
129
|
|
|
74
|
-
|
|
130
|
+
binding.btnExit.tvProceed.text = "Exit"
|
|
75
131
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
132
|
+
binding.btnExit.root.setOnClickListener(View.OnClickListener { v: View? ->
|
|
133
|
+
dialog.dismiss()
|
|
134
|
+
finish()
|
|
135
|
+
})
|
|
80
136
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
137
|
+
binding.btnCancel.root.setOnClickListener(View.OnClickListener { v: View? ->
|
|
138
|
+
dialog.dismiss()
|
|
139
|
+
})
|
|
84
140
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
141
|
+
binding.closeButton.setOnClickListener(View.OnClickListener { v: View? ->
|
|
142
|
+
dialog.dismiss()
|
|
143
|
+
})
|
|
88
144
|
|
|
89
|
-
|
|
90
|
-
|
|
145
|
+
dialog.show()
|
|
146
|
+
}
|
|
91
147
|
|
|
92
148
|
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
package com.mytatvarnsdk.activity
|
|
2
|
+
|
|
3
|
+
import android.os.Bundle
|
|
4
|
+
import android.view.View
|
|
5
|
+
import androidx.activity.OnBackPressedCallback
|
|
6
|
+
import androidx.activity.enableEdgeToEdge
|
|
7
|
+
import androidx.appcompat.app.AppCompatActivity
|
|
8
|
+
import androidx.core.view.ViewCompat
|
|
9
|
+
import androidx.core.view.WindowInsetsCompat
|
|
10
|
+
import com.mytatvarnsdk.R
|
|
11
|
+
import com.mytatvarnsdk.databinding.ActivityStartCgmactivityBinding
|
|
12
|
+
import com.mytatvarnsdk.databinding.ActivityVideoBinding
|
|
13
|
+
import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.YouTubePlayer
|
|
14
|
+
import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.listeners.AbstractYouTubePlayerListener
|
|
15
|
+
import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.listeners.FullscreenListener
|
|
16
|
+
import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.options.IFramePlayerOptions
|
|
17
|
+
|
|
18
|
+
class VideoActivity : AppCompatActivity() {
|
|
19
|
+
private lateinit var binding: ActivityVideoBinding
|
|
20
|
+
private var isFullscreen = false
|
|
21
|
+
private lateinit var youTubePlayer: YouTubePlayer
|
|
22
|
+
private var videoId = ""
|
|
23
|
+
|
|
24
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
|
25
|
+
super.onCreate(savedInstanceState)
|
|
26
|
+
binding = ActivityVideoBinding.inflate(layoutInflater)
|
|
27
|
+
setContentView(binding.root)
|
|
28
|
+
|
|
29
|
+
enableEdgeToEdge()
|
|
30
|
+
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
|
|
31
|
+
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
|
|
32
|
+
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
|
|
33
|
+
insets
|
|
34
|
+
}
|
|
35
|
+
init()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private fun init() {
|
|
39
|
+
videoId = intent.getStringExtra("VideoId").toString()
|
|
40
|
+
|
|
41
|
+
onBackPressedDispatcher.addCallback(onBackPressedCallback)
|
|
42
|
+
|
|
43
|
+
val iFramePlayerOptions = IFramePlayerOptions.Builder()
|
|
44
|
+
.controls(1)
|
|
45
|
+
.fullscreen(1)
|
|
46
|
+
.build()
|
|
47
|
+
binding.youtubePlayerView.enableAutomaticInitialization = false
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
binding.youtubePlayerView.addFullscreenListener(object : FullscreenListener {
|
|
51
|
+
override fun onEnterFullscreen(fullscreenView: View, exitFullscreen: () -> Unit) {
|
|
52
|
+
isFullscreen = true
|
|
53
|
+
|
|
54
|
+
// the video will continue playing in fullscreenView
|
|
55
|
+
binding.youtubePlayerView.visibility = View.GONE
|
|
56
|
+
binding.fullScreenViewContainer.visibility = View.VISIBLE
|
|
57
|
+
binding.fullScreenViewContainer.addView(fullscreenView)
|
|
58
|
+
|
|
59
|
+
// optionally request landscape orientation
|
|
60
|
+
// requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
override fun onExitFullscreen() {
|
|
64
|
+
isFullscreen = false
|
|
65
|
+
|
|
66
|
+
// the video will continue playing in the player
|
|
67
|
+
binding.youtubePlayerView.visibility = View.VISIBLE
|
|
68
|
+
binding.fullScreenViewContainer.visibility = View.GONE
|
|
69
|
+
binding.fullScreenViewContainer.removeAllViews()
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
binding.youtubePlayerView.initialize(object : AbstractYouTubePlayerListener() {
|
|
74
|
+
override fun onReady(youTubePlayer: YouTubePlayer) {
|
|
75
|
+
this@VideoActivity.youTubePlayer = youTubePlayer
|
|
76
|
+
youTubePlayer.loadVideo(videoId, 0f)
|
|
77
|
+
|
|
78
|
+
}
|
|
79
|
+
}, iFramePlayerOptions)
|
|
80
|
+
|
|
81
|
+
lifecycle.addObserver(binding.youtubePlayerView)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
private val onBackPressedCallback = object : OnBackPressedCallback(true) {
|
|
85
|
+
override fun handleOnBackPressed() {
|
|
86
|
+
if (isFullscreen) {
|
|
87
|
+
// if the player is in fullscreen, exit fullscreen
|
|
88
|
+
youTubePlayer.toggleFullscreen()
|
|
89
|
+
} else {
|
|
90
|
+
finish()
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
Binary file
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
|
3
3
|
<item android:state_checked="true">
|
|
4
4
|
<shape android:shape="rectangle">
|
|
5
|
-
<solid android:color="#
|
|
5
|
+
<solid android:color="#299D6B"/> <!-- Green -->
|
|
6
6
|
<corners android:radius="24dp"/>
|
|
7
7
|
</shape>
|
|
8
8
|
</item>
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
android:viewportHeight="17">
|
|
6
6
|
<path
|
|
7
7
|
android:pathData="M8.5,0C6.819,0 5.175,0.499 3.778,1.433C2.38,2.366 1.29,3.694 0.647,5.247C0.004,6.8 -0.165,8.509 0.163,10.158C0.491,11.807 1.301,13.322 2.49,14.51C3.678,15.699 5.193,16.509 6.842,16.837C8.491,17.165 10.2,16.996 11.753,16.353C13.306,15.71 14.634,14.62 15.568,13.222C16.501,11.825 17,10.181 17,8.5C16.998,6.246 16.101,4.086 14.508,2.492C12.914,0.899 10.754,0.002 8.5,0ZM12.232,7.001L7.655,11.578C7.594,11.639 7.522,11.687 7.443,11.72C7.363,11.753 7.278,11.77 7.192,11.77C7.106,11.77 7.021,11.753 6.942,11.72C6.863,11.687 6.79,11.639 6.73,11.578L4.768,9.616C4.645,9.494 4.577,9.327 4.577,9.154C4.577,8.98 4.645,8.814 4.768,8.691C4.891,8.569 5.057,8.5 5.231,8.5C5.404,8.5 5.571,8.569 5.693,8.691L7.192,10.191L11.307,6.076C11.367,6.015 11.439,5.967 11.519,5.934C11.598,5.901 11.683,5.884 11.769,5.884C11.855,5.884 11.94,5.901 12.02,5.934C12.099,5.967 12.171,6.015 12.232,6.076C12.293,6.137 12.341,6.209 12.374,6.288C12.406,6.367 12.423,6.453 12.423,6.538C12.423,6.624 12.406,6.709 12.374,6.789C12.341,6.868 12.293,6.94 12.232,7.001Z"
|
|
8
|
-
android:fillColor="#
|
|
8
|
+
android:fillColor="#299D6B"/>
|
|
9
9
|
</vector>
|