正在查看: OLX India v19.42.007 应用的 SmartLockAuthActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: OLX India v19.42.007 应用的 SmartLockAuthActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.olxgroup.panamera.app.users.auth.activities;
import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
import android.os.Bundle;
import android.widget.Toast;
import androidx.fragment.app.o0;
import com.google.android.gms.auth.api.credentials.Credential;
import com.google.android.gms.auth.api.credentials.CredentialRequest;
import com.google.android.gms.auth.api.credentials.CredentialRequestResponse;
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.IdToken;
import com.google.android.gms.common.api.ResolvableApiException;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.olxgroup.panamera.app.common.infra.m2;
import com.olxgroup.panamera.app.common.utils.l0;
import com.olxgroup.panamera.app.common.utils.p1;
import com.olxgroup.panamera.app.users.auth.fragments.SocialConsentFragment;
import com.olxgroup.panamera.domain.users.auth.entity.ConsentList;
import com.olxgroup.panamera.domain.users.auth.entity.LoginTrackingOrigin;
import com.olxgroup.panamera.domain.users.auth.presentation_contract.SmartLockAuthContract;
import com.olxgroup.panamera.domain.users.auth.presentation_impl.SmartLockAuthPresenter;
import java.util.List;
public class SmartLockAuthActivity extends f implements SmartLockAuthContract.IViewSmartLockAuthContract {
SmartLockAuthPresenter U;
private CredentialsClient V;
private boolean W = false;
public static Intent p2() {
return new Intent((Context) m2.b, (Class<?>) SmartLockAuthActivity.class);
}
public void q2(Task task) {
if (task.isSuccessful()) {
r2(((CredentialRequestResponse) task.getResult()).getCredential(), LoginTrackingOrigin.SMART_LOCK_AUTO.getValue());
return;
}
Exception exception = task.getException();
if (!(exception instanceof ResolvableApiException)) {
this.U.trackSmartLockResponse("error");
closeActivity();
return;
}
ResolvableApiException resolvableApiException = (ResolvableApiException) exception;
if (resolvableApiException.getStatusCode() != 4) {
s2(resolvableApiException, 2);
} else {
this.U.trackSmartLockResponse("not_found");
closeActivity();
}
}
private void r2(Credential credential, String str) {
String accountType = credential.getAccountType();
this.U.trackSmartLockResponse(str);
if (accountType == null) {
String id = credential.getId();
if (p1.r().C(id)) {
this.U.emailCredentialsRetrieved(id, credential.getPassword(), str);
return;
} else {
this.U.phoneCredentialsRetrieved(id, credential.getPassword(), str);
return;
}
}
if (!accountType.equals("https://accounts.google.com")) {
this.U.requestedCredentialsError("There is an Account Type defined, but it's not handled.");
return;
}
List idTokens = credential.getIdTokens();
if (idTokens.isEmpty() || idTokens.get(0) == null) {
return;
}
this.U.googleCredentialsRetrieved(((IdToken) idTokens.get(0)).getIdToken(), str);
}
private void s2(ResolvableApiException resolvableApiException, int i) {
if (this.W) {
return;
}
try {
resolvableApiException.startResolutionForResult(this, i);
this.W = true;
} catch (IntentSender.SendIntentException unused) {
this.U.requestedCredentialsError("Failed to send resolution");
}
}
@Override
public void closeActivity() {
setResult(0);
finish();
}
@Override
public void closeActivityAndSetResultCancel(String str, String str2) {
Intent intent = new Intent();
intent.putExtra("login_error", str2);
intent.putExtra("login_error_key", str2);
setResult(0, intent);
finish();
}
@Override
public void closeActivityAndSetResultOk() {
setResult(-1);
finish();
}
@Override
public void disableAutoLogin() {
this.V.disableAutoSignIn();
}
@Override
public void goBack() {
finish();
}
@Override
public void hideLoading() {
}
public void o2() {
this.U.performLogin();
}
public void onActivityResult(int i, int i2, Intent intent) {
super/*androidx.fragment.app.r*/.onActivityResult(i, i2, intent);
if (i != 2) {
closeActivity();
return;
}
if (i2 == -1) {
r2((Credential) intent.getParcelableExtra("com.google.android.gms.credentials.Credential"), LoginTrackingOrigin.SMART_LOCK_SELECT.getValue());
} else {
this.U.requestCredentialsDismissed("request_flow");
}
this.W = false;
}
public void onBackPressed() {
finish();
}
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(com.olx.southasia.k.activity_smart_lock);
this.U.setView(this);
this.U.start();
if (bundle != null) {
this.W = bundle.getBoolean("is_resolving");
}
this.V = Credentials.getClient(this);
if (this.W) {
return;
}
this.U.requestedCredentials();
}
protected void onSaveInstanceState(Bundle bundle) {
super/*androidx.activity.ComponentActivity*/.onSaveInstanceState(bundle);
bundle.putBoolean("is_resolving", this.W);
}
@Override
public void openLoginConsentScreen(String str, ConsentList consentList) {
SocialConsentFragment socialConsentFragment = new SocialConsentFragment();
Bundle bundle = new Bundle();
bundle.putSerializable("KEY_CONSENT_LOGIN_DATA", consentList);
socialConsentFragment.setArguments(bundle);
try {
o0 s = getSupportFragmentManager().s();
s.c(com.olx.southasia.i.container, socialConsentFragment, SocialConsentFragment.class.getName());
s.g(SocialConsentFragment.class.getName());
s.j();
} catch (Exception e) {
l0.a(e);
}
}
@Override
public void requestCredentials() {
this.V.request(new CredentialRequest.Builder().setPasswordLoginSupported(true).setIdTokenRequested(true).setAccountTypes(new String[]{"https://www.facebook.com", "https://accounts.google.com"}).build()).addOnCompleteListener(new OnCompleteListener() {
public final void onComplete(Task task) {
SmartLockAuthActivity.this.q2(task);
}
});
}
@Override
public void showLoading() {
}
@Override
public void showReactivateMessage() {
Toast.makeText((Context) this, (CharSequence) getString(com.olx.southasia.p.account_reactivated_body, "OLX"), 1).show();
}
@Override
public void showSnackBarText(String str) {
}
}