-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
show first run again #5122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
show first run again #5122
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,14 +8,13 @@ | |
| import android.content.Intent; | ||
| import android.os.Bundle; | ||
| import android.os.Handler; | ||
| import android.os.PersistableBundle; | ||
|
|
||
| import com.nextcloud.client.account.User; | ||
| import com.nextcloud.client.account.UserAccountManager; | ||
| import com.nextcloud.client.di.Injectable; | ||
| import com.nextcloud.client.preferences.AppPreferences; | ||
| import com.nextcloud.java.util.Optional; | ||
| import com.nextcloud.client.preferences.DarkMode; | ||
| import com.nextcloud.java.util.Optional; | ||
| import com.owncloud.android.MainApp; | ||
| import com.owncloud.android.datamodel.FileDataStorageManager; | ||
| import com.owncloud.android.datamodel.OCFile; | ||
|
|
@@ -54,6 +53,7 @@ public abstract class BaseActivity extends AppCompatActivity implements Injectab | |
| */ | ||
| private boolean themeChangePending; | ||
| private boolean paused; | ||
| protected boolean enableAccountHandling = true; | ||
|
|
||
| @Inject UserAccountManager accountManager; | ||
| @Inject AppPreferences preferences; | ||
|
|
@@ -72,8 +72,11 @@ public UserAccountManager getUserAccountManager() { | |
| @Override | ||
| protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
| super.onCreate(savedInstanceState); | ||
| Account account = accountManager.getCurrentAccount(); | ||
| setAccount(account, false); | ||
|
|
||
| if (enableAccountHandling) { | ||
| Account account = accountManager.getCurrentAccount(); | ||
| setAccount(account, false); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -175,10 +178,14 @@ protected void setUser(User user) { | |
| protected void swapToDefaultAccount() { | ||
| // default to the most recently used account | ||
| Account newAccount = accountManager.getCurrentAccount(); | ||
|
|
||
| if (newAccount == null) { | ||
| /// no account available: force account creation | ||
| createAccount(true); | ||
| finish(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is what closes the Removing it wil break
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, that's indeed what happens :-/ @tobiasKaminsky ? |
||
|
|
||
| if (enableAccountHandling) { | ||
| finish(); | ||
| } | ||
| } else { | ||
| currentAccount = newAccount; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part was moved in this commit:
d7d1c47
If you loot at it, you'll see that this code was previously in a wrong
onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState)method.It was a bug that I introduced while refactoring
Account-related code inBaseActivity, caused by IDE autocompletion - I simply typed wrong method signature while overridingonCreate. We didn't notice this as it works by accident simply becuase numerious calls tosetAccountin derived activities.