Target API 31 on Google variant

This commit is contained in:
Mygod
2021-10-23 17:02:52 -04:00
parent 79bade2fe9
commit c1ae7857eb
7 changed files with 40 additions and 26 deletions

View File

@@ -320,12 +320,11 @@ sealed class TetherManager(protected val parent: TetheringFragment) : Manager(),
onTetheringStarted() // force flush
}
override fun onResume(owner: LifecycleOwner) {
if (Build.VERSION.SDK_INT < 31 || parent.requireContext().checkSelfPermission(
Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) {
if (Build.VERSION.SDK_INT < 31) return
if (parent.requireContext().checkSelfPermission(Manifest.permission.BLUETOOTH_CONNECT) ==
PackageManager.PERMISSION_GRANTED) {
tethering.ensureInit(parent.requireContext())
} else if (parent.shouldShowRequestPermissionRationale(Manifest.permission.BLUETOOTH_CONNECT)) {
parent.requestBluetooth.launch(Manifest.permission.BLUETOOTH_CONNECT)
}
} else parent.requestBluetooth.launch(Manifest.permission.BLUETOOTH_CONNECT)
}
override fun onDestroy(owner: LifecycleOwner) = tethering.close()