From 75ad5cfef68c9827149455b926c29080f3cbdc44 Mon Sep 17 00:00:00 2001 From: Jonathan Nobels Date: Wed, 3 Apr 2024 15:08:55 -0400 Subject: [PATCH] android/ui: show the switching-to user immediately on FUS switch (#280) Updates tailscale/corp#18202 Reload the loggedInUser on all state transitions to ensure FUS switches are always properly represented Signed-off-by: Jonathan Nobels --- .../java/com/tailscale/ipn/ui/viewModel/IpnViewModel.kt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/android/src/main/java/com/tailscale/ipn/ui/viewModel/IpnViewModel.kt b/android/src/main/java/com/tailscale/ipn/ui/viewModel/IpnViewModel.kt index 7b7fba4..9636a43 100644 --- a/android/src/main/java/com/tailscale/ipn/ui/viewModel/IpnViewModel.kt +++ b/android/src/main/java/com/tailscale/ipn/ui/viewModel/IpnViewModel.kt @@ -38,11 +38,8 @@ open class IpnViewModel : ViewModel() { init { viewModelScope.launch { Notifier.state.collect { - // Refresh the user profiles if we're transitioning out of the - // NeedsLogin state. - if (it == Ipn.State.NeedsLogin) { - viewModelScope.launch { loadUserProfiles() } - } + // Reload the user profiles on all state transitions to ensure loggedInUser is correct + viewModelScope.launch { loadUserProfiles() } } }