Merge pull request #10703 from nextcloud/addAccount

Restart account creation with AuthenticatorActivity, which helps to add account in restricted profiles, e.g. MDM or Samsung second users
This commit is contained in:
Álvaro Brey 2022-09-02 12:21:21 +02:00 committed by GitHub
commit c962476d90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -27,6 +27,7 @@ import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.text.TextUtils;
@ -35,6 +36,7 @@ import com.nextcloud.common.NextcloudClient;
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.OCFile;
import com.owncloud.android.lib.common.OwnCloudAccount;
@ -400,12 +402,10 @@ public class UserAccountManagerImpl implements UserAccountManager {
@Override
public void startAccountCreation(final Activity activity) {
accountManager.addAccount(getAccountType(),
null,
null,
null,
activity,
null,
null);
Intent intent = new Intent(context, AuthenticatorActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
}