Skip to content

Commit

Permalink
fix: hide connectivity banner on authentications screens (#2020)
Browse files Browse the repository at this point in the history
Co-authored-by: Tommaso Piazza <196761+tmspzz@users.noreply.github.com>
  • Loading branch information
MohamadJaara and tmspzz committed Jul 28, 2023
1 parent e93fda7 commit 3ad6eef
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ class WireActivityViewModel @Inject constructor(
is CurrentScreen.IncomingCallScreen,
is CurrentScreen.OngoingCallScreen,
is CurrentScreen.OtherUserProfile,
CurrentScreen.AuthRelated,
CurrentScreen.SomeOther -> true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class CommonTopAppBarViewModel @Inject constructor(
when (it) {
is CurrentSessionResult.Failure.Generic,
CurrentSessionResult.Failure.SessionNotFound -> flowOf(ConnectivityUIState.Info.None)

is CurrentSessionResult.Success -> {
val userId = it.accountInfo.userId
combine(
Expand Down Expand Up @@ -104,14 +105,20 @@ class CommonTopAppBarViewModel @Inject constructor(
): ConnectivityUIState.Info {
val canDisplayActiveCall = currentScreen !is CurrentScreen.OngoingCallScreen

val canDisplayConnectivityIssues = currentScreen !is CurrentScreen.AuthRelated

if (activeCall != null && canDisplayActiveCall) {
return ConnectivityUIState.Info.EstablishedCall(activeCall.conversationId, activeCall.isMuted)
}

return when (connectivity) {
Connectivity.WAITING_CONNECTION -> ConnectivityUIState.Info.WaitingConnection
Connectivity.CONNECTING -> ConnectivityUIState.Info.Connecting
Connectivity.CONNECTED -> ConnectivityUIState.Info.None
return if (canDisplayConnectivityIssues) {
when (connectivity) {
Connectivity.WAITING_CONNECTION -> ConnectivityUIState.Info.WaitingConnection
Connectivity.CONNECTING -> ConnectivityUIState.Info.Connecting
Connectivity.CONNECTED -> ConnectivityUIState.Info.None
}
} else {
ConnectivityUIState.Info.None
}
}

Expand Down
17 changes: 17 additions & 0 deletions app/src/main/kotlin/com/wire/android/util/CurrentScreenManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,13 @@ sealed class CurrentScreen {

// Import media screen is opened
object ImportMedia : CurrentScreen()

// SelfDevices screen is opened
object DeviceManager : CurrentScreen()

// Auth related screen is opened
object AuthRelated : CurrentScreen()

// Some other screen is opened, kinda "do nothing screen"
object SomeOther : CurrentScreen()

Expand All @@ -170,26 +174,39 @@ sealed class CurrentScreen {
?.let { Conversation(it) }
?: SomeOther
}

NavigationItem.OtherUserProfile -> {
arguments?.getString(EXTRA_CONVERSATION_ID)
?.toQualifiedID(qualifiedIdMapper)
?.let { OtherUserProfile(it) }
?: SomeOther
}

NavigationItem.OngoingCall -> {
arguments?.getString(EXTRA_CONVERSATION_ID)
?.toQualifiedID(qualifiedIdMapper)
?.let { OngoingCallScreen(it) }
?: SomeOther
}

NavigationItem.IncomingCall -> {
arguments?.getString(EXTRA_CONVERSATION_ID)
?.toQualifiedID(qualifiedIdMapper)
?.let { IncomingCallScreen(it) }
?: SomeOther
}

NavigationItem.ImportMedia -> ImportMedia
NavigationItem.SelfDevices -> DeviceManager
NavigationItem.Welcome,
NavigationItem.Login,
NavigationItem.CreatePersonalAccount,
NavigationItem.CreateTeam,
NavigationItem.CreateAccountSummary,
NavigationItem.Migration,
NavigationItem.InitialSync,
NavigationItem.RemoveDevices -> AuthRelated

else -> SomeOther
}
}
Expand Down

0 comments on commit 3ad6eef

Please sign in to comment.