导航菜单

页面标题

页面副标题

Hopscotch v9.7.2 - CustomerInfoActivity.java 源代码

正在查看: Hopscotch v9.7.2 应用的 CustomerInfoActivity.java JAVA 源代码文件

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


package in.hopscotch.android.activity;

import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import androidx.activity.result.contract.c;
import androidx.activity.result.i;
import androidx.annotation.NonNull;
import androidx.core.app.c;
import com.facebook.AccessToken;
import com.facebook.CallbackManager;
import com.facebook.FacebookAuthorizationException;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.GraphRequest;
import com.facebook.login.LoginManager;
import com.facebook.login.LoginResult;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableMap;
import com.payu.india.Payu.PayuConstants;
import com.payu.upisdk.util.UpiConstant;
import com.yalantis.ucrop.UCrop;
import in.hopscotch.android.api.ApiParam;
import in.hopscotch.android.api.RetrofitApiBuilder;
import in.hopscotch.android.api.factory.CustomerInfoApiFactory;
import in.hopscotch.android.api.model.FaceBookUserInfo;
import in.hopscotch.android.api.response.LoginResponse;
import in.hopscotch.android.api.rest.HSRetrofitCallback;
import in.hopscotch.android.application.HsApplication;
import in.hopscotch.android.application.r;
import in.hopscotch.android.common.util.x;
import in.hopscotch.android.model.UserStatus;
import in.hopscotch.android.service.PhotoUploadService;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import net.mischneider.MSREventBridgeModule;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONException;
import org.json.JSONObject;
import retrofit2.Response;

public class CustomerInfoActivity extends in.hopscotch.android.activity.base.c implements net.mischneider.a, net.mischneider.b, r.a {
    private static final String FROM_FACEBOOK = "fromFaceBook";
    private static final String TAG = "CustomerInfoActivity";
    public static final int p = 0;
    private String authenticationType;
    private String currentRoute;
    private in.hopscotch.android.databinding.a0 customerInfoBinding;
    private String fromLocation;
    private String fromRedirect;
    private String fromScreen;
    private String fromValidationType;
    private boolean goBackOnFinish;
    private boolean isFromFeatureCard;
    private CallbackManager mCallbackManager;
    private net.mischneider.d msrEventBridgeReceiverCallback;
    private List<String> permissionNeeds;
    private String previousRoute;
    private ProgressDialog progressDialog;
    private String redirectType;
    private LoginResponse savedFacebookResponse;
    private LoginResponse savedLoginResponse;
    private String validationType;
    private boolean logoutUserForPRR = false;
    private boolean addNewAddressForExchange = false;
    private final androidx.activity.result.b<androidx.activity.result.i> imageActivityResultLauncher = registerForActivityResult(new androidx.activity.result.contract.c(), new g(this, 0));
    private final in.hopscotch.android.platform.b platformPushManager = HsApplication.b().g;
    private BroadcastReceiver photoUploadReceiver = new b();

    public class a implements FacebookCallback<LoginResult> {
        public final net.mischneider.d a;

        public a(net.mischneider.d dVar) {
            this.a = dVar;
        }

        public final void onCancel() {
            AccessToken.setCurrentAccessToken((AccessToken) null);
            net.mischneider.b bVar = CustomerInfoActivity.this;
            in.hopscotch.android.util.q.h(bVar, bVar.getString(2132018013), (DialogInterface.OnDismissListener) null);
        }

        public final void onError(FacebookException facebookException) {
            boolean z = facebookException instanceof FacebookAuthorizationException;
            net.mischneider.b bVar = CustomerInfoActivity.this;
            if (!z) {
                in.hopscotch.android.util.q.h(bVar, bVar.getString(2132018014), (DialogInterface.OnDismissListener) null);
                return;
            }
            in.hopscotch.android.util.q.h(bVar, bVar.getString(2132018015), (DialogInterface.OnDismissListener) null);
            if (AccessToken.getCurrentAccessToken() != null) {
                LoginManager.getInstance().logOut();
            }
        }

        public final void onSuccess(Object obj) {
            LoginResult loginResult = (LoginResult) obj;
            GraphRequest newMeRequest = GraphRequest.newMeRequest(loginResult.getAccessToken(), new androidx.transition.d(this, loginResult, this.a));
            Bundle bundle = new Bundle();
            bundle.putString("fields", "id,name,email");
            newMeRequest.setParameters(bundle);
            newMeRequest.executeAsync();
        }
    }

    public class b extends BroadcastReceiver {
        public b() {
        }

        @Override
        public final void onReceive(Context context, Intent intent) {
            if (intent.getAction() == null || !intent.getAction().equalsIgnoreCase("photo_upload")) {
                return;
            }
            ?? r0 = CustomerInfoActivity.this;
            r0.stopService(new Intent((Context) r0, (Class<?>) PhotoUploadService.class));
            if (((CustomerInfoActivity) r0).msrEventBridgeReceiverCallback == null || TextUtils.isEmpty(intent.getStringExtra("uploaded_photo_url"))) {
                return;
            }
            ((CustomerInfoActivity) r0).msrEventBridgeReceiverCallback.a(intent.getStringExtra("uploaded_photo_url"));
            ((CustomerInfoActivity) r0).msrEventBridgeReceiverCallback = null;
        }
    }

    public class c extends HSRetrofitCallback<LoginResponse> {
        public final net.mischneider.d a;

        public c(net.mischneider.d dVar) {
            this.a = dVar;
        }

        @Override
        public final void onFailure(Throwable th) {
            net.mischneider.b bVar = CustomerInfoActivity.this;
            displayFailureMessage(bVar, null);
            int i = CustomerInfoActivity.p;
            bVar.getClass();
            CustomerInfoActivity.w1(this.a);
        }

        @Override
        public final void onResponse(Response<LoginResponse> response) {
            net.mischneider.d dVar = this.a;
            ?? r1 = CustomerInfoActivity.this;
            if (response == null || !response.isSuccessful()) {
                displayFailureMessage(r1, response);
                int i = CustomerInfoActivity.p;
                r1.getClass();
                CustomerInfoActivity.w1(dVar);
                return;
            }
            LoginResponse loginResponse = (LoginResponse) response.body();
            if (loginResponse == null) {
                int i2 = CustomerInfoActivity.p;
                r1.getClass();
                CustomerInfoActivity.w1(dVar);
                return;
            }
            if (!TextUtils.isEmpty(loginResponse.popUpMessage)) {
                CustomerInfoActivity.m1(r1, loginResponse.popUpMessage);
            }
            try {
                JSONObject jSONObject = new JSONObject(in.hopscotch.android.common.util.d.b().a().h(loginResponse));
                in.hopscotch.android.util.react.a.d().getClass();
                WritableMap e = in.hopscotch.android.util.react.a.e(jSONObject);
                int i3 = CustomerInfoActivity.p;
                r1.getClass();
                CustomerInfoActivity.C1(dVar, e);
                ((CustomerInfoActivity) r1).savedLoginResponse = loginResponse;
            } catch (JSONException e2) {
                in.hopscotch.android.util.g.b(e2);
                int i4 = CustomerInfoActivity.p;
                r1.getClass();
                CustomerInfoActivity.w1(dVar);
            }
        }
    }

    public static void C1(net.mischneider.d dVar, WritableMap writableMap) {
        Log.d(TAG, "reactToNativeEvent: ");
        if (dVar != null) {
            ((MSREventBridgeModule.b.a) dVar).a(writableMap);
        }
    }

    public static void j1(CustomerInfoActivity customerInfoActivity) {
        customerInfoActivity.getClass();
        try {
            ProgressDialog progressDialog = customerInfoActivity.progressDialog;
            if (progressDialog == null || !progressDialog.isShowing()) {
                return;
            }
            customerInfoActivity.progressDialog.dismiss();
        } catch (IllegalArgumentException | IllegalStateException e) {
            in.hopscotch.android.util.g.b(e);
        }
    }

    public static void k1(CustomerInfoActivity customerInfoActivity, LoginResponse loginResponse, String str) {
        customerInfoActivity.getClass();
        Log.d(TAG, "fireCustomerRegisteredEvent: ");
        if (TextUtils.isEmpty(str) || !str.equalsIgnoreCase("SIGN_UP")) {
            return;
        }
        String str2 = loginResponse.mobileStatus;
        if (str2 != null) {
            in.hopscotch.android.db.a.U(str2);
            in.hopscotch.android.db.a.d0();
        } else {
            str2 = null;
        }
        in.hopscotch.android.analytics.c.m().s(loginResponse.email, loginResponse.phoneNumber, loginResponse.userId, loginResponse.userName, str2, true);
        in.hopscotch.android.analytics.c m = in.hopscotch.android.analytics.c.m();
        String str3 = customerInfoActivity.fromScreen;
        String str4 = customerInfoActivity.fromLocation;
        String str5 = customerInfoActivity.fromRedirect;
        m.getClass();
        in.hopscotch.android.analytics.c.G(str3, str4, str5);
        HsApplication.b().c.e();
    }

    public static void l1(CustomerInfoActivity customerInfoActivity, FaceBookUserInfo faceBookUserInfo, AccessToken accessToken, net.mischneider.d dVar) {
        if (customerInfoActivity.progressDialog == null) {
            ProgressDialog progressDialog = new ProgressDialog(customerInfoActivity, 2132082701);
            customerInfoActivity.progressDialog = progressDialog;
            progressDialog.setCancelable(true);
            customerInfoActivity.progressDialog.setCanceledOnTouchOutside(false);
        }
        try {
            customerInfoActivity.progressDialog.show();
            customerInfoActivity.progressDialog.setContentView(2131558930);
        } catch (Exception e) {
            in.hopscotch.android.util.g.b(e);
        }
        HashMap hashMap = new HashMap();
        hashMap.put("email", faceBookUserInfo.email);
        hashMap.put("name", faceBookUserInfo.name);
        hashMap.put(ApiParam.LoginParam.FIRSTNAME, faceBookUserInfo.name.split(" ")[0]);
        hashMap.put(ApiParam.LoginParam.LASTNAME, faceBookUserInfo.name.split(" ")[faceBookUserInfo.name.split(" ").length - 1]);
        hashMap.put(ApiParam.LoginParam.PROFILEPHOTO, faceBookUserInfo.profilePhoto);
        hashMap.put("gender", faceBookUserInfo.gender);
        hashMap.put(ApiParam.LoginParam.USERID, faceBookUserInfo.id);
        hashMap.put(ApiParam.LoginParam.ACCESSTOKEN, accessToken.getToken());
        HashMap hashMap2 = new HashMap();
        for (String str : hashMap.keySet()) {
            if (hashMap.get(str) != null) {
                hashMap2.put(str, hashMap.get(str));
            }
        }
        CustomerInfoApiFactory.getInstance().facebookLogin(hashMap2, new l(customerInfoActivity, dVar));
    }

    public static void m1(CustomerInfoActivity customerInfoActivity, String str) {
        customerInfoActivity.getClass();
        if (TextUtils.isEmpty(str)) {
            return;
        }
        in.hopscotch.android.components.toast.a.d(customerInfoActivity.getApplicationContext(), 1, str);
    }

    public static void n1(CustomerInfoActivity customerInfoActivity, ReadableMap readableMap, String str, net.mischneider.d dVar, String str2) {
        customerInfoActivity.getClass();
        Log.d(TAG, "signInSignUpAfterLoggedOutForPRR: ");
        str.getClass();
        switch (str) {
            case "facebookSignIn":
                customerInfoActivity.p1(dVar);
                break;
            case "signUp":
                customerInfoActivity.Y0(readableMap, dVar, str2);
                break;
            case "loginWithPassword":
                customerInfoActivity.x1(readableMap, dVar);
                break;
            case "sendOTP":
                customerInfoActivity.Y0(readableMap, dVar, str2);
                break;
        }
    }

    public static String v1(String str) {
        str.getClass();
        switch (str) {
            case "ACCOUNT_NAME":
                return "name_updated";
            case "EMAIL":
                return "email_updated";
            case "PHONE":
                return "mobile_updated";
            case "PASSWORD":
                return "password_updated";
            default:
                return null;
        }
    }

    public static void w1(net.mischneider.d dVar) {
        Log.d(TAG, "handleApiFailure: callback: " + dVar);
        if (dVar != null) {
            C1(dVar, null);
        }
    }

    public static Intent z1(@NonNull Context context, String str, String str2, String str3, String str4, boolean z, Bundle bundle) {
        Log.d(TAG, "newInstance: fromScreen: " + str + "\tfromLocation: " + str2);
        Intent intent = new Intent(context, (Class<?>) CustomerInfoActivity.class);
        intent.putExtra("FROM_SCREEN", str);
        intent.putExtra("from_location", str2);
        if (TextUtils.isEmpty(str3)) {
            str3 = "LOGIN_WITH_OTP";
        }
        intent.putExtra("initialRouteName", str3);
        intent.putExtra("IS_POPUP_WINDOW", z);
        intent.putExtra("userData", bundle);
        if (TextUtils.isEmpty(str4)) {
            str4 = "REDIRECT_LANDING";
        }
        intent.putExtra("INTENT_FLAG_SIGN_ACTION", str4);
        return intent;
    }

    public final void A1(in.hopscotch.android.api.response.LoginResponse r17, java.lang.String r18, boolean r19, boolean r20) {
        throw new UnsupportedOperationException("Method not decompiled: in.hopscotch.android.activity.CustomerInfoActivity.A1(in.hopscotch.android.api.response.LoginResponse, java.lang.String, boolean, boolean):void");
    }

    @Override
    public final void B() {
        InputMethodManager inputMethodManager;
        RetrofitApiBuilder.getInstance().cancelAllRequests();
        View currentFocus = getCurrentFocus();
        if (currentFocus != null && (inputMethodManager = (InputMethodManager) getSystemService("input_method")) != null) {
            inputMethodManager.hideSoftInputFromWindow(currentFocus.getWindowToken(), 2);
        }
        if (isTaskRoot()) {
            startActivity(in.hopscotch.android.application.a0.a(this));
        } else {
            in.hopscotch.android.application.a0.f(this, getIntent());
        }
        finish();
    }

    public final void B1(String str) {
        startActivity(z1(this, "", "", str, null, true, getIntent().getBundleExtra("userData")));
        finish();
    }

    public final void D1() {
        if (this.k != null) {
            this.k = null;
        }
        if (this.m != null) {
            this.m = null;
        }
    }

    public final void E1() {
        String str = this.currentRoute;
        if (in.hopscotch.android.common.util.t.a(str)) {
            if (str.equalsIgnoreCase("LOGIN_WITH_OTP")) {
                this.validationType = "OTP";
                this.authenticationType = "Mobile";
            }
            if (str.equalsIgnoreCase("LOGIN_WITH_EMAIL")) {
                this.validationType = "Password";
                this.authenticationType = "Email";
            }
            if (TextUtils.isEmpty(this.previousRoute) || this.previousRoute.equalsIgnoreCase(str)) {
                return;
            }
            if (this.previousRoute.equalsIgnoreCase("LOGIN_WITH_OTP") || this.previousRoute.equalsIgnoreCase("SIGN_UP")) {
                this.fromValidationType = "OTP";
            }
            if (this.previousRoute.equalsIgnoreCase("LOGIN_WITH_EMAIL")) {
                this.fromValidationType = "Password";
            }
        }
    }

    @Override
    public final void S0(String str, boolean z) {
        String str2 = TAG;
        Log.d(str2, "callSendOTPAPI: canReadSMS: " + z + "\tsignInSignUp: " + str);
        if (!str.equalsIgnoreCase("signUp")) {
            if (str.equalsIgnoreCase("sendOTP")) {
                Log.d(str2, "sendOTP: ");
                ReadableMap readableMap = this.k;
                if (readableMap == null || this.m == null) {
                    return;
                }
                String T0 = in.hopscotch.android.activity.base.c.T0(readableMap, ApiParam.LoginParam.LOGIN_ID);
                String T02 = in.hopscotch.android.activity.base.c.T0(this.k, ApiParam.LoginParam.OTP_REASON);
                this.fromLocation = (!this.k.hasKey("from_location") || TextUtils.isEmpty(this.k.getString("from_location"))) ? this.fromLocation : this.k.getString("from_location");
                if (TextUtils.isEmpty(T0) || TextUtils.isEmpty(T02)) {
                    w1(this.m);
                    D1();
                    return;
                }
                HashMap o = android.support.v4.media.a.o(ApiParam.LoginParam.LOGIN_ID, T0, ApiParam.LoginParam.OTP_REASON, T02);
                in.hopscotch.android.common.util.x.a.getClass();
                if (x.a.a(T0)) {
                    W0();
                }
                CustomerInfoApiFactory.getInstance().sendOTP(o, new o(this, T0, T02));
                return;
            }
            return;
        }
        if (this.l == null || this.n == null) {
            return;
        }
        HashMap hashMap = new HashMap();
        String string = (!this.l.hasKey("email") || TextUtils.isEmpty(this.l.getString("email"))) ? null : this.l.getString("email");
        String string2 = (!this.l.hasKey("name") || TextUtils.isEmpty(this.l.getString("name"))) ? null : this.l.getString("name");
        String string3 = (!this.l.hasKey(PayuConstants.P_MOBILE) || TextUtils.isEmpty(this.l.getString(PayuConstants.P_MOBILE))) ? null : this.l.getString(PayuConstants.P_MOBILE);
        String string4 = (!this.l.hasKey(ApiParam.LoginParam.OTP_REASON) || TextUtils.isEmpty(this.l.getString(ApiParam.LoginParam.OTP_REASON))) ? null : this.l.getString(ApiParam.LoginParam.OTP_REASON);
        this.fromLocation = (!this.l.hasKey("from_location") || TextUtils.isEmpty(this.l.getString("from_location"))) ? this.fromLocation : this.l.getString("from_location");
        if (TextUtils.isEmpty(string) || TextUtils.isEmpty(string2) || TextUtils.isEmpty(string3) || TextUtils.isEmpty(string4)) {
            C1(this.n, null);
            return;
        }
        hashMap.put("email", string);
        hashMap.put("name", string2);
        hashMap.put(ApiParam.LoginParam.PHONENO, string3);
        hashMap.put(ApiParam.LoginParam.OTP_REASON, string4);
        W0();
        CustomerInfoApiFactory.getInstance().signUp(hashMap, new k(this, string4, string3, string));
    }

    @Override
    public final void V0(String str) {
        Log.d(TAG, "otpReceived: otp" + str);
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("OTP", str);
            in.hopscotch.android.util.react.a.d().getClass();
            MSREventBridgeModule.emitEventForActivity(this, this.customerInfoBinding.d, this, "autoReadOTP", in.hopscotch.android.util.react.a.e(jSONObject));
        } catch (Exception e) {
            in.hopscotch.android.util.g.b(e);
        }
    }

    public final void d(String str, ReadableMap readableMap, MSREventBridgeModule.b.a aVar) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        String str2 = TAG;
        Log.d(str2, "onEventCallback: name: " + str);
        if (str.equalsIgnoreCase("editAddPhoto")) {
            this.msrEventBridgeReceiverCallback = aVar;
            androidx.activity.result.b<androidx.activity.result.i> bVar = this.imageActivityResultLauncher;
            i.a aVar2 = new i.a();
            aVar2.b(c.c.a);
            bVar.b(aVar2.a(), (c.a) null);
            return;
        }
        if (str.equalsIgnoreCase("loginWithPassword")) {
            q1(readableMap, "loginWithPassword", aVar, null);
            return;
        }
        if (str.equalsIgnoreCase("signUp")) {
            q1(readableMap, "signUp", aVar, str);
            return;
        }
        if (str.equalsIgnoreCase("sendOTP")) {
            q1(readableMap, "sendOTP", aVar, str);
            return;
        }
        if (str.equalsIgnoreCase("verifyOTP")) {
            Log.d(str2, "verifyOTPNumber: ");
            if (readableMap == null) {
                w1(aVar);
                return;
            }
            String T0 = in.hopscotch.android.activity.base.c.T0(readableMap, ApiParam.LoginParam.LOGIN_ID);
            String T02 = in.hopscotch.android.activity.base.c.T0(readableMap, ApiParam.LoginParam.OTP_REASON);
            String T03 = in.hopscotch.android.activity.base.c.T0(readableMap, "otpNumber");
            if (in.hopscotch.android.util.a1.H(new String[]{T0, T03, T02})) {
                w1(aVar);
                return;
            }
            HashMap o = android.support.v4.media.a.o(ApiParam.LoginParam.LOGIN_ID, T0, "otp", T03);
            o.put(ApiParam.LoginParam.OTP_REASON, T02);
            Log.d(str2, "verifyOTPNumber: callback: " + aVar);
            CustomerInfoApiFactory.getInstance().verifyOTP(o, new n(this, aVar, T0, T02));
            return;
        }
        if (str.equalsIgnoreCase("pincodeCheck")) {
            if (readableMap != null && readableMap.hasKey(ApiParam.PIN_CODE)) {
                r6 = readableMap.getString(ApiParam.PIN_CODE);
            }
            if (TextUtils.isEmpty(r6)) {
                w1(aVar);
                return;
            } else {
                CustomerInfoApiFactory.getInstance().checkPinCode(r6, this.addNewAddressForExchange, new j(this, aVar));
                return;
            }
        }
        if (str.equalsIgnoreCase("addAddress")) {
            if (readableMap == null) {
                w1(aVar);
                return;
            }
            String string = readableMap.hasKey("shipToName") ? readableMap.getString("shipToName") : null;
            String string2 = readableMap.hasKey("city") ? readableMap.getString("city") : null;
            String string3 = readableMap.hasKey("zipCode") ? readableMap.getString("zipCode") : null;
            String string4 = readableMap.hasKey("streetAddress") ? readableMap.getString("streetAddress") : null;
            String string5 = readableMap.hasKey("landmark") ? readableMap.getString("landmark") : null;
            String string6 = readableMap.hasKey("cellPhone") ? readableMap.getString("cellPhone") : null;
            r6 = readableMap.hasKey("state") ? readableMap.getString("state") : null;
            boolean z = readableMap.hasKey("defaultAddress") && readableMap.getBoolean("defaultAddress");
            if (in.hopscotch.android.util.a1.H(new String[]{string, string2, string3, string4, string6, r6})) {
                w1(aVar);
                return;
            }
            HashMap o2 = android.support.v4.media.a.o("shipToName", string, "city", string2);
            o2.put("zipCode", string3);
            o2.put("streetAddress", string4);
            if (!TextUtils.isEmpty(string5)) {
                o2.put("landmark", string5);
            }
            o2.put("cellPhone", string6);
            o2.put("state", r6);
            o2.put("defaultAddress", Boolean.valueOf(z));
            if (!this.addNewAddressForExchange) {
                CustomerInfoApiFactory.getInstance().saveNewAddress(o2, new s(this, readableMap, aVar));
                return;
            } else {
                o2.put(ApiParam.NewAddressParam.DELIVERY_ACTION, "EXCHANGE");
                CustomerInfoApiFactory.getInstance().saveNewGCAddress(o2, new r(this, readableMap, aVar));
                return;
            }
        }
        if (str.equalsIgnoreCase("editAddress")) {
            if (readableMap == null) {
                w1(aVar);
                return;
            }
            String valueOf = readableMap.hasKey(ApiParam.CheckParam.Address.ADDRESS_ID) ? String.valueOf(readableMap.getInt(ApiParam.CheckParam.Address.ADDRESS_ID)) : null;
            String string7 = readableMap.hasKey("shipToName") ? readableMap.getString("shipToName") : null;
            String string8 = readableMap.hasKey("city") ? readableMap.getString("city") : null;
            String string9 = readableMap.hasKey("zipCode") ? readableMap.getString("zipCode") : null;
            String string10 = readableMap.hasKey("streetAddress") ? readableMap.getString("streetAddress") : null;
            String string11 = readableMap.hasKey("landmark") ? readableMap.getString("landmark") : null;
            String string12 = readableMap.hasKey("cellPhone") ? readableMap.getString("cellPhone") : null;
            r6 = readableMap.hasKey("state") ? readableMap.getString("state") : null;
            boolean z2 = readableMap.hasKey("defaultAddress") && readableMap.getBoolean("defaultAddress");
            if (in.hopscotch.android.util.a1.H(new String[]{valueOf, string7, string8, string9, string10, string12, r6})) {
                w1(aVar);
                return;
            }
            HashMap o3 = android.support.v4.media.a.o("shipToName", string7, "city", string8);
            o3.put("zipCode", string9);
            o3.put("streetAddress", string10);
            if (!TextUtils.isEmpty(string11)) {
                o3.put("landmark", string11);
            }
            o3.put("cellPhone", string12);
            o3.put("state", r6);
            o3.put("defaultAddress", Boolean.valueOf(z2));
            CustomerInfoApiFactory.getInstance().updateAddress(valueOf, o3, new t(this, readableMap, aVar));
            return;
        }
        if (str.equalsIgnoreCase("getAddressList")) {
            CustomerInfoApiFactory.getInstance().getAddressesList(new i(this, aVar));
            return;
        }
        if (str.equalsIgnoreCase("removeAddress")) {
            if (readableMap == null) {
                w1(aVar);
                return;
            }
            r6 = readableMap.hasKey(ApiParam.CheckParam.Address.ADDRESS_ID) ? String.valueOf(readableMap.getInt(ApiParam.CheckParam.Address.ADDRESS_ID)) : null;
            if (TextUtils.isEmpty(r6)) {
                w1(aVar);
                return;
            } else {
                CustomerInfoApiFactory.getInstance().deleteAddress(r6, new h(this, r6, readableMap, aVar));
                return;
            }
        }
        if (str.equalsIgnoreCase("myAccount")) {
            CustomerInfoApiFactory.getInstance().myAccount(new p(this, aVar));
            return;
        }
        if (!str.equalsIgnoreCase("updateProfileItem")) {
            if (str.equalsIgnoreCase("facebookSignIn")) {
                q1(null, "facebookSignIn", aVar, null);
            }
        } else {
            if (readableMap == null) {
                w1(aVar);
                return;
            }
            String string13 = readableMap.hasKey("type") ? readableMap.getString("type") : null;
            r6 = readableMap.hasKey("value") ? readableMap.getString("value") : null;
            if (TextUtils.isEmpty(string13) || TextUtils.isEmpty(r6)) {
                w1(aVar);
            } else {
                CustomerInfoApiFactory.getInstance().updateAccount(android.support.v4.media.a.o("type", string13, "value", r6), new q(this, aVar));
            }
        }
    }

    public final void onActivityResult(int i, int i2, Intent intent) {
        super/*androidx.fragment.app.n*/.onActivityResult(i, i2, intent);
        if (i2 == 10003 || i2 == 10002) {
            if (in.hopscotch.android.util.a1.t(i2, intent, this)) {
                try {
                    String w = in.hopscotch.android.util.a1.w(this, UCrop.getOutput(intent));
                    if (!TextUtils.isEmpty(w)) {
                        Intent intent2 = new Intent((Context) this, (Class<?>) PhotoUploadService.class);
                        intent2.putExtra("filePath", w);
                        startService(intent2);
                        in.hopscotch.android.analytics.c.m().getClass();
                        in.hopscotch.android.analytics.c.X();
                    }
                } catch (Exception e) {
                    in.hopscotch.android.util.g.b(e);
                }
            }
            if (i2 == 10003) {
                androidx.activity.result.b<androidx.activity.result.i> bVar = this.imageActivityResultLauncher;
                i.a aVar = new i.a();
                aVar.b(c.c.a);
                bVar.b(aVar.a(), (c.a) null);
            }
        }
        if (this.mCallbackManager == null) {
            this.mCallbackManager = CallbackManager.Factory.create();
        }
        this.mCallbackManager.onActivityResult(i, i2, intent);
    }

    public final void onBackPressed() {
        RetrofitApiBuilder.getInstance().cancelAllRequests();
        in.hopscotch.android.application.r.b().c().onBackPressed();
    }

    public final void onCreate(Bundle bundle) {
        boolean booleanExtra = getIntent().getBooleanExtra("IS_POPUP_WINDOW", true);
        super/*androidx.fragment.app.n*/.onCreate(bundle);
        in.hopscotch.android.util.e0.b().h();
        try {
            String str = in.hopscotch.android.util.a1.a;
        } catch (Exception e) {
            in.hopscotch.android.util.g.b(e);
        }
        LayoutInflater layoutInflater = getLayoutInflater();
        int i = in.hopscotch.android.databinding.a0.f;
        in.hopscotch.android.databinding.a0 a0Var = (in.hopscotch.android.databinding.a0) androidx.databinding.p.M(layoutInflater, 2131558458, (ViewGroup) null, false, androidx.databinding.g.e());
        this.customerInfoBinding = a0Var;
        setContentView(a0Var.E());
        in.hopscotch.android.application.r.b().h(this);
        this.customerInfoBinding.d.setEventBridgeEventReceiver(this);
        if (booleanExtra) {
            this.customerInfoBinding.d.setBackground(getResources().getDrawable(2131230875));
        }
        this.fromScreen = getIntent().getStringExtra("FROM_SCREEN");
        this.fromLocation = getIntent().getStringExtra("from_location");
        Log.d(TAG, "onCreate: fromScreen: " + this.fromScreen + "\tfromLocation: " + this.fromLocation);
        this.isFromFeatureCard = getIntent().getBooleanExtra("from_feature_card", false);
        this.goBackOnFinish = getIntent().getBooleanExtra("goBackOnFinish", false);
        String stringExtra = getIntent().getStringExtra("initialRouteName");
        this.currentRoute = stringExtra;
        this.previousRoute = null;
        Bundle g = android.support.v4.media.c.g("initialRouteName", stringExtra);
        this.redirectType = getIntent().getStringExtra("INTENT_FLAG_SIGN_ACTION");
        this.fromRedirect = getIntent().getStringExtra("fromRedirect");
        String stringExtra2 = getIntent().getStringExtra("redirectMessage");
        Bundle bundleExtra = getIntent().getBundleExtra("userData");
        if (bundleExtra == null) {
            bundleExtra = new Bundle();
        }
        if (!TextUtils.isEmpty(this.redirectType)) {
            bundleExtra.putString("loginRedirectType", this.redirectType);
        }
        if (!TextUtils.isEmpty(stringExtra2)) {
            bundleExtra.putString("redirectMessage", stringExtra2);
        }
        g.putBundle("userData", bundleExtra);
        bundleExtra.putBoolean("facebookEnabled", false);
        this.customerInfoBinding.d.startReactApplication(in.hopscotch.android.application.r.b().c(), "HSCustomer", g);
        this.permissionNeeds = Arrays.asList(getResources().getStringArray(2130903060));
        t1();
        s1();
        r1(null);
        if (bundleExtra.getBoolean("signOutRequestForPRR") && UserStatus.getInstance().getLoginStatus()) {
            this.logoutUserForPRR = true;
        } else {
            this.logoutUserForPRR = false;
        }
        this.addNewAddressForExchange = bundleExtra.getBoolean("addNewAddressForExchange", false);
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("photo_upload");
        androidx.localbroadcastmanager.content.a.b(getApplicationContext()).c(this.photoUploadReceiver, intentFilter);
    }

    @Override
    public final void onDestroy() {
        androidx.localbroadcastmanager.content.a.b(getApplicationContext()).e(this.photoUploadReceiver);
        Z0();
        in.hopscotch.android.application.r.b().h(null);
        in.hopscotch.android.application.r.b().e(this);
        this.customerInfoBinding.d.unmountReactApplication();
        this.photoUploadReceiver = null;
        super.onDestroy();
    }

    public final void onPause() {
        in.hopscotch.android.application.r.b().f(this);
        super/*androidx.fragment.app.n*/.onPause();
    }

    public final void onResume() {
        in.hopscotch.android.application.r.b().g(this);
        super/*androidx.fragment.app.n*/.onResume();
    }

    public final void p1(net.mischneider.d dVar) {
        if (this.mCallbackManager == null) {
            this.mCallbackManager = CallbackManager.Factory.create();
        }
        LoginManager.getInstance().logInWithReadPermissions(this, this.permissionNeeds);
        LoginManager.getInstance().registerCallback(this.mCallbackManager, new a(dVar));
    }

    public final void q1(ReadableMap readableMap, String str, MSREventBridgeModule.b.a aVar, String str2) {
        String str3 = TAG;
        StringBuilder k = android.support.v4.media.d.k("filterSignInSignUpRequestForPRR: signInMode: ", str, "\tname: ", str2, "\tlogoutUserForPRR: ");
        k.append(this.logoutUserForPRR);
        Log.d(str3, k.toString());
        switch (str) {
            case "facebookSignIn":
                if (!this.logoutUserForPRR) {
                    p1(aVar);
                    break;
                } else {
                    y1(readableMap, "facebookSignIn", aVar, str2);
                    break;
                }
            case "signUp":
                if (!this.logoutUserForPRR) {
                    Y0(readableMap, aVar, str2);
                    break;
                } else {
                    y1(readableMap, "signUp", aVar, str2);
                    break;
                }
            case "loginWithPassword":
                if (!this.logoutUserForPRR) {
                    x1(readableMap, aVar);
                    break;
                } else {
                    y1(readableMap, "loginWithPassword", aVar, str2);
                    break;
                }
            case "sendOTP":
                if (!this.logoutUserForPRR) {
                    Y0(readableMap, aVar, str2);
                    break;
                } else {
                    y1(readableMap, "sendOTP", aVar, str2);
                    break;
                }
        }
    }

    public final void r0(ReadableMap readableMap, String str) {
        String str2;
        String str3;
        String str4;
        String string;
        if (TextUtils.isEmpty(str)) {
            return;
        }
        if (str.equalsIgnoreCase("exitCustomerInfoModule")) {
            B();
            return;
        }
        String str5 = null;
        if (str.equalsIgnoreCase("loggedInComplete")) {
            String string2 = (readableMap == null || !readableMap.hasKey("authenticationType") || TextUtils.isEmpty(readableMap.getString("authenticationType"))) ? null : readableMap.getString("authenticationType");
            if (readableMap != null && readableMap.hasKey("isFromAddAddress") && readableMap.getBoolean("isFromAddAddress")) {
                Intent intent = new Intent();
                intent.putExtra("isFromAddAddress", readableMap.getBoolean("isFromAddAddress"));
                setResult(-1, intent);
                A1(this.savedLoginResponse, string2, false, true);
                finish();
                return;
            }
            if (readableMap != null && readableMap.hasKey("verifyMobileForCart") && readableMap.getBoolean("verifyMobileForCart")) {
                setResult(-1);
                A1(this.savedLoginResponse, string2, false, true);
                finish();
                return;
            }
            if (readableMap == null || !readableMap.hasKey(FROM_FACEBOOK) || !readableMap.getBoolean(FROM_FACEBOOK)) {
                if (this.savedLoginResponse != null) {
                    in.hopscotch.android.db.a.c();
                    in.hopscotch.android.db.a.P(false);
                    this.platformPushManager.a();
                    A1(this.savedLoginResponse, string2, (readableMap == null || !readableMap.hasKey("isRegister")) ? false : readableMap.getBoolean("isRegister"), false);
                    if (this.savedLoginResponse != null) {
                        this.savedLoginResponse = null;
                        return;
                    }
                    return;
                }
                return;
            }
            LoginResponse loginResponse = this.savedFacebookResponse;
            if (loginResponse != null) {
                String str6 = loginResponse.action;
                String str7 = in.hopscotch.android.util.a1.a;
                if ("success".equalsIgnoreCase(str6)) {
                    if (!TextUtils.isEmpty(this.savedFacebookResponse.profileImage)) {
                        UserStatus.getInstance().setUserProfilePhoto(this.savedFacebookResponse.profileImage);
                    }
                    A1(this.savedFacebookResponse, "Facebook", false, false);
                    in.hopscotch.android.db.a.c();
                    in.hopscotch.android.db.a.P(false);
                    this.platformPushManager.a();
                    if (this.savedFacebookResponse != null) {
                        this.savedFacebookResponse = null;
                        return;
                    }
                    return;
                }
                return;
            }
            return;
        }
        if (str.equalsIgnoreCase("screenLoaded")) {
            if (readableMap != null) {
                this.currentRoute = readableMap.getString("currentRouteName");
                this.previousRoute = readableMap.getString("previousRouteName");
                if (readableMap.hasKey("redirect") && readableMap.getBoolean("redirect")) {
                    str5 = u1(this.previousRoute);
                }
                if (!TextUtils.isEmpty(str5)) {
                    this.fromRedirect = str5;
                }
                t1();
                s1();
                r1(readableMap);
                return;
            }
            return;
        }
        if (str.equalsIgnoreCase("messageDeeplink")) {
            if (readableMap == null || !readableMap.hasKey(ApiParam.Search.DEEPLINK)) {
                return;
            }
            String string3 = readableMap.getString(ApiParam.Search.DEEPLINK);
            if (TextUtils.isEmpty(string3)) {
                return;
            }
            Intent a2 = in.hopscotch.android.util.s0.a(this, string3, "", (String) null, (String) null, this.fromScreen, this.fromLocation, (Bundle) null);
            a2.putExtra("fromRedirect", u1(this.currentRoute));
            startActivity(a2);
            finish();
            return;
        }
        if (!str.equalsIgnoreCase("profileStepUpdated")) {
            if (str.equalsIgnoreCase("bypassLoggedInComplete") && readableMap != null && readableMap.hasKey("verifyMobileForCart") && readableMap.getBoolean("verifyMobileForCart")) {
                Intent intent2 = new Intent();
                intent2.putExtra("isGUPhoneVerified", true);
                setResult(-1, intent2);
                finish();
                return;
            }
            return;
        }
        if (this.isFromFeatureCard) {
            finish();
        }
        if (!readableMap.hasKey("type") || TextUtils.isEmpty(v1(readableMap.getString("type")))) {
            return;
        }
        try {
            HashMap hashMap = new HashMap();
            if (readableMap.hasKey("fromScreen") && !TextUtils.isEmpty(readableMap.getString("fromScreen"))) {
                hashMap.put("from_screen", readableMap.getString("fromScreen"));
            }
            if (readableMap.hasKey("from_name") && !TextUtils.isEmpty(readableMap.getString("from_name"))) {
                hashMap.put("from_name", readableMap.getString("from_name"));
            }
            if (!readableMap.hasKey("name") || TextUtils.isEmpty(readableMap.getString("name"))) {
                str2 = null;
            } else {
                String string4 = readableMap.getString("name");
                UserStatus.getInstance().setUserName(string4);
                if (!TextUtils.isEmpty(string4)) {
                    UserStatus.getInstance().setFirstName(string4.trim().split(" ")[0]);
                }
                hashMap.put("name", string4);
                str2 = string4;
            }
            if (readableMap.hasKey("from_email") && !TextUtils.isEmpty(readableMap.getString("from_email"))) {
                hashMap.put("from_email", readableMap.getString("from_email"));
            }
            if (!readableMap.hasKey("email") || TextUtils.isEmpty(readableMap.getString("email"))) {
                str3 = null;
            } else {
                String string5 = readableMap.getString("email");
                UserStatus.getInstance().setUserEmail(string5);
                hashMap.put("email", string5);
                str3 = string5;
            }
            if (readableMap.hasKey("from_mobile") && !TextUtils.isEmpty(readableMap.getString("from_mobile"))) {
                hashMap.put("from_mobile", readableMap.getString("from_mobile"));
            }
            if (!readableMap.hasKey(PayuConstants.P_MOBILE) || TextUtils.isEmpty(readableMap.getString(PayuConstants.P_MOBILE))) {
                str4 = null;
            } else {
                String string6 = readableMap.getString(PayuConstants.P_MOBILE);
                UserStatus.getInstance().setPhone(string6);
                hashMap.put(PayuConstants.P_MOBILE, string6);
                str4 = string6;
            }
            if (readableMap.hasKey("from_password")) {
                hashMap.put("from_password", readableMap.getString("from_password"));
            }
            if (readableMap.hasKey("from_location")) {
                hashMap.put("from_location", readableMap.getString("from_location"));
            }
            if (!"password_updated".equalsIgnoreCase(v1(readableMap.getString("type")))) {
                synchronized (in.hopscotch.android.db.a.class) {
                    string = in.hopscotch.android.db.a.x().getString("MOBILE_STATUS", null);
                }
                if (string != null) {
                    str5 = in.hopscotch.android.db.a.n();
                    in.hopscotch.android.db.a.d0();
                }
                in.hopscotch.android.analytics.c.m().s(str3, str4, UserStatus.getInstance().getUserId(), str2, str5, false);
            }
            in.hopscotch.android.analytics.c m = in.hopscotch.android.analytics.c.m();
            String v1 = v1(readableMap.getString("type"));
            m.getClass();
            in.hopscotch.android.analytics.c.I(v1, hashMap, false, true);
        } catch (Exception e) {
            in.hopscotch.android.util.g.b(e);
        }
    }

    public final void r1(ReadableMap readableMap) {
        String str;
        long j;
        String str2 = this.currentRoute;
        if (in.hopscotch.android.common.util.t.a(str2) && str2.equalsIgnoreCase("VERIFY_EMAIL")) {
            String string = (readableMap == null || !readableMap.hasKey(ApiParam.LoginParam.LOGIN_ID) || TextUtils.isEmpty(readableMap.getString(ApiParam.LoginParam.LOGIN_ID))) ? null : readableMap.getString(ApiParam.LoginParam.LOGIN_ID);
            if (TextUtils.isEmpty(string)) {
                str = null;
                j = 0;
            } else {
                boolean isNumeric = StringUtils.isNumeric(string);
                String str3 = isNumeric ? "Mobile" : "Email";
                j = isNumeric ? Long.parseLong(string) : 0L;
                str = isNumeric ? null : string;
                r0 = str3;
            }
            in.hopscotch.android.analytics.c m = in.hopscotch.android.analytics.c.m();
            String str4 = this.fromScreen;
            String str5 = this.fromLocation;
            String str6 = this.fromRedirect;
            m.getClass();
            HashMap hashMap = new HashMap();
            if (TextUtils.isEmpty(str4)) {
                str4 = UpiConstant.NONE;
            }
            hashMap.put("from_screen", str4);
            if (TextUtils.isEmpty(str5)) {
                str5 = UpiConstant.NONE;
            }
            hashMap.put("from_location", str5);
            if (TextUtils.isEmpty(r0)) {
                r0 = UpiConstant.NONE;
            }
            hashMap.put("from_authentication_type", r0);
            if (TextUtils.isEmpty(str6)) {
                str6 = UpiConstant.NONE;
            }
            hashMap.put("from_redirect", str6);
            hashMap.put(PayuConstants.P_MOBILE, j != 0 ? Long.valueOf(j) : UpiConstant.NONE);
            if (TextUtils.isEmpty(str)) {
                str = UpiConstant.NONE;
            }
            hashMap.put("email", str);
            in.hopscotch.android.analytics.c.I("forgot_viewed", hashMap, false, true);
        }
    }

    public final void s1() {
        String str = this.currentRoute;
        if (in.hopscotch.android.common.util.t.a(str) && str.equalsIgnoreCase("SIGN_UP")) {
            E1();
            in.hopscotch.android.analytics.c m = in.hopscotch.android.analytics.c.m();
            String str2 = this.fromScreen;
            String str3 = this.fromLocation;
            String str4 = this.fromValidationType;
            String str5 = this.fromRedirect;
            m.getClass();
            in.hopscotch.android.analytics.c.L(str2, str3, str4, str5);
        }
    }

    public final ReactInstanceManager t0() {
        return in.hopscotch.android.application.r.b().c();
    }

    public final void t1() {
        String str = this.currentRoute;
        if (in.hopscotch.android.common.util.t.a(str)) {
            if (str.equalsIgnoreCase("LOGIN_WITH_OTP") || str.equalsIgnoreCase("LOGIN_WITH_EMAIL")) {
                E1();
                in.hopscotch.android.analytics.c m = in.hopscotch.android.analytics.c.m();
                String str2 = this.fromScreen;
                String str3 = this.fromLocation;
                String str4 = this.validationType;
                String str5 = this.fromValidationType;
                String str6 = this.authenticationType;
                String str7 = this.fromRedirect;
                m.getClass();
                in.hopscotch.android.analytics.c.M(str2, str3, str4, str5, str6, str7);
            }
        }
    }

    public final String u1(String str) {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        if (str.equalsIgnoreCase("LOGIN_WITH_OTP") || str.equalsIgnoreCase("LOGIN_WITH_EMAIL")) {
            return "Login";
        }
        if (str.equalsIgnoreCase("SIGN_UP")) {
            return "Join";
        }
        if (str.equalsIgnoreCase("VERIFY_EMAIL")) {
            return "Forgot password";
        }
        if (str.equalsIgnoreCase("OTP_SCREEN")) {
            return "OTP";
        }
        if (str.equalsIgnoreCase("ADDRESSES")) {
            return "Addresses";
        }
        if (str.equalsIgnoreCase("PROFILE_SETTINGS")) {
            return "Profile settings";
        }
        if (str.equalsIgnoreCase("PROFILE_UPDATE")) {
            return "Profile update";
        }
        if (str.equalsIgnoreCase("ADD_ADDRESS")) {
            return this.addNewAddressForExchange ? "New address" : "Add address";
        }
        if (str.equalsIgnoreCase("EDIT_ADDRESS")) {
            return "Edit address";
        }
        return null;
    }

    public final void x1(ReadableMap readableMap, net.mischneider.d dVar) {
        if (readableMap == null) {
            w1(dVar);
            return;
        }
        String string = readableMap.hasKey(ApiParam.LoginParam.LOGIN_ID) ? readableMap.getString(ApiParam.LoginParam.LOGIN_ID) : null;
        String string2 = readableMap.hasKey(ApiParam.LoginParam.PASSWORD) ? readableMap.getString(ApiParam.LoginParam.PASSWORD) : null;
        String string3 = readableMap.hasKey(ApiParam.LoginParam.OTP_REASON) ? readableMap.getString(ApiParam.LoginParam.OTP_REASON) : null;
        if (TextUtils.isEmpty(string) || TextUtils.isEmpty(string2)) {
            w1(dVar);
            return;
        }
        HashMap o = android.support.v4.media.a.o(ApiParam.LoginParam.LOGIN_ID, string, ApiParam.LoginParam.PASSWORD, string2);
        o.put(ApiParam.LoginParam.OTP_REASON, string3);
        CustomerInfoApiFactory.getInstance().signWithPassword(o, new c(dVar));
    }

    public final void y1(ReadableMap readableMap, String str, MSREventBridgeModule.b.a aVar, String str2) {
        Log.d(TAG, "logoutUserRequestForPRR: ");
        CustomerInfoApiFactory.getInstance().logout(new m(this, readableMap, str, aVar, str2));
    }
}