Switch accounts on intent

Signed-off-by: ZetaTom <70907959+ZetaTom@users.noreply.github.com>
This commit is contained in:
ZetaTom 2023-07-10 11:13:44 +02:00 committed by Andy Scherzinger
parent 88a5884b26
commit 6a07bac0eb
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
2 changed files with 5 additions and 4 deletions

View file

@ -371,7 +371,7 @@ public abstract class DrawerActivity extends ToolbarActivity
Intent intent = getPackageManager().getLaunchIntentForPackage(packageName);
if (intent != null) {
// app installed - open directly
intent.putExtra(FileDisplayActivity.KEY_ACTIVE_USER, getUser().get().hashCode());
intent.putExtra(FileDisplayActivity.KEY_ACCOUNT, getUser().get().hashCode());
startActivity(intent);
} else {
// app not found - open market (Google Play Store, F-Droid, etc.)

View file

@ -191,7 +191,6 @@ public class FileDisplayActivity extends FileActivity
public static final String KEY_FILE_ID = "KEY_FILE_ID";
public static final String KEY_FILE_PATH = "KEY_FILE_PATH";
public static final String KEY_ACCOUNT = "KEY_ACCOUNT";
public static final String KEY_ACTIVE_USER = "KEY_ACTIVE_USER";
private static final String KEY_WAITING_TO_PREVIEW = "WAITING_TO_PREVIEW";
@ -392,6 +391,10 @@ public class FileDisplayActivity extends FileActivity
if (OPEN_FILE.equals(getIntent().getAction())) {
getSupportFragmentManager().executePendingTransactions();
onOpenFileIntent(getIntent());
} else if (RESTART.equals(getIntent().getAction())) {
// most likely switched to different account
DisplayUtils.showSnackMessage(this, String.format(getString(R.string.logged_in_as),
accountManager.getUser().getAccountName()));
}
upgradeNotificationForInstantUpload();
@ -2505,8 +2508,6 @@ public class FileDisplayActivity extends FileActivity
} else {
dismissLoadingDialog();
accountClicked(optionalUser.get().hashCode());
DisplayUtils.showSnackMessage(this, String.format(getString(R.string.logged_in_as),
optionalUser.get().getAccountName()));
}
} else {
dismissLoadingDialog();