diff --git a/app/src/main/kotlin/com/wire/android/ui/common/topappbar/CommonTopAppBar.kt b/app/src/main/kotlin/com/wire/android/ui/common/topappbar/CommonTopAppBar.kt index 2c7deb0298c..00ee63b2e93 100644 --- a/app/src/main/kotlin/com/wire/android/ui/common/topappbar/CommonTopAppBar.kt +++ b/app/src/main/kotlin/com/wire/android/ui/common/topappbar/CommonTopAppBar.kt @@ -34,9 +34,9 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.material3.Text import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -105,7 +105,8 @@ private fun ConnectivityStatusBar( .animateContentSize() .fillMaxWidth() .height(MaterialTheme.wireDimensions.ongoingCallLabelHeight) - .background(backgroundColor).run { + .background(backgroundColor) + .run { if (connectivityInfo is ConnectivityUIState.Info.EstablishedCall) { clickable(onClick = onReturnToCallClick) } else this @@ -121,24 +122,18 @@ private fun ConnectivityStatusBar( horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center ) { - if (connectivityInfo is ConnectivityUIState.Info.EstablishedCall) { - OngoingCallContent(connectivityInfo.isMuted) - } else { - val isConnecting = connectivityInfo is ConnectivityUIState.Info.Connecting - ConnectivityIssueContent(isConnecting) + when (connectivityInfo) { + is ConnectivityUIState.Info.EstablishedCall -> OngoingCallContent(connectivityInfo.isMuted) + ConnectivityUIState.Info.Connecting -> StatusLabel(R.string.connectivity_status_bar_connecting) + ConnectivityUIState.Info.WaitingConnection -> + StatusLabel(R.string.connectivity_status_bar_waiting_for_network) + + ConnectivityUIState.Info.None -> {} } } } } -@Composable -private fun ConnectivityIssueContent(isConnecting: Boolean) { - val stringResource = if (isConnecting) R.string.connectivity_status_bar_connecting - else R.string.connectivity_status_bar_waiting_for_network - - StatusLabel(stringResource) -} - @Composable private fun OngoingCallContent(isMuted: Boolean) { Row { diff --git a/app/src/main/kotlin/com/wire/android/ui/common/topappbar/CommonTopAppBarViewModel.kt b/app/src/main/kotlin/com/wire/android/ui/common/topappbar/CommonTopAppBarViewModel.kt index f2af7d26f4c..12b5149f14c 100644 --- a/app/src/main/kotlin/com/wire/android/ui/common/topappbar/CommonTopAppBarViewModel.kt +++ b/app/src/main/kotlin/com/wire/android/ui/common/topappbar/CommonTopAppBarViewModel.kt @@ -62,6 +62,23 @@ class CommonTopAppBarViewModel @Inject constructor( var connectivityState by mutableStateOf(ConnectivityUIState(ConnectivityUIState.Info.None)) + private suspend fun currentScreenFlow() = currentScreenManager.observeCurrentScreen(viewModelScope) + + private fun connectivityFlow(userId: UserId): Flow = coreLogic.sessionScope(userId) { + observeSyncState().map { + when (it) { + is SyncState.Failed, SyncState.Waiting -> Connectivity.WAITING_CONNECTION + SyncState.GatheringPendingEvents, SyncState.SlowSync -> Connectivity.CONNECTING + SyncState.Live -> Connectivity.CONNECTED + } + } + } + private suspend fun activeCallFlow(userId: UserId): Flow = coreLogic.sessionScope(userId) { + calls.establishedCall().distinctUntilChanged().map { calls -> + calls.firstOrNull() + } + } + init { viewModelScope.launch { coreLogic.globalScope { @@ -127,24 +144,6 @@ class CommonTopAppBarViewModel @Inject constructor( } } - private fun connectivityFlow(userId: UserId): Flow = coreLogic.sessionScope(userId) { - observeSyncState().map { - when (it) { - is SyncState.Failed, SyncState.Waiting -> Connectivity.WAITING_CONNECTION - SyncState.GatheringPendingEvents, SyncState.SlowSync -> Connectivity.CONNECTING - SyncState.Live -> Connectivity.CONNECTED - } - } - } - - private suspend fun activeCallFlow(userId: UserId): Flow = coreLogic.sessionScope(userId) { - calls.establishedCall().distinctUntilChanged().map { calls -> - calls.firstOrNull() - } - } - - private suspend fun currentScreenFlow() = currentScreenManager.observeCurrentScreen(viewModelScope) - private companion object { const val WAITING_TIME_TO_SHOW_ONGOING_CALL_BANNER = 600L } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8b8e1e24be9..f98f2f6663d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -750,7 +750,7 @@ The option to initiate a conference call is only available in the paid version of Wire. Return to call - Connecting + Decrypting messages Waiting for network Connect