From ae370019495b1dfa053e0e55ef420b68769c6acb Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Mon, 18 Nov 2024 12:18:29 -0500 Subject: [PATCH] Convert InternalValues to kotlin. --- .../app/internal/InternalSettingsViewModel.kt | 32 +-- .../AdvancedPrivacySettingsViewModel.kt | 2 +- .../ConversationSettingsRepository.kt | 2 +- .../conversation/v2/ConversationAdapterV2.kt | 2 +- .../securesms/emoji/EmojiSource.kt | 2 +- .../securesms/groups/GroupManagerV2.java | 4 +- .../v2/processing/GroupsV2StateProcessor.kt | 2 +- .../securesms/jobs/ResendMessageJob.java | 2 +- .../securesms/jobs/StorageSyncJob.kt | 2 +- .../securesms/keyvalue/InternalValues.java | 228 ------------------ .../securesms/keyvalue/InternalValues.kt | 161 +++++++++++++ .../keyvalue/SignalStoreValueDelegates.kt | 68 +++++- .../securesms/messages/GroupSendUtil.java | 2 +- .../net/DefaultWebSocketShadowingBridge.kt | 4 +- .../service/webrtc/AndroidTelecomUtil.kt | 2 +- .../webrtc/CallLinkPreJoinActionProcessor.kt | 2 +- ...roupNetworkUnavailableActionProcessor.java | 2 +- .../webrtc/GroupPreJoinActionProcessor.java | 2 +- .../IncomingGroupCallActionProcessor.java | 2 +- .../webrtc/RingRtcDynamicConfiguration.kt | 6 +- .../service/webrtc/SignalCallManager.java | 6 +- .../webrtc/links/SignalCallLinkManager.kt | 10 +- .../securesms/shakereport/ShakeToReport.java | 8 +- .../securesms/util/NetworkUtil.java | 4 +- .../processing/GroupsV2StateProcessorTest.kt | 2 +- 25 files changed, 270 insertions(+), 289 deletions(-) delete mode 100644 app/src/main/java/org/thoughtcrime/securesms/keyvalue/InternalValues.java create mode 100644 app/src/main/java/org/thoughtcrime/securesms/keyvalue/InternalValues.kt diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/internal/InternalSettingsViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/internal/InternalSettingsViewModel.kt index 517bc83a032..5116ba63227 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/internal/InternalSettingsViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/internal/InternalSettingsViewModel.kt @@ -115,7 +115,7 @@ class InternalSettingsViewModel(private val repository: InternalSettingsReposito } fun setUseConversationItemV2Media(enabled: Boolean) { - SignalStore.internal.setUseConversationItemV2Media(enabled) + SignalStore.internal.useConversationItemV2Media = enabled refresh() } @@ -145,25 +145,25 @@ class InternalSettingsViewModel(private val repository: InternalSettingsReposito } private fun getState() = InternalSettingsState( - seeMoreUserDetails = SignalStore.internal.recipientDetails(), - shakeToReport = SignalStore.internal.shakeToReport(), - gv2forceInvites = SignalStore.internal.gv2ForceInvites(), - gv2ignoreP2PChanges = SignalStore.internal.gv2IgnoreP2PChanges(), - allowCensorshipSetting = SignalStore.internal.allowChangingCensorshipSetting(), + seeMoreUserDetails = SignalStore.internal.recipientDetails, + shakeToReport = SignalStore.internal.shakeToReport, + gv2forceInvites = SignalStore.internal.gv2ForceInvites, + gv2ignoreP2PChanges = SignalStore.internal.gv2IgnoreP2PChanges, + allowCensorshipSetting = SignalStore.internal.allowChangingCensorshipSetting, forceWebsocketMode = SignalStore.internal.isWebsocketModeForced, - callingServer = SignalStore.internal.groupCallingServer(), - callingAudioProcessingMethod = SignalStore.internal.callingAudioProcessingMethod(), - callingDataMode = SignalStore.internal.callingDataMode(), - callingDisableTelecom = SignalStore.internal.callingDisableTelecom(), - callingEnableOboeAdm = SignalStore.internal.callingEnableOboeAdm(), - useBuiltInEmojiSet = SignalStore.internal.forceBuiltInEmoji(), + callingServer = SignalStore.internal.groupCallingServer, + callingAudioProcessingMethod = SignalStore.internal.callingAudioProcessingMethod, + callingDataMode = SignalStore.internal.callingDataMode, + callingDisableTelecom = SignalStore.internal.callingDisableTelecom, + callingEnableOboeAdm = SignalStore.internal.callingEnableOboeAdm, + useBuiltInEmojiSet = SignalStore.internal.forceBuiltInEmoji, emojiVersion = null, - removeSenderKeyMinimium = SignalStore.internal.removeSenderKeyMinimum(), - delayResends = SignalStore.internal.delayResends(), - disableStorageService = SignalStore.internal.storageServiceDisabled(), + removeSenderKeyMinimium = SignalStore.internal.removeSenderKeyMinimum, + delayResends = SignalStore.internal.delayResends, + disableStorageService = SignalStore.internal.storageServiceDisabled, canClearOnboardingState = SignalStore.story.hasDownloadedOnboardingStory && Stories.isFeatureEnabled(), pnpInitialized = SignalStore.misc.hasPniInitializedDevices, - useConversationItemV2ForMedia = SignalStore.internal.useConversationItemV2Media(), + useConversationItemV2ForMedia = SignalStore.internal.useConversationItemV2Media, hasPendingOneTimeDonation = SignalStore.inAppPayments.getPendingOneTimeDonation() != null, hevcEncoding = SignalStore.internal.hevcEncoding, newCallingUi = SignalStore.internal.newCallingUi diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/privacy/advanced/AdvancedPrivacySettingsViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/privacy/advanced/AdvancedPrivacySettingsViewModel.kt index 9dff6b96457..dc7b03f522e 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/privacy/advanced/AdvancedPrivacySettingsViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/privacy/advanced/AdvancedPrivacySettingsViewModel.kt @@ -96,7 +96,7 @@ class AdvancedPrivacySettingsViewModel( val websocketConnected: Boolean = AppDependencies.signalWebSocket.webSocketState.firstOrError().blockingGet() == WebSocketConnectionState.CONNECTED return when { - SignalStore.internal.allowChangingCensorshipSetting() -> { + SignalStore.internal.allowChangingCensorshipSetting -> { CensorshipCircumventionState.AVAILABLE } isCountryCodeCensoredByDefault && enabledState == SettingsValues.CensorshipCircumventionEnabled.DISABLED -> { diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/settings/conversation/ConversationSettingsRepository.kt b/app/src/main/java/org/thoughtcrime/securesms/components/settings/conversation/ConversationSettingsRepository.kt index e7ce084c48e..6746d28bfbb 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/settings/conversation/ConversationSettingsRepository.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/components/settings/conversation/ConversationSettingsRepository.kt @@ -84,7 +84,7 @@ class ConversationSettingsRepository( } } - fun isInternalRecipientDetailsEnabled(): Boolean = SignalStore.internal.recipientDetails() + fun isInternalRecipientDetailsEnabled(): Boolean = SignalStore.internal.recipientDetails fun hasGroups(consumer: (Boolean) -> Unit) { SignalExecutors.BOUNDED.execute { consumer(SignalDatabase.groups.getActiveGroupCount() > 0) } diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationAdapterV2.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationAdapterV2.kt index d54a484b7c7..7c015deea42 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationAdapterV2.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationAdapterV2.kt @@ -107,7 +107,7 @@ class ConversationAdapterV2( ConversationUpdateViewHolder(view) } - if (SignalStore.internal.useConversationItemV2Media()) { + if (SignalStore.internal.useConversationItemV2Media) { registerFactory(OutgoingMedia::class.java) { parent -> val view = CachedInflater.from(parent.context).inflate(R.layout.v2_conversation_item_media_outgoing, parent, false) V2ConversationItemMediaViewHolder(V2ConversationItemMediaOutgoingBinding.bind(view).bridge(), this) diff --git a/app/src/main/java/org/thoughtcrime/securesms/emoji/EmojiSource.kt b/app/src/main/java/org/thoughtcrime/securesms/emoji/EmojiSource.kt index fb0de789328..348cf502449 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/emoji/EmojiSource.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/emoji/EmojiSource.kt @@ -104,7 +104,7 @@ class EmojiSource( } private fun loadRemoteBasedEmojis(): EmojiSource? { - if (SignalStore.internal.forceBuiltInEmoji()) { + if (SignalStore.internal.forceBuiltInEmoji) { return null } diff --git a/app/src/main/java/org/thoughtcrime/securesms/groups/GroupManagerV2.java b/app/src/main/java/org/thoughtcrime/securesms/groups/GroupManagerV2.java index 6f5eee8186f..7ca5faeb4ca 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/groups/GroupManagerV2.java +++ b/app/src/main/java/org/thoughtcrime/securesms/groups/GroupManagerV2.java @@ -291,7 +291,7 @@ final class GroupEditor extends LockOwner { Set groupCandidates = groupCandidateHelper.recipientIdsToCandidates(new HashSet<>(newMembers)); - if (SignalStore.internal().gv2ForceInvites()) { + if (SignalStore.internal().getGv2ForceInvites()) { groupCandidates = GroupCandidate.withoutExpiringProfileKeyCredentials(groupCandidates); } @@ -792,7 +792,7 @@ private DecryptedGroupChange getDecryptedGroupChange(@Nullable byte[] signedGrou GroupCandidate self = groupCandidateHelper.recipientIdToCandidate(Recipient.self().getId()); Set candidates = new HashSet<>(groupCandidateHelper.recipientIdsToCandidates(members)); - if (SignalStore.internal().gv2ForceInvites()) { + if (SignalStore.internal().getGv2ForceInvites()) { Log.w(TAG, "Forcing GV2 invites due to internal setting"); candidates = GroupCandidate.withoutExpiringProfileKeyCredentials(candidates); } diff --git a/app/src/main/java/org/thoughtcrime/securesms/groups/v2/processing/GroupsV2StateProcessor.kt b/app/src/main/java/org/thoughtcrime/securesms/groups/v2/processing/GroupsV2StateProcessor.kt index a6fc03550b5..79553b530b8 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/groups/v2/processing/GroupsV2StateProcessor.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/groups/v2/processing/GroupsV2StateProcessor.kt @@ -226,7 +226,7 @@ class GroupsV2StateProcessor private constructor( currentLocalState: DecryptedGroup?, groupRecord: Optional ): Boolean { - if (SignalStore.internal.gv2IgnoreP2PChanges()) { + if (SignalStore.internal.gv2IgnoreP2PChanges) { Log.w(TAG, "$logPrefix Ignoring P2P group change by setting") return false } diff --git a/app/src/main/java/org/thoughtcrime/securesms/jobs/ResendMessageJob.java b/app/src/main/java/org/thoughtcrime/securesms/jobs/ResendMessageJob.java index 76ccd843514..4ef54ac9315 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/jobs/ResendMessageJob.java +++ b/app/src/main/java/org/thoughtcrime/securesms/jobs/ResendMessageJob.java @@ -126,7 +126,7 @@ private ResendMessageJob(@NonNull RecipientId recipientId, @Override protected void onRun() throws Exception { - if (SignalStore.internal().delayResends()) { + if (SignalStore.internal().getDelayResends()) { Log.w(TAG, "Delaying resend by 10 sec because of an internal preference."); ThreadUtil.sleep(10000); } diff --git a/app/src/main/java/org/thoughtcrime/securesms/jobs/StorageSyncJob.kt b/app/src/main/java/org/thoughtcrime/securesms/jobs/StorageSyncJob.kt index f5922ba4412..c72fc972942 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/jobs/StorageSyncJob.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/jobs/StorageSyncJob.kt @@ -158,7 +158,7 @@ class StorageSyncJob private constructor(parameters: Parameters) : BaseJob(param return } - if (SignalStore.internal.storageServiceDisabled()) { + if (SignalStore.internal.storageServiceDisabled) { Log.w(TAG, "Storage service has been manually disabled. Skipping.") return } diff --git a/app/src/main/java/org/thoughtcrime/securesms/keyvalue/InternalValues.java b/app/src/main/java/org/thoughtcrime/securesms/keyvalue/InternalValues.java deleted file mode 100644 index 8c4cf87ec39..00000000000 --- a/app/src/main/java/org/thoughtcrime/securesms/keyvalue/InternalValues.java +++ /dev/null @@ -1,228 +0,0 @@ -package org.thoughtcrime.securesms.keyvalue; - -import androidx.annotation.NonNull; - -import org.signal.ringrtc.CallManager; -import org.thoughtcrime.securesms.BuildConfig; -import org.thoughtcrime.securesms.util.Environment; -import org.thoughtcrime.securesms.util.RemoteConfig; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -public final class InternalValues extends SignalStoreValues { - - public static final String GV2_FORCE_INVITES = "internal.gv2.force_invites"; - public static final String GV2_IGNORE_P2P_CHANGES = "internal.gv2.ignore_p2p_changes"; - public static final String RECIPIENT_DETAILS = "internal.recipient_details"; - public static final String ALLOW_CENSORSHIP_SETTING = "internal.force_censorship"; - public static final String FORCE_BUILT_IN_EMOJI = "internal.force_built_in_emoji"; - public static final String REMOVE_SENDER_KEY_MINIMUM = "internal.remove_sender_key_minimum"; - public static final String DELAY_RESENDS = "internal.delay_resends"; - public static final String CALLING_SERVER = "internal.calling_server"; - public static final String CALLING_AUDIO_PROCESSING_METHOD = "internal.calling_audio_processing_method"; - public static final String CALLING_DATA_MODE = "internal.calling_bandwidth_mode"; - public static final String CALLING_DISABLE_TELECOM = "internal.calling_disable_telecom"; - public static final String CALLING_ENABLE_OBOE_ADM = "internal.calling_enable_oboe_adm"; - public static final String SHAKE_TO_REPORT = "internal.shake_to_report"; - public static final String DISABLE_STORAGE_SERVICE = "internal.disable_storage_service"; - public static final String FORCE_WEBSOCKET_MODE = "internal.force_websocket_mode"; - public static final String LAST_SCROLL_POSITION = "internal.last_scroll_position"; - public static final String CONVERSATION_ITEM_V2_MEDIA = "internal.conversation_item_v2_media"; - public static final String FORCE_ENTER_RESTORE_V2_FLOW = "internal.force_enter_restore_v2_flow"; - public static final String WEB_SOCKET_SHADOWING_STATS = "internal.web_socket_shadowing_stats"; - public static final String ENCODE_HEVC = "internal.hevc_encoding"; - public static final String NEW_CALL_UI = "internal.new.call.ui"; - - InternalValues(KeyValueStore store) { - super(store); - } - - @Override - void onFirstEverAppLaunch() { - } - - @Override - @NonNull List getKeysToIncludeInBackup() { - return Collections.emptyList(); - } - - /** - * Members will not be added directly to a GV2 even if they could be. - */ - public synchronized boolean gv2ForceInvites() { - return RemoteConfig.internalUser() && getBoolean(GV2_FORCE_INVITES, false); - } - - /** - * Signed group changes are sent P2P, if the client ignores them, it will then ask the server - * directly which allows testing of certain testing scenarios. - */ - public synchronized boolean gv2IgnoreP2PChanges() { - return RemoteConfig.internalUser() && getBoolean(GV2_IGNORE_P2P_CHANGES, false); - } - - /** - * Show detailed recipient info in the {@link org.thoughtcrime.securesms.components.settings.conversation.InternalConversationSettingsFragment}. - */ - public synchronized boolean recipientDetails() { - return RemoteConfig.internalUser() && getBoolean(RECIPIENT_DETAILS, true); - } - - /** - * Allow changing the censorship circumvention setting regardless of network status. - */ - public synchronized boolean allowChangingCensorshipSetting() { - return RemoteConfig.internalUser() && getBoolean(ALLOW_CENSORSHIP_SETTING, false); - } - - /** - * Force the app to use the emoji that ship with the app, as opposed to the ones that were downloaded. - */ - public synchronized boolean forceBuiltInEmoji() { - return RemoteConfig.internalUser() && getBoolean(FORCE_BUILT_IN_EMOJI, false); - } - - /** - * Remove the requirement that there must be two sender-key-capable recipients to use sender key - */ - public synchronized boolean removeSenderKeyMinimum() { - return RemoteConfig.internalUser() && getBoolean(REMOVE_SENDER_KEY_MINIMUM, false); - } - - /** - * Delay resending messages in response to retry receipts by 10 seconds. - */ - public synchronized boolean delayResends() { - return RemoteConfig.internalUser() && getBoolean(DELAY_RESENDS, false); - } - - /** - * Whether or not "shake to report" is enabled. - */ - public synchronized boolean shakeToReport() { - return RemoteConfig.internalUser() && getBoolean(SHAKE_TO_REPORT, true); - } - - /** - * Whether or not storage service is manually disabled. - */ - public synchronized boolean storageServiceDisabled() { - return RemoteConfig.internalUser() && getBoolean(DISABLE_STORAGE_SERVICE, false); - } - - /** - * The selected group calling server to use. - *

- * The user must be an internal user and the setting must be one of the current set of internal servers otherwise - * the default SFU will be returned. This ensures that if the {@link BuildConfig#SIGNAL_SFU_INTERNAL_URLS} list changes, - * internal users cannot be left on old servers. - */ - public synchronized @NonNull String groupCallingServer() { - String internalServer = RemoteConfig.internalUser() ? getString(CALLING_SERVER, Environment.Calling.defaultSfuUrl()) : null; - if (internalServer != null && !Arrays.asList(BuildConfig.SIGNAL_SFU_INTERNAL_URLS).contains(internalServer)) { - internalServer = null; - } - return internalServer != null ? internalServer : BuildConfig.SIGNAL_SFU_URL; - } - - /** - * Setting to override the default handling of hardware/software AEC. - */ - public synchronized CallManager.AudioProcessingMethod callingAudioProcessingMethod() { - if (RemoteConfig.internalUser()) { - return CallManager.AudioProcessingMethod.values()[getInteger(CALLING_AUDIO_PROCESSING_METHOD, CallManager.AudioProcessingMethod.Default.ordinal())]; - } else { - return CallManager.AudioProcessingMethod.Default; - } - } - - /** - * Setting to override the default calling bandwidth mode. - */ - public synchronized CallManager.DataMode callingDataMode() { - if (RemoteConfig.internalUser()) { - int index = getInteger(CALLING_DATA_MODE, CallManager.DataMode.NORMAL.ordinal()); - CallManager.DataMode[] modes = CallManager.DataMode.values(); - - return index < modes.length ? modes[index] : CallManager.DataMode.NORMAL; - } else { - return CallManager.DataMode.NORMAL; - } - } - - /** - * Whether or not Telecom integration is manually disabled. - */ - public synchronized boolean callingDisableTelecom() { - if (RemoteConfig.internalUser()) { - return getBoolean(CALLING_DISABLE_TELECOM, true); - } else { - return false; - } - } - - /** - * Whether or not the Oboe ADM is used. - */ - public synchronized boolean callingEnableOboeAdm() { - if (RemoteConfig.internalUser()) { - return getBoolean(CALLING_ENABLE_OBOE_ADM, true); - } else { - return false; - } - } - - /** - * Whether or not the system is forced to be in 'websocket mode', where FCM is ignored and we use a foreground service to keep the app alive. - */ - public boolean isWebsocketModeForced() { - if (RemoteConfig.internalUser()) { - return getBoolean(FORCE_WEBSOCKET_MODE, false); - } else { - return false; - } - } - - public void setHevcEncoding(boolean enabled) { - putBoolean(ENCODE_HEVC, enabled); - } - - public boolean getHevcEncoding() { - return getBoolean(ENCODE_HEVC, false); - } - - public void setNewCallingUi(boolean enabled) { - putBoolean(NEW_CALL_UI, enabled); - } - - public boolean getNewCallingUi() { - return getBoolean(NEW_CALL_UI, false); - } - - public void setLastScrollPosition(int position) { - putInteger(LAST_SCROLL_POSITION, position); - } - - public int getLastScrollPosition() { - return getInteger(LAST_SCROLL_POSITION, 0); - } - - public void setUseConversationItemV2Media(boolean useConversationFragmentV2Media) { - putBoolean(CONVERSATION_ITEM_V2_MEDIA, useConversationFragmentV2Media); - } - - public boolean useConversationItemV2Media() { - return RemoteConfig.internalUser() && getBoolean(CONVERSATION_ITEM_V2_MEDIA, false); - } - - public synchronized void setWebSocketShadowingStats(byte[] bytes) { - putBlob(WEB_SOCKET_SHADOWING_STATS, bytes); - } - - public synchronized byte[] getWebSocketShadowingStats(byte[] defaultValue) { - return getBlob(WEB_SOCKET_SHADOWING_STATS, defaultValue); - } - -} diff --git a/app/src/main/java/org/thoughtcrime/securesms/keyvalue/InternalValues.kt b/app/src/main/java/org/thoughtcrime/securesms/keyvalue/InternalValues.kt new file mode 100644 index 00000000000..fb461658755 --- /dev/null +++ b/app/src/main/java/org/thoughtcrime/securesms/keyvalue/InternalValues.kt @@ -0,0 +1,161 @@ +package org.thoughtcrime.securesms.keyvalue + +import org.signal.ringrtc.CallManager.AudioProcessingMethod +import org.signal.ringrtc.CallManager.DataMode +import org.thoughtcrime.securesms.BuildConfig +import org.thoughtcrime.securesms.util.Environment.Calling.defaultSfuUrl +import org.thoughtcrime.securesms.util.RemoteConfig + +class InternalValues internal constructor(store: KeyValueStore) : SignalStoreValues(store) { + companion object { + const val GV2_FORCE_INVITES: String = "internal.gv2.force_invites" + const val GV2_IGNORE_P2P_CHANGES: String = "internal.gv2.ignore_p2p_changes" + const val RECIPIENT_DETAILS: String = "internal.recipient_details" + const val ALLOW_CENSORSHIP_SETTING: String = "internal.force_censorship" + const val FORCE_BUILT_IN_EMOJI: String = "internal.force_built_in_emoji" + const val REMOVE_SENDER_KEY_MINIMUM: String = "internal.remove_sender_key_minimum" + const val DELAY_RESENDS: String = "internal.delay_resends" + const val CALLING_SERVER: String = "internal.calling_server" + const val CALLING_AUDIO_PROCESSING_METHOD: String = "internal.calling_audio_processing_method" + const val CALLING_DATA_MODE: String = "internal.calling_bandwidth_mode" + const val CALLING_DISABLE_TELECOM: String = "internal.calling_disable_telecom" + const val CALLING_ENABLE_OBOE_ADM: String = "internal.calling_enable_oboe_adm" + const val SHAKE_TO_REPORT: String = "internal.shake_to_report" + const val DISABLE_STORAGE_SERVICE: String = "internal.disable_storage_service" + const val FORCE_WEBSOCKET_MODE: String = "internal.force_websocket_mode" + const val LAST_SCROLL_POSITION: String = "internal.last_scroll_position" + const val CONVERSATION_ITEM_V2_MEDIA: String = "internal.conversation_item_v2_media" + const val WEB_SOCKET_SHADOWING_STATS: String = "internal.web_socket_shadowing_stats" + const val ENCODE_HEVC: String = "internal.hevc_encoding" + const val NEW_CALL_UI: String = "internal.new.call.ui" + } + + public override fun onFirstEverAppLaunch() = Unit + + public override fun getKeysToIncludeInBackup(): List = emptyList() + + /** + * Members will not be added directly to a GV2 even if they could be. + */ + var gv2ForceInvites by booleanValue(GV2_FORCE_INVITES, false).defaultForExternalUsers() + + /** + * Signed group changes are sent P2P, if the client ignores them, it will then ask the server + * directly which allows testing of certain testing scenarios. + */ + var gv2IgnoreP2PChanges by booleanValue(GV2_IGNORE_P2P_CHANGES, false).defaultForExternalUsers() + + /** + * Show detailed recipient info in the [org.thoughtcrime.securesms.components.settings.conversation.InternalConversationSettingsFragment]. + */ + var recipientDetails by booleanValue(RECIPIENT_DETAILS, true).falseForExternalUsers() + + /** + * Allow changing the censorship circumvention setting regardless of network status. + */ + var allowChangingCensorshipSetting by booleanValue(ALLOW_CENSORSHIP_SETTING, false).defaultForExternalUsers() + + /** + * Force the app to use the emoji that ship with the app, as opposed to the ones that were downloaded. + */ + var forceBuiltInEmoji by booleanValue(FORCE_BUILT_IN_EMOJI, false).defaultForExternalUsers() + + /** + * Remove the requirement that there must be two sender-key-capable recipients to use sender key + */ + var removeSenderKeyMinimum by booleanValue(REMOVE_SENDER_KEY_MINIMUM, false).defaultForExternalUsers() + + /** + * Delay resending messages in response to retry receipts by 10 seconds. + */ + var delayResends by booleanValue(DELAY_RESENDS, false).defaultForExternalUsers() + + /** + * Whether or not "shake to report" is enabled. + */ + var shakeToReport: Boolean by booleanValue(SHAKE_TO_REPORT, true).falseForExternalUsers() + + /** + * Whether or not storage service is manually disabled. + */ + var storageServiceDisabled by booleanValue(DISABLE_STORAGE_SERVICE, false).defaultForExternalUsers() + + /** + * The selected group calling server to use. + * + * + * The user must be an internal user and the setting must be one of the current set of internal servers otherwise + * the default SFU will be returned. This ensures that if the [BuildConfig.SIGNAL_SFU_INTERNAL_URLS] list changes, + * internal users cannot be left on old servers. + */ + var groupCallingServer: String + get() { + var internalServer = if (RemoteConfig.internalUser) getString(CALLING_SERVER, defaultSfuUrl()) else null + if (internalServer != null && !listOf(*BuildConfig.SIGNAL_SFU_INTERNAL_URLS).contains(internalServer)) { + internalServer = null + } + return internalServer ?: BuildConfig.SIGNAL_SFU_URL + } + set(value) = putString(CALLING_SERVER, value) + + /** + * Setting to override the default handling of hardware/software AEC. + */ + val callingAudioProcessingMethod: AudioProcessingMethod + get() { + return if (RemoteConfig.internalUser) { + val entryIndex = getInteger(CALLING_AUDIO_PROCESSING_METHOD, AudioProcessingMethod.Default.ordinal) + AudioProcessingMethod.entries[entryIndex] + } else { + AudioProcessingMethod.Default + } + } + + /** + * Setting to override the default calling bandwidth mode. + */ + val callingDataMode: DataMode + get() { + return if (RemoteConfig.internalUser) { + val index = getInteger(CALLING_DATA_MODE, DataMode.NORMAL.ordinal) + val modes: Array = DataMode.entries.toTypedArray() + + if (index < modes.size) modes[index] else DataMode.NORMAL + } else { + DataMode.NORMAL + } + } + + /** + * Whether or not Telecom integration is manually disabled. + */ + var callingDisableTelecom by booleanValue(CALLING_DISABLE_TELECOM, true).falseForExternalUsers() + + /** + * Whether or not the Oboe ADM is used. + */ + var callingEnableOboeAdm by booleanValue(CALLING_ENABLE_OBOE_ADM, true).falseForExternalUsers() + + /** + * Whether or not the system is forced to be in 'websocket mode', where FCM is ignored and we use a foreground service to keep the app alive. + */ + var isWebsocketModeForced: Boolean by booleanValue(FORCE_WEBSOCKET_MODE, false).defaultForExternalUsers() + + var hevcEncoding by booleanValue(ENCODE_HEVC, false).defaultForExternalUsers() + + var newCallingUi: Boolean by booleanValue(NEW_CALL_UI, false).defaultForExternalUsers() + + var lastScrollPosition: Int by integerValue(LAST_SCROLL_POSITION, 0).defaultForExternalUsers() + + var useConversationItemV2Media by booleanValue(CONVERSATION_ITEM_V2_MEDIA, false).defaultForExternalUsers() + + var webSocketShadowingStats by nullableBlobValue(WEB_SOCKET_SHADOWING_STATS, null).defaultForExternalUsers() + + private fun SignalStoreValueDelegate.defaultForExternalUsers(): SignalStoreValueDelegate { + return this.withPrecondition { RemoteConfig.internalUser } + } + + private fun SignalStoreValueDelegate.falseForExternalUsers(): SignalStoreValueDelegate { + return this.map { actualValue -> RemoteConfig.internalUser && actualValue } + } +} diff --git a/app/src/main/java/org/thoughtcrime/securesms/keyvalue/SignalStoreValueDelegates.kt b/app/src/main/java/org/thoughtcrime/securesms/keyvalue/SignalStoreValueDelegates.kt index 2b2d680e571..ee47222ce64 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/keyvalue/SignalStoreValueDelegates.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/keyvalue/SignalStoreValueDelegates.kt @@ -42,11 +42,25 @@ internal fun SignalStoreValues.protoValue(key: String, adapter: ProtoAdapter return KeyValueProtoValue(key, adapter, this.store) } +internal fun SignalStoreValueDelegate.withPrecondition(precondition: () -> Boolean): SignalStoreValueDelegate { + return PreconditionDelegate( + delegate = this, + precondition = precondition + ) +} + +internal fun SignalStoreValueDelegate.map(transform: (T) -> T): SignalStoreValueDelegate { + return MappingDelegate( + delegate = this, + transform = transform + ) +} + /** * Kotlin delegate that serves as a base for all other value types. This allows us to only expose this sealed * class to callers and protect the individual implementations as private behind the various extension functions. */ -sealed class SignalStoreValueDelegate(private val store: KeyValueStore) { +sealed class SignalStoreValueDelegate(val store: KeyValueStore, open val default: T) { private var flow: Lazy> = lazy { MutableStateFlow(getValue(store)) } @@ -69,7 +83,7 @@ sealed class SignalStoreValueDelegate(private val store: KeyValueStore) { internal abstract fun setValue(values: KeyValueStore, value: T) } -private class LongValue(private val key: String, private val default: Long, store: KeyValueStore) : SignalStoreValueDelegate(store) { +private class LongValue(private val key: String, default: Long, store: KeyValueStore) : SignalStoreValueDelegate(store, default) { override fun getValue(values: KeyValueStore): Long { return values.getLong(key, default) } @@ -79,7 +93,7 @@ private class LongValue(private val key: String, private val default: Long, stor } } -private class BooleanValue(private val key: String, private val default: Boolean, store: KeyValueStore) : SignalStoreValueDelegate(store) { +private class BooleanValue(private val key: String, default: Boolean, store: KeyValueStore) : SignalStoreValueDelegate(store, default) { override fun getValue(values: KeyValueStore): Boolean { return values.getBoolean(key, default) } @@ -89,7 +103,7 @@ private class BooleanValue(private val key: String, private val default: Boolean } } -private class StringValue(private val key: String, private val default: T, store: KeyValueStore) : SignalStoreValueDelegate(store) { +private class StringValue(private val key: String, default: T, store: KeyValueStore) : SignalStoreValueDelegate(store, default) { override fun getValue(values: KeyValueStore): T { @Suppress("UNCHECKED_CAST") return values.getString(key, default) as T @@ -100,7 +114,7 @@ private class StringValue(private val key: String, private val defa } } -private class IntValue(private val key: String, private val default: Int, store: KeyValueStore) : SignalStoreValueDelegate(store) { +private class IntValue(private val key: String, default: Int, store: KeyValueStore) : SignalStoreValueDelegate(store, default) { override fun getValue(values: KeyValueStore): Int { return values.getInteger(key, default) } @@ -110,7 +124,7 @@ private class IntValue(private val key: String, private val default: Int, store: } } -private class FloatValue(private val key: String, private val default: Float, store: KeyValueStore) : SignalStoreValueDelegate(store) { +private class FloatValue(private val key: String, default: Float, store: KeyValueStore) : SignalStoreValueDelegate(store, default) { override fun getValue(values: KeyValueStore): Float { return values.getFloat(key, default) } @@ -120,7 +134,7 @@ private class FloatValue(private val key: String, private val default: Float, st } } -private class BlobValue(private val key: String, private val default: ByteArray, store: KeyValueStore) : SignalStoreValueDelegate(store) { +private class BlobValue(private val key: String, default: ByteArray, store: KeyValueStore) : SignalStoreValueDelegate(store, default) { override fun getValue(values: KeyValueStore): ByteArray { return values.getBlob(key, default) } @@ -130,7 +144,7 @@ private class BlobValue(private val key: String, private val default: ByteArray, } } -private class NullableBlobValue(private val key: String, private val default: ByteArray?, store: KeyValueStore) : SignalStoreValueDelegate(store) { +private class NullableBlobValue(private val key: String, default: ByteArray?, store: KeyValueStore) : SignalStoreValueDelegate(store, default) { override fun getValue(values: KeyValueStore): ByteArray? { return values.getBlob(key, default) } @@ -144,7 +158,7 @@ private class KeyValueProtoValue( private val key: String, private val adapter: ProtoAdapter, store: KeyValueStore -) : SignalStoreValueDelegate(store) { +) : SignalStoreValueDelegate(store, null) { override fun getValue(values: KeyValueStore): M? { return if (values.containsKey(key)) { adapter.decode(values.getBlob(key, null)) @@ -162,7 +176,7 @@ private class KeyValueProtoValue( } } -private class KeyValueEnumValue(private val key: String, private val default: T, private val serializer: LongSerializer, store: KeyValueStore) : SignalStoreValueDelegate(store) { +private class KeyValueEnumValue(private val key: String, default: T, private val serializer: LongSerializer, store: KeyValueStore) : SignalStoreValueDelegate(store, default) { override fun getValue(values: KeyValueStore): T { return if (values.containsKey(key)) { serializer.deserialize(values.getLong(key, 0)) @@ -175,3 +189,37 @@ private class KeyValueEnumValue(private val key: String, private val default: values.beginWrite().putLong(key, serializer.serialize(value)).apply() } } + +private class PreconditionDelegate( + private val delegate: SignalStoreValueDelegate, + private val precondition: () -> Boolean +) : SignalStoreValueDelegate(delegate.store, delegate.default) { + + override fun getValue(values: KeyValueStore): T { + return if (precondition()) { + delegate.getValue(values) + } else { + delegate.default + } + } + + override fun setValue(values: KeyValueStore, value: T) { + if (precondition()) { + delegate.setValue(values, value) + } + } +} + +private class MappingDelegate( + private val delegate: SignalStoreValueDelegate, + private val transform: (T) -> T +) : SignalStoreValueDelegate(delegate.store, delegate.default) { + + override fun getValue(values: KeyValueStore): T { + return transform(delegate.getValue(values)) + } + + override fun setValue(values: KeyValueStore, value: T) { + delegate.setValue(values, value) + } +} diff --git a/app/src/main/java/org/thoughtcrime/securesms/messages/GroupSendUtil.java b/app/src/main/java/org/thoughtcrime/securesms/messages/GroupSendUtil.java index f600c27de6c..2f20c673208 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/messages/GroupSendUtil.java +++ b/app/src/main/java/org/thoughtcrime/securesms/messages/GroupSendUtil.java @@ -347,7 +347,7 @@ private static List sendMessage(@NonNull Context context, senderKeyTargets.clear(); senderKeyTargets.addAll(registeredTargets); legacyTargets.clear(); - } else if (SignalStore.internal().removeSenderKeyMinimum()) { + } else if (SignalStore.internal().getRemoveSenderKeyMinimum()) { Log.i(TAG, "Sender key minimum removed. Using for " + senderKeyTargets.size() + " recipients."); } else if (senderKeyTargets.size() < 2) { Log.i(TAG, "Too few sender-key-capable users (" + senderKeyTargets.size() + "). Doing all legacy sends."); diff --git a/app/src/main/java/org/thoughtcrime/securesms/net/DefaultWebSocketShadowingBridge.kt b/app/src/main/java/org/thoughtcrime/securesms/net/DefaultWebSocketShadowingBridge.kt index 1b06ddc20bf..9d95db6942d 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/net/DefaultWebSocketShadowingBridge.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/net/DefaultWebSocketShadowingBridge.kt @@ -29,11 +29,11 @@ class DefaultWebSocketShadowingBridge(private val context: Application) : WebSoc private val store: InternalValues = SignalStore.internal override fun writeStatsSnapshot(bytes: ByteArray) { - store.setWebSocketShadowingStats(bytes) + store.webSocketShadowingStats = bytes } override fun readStatsSnapshot(): ByteArray? { - return store.getWebSocketShadowingStats(null) + return store.webSocketShadowingStats } override fun triggerFailureNotification(message: String) { diff --git a/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/AndroidTelecomUtil.kt b/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/AndroidTelecomUtil.kt index 62214b173b9..aa120ddd12f 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/AndroidTelecomUtil.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/AndroidTelecomUtil.kt @@ -193,7 +193,7 @@ object AndroidTelecomUtil { private fun isTelecomAllowedForDevice(): Boolean { if (RemoteConfig.internalUser) { - return !SignalStore.internal.callingDisableTelecom() + return !SignalStore.internal.callingDisableTelecom } return RingRtcDynamicConfiguration.isTelecomAllowedForDevice() } diff --git a/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/CallLinkPreJoinActionProcessor.kt b/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/CallLinkPreJoinActionProcessor.kt index d239f5da29d..e2d535bfa54 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/CallLinkPreJoinActionProcessor.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/CallLinkPreJoinActionProcessor.kt @@ -60,7 +60,7 @@ class CallLinkPreJoinActionProcessor( .getCallLinkAuthorizationForToday(genericServerPublicParams, callLinkSecretParams) webRtcInteractor.callManager.createCallLinkCall( - SignalStore.internal.groupCallingServer(), + SignalStore.internal.groupCallingServer, callLinkAuthCredentialPresentation.serialize(), callLinkRootKey, callLink.credentials.adminPassBytes, diff --git a/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/GroupNetworkUnavailableActionProcessor.java b/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/GroupNetworkUnavailableActionProcessor.java index 4f21ea21c4b..4bdd10d9129 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/GroupNetworkUnavailableActionProcessor.java +++ b/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/GroupNetworkUnavailableActionProcessor.java @@ -49,7 +49,7 @@ public GroupNetworkUnavailableActionProcessor(@NonNull MultiPeerActionProcessorF byte[] groupId = currentState.getCallInfoState().getCallRecipient().requireGroupId().getDecodedId(); GroupCall groupCall = webRtcInteractor.getCallManager().createGroupCall(groupId, - SignalStore.internal().groupCallingServer(), + SignalStore.internal().getGroupCallingServer(), new byte[0], null, RingRtcDynamicConfiguration.getAudioProcessingMethod(), diff --git a/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/GroupPreJoinActionProcessor.java b/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/GroupPreJoinActionProcessor.java index 6929a027536..1e4c1459ed3 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/GroupPreJoinActionProcessor.java +++ b/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/GroupPreJoinActionProcessor.java @@ -47,7 +47,7 @@ protected GroupPreJoinActionProcessor(@NonNull MultiPeerActionProcessorFactory a byte[] groupId = currentState.getCallInfoState().getCallRecipient().requireGroupId().getDecodedId(); GroupCall groupCall = webRtcInteractor.getCallManager().createGroupCall(groupId, - SignalStore.internal().groupCallingServer(), + SignalStore.internal().getGroupCallingServer(), new byte[0], AUDIO_LEVELS_INTERVAL, RingRtcDynamicConfiguration.getAudioProcessingMethod(), diff --git a/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/IncomingGroupCallActionProcessor.java b/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/IncomingGroupCallActionProcessor.java index f8f6bf44046..b6aa5cb4483 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/IncomingGroupCallActionProcessor.java +++ b/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/IncomingGroupCallActionProcessor.java @@ -182,7 +182,7 @@ public IncomingGroupCallActionProcessor(WebRtcInteractor webRtcInteractor) { protected @NonNull WebRtcServiceState handleAcceptCall(@NonNull WebRtcServiceState currentState, boolean answerWithVideo) { byte[] groupId = currentState.getCallInfoState().getCallRecipient().requireGroupId().getDecodedId(); GroupCall groupCall = webRtcInteractor.getCallManager().createGroupCall(groupId, - SignalStore.internal().groupCallingServer(), + SignalStore.internal().getGroupCallingServer(), new byte[0], AUDIO_LEVELS_INTERVAL, RingRtcDynamicConfiguration.getAudioProcessingMethod(), diff --git a/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/RingRtcDynamicConfiguration.kt b/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/RingRtcDynamicConfiguration.kt index b4189ccbc7f..b748704617d 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/RingRtcDynamicConfiguration.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/RingRtcDynamicConfiguration.kt @@ -15,8 +15,8 @@ object RingRtcDynamicConfiguration { @JvmStatic fun getAudioProcessingMethod(): AudioProcessingMethod { - if (SignalStore.internal.callingAudioProcessingMethod() != AudioProcessingMethod.Default) { - return SignalStore.internal.callingAudioProcessingMethod() + if (SignalStore.internal.callingAudioProcessingMethod != AudioProcessingMethod.Default) { + return SignalStore.internal.callingAudioProcessingMethod } return if (shouldUseOboeAdm()) { @@ -57,7 +57,7 @@ object RingRtcDynamicConfiguration { @JvmStatic fun shouldUseOboeAdm(): Boolean { if (RemoteConfig.internalUser) { - return SignalStore.internal.callingEnableOboeAdm() + return SignalStore.internal.callingEnableOboeAdm } // For now, only allow the Oboe ADM to be used for custom ROMS. diff --git a/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/SignalCallManager.java b/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/SignalCallManager.java index 7cabc229b8a..d59b7d0a2a6 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/SignalCallManager.java +++ b/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/SignalCallManager.java @@ -415,7 +415,7 @@ public void peekCallLinkCall(@NonNull RecipientId id) { CallLinkSecretParams.deriveFromRootKey(callLinkRootKey.getKeyBytes()) ); - callManager.peekCallLinkCall(SignalStore.internal().groupCallingServer(), callLinkAuthCredentialPresentation.serialize(), callLinkRootKey, peekInfo -> { + callManager.peekCallLinkCall(SignalStore.internal().getGroupCallingServer(), callLinkAuthCredentialPresentation.serialize(), callLinkRootKey, peekInfo -> { PeekInfo info = peekInfo.getValue(); if (info == null) { Log.w(TAG, "Failed to get peek info: " + peekInfo.getStatus()); @@ -465,7 +465,7 @@ public void peekGroupCall(@NonNull RecipientId id, @Nullable Consumer List members = Stream.of(GroupManager.getUuidCipherTexts(context, groupId)) .map(entry -> new GroupCall.GroupMemberInfo(entry.getKey(), entry.getValue().serialize())) .toList(); - callManager.peekGroupCall(SignalStore.internal().groupCallingServer(), credential.token.getBytes(Charsets.UTF_8), members, peekInfo -> { + callManager.peekGroupCall(SignalStore.internal().getGroupCallingServer(), credential.token.getBytes(Charsets.UTF_8), members, peekInfo -> { Long threadId = SignalDatabase.threads().getThreadIdFor(group.getId()); if (threadId != null) { @@ -508,7 +508,7 @@ public void peekGroupCallForRingingCheck(@NonNull GroupCallRingCheckInfo info) { .map(entry -> new GroupCall.GroupMemberInfo(entry.getKey(), entry.getValue().serialize())) .collect(Collectors.toList()); - callManager.peekGroupCall(SignalStore.internal().groupCallingServer(), + callManager.peekGroupCall(SignalStore.internal().getGroupCallingServer(), credential.token.getBytes(Charsets.UTF_8), members, peekInfo -> receivedGroupCallPeekForRingingCheck(info, peekInfo)); diff --git a/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/links/SignalCallLinkManager.kt b/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/links/SignalCallLinkManager.kt index d86b934b06c..50b94539bea 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/links/SignalCallLinkManager.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/links/SignalCallLinkManager.kt @@ -111,7 +111,7 @@ class SignalCallLinkManager( // Credential callManager.createCallLink( - SignalStore.internal.groupCallingServer(), + SignalStore.internal.groupCallingServer, credentialPresentation.serialize(), rootKey, adminPassKey, @@ -139,7 +139,7 @@ class SignalCallLinkManager( ): Single { return Single.create { emitter -> callManager.readCallLink( - SignalStore.internal.groupCallingServer(), + SignalStore.internal.groupCallingServer, requestCallLinkAuthCredentialPresentation(credentials.linkKeyBytes).serialize(), CallLinkRootKey(credentials.linkKeyBytes) ) { @@ -165,7 +165,7 @@ class SignalCallLinkManager( val credentialPresentation = requestCallLinkAuthCredentialPresentation(credentials.linkKeyBytes) callManager.updateCallLinkName( - SignalStore.internal.groupCallingServer(), + SignalStore.internal.groupCallingServer, credentialPresentation.serialize(), CallLinkRootKey(credentials.linkKeyBytes), credentials.adminPassBytes, @@ -192,7 +192,7 @@ class SignalCallLinkManager( val credentialPresentation = requestCallLinkAuthCredentialPresentation(credentials.linkKeyBytes) callManager.updateCallLinkRestrictions( - SignalStore.internal.groupCallingServer(), + SignalStore.internal.groupCallingServer, credentialPresentation.serialize(), CallLinkRootKey(credentials.linkKeyBytes), credentials.adminPassBytes, @@ -218,7 +218,7 @@ class SignalCallLinkManager( val credentialPresentation = requestCallLinkAuthCredentialPresentation(credentials.linkKeyBytes) callManager.deleteCallLink( - SignalStore.internal.groupCallingServer(), + SignalStore.internal.groupCallingServer, credentialPresentation.serialize(), CallLinkRootKey(credentials.linkKeyBytes), credentials.adminPassBytes diff --git a/app/src/main/java/org/thoughtcrime/securesms/shakereport/ShakeToReport.java b/app/src/main/java/org/thoughtcrime/securesms/shakereport/ShakeToReport.java index 3f04ef58f04..d311cd2dd33 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/shakereport/ShakeToReport.java +++ b/app/src/main/java/org/thoughtcrime/securesms/shakereport/ShakeToReport.java @@ -48,26 +48,26 @@ public ShakeToReport(@NonNull Application application) { } public void enable() { - if (!SignalStore.internal().shakeToReport()) return; + if (!SignalStore.internal().getShakeToReport()) return; detector.start(ServiceUtil.getSensorManager(application)); } public void disable() { - if (!SignalStore.internal().shakeToReport()) return; + if (!SignalStore.internal().getShakeToReport()) return; detector.stop(); } public void registerActivity(@NonNull AppCompatActivity activity) { - if (!SignalStore.internal().shakeToReport()) return; + if (!SignalStore.internal().getShakeToReport()) return; this.weakActivity = new WeakReference<>(activity); } @Override public void onShakeDetected() { - if (!SignalStore.internal().shakeToReport()) return; + if (!SignalStore.internal().getShakeToReport()) return; AppCompatActivity activity = weakActivity.get(); if (activity == null) { diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/NetworkUtil.java b/app/src/main/java/org/thoughtcrime/securesms/util/NetworkUtil.java index 9585f396f16..ad10b425a90 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/util/NetworkUtil.java +++ b/app/src/main/java/org/thoughtcrime/securesms/util/NetworkUtil.java @@ -43,8 +43,8 @@ public static boolean isConnected(@NonNull Context context) { } public static @NonNull CallManager.DataMode getCallingDataMode(@NonNull Context context, @NonNull PeerConnection.AdapterType networkAdapter) { - if (SignalStore.internal().callingDataMode() != CallManager.DataMode.NORMAL) { - return SignalStore.internal().callingDataMode(); + if (SignalStore.internal().getCallingDataMode() != CallManager.DataMode.NORMAL) { + return SignalStore.internal().getCallingDataMode(); } return useLowDataCalling(context, networkAdapter) ? CallManager.DataMode.LOW : CallManager.DataMode.NORMAL; diff --git a/app/src/test/java/org/thoughtcrime/securesms/groups/v2/processing/GroupsV2StateProcessorTest.kt b/app/src/test/java/org/thoughtcrime/securesms/groups/v2/processing/GroupsV2StateProcessorTest.kt index afb4536e661..a24f9402476 100644 --- a/app/src/test/java/org/thoughtcrime/securesms/groups/v2/processing/GroupsV2StateProcessorTest.kt +++ b/app/src/test/java/org/thoughtcrime/securesms/groups/v2/processing/GroupsV2StateProcessorTest.kt @@ -108,7 +108,7 @@ class GroupsV2StateProcessorTest { } mockkObject(SignalStore) - every { SignalStore.internal.gv2IgnoreP2PChanges() } returns false + every { SignalStore.internal.gv2IgnoreP2PChanges } returns false Log.initialize(SystemOutLogger()) SignalProtocolLoggerProvider.setProvider(CustomSignalProtocolLogger())