fix(AccountSwitcherSheet): only restart on different accounts

Changes the AccountSwitcherSheet from always restarting the application
to only restarting if a different account is selected. This reduces the
friction of accidentally clicking on the same account.
This commit is contained in:
FineFindus 2024-06-13 19:22:45 +02:00
parent b38c78c50a
commit bd88606c48
No known key found for this signature in database
GPG Key ID: 64873EE210FF8E6B
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.List;
import java.util.Objects;
import java.util.function.BiConsumer;
import java.util.stream.Collectors;
@ -338,7 +339,8 @@ public class AccountSwitcherSheet extends BottomSheet{
onClick.accept(item.getID(), false);
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());
((MainActivity)activity).restartActivity();
}