70 lines
2.7 KiB
Java
70 lines
2.7 KiB
Java
package com.huawei.hms.hwid;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Context;
|
|
import android.text.TextUtils;
|
|
import com.huawei.hms.api.Api;
|
|
import com.huawei.hms.common.ApiException;
|
|
import com.huawei.hms.common.HuaweiApi;
|
|
import com.huawei.hms.common.internal.AbstractClientBuilder;
|
|
import com.huawei.hms.support.api.client.Status;
|
|
import com.huawei.hms.support.api.entity.common.CommonConstant;
|
|
import com.huawei.hms.support.api.entity.common.CommonNaming;
|
|
import com.huawei.hms.support.hianalytics.HiAnalyticsClient;
|
|
import o.HiE;
|
|
import o.nNj;
|
|
import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class aj extends HuaweiApi<Api.ApiOptions.NoOptions> {
|
|
@Override // com.huawei.hms.common.HuaweiApi
|
|
public int getApiLevel() {
|
|
return 1;
|
|
}
|
|
|
|
public aj(Activity activity, Api<Api.ApiOptions.NoOptions> api, Api.ApiOptions.NoOptions noOptions, AbstractClientBuilder abstractClientBuilder) {
|
|
super(activity, api, noOptions, abstractClientBuilder);
|
|
}
|
|
|
|
public aj(Context context, Api<Api.ApiOptions.NoOptions> api, Api.ApiOptions.NoOptions noOptions, AbstractClientBuilder abstractClientBuilder) {
|
|
super(context, api, noOptions, abstractClientBuilder);
|
|
}
|
|
|
|
public HiE<Void> a() {
|
|
String a = b().a();
|
|
if (TextUtils.isEmpty(a)) {
|
|
nNj nnj = new nNj();
|
|
nnj.c(new ApiException(new Status(2020, CommonConstant.RETCODE.SMS_PARAM_ERROR)));
|
|
return nnj.b;
|
|
}
|
|
return doWrite(new ak(CommonNaming.startSmsRetriever, a, HiAnalyticsClient.reportEntry(getContext(), CommonNaming.startSmsRetriever, 60900100)));
|
|
}
|
|
|
|
public HiE<Void> a(String str) {
|
|
as.b("ReadSmsService", "startConsent enter", true);
|
|
if (str != null && str.length() > 120) {
|
|
nNj nnj = new nNj();
|
|
nnj.c(new ApiException(new Status(2020, CommonConstant.RETCODE.SMS_PARAM_ERROR)));
|
|
return nnj.b;
|
|
}
|
|
JSONObject jSONObject = new JSONObject();
|
|
try {
|
|
jSONObject.put(CommonConstant.ReqAccessTokenParam.PACKAGE_NAME, getContext().getPackageName());
|
|
jSONObject.put("phoneNumber", str);
|
|
} catch (JSONException unused) {
|
|
as.d("ReadSmsService", "toJson failed", true);
|
|
}
|
|
if (TextUtils.isEmpty(jSONObject.toString())) {
|
|
nNj nnj2 = new nNj();
|
|
nnj2.c(new ApiException(new Status(2020, CommonConstant.RETCODE.SMS_PARAM_ERROR)));
|
|
return nnj2.b;
|
|
}
|
|
return doWrite(new al(CommonNaming.startConsent, jSONObject.toString(), HiAnalyticsClient.reportEntry(getContext(), CommonNaming.startConsent, 60900100)));
|
|
}
|
|
|
|
private af b() {
|
|
return new af(getContext().getPackageName());
|
|
}
|
|
}
|