mirror of
https://github.com/yogeshpaliyal/KeyPass.git
synced 2026-04-30 19:40:11 -05:00
feat: add DB Crash (#1077)
This commit is contained in:
committed by
GitHub
parent
593df60a43
commit
1b6ba34786
@@ -11,7 +11,7 @@ data class PasswordConfig(
|
||||
val includeUppercaseLetters: Boolean,
|
||||
val includeLowercaseLetters: Boolean,
|
||||
val includeSymbols: Boolean,
|
||||
val listOfSymbols: List<Char>,
|
||||
val listOfSymbols: List<Char> = PasswordGenerator.totalSymbol,
|
||||
val includeNumbers: Boolean,
|
||||
val includeBlankSpaces: Boolean,
|
||||
val password: String
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.yogeshpaliyal.common.utils
|
||||
|
||||
import androidx.datastore.core.Serializer
|
||||
import com.yogeshpaliyal.common.data.UserSettings
|
||||
import kotlinx.serialization.SerializationException
|
||||
import kotlinx.serialization.json.Json
|
||||
import java.io.InputStream
|
||||
import java.io.OutputStream
|
||||
@@ -16,16 +15,13 @@ class UserSettingsSerializer(
|
||||
|
||||
override suspend fun readFrom(input: InputStream): UserSettings {
|
||||
val decryptedBytes = cryptoManager.decrypt(input)
|
||||
return try {
|
||||
val decodedString = decryptedBytes.decodeToString()
|
||||
Json.decodeFromString(
|
||||
deserializer = UserSettings.serializer(),
|
||||
string = decodedString
|
||||
)
|
||||
} catch (e: SerializationException) {
|
||||
e.printStackTrace()
|
||||
defaultValue
|
||||
}
|
||||
|
||||
val decodedString = decryptedBytes.decodeToString()
|
||||
return Json.decodeFromString(
|
||||
deserializer = UserSettings.serializer(),
|
||||
string = decodedString
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
override suspend fun writeTo(t: UserSettings, output: OutputStream) {
|
||||
|
||||
Reference in New Issue
Block a user