103 lines
3.4 KiB
Java
103 lines
3.4 KiB
Java
package com.huawei.hms.support.hwid.request;
|
|
|
|
import com.huawei.hms.hwid.ap;
|
|
import com.huawei.hms.support.api.entity.auth.PermissionInfo;
|
|
import com.huawei.hms.support.api.entity.auth.Scope;
|
|
import com.huawei.hms.support.api.entity.common.CommonConstant;
|
|
import com.huawei.hms.support.feature.request.AbstractAuthParamsHelper;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class HuaweiIdAuthParamsHelper extends AbstractAuthParamsHelper {
|
|
@Deprecated
|
|
public final HuaweiIdAuthParamsHelper setDialogAuth() {
|
|
return this;
|
|
}
|
|
|
|
public HuaweiIdAuthParamsHelper() {
|
|
}
|
|
|
|
public HuaweiIdAuthParamsHelper(HuaweiIdAuthParams huaweiIdAuthParams) {
|
|
this.signInScopes.addAll(huaweiIdAuthParams.getRequestScopeList());
|
|
this.permissionSet.addAll(huaweiIdAuthParams.getPermissionInfos());
|
|
}
|
|
|
|
public final HuaweiIdAuthParamsHelper setUid() {
|
|
this.permissionSet.add(HuaweiIdAuthParams.UID_DYNAMIC_PERMISSION);
|
|
return this;
|
|
}
|
|
|
|
public final HuaweiIdAuthParamsHelper setAuthorizationCode() {
|
|
PermissionInfo permissionInfo = new PermissionInfo();
|
|
permissionInfo.setPermissionUri(CommonConstant.LocalPermission.SERVICE_AUTH_CODE);
|
|
this.permissionSet.add(permissionInfo);
|
|
return this;
|
|
}
|
|
|
|
public final HuaweiIdAuthParamsHelper setAccessToken() {
|
|
PermissionInfo permissionInfo = new PermissionInfo();
|
|
permissionInfo.setPermissionUri(CommonConstant.LocalPermission.ACCESS_TOKEN);
|
|
this.permissionSet.add(permissionInfo);
|
|
return this;
|
|
}
|
|
|
|
public final HuaweiIdAuthParamsHelper setScopeList(List<Scope> list) {
|
|
if (ap.b(list).booleanValue()) {
|
|
for (Scope scope : list) {
|
|
if (scope != null && scope.getScopeUri() != null) {
|
|
this.signInScopes.add(scope);
|
|
}
|
|
}
|
|
}
|
|
return this;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
public final HuaweiIdAuthParamsHelper setScope(Scope scope) {
|
|
this.signInScopes.add(scope);
|
|
return this;
|
|
}
|
|
|
|
public final HuaweiIdAuthParams createParams() {
|
|
return new HuaweiIdAuthParams(this.signInScopes, this.permissionSet);
|
|
}
|
|
|
|
public final HuaweiIdAuthParamsHelper setEmail() {
|
|
return setScope(HuaweiIdAuthParams.EMAIL);
|
|
}
|
|
|
|
public final HuaweiIdAuthParamsHelper setId() {
|
|
return setScope(HuaweiIdAuthParams.OPENID);
|
|
}
|
|
|
|
public final HuaweiIdAuthParamsHelper setIdToken() {
|
|
this.permissionSet.add(new PermissionInfo().setPermissionUri(CommonConstant.PERMISSION.IDTOKEN));
|
|
return this;
|
|
}
|
|
|
|
public final HuaweiIdAuthParamsHelper setProfile() {
|
|
return setScope(HuaweiIdAuthParams.PROFILE);
|
|
}
|
|
|
|
public final HuaweiIdAuthParamsHelper setShippingAddress() {
|
|
setAccessToken();
|
|
setId();
|
|
return setScope(new Scope(CommonConstant.SCOPE.SCOPE_ACCOUNT_SHIPPING_ADDRESS));
|
|
}
|
|
|
|
public final HuaweiIdAuthParamsHelper setMobileNumber() {
|
|
setAccessToken();
|
|
setId();
|
|
return setScope(new Scope(CommonConstant.SCOPE.SCOPE_MOBILE_NUMBER));
|
|
}
|
|
|
|
public final HuaweiIdAuthParamsHelper setIncludeGranted(boolean z) {
|
|
if (!z) {
|
|
PermissionInfo permissionInfo = new PermissionInfo();
|
|
permissionInfo.setPermissionUri(CommonConstant.IncludeGranted.NON_INCLUDE_GRANTED);
|
|
this.permissionSet.add(permissionInfo);
|
|
}
|
|
return this;
|
|
}
|
|
}
|