Write notification account information to the correct account (#3697)
Don't use `accountManager.activeAccount` throughout the code. Instead, get the active account once, and use that over the life of the viewmodel. As shown in https://github.com/tuskyapp/Tusky/issues/3689#issuecomment-1567219338 the active account can change before the view model is destroyed, and if that happens account information for the account will be written to the wrong account.
This commit is contained in:
parent
61374c5180
commit
346dabffc5
5 changed files with 25 additions and 22 deletions
|
|
@ -212,6 +212,13 @@ public abstract class BaseActivity extends AppCompatActivity implements Injectab
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: This changes the accountManager's activeAccount property, but does not do any
|
||||
// of the work that AccountManager.setActiveAccount() does. In particular:
|
||||
//
|
||||
// - The current active account is not saved
|
||||
// - The account passed as parameter here goes not have its `isActive` property set
|
||||
//
|
||||
// Is that deliberate? Or is this a bug?
|
||||
public void openAsAccount(@NonNull String url, @NonNull AccountEntity account) {
|
||||
accountManager.setActiveAccount(account);
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue