mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-06-20 22:29:19 +00:00
Improve: Added Sync automatically only when on wifi and plugged in
This commit is contained in:
@ -38,8 +38,10 @@ object Preferences {
|
||||
|
||||
fun init(context: Context) {
|
||||
preferences =
|
||||
context.getSharedPreferences("${context.packageName}_preferences",
|
||||
Context.MODE_PRIVATE)
|
||||
context.getSharedPreferences(
|
||||
"${context.packageName}_preferences",
|
||||
Context.MODE_PRIVATE
|
||||
)
|
||||
preferences.registerOnSharedPreferenceChangeListener { _, keyString ->
|
||||
CoroutineScope(Dispatchers.Default).launch {
|
||||
keys[keyString]?.let {
|
||||
@ -164,10 +166,11 @@ object Preferences {
|
||||
|
||||
sealed class AutoSync(override val valueString: String) : Enumeration<AutoSync> {
|
||||
override val values: List<AutoSync>
|
||||
get() = listOf(Never, Wifi, Always)
|
||||
get() = listOf(Never, Wifi, WifiBattery, Always)
|
||||
|
||||
object Never : AutoSync("never")
|
||||
object Wifi : AutoSync("wifi")
|
||||
object WifiBattery : AutoSync("wifi-battery")
|
||||
object Always : AutoSync("always")
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user