Improve account switching intents (#3732)

Before, intent creation was scattered across multiple sites, with account switching logic in both `ComposeActivity` and `MainActivity`.

Now, intents are only created in `MainActivity` Companion, and account switching only occurs in `MainActivity`

Fixes #3695
This commit is contained in:
Konrad Pozniak 2023-08-19 12:31:47 +02:00 committed by GitHub
commit dc9e9f2aeb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 394 additions and 359 deletions

View file

@ -256,9 +256,8 @@ public abstract class BaseActivity extends AppCompatActivity implements Injectab
public void openAsAccount(@NonNull String url, @NonNull AccountEntity account) {
accountManager.setActiveAccount(account.getId());
Intent intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
intent.putExtra(MainActivity.REDIRECT_URL, url);
Intent intent = MainActivity.redirectIntent(this, account.getId(), url);
startActivity(intent);
finishWithoutSlideOutAnimation();
}