导航菜单

页面标题

页面副标题

OLX India v19.42.007 - GoogleVerificationActivity.java 源代码

正在查看: OLX India v19.42.007 应用的 GoogleVerificationActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.olxgroup.panamera.app.users.linkaccount.activities;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.tasks.Task;
import com.olx.southasia.k;
import com.olx.southasia.p;
import com.olxgroup.panamera.app.common.helpers.l;
import com.olxgroup.panamera.app.common.infra.m2;
import com.olxgroup.panamera.domain.users.common.entity.User;
import com.olxgroup.panamera.domain.users.linkaccount.presentation_contract.SocialLinkBaseContract;
import com.olxgroup.panamera.domain.users.linkaccount.presentation_impl.GoogleVerificationPresenter;

public class GoogleVerificationActivity extends e implements SocialLinkBaseContract.IView {
    private GoogleSignInClient a0;
    protected GoogleSignInAccount b0;
    GoogleVerificationPresenter c0;

    public static Intent G2() {
        return new Intent((Context) m2.b, (Class<?>) GoogleVerificationActivity.class);
    }

    private void H2(Task task) {
        try {
            GoogleSignInAccount googleSignInAccount = (GoogleSignInAccount) task.getResult(ApiException.class);
            this.b0 = googleSignInAccount;
            this.c0.onSuccess(googleSignInAccount.getIdToken());
            l.r1(this.b0.getId());
        } catch (ApiException e) {
            this.c0.onError(e.getMessage());
        }
    }

    @Override
    public void closeActivity() {
        finish();
    }

    @Override
    public void closeActivityAndSetResult(User user) {
        Intent intent = new Intent();
        intent.putExtra("userExtra", user);
        setResult(-1, intent);
        finish();
    }

    @Override
    public void closeActivityAndSetResultCancel(String str) {
        Intent intent = new Intent();
        intent.putExtra("login_error", str);
        setResult(0, intent);
        finish();
    }

    @Override
    public void closeActivityAndSetResultOk() {
        setResult(-1);
        finish();
    }

    @Override
    public String getGenericErrorMessage() {
        return getString(p.error_subtitle);
    }

    @Override
    public String getNetworkErrorMessage() {
        return getString(p.connection_error_title);
    }

    @Override
    public void initializeFacebook() {
    }

    public void onActivityResult(int i, int i2, Intent intent) {
        super.onActivityResult(i, i2, intent);
        if (i == 9001) {
            H2(GoogleSignIn.getSignedInAccountFromIntent(intent));
        }
    }

    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(k.activity_google);
        this.a0 = GoogleSignIn.getClient(this, new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN).requestIdToken(getString(p.google_client_id)).requestEmail().build());
        this.c0.setView(this);
    }

    protected void onStart() {
        super.onStart();
        this.c0.start();
    }

    @Override
    public void performAction() {
    }

    @Override
    public void signIn() {
        startActivityForResult(this.a0.getSignInIntent(), 9001);
    }

    @Override
    public void signOut() {
        this.a0.signOut();
    }
}