正在查看: Housing v14.7.8 应用的 OtplessPhoneHintManagerImpl.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Housing v14.7.8 应用的 OtplessPhoneHintManagerImpl.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.otpless.utils;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Intent;
import android.content.IntentSender;
import androidx.activity.h;
import androidx.activity.result.IntentSenderRequest;
import androidx.activity.result.c;
import com.google.android.gms.auth.api.credentials.Credentials;
import com.google.android.gms.auth.api.credentials.CredentialsClient;
import com.google.android.gms.auth.api.credentials.CredentialsOptions;
import com.google.android.gms.auth.api.credentials.HintRequest;
import com.google.android.gms.auth.api.identity.GetPhoneNumberHintIntentRequest;
import com.google.android.gms.auth.api.identity.Identity;
import com.google.firebase.messaging.Constants;
import com.google.firebase.remoteconfig.internal.b;
import com.otpless.dto.Tuple;
import com.otpless.main.PhoneHintLauncherType;
import d.i;
import kotlin.Metadata;
import kotlin.jvm.internal.r;
import kq.l;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import zp.j0;
@Metadata(d1 = {"\u0000^\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u000e\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\f\b\u0000\u0018\u0000 *2\u00020\u0001:\u0001*B\u0007¢\u0006\u0004\b\u0002\u0010\u0003J\u000f\u0010\u0005\u001a\u00020\u0004H\u0002¢\u0006\u0004\b\u0005\u0010\u0003J\u001d\u0010\n\u001a\b\u0012\u0004\u0012\u00020\t0\b2\u0006\u0010\u0007\u001a\u00020\u0006H\u0002¢\u0006\u0004\b\n\u0010\u000bJ\u001f\u0010\u0010\u001a\u00020\u00042\u0006\u0010\r\u001a\u00020\f2\u0006\u0010\u000f\u001a\u00020\u000eH\u0016¢\u0006\u0004\b\u0010\u0010\u0011JE\u0010\u001a\u001a\u00020\u00042\u0006\u0010\u0012\u001a\u00020\u000e2,\u0010\u0019\u001a(\u0012\u001a\u0012\u0018\u0012\u0006\u0012\u0004\u0018\u00010\u0015\u0012\f\u0012\n\u0018\u00010\u0016j\u0004\u0018\u0001`\u00170\u0014\u0012\u0004\u0012\u00020\u00040\u0013j\u0002`\u0018H\u0016¢\u0006\u0004\b\u001a\u0010\u001bJ)\u0010!\u001a\u00020\u000e2\u0006\u0010\u001d\u001a\u00020\u001c2\u0006\u0010\u001e\u001a\u00020\u001c2\b\u0010 \u001a\u0004\u0018\u00010\u001fH\u0016¢\u0006\u0004\b!\u0010\"R\u001c\u0010#\u001a\b\u0012\u0004\u0012\u00020\t0\b8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b#\u0010$R\u001c\u0010%\u001a\b\u0012\u0004\u0012\u00020\t0\b8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b%\u0010$R\u0016\u0010&\u001a\u00020\f8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b&\u0010'R@\u0010(\u001a,\u0012\u001a\u0012\u0018\u0012\u0006\u0012\u0004\u0018\u00010\u0015\u0012\f\u0012\n\u0018\u00010\u0016j\u0004\u0018\u0001`\u00170\u0014\u0012\u0004\u0012\u00020\u0004\u0018\u00010\u0013j\u0004\u0018\u0001`\u00188\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b(\u0010)¨\u0006+"}, d2 = {"Lcom/otpless/utils/OtplessPhoneHintManagerImpl;", "Lcom/otpless/utils/OtplessPhoneHintManager;", "<init>", "()V", "Lzp/j0;", "showFallbackPhoneHint", "Lcom/otpless/main/PhoneHintLauncherType;", "launcherType", "Landroidx/activity/result/c;", "Landroidx/activity/result/IntentSenderRequest;", "getPhoneNumberHintLauncher", "(Lcom/otpless/main/PhoneHintLauncherType;)Landroidx/activity/result/c;", "Landroid/app/Activity;", "activity", "", "isInOnCreate", "register", "(Landroid/app/Activity;Z)V", "fallback", "Lkotlin/Function1;", "Lcom/otpless/dto/Tuple;", "", "Ljava/lang/Exception;", "Lkotlin/Exception;", "Lcom/otpless/utils/HintResultCallback;", "callback", "showPhoneNumberHint", "(ZLkq/l;)V", "", "requestCode", "resultCode", "Landroid/content/Intent;", Constants.ScionAnalytics.MessageType.DATA_MESSAGE, "onActivityResult", "(IILandroid/content/Intent;)Z", "phoneNumberHintIntentResultLauncher", "Landroidx/activity/result/c;", "fallbackPhoneNumberHintIntentResultLauncher", "mActivity", "Landroid/app/Activity;", "hintResultCallback", "Lkq/l;", "Companion", "otpless-android-sdk_release"}, k = 1, mv = {1, 9, 0}, xi = 48)
public final class OtplessPhoneHintManagerImpl implements OtplessPhoneHintManager {
public static final int FALLBACK_OTPLESS_PHONE_HINT_REQUEST = 9767356;
public static final int OTPLESS_PHONE_HINT_REQUEST = 9767355;
private c<IntentSenderRequest> fallbackPhoneNumberHintIntentResultLauncher;
@Nullable
private l<? super Tuple<String, Exception>, j0> hintResultCallback;
private Activity mActivity;
private c<IntentSenderRequest> phoneNumberHintIntentResultLauncher;
public final c<IntentSenderRequest> getPhoneNumberHintLauncher(PhoneHintLauncherType launcherType) {
if (launcherType == PhoneHintLauncherType.GoogleIdentity) {
c<IntentSenderRequest> cVar = this.phoneNumberHintIntentResultLauncher;
if (cVar != null) {
return cVar;
}
r.o("phoneNumberHintIntentResultLauncher");
throw null;
}
c<IntentSenderRequest> cVar2 = this.fallbackPhoneNumberHintIntentResultLauncher;
if (cVar2 != null) {
return cVar2;
}
r.o("fallbackPhoneNumberHintIntentResultLauncher");
throw null;
}
public static final void register$lambda$0(Activity activity, OtplessPhoneHintManagerImpl otplessPhoneHintManagerImpl, androidx.activity.result.a aVar) {
Tuple tuple;
r.k(activity, "$activity");
r.k(otplessPhoneHintManagerImpl, "this$0");
r.k(aVar, "result");
try {
String phoneNumberFromIntent = Identity.getSignInClient(activity).getPhoneNumberFromIntent(aVar.a());
r.j(phoneNumberFromIntent, "getPhoneNumberFromIntent(...)");
tuple = new Tuple(phoneNumberFromIntent, (Object) null);
} catch (Exception e) {
tuple = new Tuple((Object) null, e);
}
l<? super Tuple<String, Exception>, j0> lVar = otplessPhoneHintManagerImpl.hintResultCallback;
if (lVar != null) {
lVar.invoke(tuple);
}
}
public static final void register$lambda$1(OtplessPhoneHintManagerImpl otplessPhoneHintManagerImpl, androidx.activity.result.a aVar) {
r.k(otplessPhoneHintManagerImpl, "this$0");
Tuple<String, Exception> parsePhoneNumberFromCredentialHintResult = Utility.parsePhoneNumberFromCredentialHintResult(aVar);
l<? super Tuple<String, Exception>, j0> lVar = otplessPhoneHintManagerImpl.hintResultCallback;
if (lVar != null) {
r.h(parsePhoneNumberFromCredentialHintResult);
lVar.invoke(parsePhoneNumberFromCredentialHintResult);
}
}
private final void showFallbackPhoneHint() {
try {
HintRequest build = new HintRequest.Builder().setPhoneNumberIdentifierSupported(true).build();
r.j(build, "build(...)");
CredentialsOptions build2 = new CredentialsOptions.Builder().forceEnableSaveDialog().build();
r.j(build2, "build(...)");
Activity activity = this.mActivity;
if (activity == null) {
r.o("mActivity");
throw null;
}
CredentialsClient client = Credentials.getClient(activity, build2);
r.j(client, "getClient(...)");
PendingIntent hintPickerIntent = client.getHintPickerIntent(build);
r.j(hintPickerIntent, "getHintPickerIntent(...)");
if (this.fallbackPhoneNumberHintIntentResultLauncher != null) {
c<IntentSenderRequest> phoneNumberHintLauncher = getPhoneNumberHintLauncher(PhoneHintLauncherType.GoogleCredential);
IntentSender intentSender = hintPickerIntent.getIntentSender();
r.j(intentSender, "getIntentSender(...)");
phoneNumberHintLauncher.b(new IntentSenderRequest.Builder(intentSender).a());
return;
}
Activity activity2 = this.mActivity;
if (activity2 != null) {
activity2.startIntentSenderForResult(hintPickerIntent.getIntentSender(), FALLBACK_OTPLESS_PHONE_HINT_REQUEST, null, 0, 0, 0);
} else {
r.o("mActivity");
throw null;
}
} catch (NoClassDefFoundError unused) {
l<? super Tuple<String, Exception>, j0> lVar = this.hintResultCallback;
if (lVar != null) {
lVar.invoke(new Tuple((Object) null, new Exception("fallback phone hint can not be opened")));
}
}
}
public static final void showPhoneNumberHint$lambda$4(OtplessPhoneHintManagerImpl otplessPhoneHintManagerImpl, l lVar, boolean z) {
r.k(otplessPhoneHintManagerImpl, "this$0");
r.k(lVar, "$callback");
GetPhoneNumberHintIntentRequest build = GetPhoneNumberHintIntentRequest.builder().build();
r.j(build, "build(...)");
Activity activity = otplessPhoneHintManagerImpl.mActivity;
if (activity != null) {
Identity.getSignInClient(activity).getPhoneNumberHintIntent(build).addOnSuccessListener(new androidx.camera.lifecycle.c(6, new OtplessPhoneHintManagerImpl$showPhoneNumberHint$1$1(otplessPhoneHintManagerImpl, lVar))).addOnFailureListener(new b(otplessPhoneHintManagerImpl, lVar, z));
} else {
r.o("mActivity");
throw null;
}
}
public static final void showPhoneNumberHint$lambda$4$lambda$2(l lVar, Object obj) {
r.k(lVar, "$tmp0");
lVar.invoke(obj);
}
public static final void showPhoneNumberHint$lambda$4$lambda$3(boolean z, OtplessPhoneHintManagerImpl otplessPhoneHintManagerImpl, l lVar, Exception exc) {
r.k(otplessPhoneHintManagerImpl, "this$0");
r.k(lVar, "$callback");
r.k(exc, "e");
if (z) {
otplessPhoneHintManagerImpl.showFallbackPhoneHint();
} else {
lVar.invoke(new Tuple((Object) null, exc));
}
}
@Override
public boolean onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
Tuple tuple;
Tuple tuple2;
switch (requestCode) {
case OTPLESS_PHONE_HINT_REQUEST:
if (resultCode == -1) {
if (data != null) {
String stringExtra = data.getStringExtra("phone_number_hint_result");
if (stringExtra != null) {
tuple = new Tuple(stringExtra, (Object) null);
} else {
tuple2 = new Tuple((Object) null, new Exception("No phone number data found in intent"));
}
} else {
tuple2 = new Tuple((Object) null, new Exception("No phone number data found in intent"));
}
tuple = tuple2;
} else {
tuple = new Tuple((Object) null, new Exception("User cancelled the hint selection"));
}
l<? super Tuple<String, Exception>, j0> lVar = this.hintResultCallback;
if (lVar != null) {
lVar.invoke(tuple);
break;
}
break;
case FALLBACK_OTPLESS_PHONE_HINT_REQUEST:
l<? super Tuple<String, Exception>, j0> lVar2 = this.hintResultCallback;
if (lVar2 != null) {
Tuple<String, Exception> parsePhoneNumberFromCredentialHintResult = Utility.parsePhoneNumberFromCredentialHintResult(new androidx.activity.result.a(resultCode, data));
r.j(parsePhoneNumberFromCredentialHintResult, "parsePhoneNumberFromCredentialHintResult(...)");
lVar2.invoke(parsePhoneNumberFromCredentialHintResult);
break;
}
break;
}
return true;
}
@Override
public void register(@NotNull Activity activity, boolean isInOnCreate) {
r.k(activity, "activity");
this.mActivity = activity;
if ((activity instanceof h) && isInOnCreate) {
h hVar = (h) activity;
c<IntentSenderRequest> registerForActivityResult = hVar.registerForActivityResult(new i(), new androidx.camera.camera2.interop.h(17, activity, this));
r.j(registerForActivityResult, "registerForActivityResult(...)");
this.phoneNumberHintIntentResultLauncher = registerForActivityResult;
c<IntentSenderRequest> registerForActivityResult2 = hVar.registerForActivityResult(new i(), new com.facebook.login.c(this, 27));
r.j(registerForActivityResult2, "registerForActivityResult(...)");
this.fallbackPhoneNumberHintIntentResultLauncher = registerForActivityResult2;
}
}
@Override
public void showPhoneNumberHint(boolean fallback, @NotNull l<? super Tuple<String, Exception>, j0> callback) {
r.k(callback, "callback");
this.hintResultCallback = callback;
Activity activity = this.mActivity;
if (activity != null) {
activity.runOnUiThread(new com.moengage.core.internal.c(this, callback, fallback, 2));
} else {
r.o("mActivity");
throw null;
}
}
}