mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-03 13:43:20 -04:00
Merge pull request #469 from legendgroupv2/dev-app-bt-prompt
Shows a prompt when Bluetooth is off and trying to add a device
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.geeksville.mesh.ui
|
||||
|
||||
import android.bluetooth.BluetoothAdapter
|
||||
import android.bluetooth.BluetoothDevice
|
||||
import android.companion.CompanionDeviceManager
|
||||
import android.content.*
|
||||
@@ -485,6 +486,7 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
||||
if (!myActivity.hasScanPermission()) {
|
||||
myActivity.requestScanPermission()
|
||||
} else {
|
||||
checkBTEnabled()
|
||||
if (!scanModel.hasCompanionDeviceApi) checkLocationEnabled()
|
||||
scanLeDevice()
|
||||
}
|
||||
@@ -511,6 +513,15 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkBTEnabled(
|
||||
warningReason: String = getString(R.string.requires_bluetooth)
|
||||
) {
|
||||
if (bluetoothViewModel.enabled.value == false) {
|
||||
warn("We need bluetooth")
|
||||
showSnackbar(warningReason)
|
||||
}
|
||||
}
|
||||
|
||||
private val updateProgressFilter = IntentFilter(SoftwareUpdateService.ACTION_UPDATE_PROGRESS)
|
||||
|
||||
private val updateProgressReceiver: BroadcastReceiver = object : BroadcastReceiver() {
|
||||
|
||||
Reference in New Issue
Block a user