Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/main/java/com/owncloud/android/ui/activity/BaseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ public UserAccountManager getUserAccountManager() {
return accountManager;
}

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Account account = accountManager.getCurrentAccount();
setAccount(account, false);
}

@Override
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
Expand Down Expand Up @@ -97,12 +104,6 @@ protected void onResume() {
}
}

public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
super.onCreate(savedInstanceState, persistentState);
Account account = accountManager.getCurrentAccount();
setAccount(account, false);
}

@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
Expand Down Expand Up @@ -177,6 +178,7 @@ protected void swapToDefaultAccount() {
if (newAccount == null) {
/// no account available: force account creation
createAccount(true);
finish();

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to run it without it. I managed to create the account properly, but it landed in empty file list activity as a result, requiring extra pull-to-refresh.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have somewhere a delay of 500ms to do a very first loading of folder content, maybe it just takes a bit too long for you.

} else {
currentAccount = newAccount;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2539,8 +2539,9 @@ public void onMessageEvent(TokenPushEvent event) {
@Override
public void onStart() {
super.onStart();
Optional<User> optionalUser = getUser();
if (optionalUser.isPresent()) {
final Optional<User> optionalUser = getUser();
final FileDataStorageManager storageManager = getStorageManager();
if (optionalUser.isPresent() && storageManager != null) {
/// Check whether the 'main' OCFile handled by the Activity is contained in the
// current Account
OCFile file = getFile();
Expand All @@ -2552,17 +2553,17 @@ public void onStart() {
// cache until the upload is successful get parent from path
parentPath = file.getRemotePath().substring(0,
file.getRemotePath().lastIndexOf(file.getFileName()));
if (getStorageManager().getFileByPath(parentPath) == null) {
if (storageManager.getFileByPath(parentPath) == null) {
file = null; // not able to know the directory where the file is uploading
}
} else {
file = getStorageManager().getFileByPath(file.getRemotePath());
file = storageManager.getFileByPath(file.getRemotePath());
// currentDir = null if not in the current Account
}
}
if (file == null) {
// fall back to root folder
file = getStorageManager().getFileByPath(OCFile.ROOT_PATH); // never returns null
file = storageManager.getFileByPath(OCFile.ROOT_PATH); // never returns null
}
setFile(file);

Expand Down