Merge pull request #2381 from Bnyro/master

fix crash when restoring the preferences backup
This commit is contained in:
Bnyro 2022-12-15 19:16:40 +01:00 committed by GitHub
commit 6feb8c1496
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@ import android.net.Uri
import androidx.core.content.edit
import androidx.preference.PreferenceManager
import com.fasterxml.jackson.databind.ObjectMapper
import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.db.DatabaseHolder.Companion.Database
import com.github.libretube.extensions.query
import com.github.libretube.obj.BackupFile
@ -94,7 +95,12 @@ class BackupHelper(private val context: Context) {
is Boolean -> putBoolean(it.key, it.value)
is Float -> putFloat(it.key, it.value)
is Long -> putLong(it.key, it.value)
is Int -> putInt(it.key, it.value)
is Int -> {
when (it.key) {
PreferenceKeys.START_FRAGMENT -> putInt(it.key, it.value)
else -> putLong(it.key, it.value.toLong())
}
}
is String -> putString(it.key, it.value)
}
}