kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
fix provideLocationCheckbox logic
rodzic
2441e1bada
commit
f6914de76e
|
@ -650,9 +650,9 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
||||||
|
|
||||||
binding.provideLocationCheckbox.isEnabled = isGooglePlayAvailable(requireContext())
|
binding.provideLocationCheckbox.isEnabled = isGooglePlayAvailable(requireContext())
|
||||||
binding.provideLocationCheckbox.setOnCheckedChangeListener { view, isChecked ->
|
binding.provideLocationCheckbox.setOnCheckedChangeListener { view, isChecked ->
|
||||||
if (view.isPressed) { // We want to ignore changes caused by code (as opposed to the user)
|
|
||||||
debug("User changed location tracking to $isChecked")
|
|
||||||
if (view.isChecked) {
|
if (view.isChecked) {
|
||||||
|
debug("User changed location tracking to $isChecked")
|
||||||
|
if (view.isPressed) { // We want to ignore changes caused by code (as opposed to the user)
|
||||||
val hasLocationPermission = myActivity.hasLocationPermission()
|
val hasLocationPermission = myActivity.hasLocationPermission()
|
||||||
val hasBackgroundPermission = myActivity.hasBackgroundPermission()
|
val hasBackgroundPermission = myActivity.hasBackgroundPermission()
|
||||||
|
|
||||||
|
@ -677,9 +677,10 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
||||||
model.provideLocation.value = isChecked
|
model.provideLocation.value = isChecked
|
||||||
model.meshService?.setupProvideLocation()
|
model.meshService?.setupProvideLocation()
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
model.meshService?.stopProvideLocation()
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
model.provideLocation.value = isChecked
|
||||||
|
model.meshService?.stopProvideLocation()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -993,7 +994,7 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
||||||
scanModel.startScan()
|
scanModel.startScan()
|
||||||
|
|
||||||
// system permissions might have changed while we were away
|
// system permissions might have changed while we were away
|
||||||
binding.provideLocationCheckbox.isChecked = myActivity.hasBackgroundPermission() && (model.provideLocation.value ?: false) && isGooglePlayAvailable(requireContext())
|
binding.provideLocationCheckbox.isChecked = myActivity.hasLocationPermission() && myActivity.hasBackgroundPermission() && (model.provideLocation.value ?: false) && isGooglePlayAvailable(requireContext())
|
||||||
|
|
||||||
myActivity.registerReceiver(updateProgressReceiver, updateProgressFilter)
|
myActivity.registerReceiver(updateProgressReceiver, updateProgressFilter)
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue