mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 09:49:30 +01:00
Add ability to open a chat incognito.
This commit is contained in:
committed by
Michelle Tang
parent
db5cced91b
commit
b62b5ea8ef
@@ -8,4 +8,5 @@ package org.thoughtcrime.securesms.components.settings.app.labs
|
||||
sealed interface LabsSettingsEvents {
|
||||
data class ToggleIndividualChatPlaintextExport(val enabled: Boolean) : LabsSettingsEvents
|
||||
data class ToggleStoryArchive(val enabled: Boolean) : LabsSettingsEvents
|
||||
data class ToggleIncognito(val enabled: Boolean) : LabsSettingsEvents
|
||||
}
|
||||
|
||||
@@ -106,6 +106,15 @@ private fun LabsSettingsContent(
|
||||
onCheckChanged = { onEvent(LabsSettingsEvents.ToggleStoryArchive(it)) }
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
Rows.ToggleRow(
|
||||
checked = state.incognito,
|
||||
text = "Incognito Mode",
|
||||
label = "Adds an option to long-press a conversation to open it in incognito mode. Messages will not be marked as read and no read receipts will be sent.",
|
||||
onCheckChanged = { onEvent(LabsSettingsEvents.ToggleIncognito(it)) }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,5 +10,6 @@ import androidx.compose.runtime.Immutable
|
||||
@Immutable
|
||||
data class LabsSettingsState(
|
||||
val individualChatPlaintextExport: Boolean = false,
|
||||
val storyArchive: Boolean = false
|
||||
val storyArchive: Boolean = false,
|
||||
val incognito: Boolean = false
|
||||
)
|
||||
|
||||
@@ -25,13 +25,18 @@ class LabsSettingsViewModel : ViewModel() {
|
||||
SignalStore.labs.storyArchive = event.enabled
|
||||
_state.value = _state.value.copy(storyArchive = event.enabled)
|
||||
}
|
||||
is LabsSettingsEvents.ToggleIncognito -> {
|
||||
SignalStore.labs.incognito = event.enabled
|
||||
_state.value = _state.value.copy(incognito = event.enabled)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadState(): LabsSettingsState {
|
||||
return LabsSettingsState(
|
||||
individualChatPlaintextExport = SignalStore.labs.individualChatPlaintextExport,
|
||||
storyArchive = SignalStore.labs.storyArchive
|
||||
storyArchive = SignalStore.labs.storyArchive,
|
||||
incognito = SignalStore.labs.incognito
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user