Skip to content

Commit

Permalink
Convert InternalValues to kotlin.
Browse files Browse the repository at this point in the history
  • Loading branch information
greyson-signal committed Nov 21, 2024
1 parent 5f67bd9 commit ae37001
Show file tree
Hide file tree
Showing 25 changed files with 270 additions and 289 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class InternalSettingsViewModel(private val repository: InternalSettingsReposito
}

fun setUseConversationItemV2Media(enabled: Boolean) {
SignalStore.internal.setUseConversationItemV2Media(enabled)
SignalStore.internal.useConversationItemV2Media = enabled
refresh()
}

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<View>(R.layout.v2_conversation_item_media_outgoing, parent, false)
V2ConversationItemMediaViewHolder(V2ConversationItemMediaOutgoingBinding.bind(view).bridge(), this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class EmojiSource(
}

private fun loadRemoteBasedEmojis(): EmojiSource? {
if (SignalStore.internal.forceBuiltInEmoji()) {
if (SignalStore.internal.forceBuiltInEmoji) {
return null
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ final class GroupEditor extends LockOwner {

Set<GroupCandidate> groupCandidates = groupCandidateHelper.recipientIdsToCandidates(new HashSet<>(newMembers));

if (SignalStore.internal().gv2ForceInvites()) {
if (SignalStore.internal().getGv2ForceInvites()) {
groupCandidates = GroupCandidate.withoutExpiringProfileKeyCredentials(groupCandidates);
}

Expand Down Expand Up @@ -792,7 +792,7 @@ private DecryptedGroupChange getDecryptedGroupChange(@Nullable byte[] signedGrou
GroupCandidate self = groupCandidateHelper.recipientIdToCandidate(Recipient.self().getId());
Set<GroupCandidate> 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class GroupsV2StateProcessor private constructor(
currentLocalState: DecryptedGroup?,
groupRecord: Optional<GroupRecord>
): Boolean {
if (SignalStore.internal.gv2IgnoreP2PChanges()) {
if (SignalStore.internal.gv2IgnoreP2PChanges) {
Log.w(TAG, "$logPrefix Ignoring P2P group change by setting")
return false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

This file was deleted.

Loading

0 comments on commit ae37001

Please sign in to comment.