Support new permission in Tiramisu

This commit is contained in:
Mygod
2022-07-12 10:18:52 -04:00
parent 77faca0dfb
commit 4e1f7c9c40
11 changed files with 59 additions and 38 deletions

View File

@@ -92,7 +92,9 @@ class RepeaterManager(private val parent: TetheringFragment) : Manager(), Servic
when (binder?.service?.status) {
RepeaterService.Status.IDLE -> if (Build.VERSION.SDK_INT < 29) parent.requireContext().let { context ->
ContextCompat.startForegroundService(context, Intent(context, RepeaterService::class.java))
} else parent.startRepeater.launch(Manifest.permission.ACCESS_FINE_LOCATION)
} else parent.startRepeater.launch(if (BuildConfig.TARGET_SDK >= 33 && Build.VERSION.SDK_INT >= 33) {
Manifest.permission.NEARBY_WIFI_DEVICES
} else Manifest.permission.ACCESS_FINE_LOCATION)
RepeaterService.Status.ACTIVE -> binder.shutdown()
else -> { }
}