Adds an extra catch in case there is a decryption error
This commit is contained in:
+14
-9
@@ -83,16 +83,21 @@ class AppSpecificState(
|
|||||||
scope.launch(Dispatchers.Default) {
|
scope.launch(Dispatchers.Default) {
|
||||||
Log.d("AccountRegisterObservers", "AppSpecificData Collector Start")
|
Log.d("AccountRegisterObservers", "AppSpecificData Collector Start")
|
||||||
getAppSpecificDataFlow().collect {
|
getAppSpecificDataFlow().collect {
|
||||||
Log.d("AccountRegisterObservers", "Updating AppSpecificData for ${signer.pubKey}")
|
try {
|
||||||
(it.note.event as? AppSpecificDataEvent)?.let {
|
Log.d("AccountRegisterObservers", "Updating AppSpecificData for ${signer.pubKey}")
|
||||||
val decrypted = signer.decrypt(it.content, it.pubKey)
|
(it.note.event as? AppSpecificDataEvent)?.let {
|
||||||
try {
|
val decrypted = signer.decrypt(it.content, it.pubKey)
|
||||||
val syncedSettings = JsonMapper.mapper.readValue<AccountSyncedSettingsInternal>(decrypted)
|
try {
|
||||||
settings.updateAppSpecificData(it, syncedSettings)
|
val syncedSettings = JsonMapper.mapper.readValue<AccountSyncedSettingsInternal>(decrypted)
|
||||||
} catch (e: Throwable) {
|
settings.updateAppSpecificData(it, syncedSettings)
|
||||||
if (e is CancellationException) throw e
|
} catch (e: Throwable) {
|
||||||
Log.w("LocalPreferences", "Error Decoding latestAppSpecificData from Preferences with value $decrypted", e)
|
if (e is CancellationException) throw e
|
||||||
|
Log.w("LocalPreferences", "Error Decoding latestAppSpecificData from Preferences with value $decrypted", e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
if (e is CancellationException) throw e
|
||||||
|
Log.w("LocalPreferences", "Error Decrypting latestAppSpecificData from Preferences", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user