mirror of
https://github.com/rebelonion/Dantotsu.git
synced 2026-01-21 20:53:57 +00:00
feat: import settings on login page
This commit is contained in:
@@ -242,6 +242,13 @@ object PrefManager {
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param prefs Map of preferences to import
|
||||
* @param prefLocation Location to import to
|
||||
* @return true if successful, false if error
|
||||
*/
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun importAllPrefs(prefs: Map<String, *>, prefLocation: Location): Boolean {
|
||||
val pref = getPrefLocation(prefLocation)
|
||||
|
||||
@@ -64,14 +64,17 @@ class PreferencePackager {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return true if successful, false if error
|
||||
*/
|
||||
private fun unpackagePreferences(map: Map<String, Map<String, *>>): Boolean {
|
||||
var failed = false
|
||||
var success = true
|
||||
map.forEach { (location, prefMap) ->
|
||||
val locationEnum = locationFromString(location)
|
||||
if (!PrefManager.importAllPrefs(prefMap, locationEnum))
|
||||
failed = true
|
||||
success = false
|
||||
}
|
||||
return failed
|
||||
return success
|
||||
}
|
||||
|
||||
private fun locationFromString(location: String): Location {
|
||||
|
||||
Reference in New Issue
Block a user