mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-09 08:04:45 +00:00
Merge pull request #1512 from davotoula/fix-nwc-string-deleted-on-restart
BUGFIX: Fix nwc string deleted on restart
This commit is contained in:
@@ -325,6 +325,7 @@ object LocalPreferences {
|
||||
PrefKeys.DEFAULT_DISCOVERY_FOLLOW_LIST,
|
||||
settings.defaultDiscoveryFollowList.value,
|
||||
)
|
||||
|
||||
putOrRemove(PrefKeys.ZAP_PAYMENT_REQUEST_SERVER, settings.zapPaymentRequest.value?.denormalize())
|
||||
|
||||
putOrRemove(PrefKeys.LATEST_CONTACT_LIST, settings.backupContactList)
|
||||
@@ -383,7 +384,7 @@ object LocalPreferences {
|
||||
|
||||
suspend fun loadAccountConfigFromEncryptedStorage(): AccountSettings? = currentAccount()?.let { loadAccountConfigFromEncryptedStorage(it) }
|
||||
|
||||
suspend fun saveSharedSettings(
|
||||
fun saveSharedSettings(
|
||||
sharedSettings: UiSettings,
|
||||
prefs: SharedPreferences = encryptedPreferences(),
|
||||
) {
|
||||
@@ -393,7 +394,7 @@ object LocalPreferences {
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun loadSharedSettings(prefs: SharedPreferences = encryptedPreferences()): UiSettings? {
|
||||
fun loadSharedSettings(prefs: SharedPreferences = encryptedPreferences()): UiSettings? {
|
||||
Log.d("LocalPreferences", "Load shared settings")
|
||||
with(prefs) {
|
||||
return try {
|
||||
@@ -583,4 +584,15 @@ object LocalPreferences {
|
||||
remove(key)
|
||||
}
|
||||
}
|
||||
|
||||
fun SharedPreferences.Editor.putOrRemove(
|
||||
key: String,
|
||||
nwc: Nip47WalletConnect.Nip47URI?,
|
||||
) {
|
||||
if (nwc != null) {
|
||||
putString(key, JsonMapper.toJson(nwc))
|
||||
} else {
|
||||
remove(key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user