forked from upstream-mirrors/quik
Migrate backup & restore feature to use SAF (#1900)
* Migrate backup & restore feature to use SAF * Remove unused imports * Remove unused rx subject * Remove unused dateFormatter * Open picker to current dir * Improve exception messages when handling DocumentFile
This commit is contained in:
@@ -20,6 +20,7 @@ package com.moez.QKSMS.util
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.provider.Settings
|
||||
import com.f2prateek.rx.preferences2.Preference
|
||||
@@ -85,6 +86,7 @@ class Preferences @Inject constructor(
|
||||
val version = rxPrefs.getInteger("version", context.versionCode)
|
||||
val changelogVersion = rxPrefs.getInteger("changelogVersion", context.versionCode)
|
||||
val hasAskedForNotificationPermission = rxPrefs.getBoolean("hasAskedForNotificationPermission", false)
|
||||
val backupDirectory = rxPrefs.getObject("backupDirectory", Uri.EMPTY, UriPreferenceConverter())
|
||||
@Deprecated("This should only be accessed when migrating to @blockingManager")
|
||||
val sia = rxPrefs.getBoolean("sia", false)
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.moez.QKSMS.util
|
||||
|
||||
import android.net.Uri
|
||||
import com.f2prateek.rx.preferences2.Preference.Converter
|
||||
|
||||
class UriPreferenceConverter : Converter<Uri> {
|
||||
|
||||
override fun deserialize(serialized: String): Uri {
|
||||
return Uri.parse(serialized)
|
||||
}
|
||||
|
||||
override fun serialize(value: Uri): String {
|
||||
return value.toString()
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user