store background location pref

This commit is contained in:
Kevin Hester 2021-06-23 12:41:44 -07:00
parent 74f7281a60
commit 74a34cd9b6
5 changed files with 20 additions and 2 deletions

View file

@ -0,0 +1,5 @@
package com.geeksville.mesh.model
object MyPreferences {
val provideLocationKey = "provide-location"
}

View file

@ -190,6 +190,15 @@ class UIViewModel(private val app: Application) : AndroidViewModel(app), Logging
val bluetoothEnabled = object : MutableLiveData<Boolean>(false) {
}
val provideLocation = object : MutableLiveData<Boolean>(getPreferences(context).getBoolean(MyPreferences.provideLocationKey, false)) {
override fun setValue(value: Boolean) {
super.setValue(value)
getPreferences(context).edit(commit = true) {
this.putBoolean(MyPreferences.provideLocationKey, value)
}
}
}
/// If the app was launched because we received a new channel intent, the Url will be here
var requestedChannelUrl: Uri? = null