Skip to content

Commit

Permalink
fix: persistent ws not reflected in UI (WPB-7020) (#2771)
Browse files Browse the repository at this point in the history
Co-authored-by: Yamil Medina <[email protected]>
  • Loading branch information
AndroidBob and yamilmedina authored Mar 11, 2024
1 parent 94d9786 commit 79c1384
Showing 1 changed file with 20 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ package com.wire.android.ui.home.settings.appsettings.networkSettings
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import com.wire.android.ui.common.scaffold.WireScaffold
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
Expand All @@ -33,6 +32,7 @@ import com.ramcosta.composedestinations.annotation.Destination
import com.ramcosta.composedestinations.annotation.RootNavGraph
import com.wire.android.R
import com.wire.android.navigation.Navigator
import com.wire.android.ui.common.scaffold.WireScaffold
import com.wire.android.ui.common.topappbar.WireCenterAlignedTopAppBar
import com.wire.android.ui.home.conversations.details.options.ArrowType
import com.wire.android.ui.home.conversations.details.options.GroupConversationOptionsItem
Expand Down Expand Up @@ -74,20 +74,27 @@ fun NetworkSettingsScreenContent(
.fillMaxSize()
.padding(internalPadding)
) {
if (!isWebsocketEnabledByDefault(LocalContext.current)) {
GroupConversationOptionsItem(
title = stringResource(R.string.settings_keep_connection_to_websocket),
subtitle = stringResource(
R.string.settings_keep_connection_to_websocket_description,
backendName
),
switchState = SwitchState.Enabled(
value = isWebSocketEnabled,
onCheckedChange = setWebSocketState
),
arrowType = ArrowType.NONE
val appContext = LocalContext.current
val isWebSocketEnforcedByDefault = isWebsocketEnabledByDefault(appContext)

val switchState = if (isWebSocketEnforcedByDefault) {
SwitchState.TextOnly(true)
} else {
SwitchState.Enabled(
value = isWebSocketEnabled,
onCheckedChange = setWebSocketState
)
}

GroupConversationOptionsItem(
title = stringResource(R.string.settings_keep_connection_to_websocket),
subtitle = stringResource(
R.string.settings_keep_connection_to_websocket_description,
backendName
),
switchState = switchState,
arrowType = ArrowType.NONE
)
}
}
}
Expand Down

0 comments on commit 79c1384

Please sign in to comment.