mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-07-25 21:05:24 +00:00
unify location enabled / disabled
This commit is contained in:
@@ -88,10 +88,17 @@ class LocationChannelManager private constructor(private val context: Context) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable location channels (request permission if needed)
|
* Enable location channels (request permission if needed)
|
||||||
|
* UNIFIED: Only requests location if location services are enabled by user
|
||||||
*/
|
*/
|
||||||
fun enableLocationChannels() {
|
fun enableLocationChannels() {
|
||||||
Log.d(TAG, "enableLocationChannels() called")
|
Log.d(TAG, "enableLocationChannels() called")
|
||||||
|
|
||||||
|
// UNIFIED FIX: Check if location services are enabled by user
|
||||||
|
if (!isLocationServicesEnabled()) {
|
||||||
|
Log.w(TAG, "Location services disabled by user - not requesting location")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
when (getCurrentPermissionStatus()) {
|
when (getCurrentPermissionStatus()) {
|
||||||
PermissionState.NOT_DETERMINED -> {
|
PermissionState.NOT_DETERMINED -> {
|
||||||
Log.d(TAG, "Permission not determined - user needs to grant in app settings")
|
Log.d(TAG, "Permission not determined - user needs to grant in app settings")
|
||||||
|
|||||||
@@ -85,6 +85,9 @@ private fun LocationNotesErrorSheet(
|
|||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(24.dp))
|
Spacer(modifier = Modifier.height(24.dp))
|
||||||
Button(onClick = {
|
Button(onClick = {
|
||||||
|
// UNIFIED FIX: Enable location services first (user toggle)
|
||||||
|
locationManager.enableLocationServices()
|
||||||
|
// Then request location channels (which will also request permission if needed)
|
||||||
locationManager.enableLocationChannels()
|
locationManager.enableLocationChannels()
|
||||||
locationManager.refreshChannels()
|
locationManager.refreshChannels()
|
||||||
}) {
|
}) {
|
||||||
|
|||||||
Reference in New Issue
Block a user