Skip to content

Commit 58341a1

Browse files
ohassinetrOnk12
andauthored
fix: change the connectivity message (RC) (#2102)
Co-authored-by: Mateusz <m.pachulski94@gmail.com>
1 parent a6a1f6a commit 58341a1

File tree

3 files changed

+28
-34
lines changed

3 files changed

+28
-34
lines changed

app/src/main/kotlin/com/wire/android/ui/common/topappbar/CommonTopAppBar.kt

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ import androidx.compose.foundation.layout.Row
3434
import androidx.compose.foundation.layout.fillMaxWidth
3535
import androidx.compose.foundation.layout.height
3636
import androidx.compose.foundation.layout.padding
37-
import androidx.compose.material3.Text
3837
import androidx.compose.material3.Icon
3938
import androidx.compose.material3.MaterialTheme
39+
import androidx.compose.material3.Text
4040
import androidx.compose.runtime.Composable
4141
import androidx.compose.runtime.getValue
4242
import androidx.compose.runtime.mutableStateOf
@@ -105,7 +105,8 @@ private fun ConnectivityStatusBar(
105105
.animateContentSize()
106106
.fillMaxWidth()
107107
.height(MaterialTheme.wireDimensions.ongoingCallLabelHeight)
108-
.background(backgroundColor).run {
108+
.background(backgroundColor)
109+
.run {
109110
if (connectivityInfo is ConnectivityUIState.Info.EstablishedCall) {
110111
clickable(onClick = onReturnToCallClick)
111112
} else this
@@ -121,24 +122,18 @@ private fun ConnectivityStatusBar(
121122
horizontalAlignment = Alignment.CenterHorizontally,
122123
verticalArrangement = Arrangement.Center
123124
) {
124-
if (connectivityInfo is ConnectivityUIState.Info.EstablishedCall) {
125-
OngoingCallContent(connectivityInfo.isMuted)
126-
} else {
127-
val isConnecting = connectivityInfo is ConnectivityUIState.Info.Connecting
128-
ConnectivityIssueContent(isConnecting)
125+
when (connectivityInfo) {
126+
is ConnectivityUIState.Info.EstablishedCall -> OngoingCallContent(connectivityInfo.isMuted)
127+
ConnectivityUIState.Info.Connecting -> StatusLabel(R.string.connectivity_status_bar_connecting)
128+
ConnectivityUIState.Info.WaitingConnection ->
129+
StatusLabel(R.string.connectivity_status_bar_waiting_for_network)
130+
131+
ConnectivityUIState.Info.None -> {}
129132
}
130133
}
131134
}
132135
}
133136

134-
@Composable
135-
private fun ConnectivityIssueContent(isConnecting: Boolean) {
136-
val stringResource = if (isConnecting) R.string.connectivity_status_bar_connecting
137-
else R.string.connectivity_status_bar_waiting_for_network
138-
139-
StatusLabel(stringResource)
140-
}
141-
142137
@Composable
143138
private fun OngoingCallContent(isMuted: Boolean) {
144139
Row {

app/src/main/kotlin/com/wire/android/ui/common/topappbar/CommonTopAppBarViewModel.kt

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,23 @@ class CommonTopAppBarViewModel @Inject constructor(
6262

6363
var connectivityState by mutableStateOf(ConnectivityUIState(ConnectivityUIState.Info.None))
6464

65+
private suspend fun currentScreenFlow() = currentScreenManager.observeCurrentScreen(viewModelScope)
66+
67+
private fun connectivityFlow(userId: UserId): Flow<Connectivity> = coreLogic.sessionScope(userId) {
68+
observeSyncState().map {
69+
when (it) {
70+
is SyncState.Failed, SyncState.Waiting -> Connectivity.WAITING_CONNECTION
71+
SyncState.GatheringPendingEvents, SyncState.SlowSync -> Connectivity.CONNECTING
72+
SyncState.Live -> Connectivity.CONNECTED
73+
}
74+
}
75+
}
76+
private suspend fun activeCallFlow(userId: UserId): Flow<Call?> = coreLogic.sessionScope(userId) {
77+
calls.establishedCall().distinctUntilChanged().map { calls ->
78+
calls.firstOrNull()
79+
}
80+
}
81+
6582
init {
6683
viewModelScope.launch {
6784
coreLogic.globalScope {
@@ -127,24 +144,6 @@ class CommonTopAppBarViewModel @Inject constructor(
127144
}
128145
}
129146

130-
private fun connectivityFlow(userId: UserId): Flow<Connectivity> = coreLogic.sessionScope(userId) {
131-
observeSyncState().map {
132-
when (it) {
133-
is SyncState.Failed, SyncState.Waiting -> Connectivity.WAITING_CONNECTION
134-
SyncState.GatheringPendingEvents, SyncState.SlowSync -> Connectivity.CONNECTING
135-
SyncState.Live -> Connectivity.CONNECTED
136-
}
137-
}
138-
}
139-
140-
private suspend fun activeCallFlow(userId: UserId): Flow<Call?> = coreLogic.sessionScope(userId) {
141-
calls.establishedCall().distinctUntilChanged().map { calls ->
142-
calls.firstOrNull()
143-
}
144-
}
145-
146-
private suspend fun currentScreenFlow() = currentScreenManager.observeCurrentScreen(viewModelScope)
147-
148147
private companion object {
149148
const val WAITING_TIME_TO_SHOW_ONGOING_CALL_BANNER = 600L
150149
}

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@
750750
<string name="calling_feature_unavailable_message_alert">The option to initiate a conference call is only available in the paid version of Wire.</string>
751751
<!-- Connectivity Status Bar -->
752752
<string name="connectivity_status_bar_return_to_call">Return to call</string>
753-
<string name="connectivity_status_bar_connecting">Connecting</string>
753+
<string name="connectivity_status_bar_connecting">Decrypting messages</string>
754754
<string name="connectivity_status_bar_waiting_for_network">Waiting for network</string>
755755
<!-- Connections -->
756756
<string name="connection_label_connect">Connect</string>

0 commit comments

Comments
 (0)