ManageAccountsActivity: go back to AuthenticatorActivity after removing last account

Instead of waiting for FileDisplayActivity to make a network request and fail

Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
This commit is contained in:
Álvaro Brey Vilas 2022-03-23 18:23:57 +01:00
parent 95046c4b5d
commit a1901ca3e8
No known key found for this signature in database
GPG key ID: 2585783189A62105

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();
}
}
/**