You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently user account can be represented by 4 different types:
android.accounts.Account
com.owncloud.android.lib.common.OwnCloudAccount
String id
int id
Accounts are being juggled in activities that try to track which account is currently active and perform ad-hoc reinitialization of UI on change.
The logic responsible for reconciliation of currently selected account and UI state is virtually impossible to track due to large amount of flags, conditions and out-of-band state modification.
Additionally, we discovered some issues with android account manager, causing accounts to disappear from the android.accounts.AccountManager on phones that allow installing the application on external storage (despite we forbid it in the manifest).
Solution
Make UserAccountManager a single point of truth regarding currently selected account
Eliminate ad-hoc UI patching in life cycle callbacks
Seal OwnCloudAccount and Account behind new unified interface
Migrate application components to new unified account type
No visible user impact, or impact minimized up to this point.
Make decision about new account manager implementation (platform? custom? library? app? sso?)
Roadmap
Due to current state of code, extensive refactoring and cleanup around account handling is necessary, as it contains too much state mutation dispersed through many functional areas.
Managing risk in such environment is not economical.
Extend UserAccountManager with notification API, allowing UI layer to react on account swap
Finish activities stack and restart with new account instead of trying to switch internal state
Enable assumption that account cannot change while being inside lifecycle activity.
Start migrating to new account type (details to follow...)
The text was updated successfully, but these errors were encountered:
Very good approach!
I guess the idea of OwnCloudAccount is to handle the most basic infos within library, so that other apps can also use this. Something similar is OCFile (in our app) vs RemoteFile (in library) for representing a server file.
Situation
Currently user account can be represented by 4 different types:
android.accounts.Account
com.owncloud.android.lib.common.OwnCloudAccount
String
idint
idAccounts are being juggled in activities that try to track which account is currently active and perform ad-hoc reinitialization of UI on change.
The logic responsible for reconciliation of currently selected account and UI state is virtually impossible to track due to large amount of flags, conditions and out-of-band state modification.
Additionally, we discovered some issues with android account manager, causing accounts to disappear from the
android.accounts.AccountManager
on phones that allow installing the application on external storage (despite we forbid it in the manifest).Solution
UserAccountManager
a single point of truth regarding currently selected accountOwnCloudAccount
andAccount
behind new unified interfaceNo visible user impact, or impact minimized up to this point.
Roadmap
Due to current state of code, extensive refactoring and cleanup around account handling is necessary, as it contains too much state mutation dispersed through many functional areas.
Managing risk in such environment is not economical.
Proposal (incomplete):
setAccount
andonAccountSet
logic:Deprecate setAccount logic and remove accounWasSet flag #4677Remove onAccountSet from UploadPathActivity #4685 Remove onAccountSet from image and video preview activities #4686 Remove onAccountSet from UploadFilesActivity #4687 Remove onAccountSet from ShareActivity #4688 Remove onAccountSet from FolderPickerActivity #4689 Remove onAccountSet from FileDisplayActivity #4693 Remove onAccountSet from ConflictsResolveActivity #4694 Remove onAccountSet from ReceiveExternalFilesActivity #4700BaseActivity
and derived classesEliminate account status flags from BaseActivity #4710setAccount
and manually callingonAccountSet
callback out of band. Remove out of band setAccount/onAccountSet calls #4713UserAccountManager
with notification API, allowing UI layer to react on account swapEnable assumption that account cannot change while being inside lifecycle activity.
The text was updated successfully, but these errors were encountered: