diff --git a/app/src/main/kotlin/com/wire/android/di/CoreLogicModule.kt b/app/src/main/kotlin/com/wire/android/di/CoreLogicModule.kt
index 1711c52531..cadddf234d 100644
--- a/app/src/main/kotlin/com/wire/android/di/CoreLogicModule.kt
+++ b/app/src/main/kotlin/com/wire/android/di/CoreLogicModule.kt
@@ -998,6 +998,16 @@ class UseCaseModule {
fun providePersistReadReceiptsStatusConfig(@KaliumCoreLogic coreLogic: CoreLogic, @CurrentAccount currentAccount: UserId) =
coreLogic.getSessionScope(currentAccount).users.persistReadReceiptsStatusConfig
+ @ViewModelScoped
+ @Provides
+ fun provideObserveTypingIndicatorEnabled(@KaliumCoreLogic coreLogic: CoreLogic, @CurrentAccount currentAccount: UserId) =
+ coreLogic.getSessionScope(currentAccount).users.observeTypingIndicatorEnabled
+
+ @ViewModelScoped
+ @Provides
+ fun providePersistTypingIndicatorStatusConfig(@KaliumCoreLogic coreLogic: CoreLogic, @CurrentAccount currentAccount: UserId) =
+ coreLogic.getSessionScope(currentAccount).users.persistTypingIndicatorStatusConfig
+
@ViewModelScoped
@Provides
fun provideObserveIfAppFreshEnoughUseCase(@KaliumCoreLogic coreLogic: CoreLogic) =
diff --git a/app/src/main/kotlin/com/wire/android/ui/home/settings/privacy/PrivacySettingsScreen.kt b/app/src/main/kotlin/com/wire/android/ui/home/settings/privacy/PrivacySettingsScreen.kt
index ad2c427d37..8ffe324b4f 100644
--- a/app/src/main/kotlin/com/wire/android/ui/home/settings/privacy/PrivacySettingsScreen.kt
+++ b/app/src/main/kotlin/com/wire/android/ui/home/settings/privacy/PrivacySettingsScreen.kt
@@ -48,8 +48,10 @@ fun PrivacySettingsConfigScreen(
) {
with(viewModel) {
PrivacySettingsScreenContent(
- isReadReceiptsEnabled = state.isReadReceiptsEnabled,
+ areReadReceiptsEnabled = state.areReadReceiptsEnabled,
setReadReceiptsState = ::setReadReceiptsState,
+ isTypingIndicatorEnabled = state.isTypingIndicatorEnabled,
+ setTypingIndicatorState = ::setTypingIndicatorState,
screenshotCensoringConfig = state.screenshotCensoringConfig,
setScreenshotCensoringConfig = ::setScreenshotCensoringConfig,
onBackPressed = navigator::navigateBack
@@ -59,8 +61,10 @@ fun PrivacySettingsConfigScreen(
@Composable
fun PrivacySettingsScreenContent(
- isReadReceiptsEnabled: Boolean,
+ areReadReceiptsEnabled: Boolean,
setReadReceiptsState: (Boolean) -> Unit,
+ isTypingIndicatorEnabled: Boolean,
+ setTypingIndicatorState: (Boolean) -> Unit,
screenshotCensoringConfig: ScreenshotCensoringConfig,
setScreenshotCensoringConfig: (Boolean) -> Unit,
onBackPressed: () -> Unit
@@ -79,7 +83,7 @@ fun PrivacySettingsScreenContent(
) {
GroupConversationOptionsItem(
title = stringResource(R.string.settings_send_read_receipts),
- switchState = SwitchState.Enabled(value = isReadReceiptsEnabled, onCheckedChange = setReadReceiptsState),
+ switchState = SwitchState.Enabled(value = areReadReceiptsEnabled, onCheckedChange = setReadReceiptsState),
arrowType = ArrowType.NONE,
subtitle = stringResource(id = R.string.settings_send_read_receipts_description)
)
@@ -103,6 +107,12 @@ fun PrivacySettingsScreenContent(
}
)
)
+ GroupConversationOptionsItem(
+ title = stringResource(R.string.settings_show_typing_indicator_title),
+ switchState = SwitchState.Enabled(value = isTypingIndicatorEnabled, onCheckedChange = setTypingIndicatorState),
+ arrowType = ArrowType.NONE,
+ subtitle = stringResource(id = R.string.settings_send_read_receipts_description)
+ )
}
}
}
@@ -110,5 +120,5 @@ fun PrivacySettingsScreenContent(
@Composable
@Preview
fun PreviewSendReadReceipts() {
- PrivacySettingsScreenContent(true, {}, ScreenshotCensoringConfig.DISABLED, {}, {})
+ PrivacySettingsScreenContent(true, {}, true, {}, ScreenshotCensoringConfig.DISABLED, {}, {})
}
diff --git a/app/src/main/kotlin/com/wire/android/ui/home/settings/privacy/PrivacySettingsState.kt b/app/src/main/kotlin/com/wire/android/ui/home/settings/privacy/PrivacySettingsState.kt
index 92e7473d98..ab900b8a22 100644
--- a/app/src/main/kotlin/com/wire/android/ui/home/settings/privacy/PrivacySettingsState.kt
+++ b/app/src/main/kotlin/com/wire/android/ui/home/settings/privacy/PrivacySettingsState.kt
@@ -21,7 +21,8 @@
package com.wire.android.ui.home.settings.privacy
data class PrivacySettingsState(
- val isReadReceiptsEnabled: Boolean = true,
+ val areReadReceiptsEnabled: Boolean = true,
+ val isTypingIndicatorEnabled: Boolean = true,
val screenshotCensoringConfig: ScreenshotCensoringConfig = ScreenshotCensoringConfig.ENABLED_BY_USER
)
diff --git a/app/src/main/kotlin/com/wire/android/ui/home/settings/privacy/PrivacySettingsViewModel.kt b/app/src/main/kotlin/com/wire/android/ui/home/settings/privacy/PrivacySettingsViewModel.kt
index 006fb1e399..a4b7422010 100644
--- a/app/src/main/kotlin/com/wire/android/ui/home/settings/privacy/PrivacySettingsViewModel.kt
+++ b/app/src/main/kotlin/com/wire/android/ui/home/settings/privacy/PrivacySettingsViewModel.kt
@@ -34,6 +34,9 @@ import com.wire.kalium.logic.feature.user.screenshotCensoring.ObserveScreenshotC
import com.wire.kalium.logic.feature.user.screenshotCensoring.ObserveScreenshotCensoringConfigUseCase
import com.wire.kalium.logic.feature.user.screenshotCensoring.PersistScreenshotCensoringConfigResult
import com.wire.kalium.logic.feature.user.screenshotCensoring.PersistScreenshotCensoringConfigUseCase
+import com.wire.kalium.logic.feature.user.typingIndicator.ObserveTypingIndicatorEnabledUseCase
+import com.wire.kalium.logic.feature.user.typingIndicator.PersistTypingIndicatorStatusConfigUseCase
+import com.wire.kalium.logic.feature.user.typingIndicator.TypingIndicatorConfigResult
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.launch
@@ -46,7 +49,9 @@ class PrivacySettingsViewModel @Inject constructor(
private val persistReadReceiptsStatusConfig: PersistReadReceiptsStatusConfigUseCase,
private val observeReadReceiptsEnabled: ObserveReadReceiptsEnabledUseCase,
private val persistScreenshotCensoringConfig: PersistScreenshotCensoringConfigUseCase,
- private val observeScreenshotCensoringConfig: ObserveScreenshotCensoringConfigUseCase
+ private val observeScreenshotCensoringConfig: ObserveScreenshotCensoringConfigUseCase,
+ private val persistTypingIndicatorStatusConfig: PersistTypingIndicatorStatusConfigUseCase,
+ private val observeTypingIndicatorEnabled: ObserveTypingIndicatorEnabledUseCase
) : ViewModel() {
var state by mutableStateOf(PrivacySettingsState())
@@ -56,11 +61,13 @@ class PrivacySettingsViewModel @Inject constructor(
viewModelScope.launch {
combine(
observeReadReceiptsEnabled(),
+ observeTypingIndicatorEnabled(),
observeScreenshotCensoringConfig(),
- ::Pair
- ).collect { (readReceiptsEnabled, screenshotCensoringConfig) ->
+ ::Triple
+ ).collect { (readReceiptsEnabled, typingIndicatorEnabled, screenshotCensoringConfig) ->
state = state.copy(
- isReadReceiptsEnabled = readReceiptsEnabled,
+ areReadReceiptsEnabled = readReceiptsEnabled,
+ isTypingIndicatorEnabled = typingIndicatorEnabled,
screenshotCensoringConfig = when (screenshotCensoringConfig) {
ObserveScreenshotCensoringConfigResult.Disabled ->
ScreenshotCensoringConfig.DISABLED
@@ -78,16 +85,35 @@ class PrivacySettingsViewModel @Inject constructor(
fun setReadReceiptsState(isEnabled: Boolean) {
viewModelScope.launch {
- when (withContext(dispatchers.io()) { persistReadReceiptsStatusConfig(isEnabled) }) {
- is ReadReceiptStatusConfigResult.Failure -> {
- appLogger.e("Something went wrong while updating read receipts config")
- state = state.copy(isReadReceiptsEnabled = !isEnabled)
+ state =
+ when (withContext(dispatchers.io()) { persistReadReceiptsStatusConfig(isEnabled) }) {
+ is ReadReceiptStatusConfigResult.Failure -> {
+ appLogger.e("Something went wrong while updating read receipts config")
+ state.copy(areReadReceiptsEnabled = !isEnabled)
+ }
+
+ is ReadReceiptStatusConfigResult.Success -> {
+ appLogger.d("Read receipts config changed")
+ state.copy(areReadReceiptsEnabled = isEnabled)
+ }
}
- is ReadReceiptStatusConfigResult.Success -> {
- appLogger.d("Read receipts config changed")
- state = state.copy(isReadReceiptsEnabled = isEnabled)
+ }
+ }
+
+ fun setTypingIndicatorState(isEnabled: Boolean) {
+ viewModelScope.launch {
+ state =
+ when (withContext(dispatchers.io()) { persistTypingIndicatorStatusConfig(isEnabled) }) {
+ is TypingIndicatorConfigResult.Failure -> {
+ appLogger.e("Something went wrong while updating typing indicator config")
+ state.copy(isTypingIndicatorEnabled = !isEnabled)
+ }
+
+ is TypingIndicatorConfigResult.Success -> {
+ appLogger.d("Typing indicator configuration changed successfully")
+ state.copy(isTypingIndicatorEnabled = isEnabled)
+ }
}
- }
}
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 96b024819b..11f963c728 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -882,6 +882,8 @@
Censor screenshots
If this is ON, then the content of the messages will not be visible on the screenshot or screen recording.
This is enforced by the self-deleting message team setting and cannot be changed.\nThe content of the messages will not be visible on the screenshot or screen recording.
+ Typing indicator
+ When this is off, you won\'t be able to see when other people are typing, and others won\'t see when you are typing. This setting applies to all conversations on this device.
Your Devices
Current Device
diff --git a/kalium b/kalium
index 38df69bfbd..a0ff361dae 160000
--- a/kalium
+++ b/kalium
@@ -1 +1 @@
-Subproject commit 38df69bfbd5455b5c28c8fe3bb94a640c79603be
+Subproject commit a0ff361daecd9528f263868e5a7bef1d2c87a8d5