Merge pull request #425 from FineFindus/fix/account-switch-reload

fix(AccountSwitcherSheet): only restart on different accounts
This commit is contained in:
LucasGGamerM 2024-06-14 14:10:24 -03:00 committed by GitHub
commit 4d598bd2fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -35,6 +35,7 @@ import org.joinmastodon.android.ui.views.CheckableRelativeLayout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -338,7 +339,8 @@ public class AccountSwitcherSheet extends BottomSheet{
onClick.accept(item.getID(), false); onClick.accept(item.getID(), false);
return; return;
} }
if(AccountSessionManager.getInstance().tryGetAccount(item.getID())!=null){ AccountSessionManager accountSessionManager=AccountSessionManager.getInstance();
if(accountSessionManager.tryGetAccount(item.getID())!=null && !Objects.equals(accountSessionManager.getLastActiveAccountID(), item.getID())){
AccountSessionManager.getInstance().setLastActiveAccountID(item.getID()); AccountSessionManager.getInstance().setLastActiveAccountID(item.getID());
((MainActivity)activity).restartActivity(); ((MainActivity)activity).restartActivity();
} }