Merge pull request #10013 from nextcloud/fix/login-after-logout

Fix bugs when removing accounts
This commit is contained in:
Álvaro Brey 2022-03-30 18:29:24 +02:00 committed by GitHub
commit d9811e1f34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 5 deletions

View file

@ -58,7 +58,6 @@ import com.owncloud.android.utils.FileStorageUtils
import com.owncloud.android.utils.PushUtils
import org.greenrobot.eventbus.EventBus
import java.io.File
import java.util.ArrayList
/**
* Removes account and all local files
@ -150,6 +149,9 @@ class AccountRemovalWork(
deleteAppPasswordRemoteOperation.execute(optionNextcloudClient.get())
}
// delete cached OwncloudClient
OwnCloudClientManagerFactory.getDefaultSingleton().removeClientFor(user.toOwnCloudAccount())
if (userRemoved) {
eventBus.post(AccountRemovedEvent())
}

View file

@ -45,6 +45,7 @@ import com.nextcloud.client.onboarding.FirstRunActivity;
import com.nextcloud.java.util.Optional;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.files.services.FileDownloader;
@ -180,11 +181,18 @@ public class ManageAccountsActivity extends FileActivity implements UserListAdap
@Override
public void onBackPressed() {
Intent resultIntent = new Intent();
resultIntent.putExtra(KEY_ACCOUNT_LIST_CHANGED, hasAccountListChanged());
resultIntent.putExtra(KEY_CURRENT_ACCOUNT_CHANGED, hasCurrentAccountChanged());
setResult(RESULT_OK, resultIntent);
if (accountManager.getAllUsers().size() > 0) {
resultIntent.putExtra(KEY_ACCOUNT_LIST_CHANGED, hasAccountListChanged());
resultIntent.putExtra(KEY_CURRENT_ACCOUNT_CHANGED, hasCurrentAccountChanged());
setResult(RESULT_OK, resultIntent);
super.onBackPressed();
super.onBackPressed();
} else {
final Intent intent = new Intent(this, AuthenticatorActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
}
}
/**