From 264741152aeef952dc8aec276a07aeaa82ec4640 Mon Sep 17 00:00:00 2001 From: woodser Date: Thu, 10 Oct 2024 09:13:00 -0400 Subject: [PATCH] enable sounds by default for existing clients --- core/src/main/java/haveno/core/user/Preferences.java | 6 ++++++ core/src/main/java/haveno/core/user/PreferencesPayload.java | 3 +++ proto/src/main/proto/pb.proto | 1 + 3 files changed, 10 insertions(+) diff --git a/core/src/main/java/haveno/core/user/Preferences.java b/core/src/main/java/haveno/core/user/Preferences.java index b57b5708..3f8a80f9 100644 --- a/core/src/main/java/haveno/core/user/Preferences.java +++ b/core/src/main/java/haveno/core/user/Preferences.java @@ -314,6 +314,12 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid }); } + // enable sounds by default for existing clients (protobuf does not express that new field is unset) + if (!prefPayload.isUseSoundForNotificationsInitialized()) { + prefPayload.setUseSoundForNotificationsInitialized(true); + setUseSoundForNotifications(true); + } + initialReadDone = true; requestPersistence(); } diff --git a/core/src/main/java/haveno/core/user/PreferencesPayload.java b/core/src/main/java/haveno/core/user/PreferencesPayload.java index 5484c514..e45f1282 100644 --- a/core/src/main/java/haveno/core/user/PreferencesPayload.java +++ b/core/src/main/java/haveno/core/user/PreferencesPayload.java @@ -109,6 +109,7 @@ public final class PreferencesPayload implements PersistableEnvelope { private boolean usePriceNotifications = true; private boolean useStandbyMode = false; private boolean useSoundForNotifications = true; + private boolean useSoundForNotificationsInitialized = false; @Nullable private String rpcUser; @Nullable @@ -187,6 +188,7 @@ public final class PreferencesPayload implements PersistableEnvelope { .setUsePriceNotifications(usePriceNotifications) .setUseStandbyMode(useStandbyMode) .setUseSoundForNotifications(useSoundForNotifications) + .setUseSoundForNotificationsInitialized(useSoundForNotificationsInitialized) .setBuyerSecurityDepositAsPercent(buyerSecurityDepositAsPercent) .setIgnoreDustThreshold(ignoreDustThreshold) .setClearDataAfterDays(clearDataAfterDays) @@ -283,6 +285,7 @@ public final class PreferencesPayload implements PersistableEnvelope { proto.getUsePriceNotifications(), proto.getUseStandbyMode(), proto.getUseSoundForNotifications(), + proto.getUseSoundForNotificationsInitialized(), proto.getRpcUser().isEmpty() ? null : proto.getRpcUser(), proto.getRpcPw().isEmpty() ? null : proto.getRpcPw(), proto.getTakeOfferSelectedPaymentAccountId().isEmpty() ? null : proto.getTakeOfferSelectedPaymentAccountId(), diff --git a/proto/src/main/proto/pb.proto b/proto/src/main/proto/pb.proto index f63e82a1..00b44736 100644 --- a/proto/src/main/proto/pb.proto +++ b/proto/src/main/proto/pb.proto @@ -1741,6 +1741,7 @@ message PreferencesPayload { string sell_screen_crypto_currency_code = 61; bool split_offer_output = 62; bool use_sound_for_notifications = 63; + bool use_sound_for_notifications_initialized = 64; } message AutoConfirmSettings {