mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 20:06:37 +01:00
create putOrRemove overload for Nip47URI?
This commit is contained in:
@@ -326,12 +326,7 @@ object LocalPreferences {
|
||||
settings.defaultDiscoveryFollowList.value,
|
||||
)
|
||||
|
||||
val nwcToBeSaved = settings.zapPaymentRequest.value?.denormalize()
|
||||
if (nwcToBeSaved != null) {
|
||||
putString(PrefKeys.ZAP_PAYMENT_REQUEST_SERVER, JsonMapper.toJson(nwcToBeSaved))
|
||||
} else {
|
||||
remove(PrefKeys.ZAP_PAYMENT_REQUEST_SERVER)
|
||||
}
|
||||
putOrRemove(PrefKeys.ZAP_PAYMENT_REQUEST_SERVER, settings.zapPaymentRequest.value?.denormalize())
|
||||
|
||||
putOrRemove(PrefKeys.LATEST_CONTACT_LIST, settings.backupContactList)
|
||||
|
||||
@@ -589,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