feat: import settings on login page
This commit is contained in:
parent
d80b250650
commit
7a67fbb980
6 changed files with 123 additions and 4 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue