react-native-mytatva-rn-sdk 1.2.50 → 1.2.51

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.
@@ -94,17 +94,23 @@ class PermissionActivity : BasePermissionActivity() {
94
94
  return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
95
95
  val connectPermission = ContextCompat.checkSelfPermission(
96
96
  context,
97
- android.Manifest.permission.BLUETOOTH_CONNECT
97
+ Manifest.permission.BLUETOOTH_CONNECT
98
98
  ) == PackageManager.PERMISSION_GRANTED
99
99
 
100
100
  val scanPermission = ContextCompat.checkSelfPermission(
101
101
  context,
102
- android.Manifest.permission.BLUETOOTH_SCAN
102
+ Manifest.permission.BLUETOOTH_SCAN
103
103
  ) == PackageManager.PERMISSION_GRANTED
104
104
 
105
- connectPermission && scanPermission
105
+ val advertisePermission = ContextCompat.checkSelfPermission(
106
+ context,
107
+ Manifest.permission.BLUETOOTH_ADVERTISE
108
+ ) == PackageManager.PERMISSION_GRANTED
109
+
110
+ // Include advertisePermission only if your app uses Bluetooth advertising
111
+ connectPermission && scanPermission && advertisePermission
106
112
  } else {
107
- // For Android 11 and below, permission is granted at install time
113
+ // For Android 11 and below, permission is granted at install time or via location
108
114
  true
109
115
  }
110
116
  }
@@ -1,6 +1,7 @@
1
1
  package com.mytatvarnsdk.activity
2
2
 
3
3
  import android.app.Dialog
4
+ import android.bluetooth.BluetoothAdapter
4
5
  import android.content.Intent
5
6
  import android.content.pm.PackageManager
6
7
  import android.graphics.Color
@@ -33,6 +34,9 @@ class StartCGMActivity : AppCompatActivity() {
33
34
  private lateinit var binding: ActivityStartCgmactivityBinding
34
35
  private var isForReconnect: Boolean = false
35
36
  private val reactContext = CgmTrackyLibModule.mReactContext
37
+ private val bluetoothAdapter: BluetoothAdapter? by lazy {
38
+ BluetoothAdapter.getDefaultAdapter()
39
+ }
36
40
 
37
41
  override fun onCreate(savedInstanceState: Bundle?) {
38
42
  super.onCreate(savedInstanceState)
@@ -63,7 +67,7 @@ class StartCGMActivity : AppCompatActivity() {
63
67
  sendDataToRN("", "cgm_start_connection_journey_clicked")
64
68
 
65
69
  if (isForReconnect) {
66
- val intent = if (areAllPermissionsGranted()) {
70
+ val intent = if (areAllPermissionsGranted() && bluetoothAdapter!!.isEnabled) {
67
71
  Intent(this, SearchTransmitterActivity::class.java).putExtra(
68
72
  "IsForReconnect",
69
73
  true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-mytatva-rn-sdk",
3
- "version": "1.2.50",
3
+ "version": "1.2.51",
4
4
  "description": "a package to inject data into visit health pwa",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",