fix: add missing ui SharedPreference

This commit is contained in:
rebelonion 2024-03-18 17:45:17 -05:00
parent 6a8e422a30
commit ce50627989
2 changed files with 5 additions and 2 deletions

View file

@ -16,6 +16,7 @@ import java.io.ObjectOutputStream
object PrefManager {
private var generalPreferences: SharedPreferences? = null
private var uiPreferences: SharedPreferences? = null
private var playerPreferences: SharedPreferences? = null
private var readerPreferences: SharedPreferences? = null
private var irrelevantPreferences: SharedPreferences? = null
@ -25,6 +26,8 @@ object PrefManager {
fun init(context: Context) { //must be called in Application class or will crash
generalPreferences =
context.getSharedPreferences(Location.General.location, Context.MODE_PRIVATE)
uiPreferences =
context.getSharedPreferences(Location.UI.location, Context.MODE_PRIVATE)
playerPreferences =
context.getSharedPreferences(Location.Player.location, Context.MODE_PRIVATE)
readerPreferences =
@ -353,7 +356,7 @@ object PrefManager {
private fun getPrefLocation(prefLoc: Location): SharedPreferences {
return when (prefLoc) {
Location.General -> generalPreferences
Location.UI -> generalPreferences
Location.UI -> uiPreferences
Location.Player -> playerPreferences
Location.Reader -> readerPreferences
Location.NovelReader -> readerPreferences

View file

@ -41,7 +41,7 @@ class PreferencePackager {
val value = typeValueMap["value"]
innerMap[key] =
when (typeName) { //wierdly null sometimes so cast to string
when (typeName) { //weirdly null sometimes so cast to string
"kotlin.Int" -> (value as? Double)?.toInt()
"kotlin.String" -> value.toString()
"kotlin.Boolean" -> value as? Boolean