package com.ss.android.ugc.aweme.services;

import X.0CB;
import X.0CH;
import X.0HH;
import X.2K7;
import X.2MC;
import X.2UX;
import X.2fU;
import X.2nK;
import X.3BB;
import X.3QA;
import X.3g2;
import X.3i8;
import X.3jJ;
import X.41H;
import X.46i;
import X.46k;
import X.4vZ;
import X.6Is;
import X.878;
import X.8uQ;
import X.9EH;
import X.9Ee;
import X.9Y3;
import X.C1551Rjv;
import X.C1908Rpg;
import X.C2117Rt3;
import X.C2160Rtk;
import X.C2162Rtm;
import X.C2376RxE;
import X.C2409Rxl;
import X.C2452RyS;
import X.C2466Ryg;
import X.C2469Ryj;
import X.C2471Ryl;
import X.C2474Ryo;
import X.C2477Ryr;
import X.C2505RzJ;
import X.C2528Rzg;
import X.C2529Rzh;
import X.C2547Rzz;
import X.C2555S0h;
import X.C2585S1l;
import X.EaA;
import X.Fgs;
import X.FhI;
import X.JtF;
import X.K1r;
import X.KEl;
import X.Lea;
import X.Lw2;
import X.M12;
import X.S01;
import X.S0C;
import X.S0N;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.Window;
import android.view.WindowManager;
import com.bytedance.covode.number.Covode;
import com.bytedance.keva.Keva;
import com.bytedance.router.SmartRoute;
import com.ss.android.ugc.aweme.IAccountUserService;
import com.ss.android.ugc.aweme.account.apiguard.ApiGuardService;
import com.ss.android.ugc.aweme.account.login.auth.I18nSignUpActivity;
import com.ss.android.ugc.aweme.account.login.authorize.AuthorizeActivity;
import com.ss.android.ugc.aweme.account.login.model.AccountPassLoginMethod;
import com.ss.android.ugc.aweme.account.login.model.BaseLoginMethod;
import com.ss.android.ugc.aweme.account.login.model.LoginMethodName;
import com.ss.android.ugc.aweme.account.login.model.PhoneLoginMethod;
import com.ss.android.ugc.aweme.account.login.model.TPLoginMethod;
import com.ss.android.ugc.aweme.account.login.rememberaccount.LoginMethodListActivity;
import com.ss.android.ugc.aweme.account.login.ui.MusCountryListActivity;
import com.ss.android.ugc.aweme.account.login.v2.ui.SignUpOrLoginActivity;
import com.ss.android.ugc.aweme.account.ui.RecoverDeletedAccountActivity;
import com.ss.android.ugc.aweme.app.PushLoginActivity;
import com.ss.android.ugc.aweme.app.services.IFeed0VVManagerService;
import com.ss.android.ugc.aweme.compliance.api.a;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import kotlin.h.b.n;
import org.json.JSONException;
import org.json.JSONObject;

public class LoginService extends BaseLoginService implements 6Is {
    public Dialog mLoginDialog;

    static {
        Covode.recordClassIndex(105111);
    }

    public void onStateChanged(0CH r1, 0CB r2) {
        super.onStateChanged(r1, r2);
    }

    public Class<? extends Activity> getPushLoginActivityClass() {
        return PushLoginActivity.class;
    }

    public void retryLogin() {
        retryLogin(false);
    }

    public static final /* synthetic */ void lambda$null$0$LoginService() {
        C2469Ryj.LIZ(1, 3, (Object) "");
        C2469Ryj.LJIIIIZZ();
    }

    public void checkin() {
        9Ee.LIZ().LIZ((Handler) null, Fgs.LIZ, 0);
    }

    public boolean isEnableMultiAccountLogin() {
        if (!9Y3.LIZ(9Y3.LIZ(), true, "enable_multi_account_login", true) || 46i.LJFF().isChildrenMode()) {
            return false;
        }
        return true;
    }

    public void onDestroy() {
        super.onDestroy();
        Dialog dialog = this.mLoginDialog;
        if (dialog != null) {
            dialog.dismiss();
            this.mLoginDialog = null;
        }
        Dialog dialog2 = this.mLoginDialog;
        if (dialog2 != null && dialog2.isShowing()) {
            this.mLoginDialog.dismiss();
            this.mLoginDialog = null;
        }
    }

    public List<KEl> getAllSupportedLoginPlatform() {
        LinkedList linkedList = new LinkedList(super.getAllSupportedLoginPlatform());
        linkedList.add(new KEl("Email", 2131755285, "email"));
        linkedList.addAll(C2474Ryo.LIZ.LIZIZ(C2585S1l.values()));
        return linkedList;
    }

    /* renamed from: com.ss.android.ugc.aweme.services.LoginService$1  reason: invalid class name */
    public static /* synthetic */ class AnonymousClass1 {
        public static final /* synthetic */ int[] $SwitchMap$com$ss$android$ugc$aweme$account$login$model$LoginMethodName;

        /* JADX WARNING: Can't wrap try/catch for region: R(10:0|1|2|3|4|5|6|7|8|(3:9|10|12)) */
        /* JADX WARNING: Can't wrap try/catch for region: R(12:0|1|2|3|4|5|6|7|8|9|10|12) */
        /* JADX WARNING: Failed to process nested try/catch */
        /* JADX WARNING: Missing exception handler attribute for start block: B:3:0x0018 */
        /* JADX WARNING: Missing exception handler attribute for start block: B:5:0x0023 */
        /* JADX WARNING: Missing exception handler attribute for start block: B:7:0x002e */
        /* JADX WARNING: Missing exception handler attribute for start block: B:9:0x0039 */
        static {
            /*
                r0 = 105116(0x19a9c, float:1.47299E-40)
                com.bytedance.covode.number.Covode.recordClassIndex(r0)
                com.ss.android.ugc.aweme.account.login.model.LoginMethodName[] r0 = com.ss.android.ugc.aweme.account.login.model.LoginMethodName.values()
                int r0 = r0.length
                int[] r2 = new int[r0]
                $SwitchMap$com$ss$android$ugc$aweme$account$login$model$LoginMethodName = r2
                com.ss.android.ugc.aweme.account.login.model.LoginMethodName r0 = com.ss.android.ugc.aweme.account.login.model.LoginMethodName.THIRD_PARTY     // Catch:{ NoSuchFieldError -> 0x0018 }
                int r1 = r0.ordinal()     // Catch:{ NoSuchFieldError -> 0x0018 }
                r0 = 1
                r2[r1] = r0     // Catch:{ NoSuchFieldError -> 0x0018 }
            L_0x0018:
                int[] r2 = $SwitchMap$com$ss$android$ugc$aweme$account$login$model$LoginMethodName     // Catch:{ NoSuchFieldError -> 0x0023 }
                com.ss.android.ugc.aweme.account.login.model.LoginMethodName r0 = com.ss.android.ugc.aweme.account.login.model.LoginMethodName.PHONE_NUMBER_PASS     // Catch:{ NoSuchFieldError -> 0x0023 }
                int r1 = r0.ordinal()     // Catch:{ NoSuchFieldError -> 0x0023 }
                r0 = 2
                r2[r1] = r0     // Catch:{ NoSuchFieldError -> 0x0023 }
            L_0x0023:
                int[] r2 = $SwitchMap$com$ss$android$ugc$aweme$account$login$model$LoginMethodName     // Catch:{ NoSuchFieldError -> 0x002e }
                com.ss.android.ugc.aweme.account.login.model.LoginMethodName r0 = com.ss.android.ugc.aweme.account.login.model.LoginMethodName.PHONE_SMS     // Catch:{ NoSuchFieldError -> 0x002e }
                int r1 = r0.ordinal()     // Catch:{ NoSuchFieldError -> 0x002e }
                r0 = 3
                r2[r1] = r0     // Catch:{ NoSuchFieldError -> 0x002e }
            L_0x002e:
                int[] r2 = $SwitchMap$com$ss$android$ugc$aweme$account$login$model$LoginMethodName     // Catch:{ NoSuchFieldError -> 0x0039 }
                com.ss.android.ugc.aweme.account.login.model.LoginMethodName r0 = com.ss.android.ugc.aweme.account.login.model.LoginMethodName.EMAIL_PASS     // Catch:{ NoSuchFieldError -> 0x0039 }
                int r1 = r0.ordinal()     // Catch:{ NoSuchFieldError -> 0x0039 }
                r0 = 4
                r2[r1] = r0     // Catch:{ NoSuchFieldError -> 0x0039 }
            L_0x0039:
                int[] r2 = $SwitchMap$com$ss$android$ugc$aweme$account$login$model$LoginMethodName     // Catch:{ NoSuchFieldError -> 0x0044 }
                com.ss.android.ugc.aweme.account.login.model.LoginMethodName r0 = com.ss.android.ugc.aweme.account.login.model.LoginMethodName.USER_NAME_PASS     // Catch:{ NoSuchFieldError -> 0x0044 }
                int r1 = r0.ordinal()     // Catch:{ NoSuchFieldError -> 0x0044 }
                r0 = 5
                r2[r1] = r0     // Catch:{ NoSuchFieldError -> 0x0044 }
            L_0x0044:
                return
            */
            throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.services.LoginService.AnonymousClass1.<clinit>():void");
        }
    }

    public boolean isLoginActivity(Activity activity) {
        return activity instanceof SignUpOrLoginActivity;
    }

    public void openPrivacyPolicy(Activity activity) {
        4vZ.LIZ(C2452RyS.LIZIZ(activity));
    }

    public static boolean INVOKESTATIC_com_ss_android_ugc_aweme_services_LoginService_com_ss_android_ugc_aweme_net_lancet_NetworkLancet_isNetworkAvailableTwo(Context context) {
        try {
            return 2K7.LIZ.LIZJ();
        } catch (Exception unused) {
            return false;
        }
    }

    public void retryLogin(boolean z) {
        new Handler().postDelayed(new LoginService$$Lambda$2(this, z), 300);
    }

    public final /* synthetic */ void lambda$retryLogin$3$LoginService(boolean z) {
        C2466Ryg.LIZIZ(new BaseLoginMethod());
        if (getLoginParam() != null) {
            getLoginParam().LIZLLL.putBoolean("from_third_party_login", z);
            showLoginAndRegisterView(getLoginParam());
        }
    }

    public boolean toRecoverDeletedAccount(String str) {
        if (!C2469Ryj.LJFF().isUserCancelled()) {
            return false;
        }
        ((46k) Lw2.LIZ(46k.class)).LJ().LIZ();
        Context LIZ = 9EH.LJJIFFI.LIZ();
        Intent intent = new Intent(LIZ, RecoverDeletedAccountActivity.class);
        intent.addFlags(268435456);
        if (!TextUtils.isEmpty(str)) {
            intent.putExtra("enter_from", str);
        }
        3i8.LIZ(intent, LIZ);
        LIZ.startActivity(intent);
        return true;
    }

    /* JADX WARNING: type inference failed for: r3v1, types: [X.S01, X.Rzw, android.app.Dialog] */
    public void showLoginAndRegisterView(3g2 r5) {
        super.showLoginAndRegisterView(r5);
        if (r5.LIZ != null && !r5.LIZ.isFinishing()) {
            ApiGuardService.createIApiGuardServicebyMonsterPlugin(false).initializeApiGuard();
            boolean z = r5.LIZLLL.getBoolean("is_fullscreen_dialog");
            C2409Rxl.LIZ = r5.LIZLLL.getString("enter_method", "");
            C2409Rxl.LIZIZ = r5.LIZLLL.getString("enter_from", "");
            if (!a.LJII().LIZJ() || z) {
                showLoginAndRegisterViewInner(r5);
                return;
            }
            Activity activity = r5.LIZ;
            Bundle bundle = r5.LIZLLL;
            M12.LIZ(activity, bundle);
            ? s01 = new S01(activity, bundle);
            Window window = s01.getWindow();
            if (window != null) {
                WindowManager.LayoutParams attributes = window.getAttributes();
                attributes.gravity = 80;
                attributes.flags |= 2;
                window.setAttributes(attributes);
                window.setWindowAnimations(2131886922);
            }
            s01.show();
            2fU.LIZ.LIZ(s01);
            this.mLoginDialog = s01;
        }
    }

    public void showLoginView(3g2 r5) {
        super.showLoginView(r5);
        JtF jtF = new JtF();
        jtF.LIZ("enter_method", C2409Rxl.LIZ);
        2nK.LIZ("click_login", jtF.LIZ);
        IFeed0VVManagerService iFeed0VVManagerService = (IFeed0VVManagerService) Lw2.LIZ(IFeed0VVManagerService.class);
        if (iFeed0VVManagerService != null) {
            iFeed0VVManagerService.LIZ("click_login");
            iFeed0VVManagerService.LIZIZ("LOGIN");
        }
        SmartRoute LIZJ = C2376RxE.LIZJ(r5.LIZ);
        if (TextUtils.isEmpty(r5.LIZLLL.getString("enter_type"))) {
            r5.LIZLLL.putString("enter_type", "click_login");
        }
        ApiGuardService.createIApiGuardServicebyMonsterPlugin(false).initializeApiGuard();
        LIZJ.withParam(r5.LIZLLL);
        LIZJ.open();
    }

    public void uploadAccountNum(boolean z) {
        LoginService LJI = C2469Ryj.LJI();
        n.LIZIZ(LJI, "");
        if (LJI.isEnableMultiAccountLogin()) {
            if (C2528Rzg.LJ == 0) {
                SharedPreferences LIZ = 8uQ.LIZ(9EH.LJJIFFI.LIZ(), C2528Rzg.LIZ, 0);
                C2528Rzg.LIZLLL = LIZ.getInt(C2528Rzg.LIZIZ, 0);
                C2528Rzg.LJ = LIZ.getLong(C2528Rzg.LIZJ, 0);
            }
            if (!C2469Ryj.LIZLLL()) {
                return;
            }
            if (!EaA.LIZ(C2528Rzg.LJ) || C2528Rzg.LIZLLL != 46i.LJFF().allUidList().size()) {
                C2528Rzg.LIZLLL = 46i.LJFF().allUidList().size();
                Calendar instance = Calendar.getInstance();
                n.LIZIZ(instance, "");
                Date time = instance.getTime();
                n.LIZIZ(time, "");
                C2528Rzg.LJ = time.getTime();
                8uQ.LIZ(9EH.LJJIFFI.LIZ(), C2528Rzg.LIZ, 0).edit().putInt(C2528Rzg.LIZIZ, C2528Rzg.LIZLLL).putLong(C2528Rzg.LIZJ, C2528Rzg.LJ).apply();
                2UX r2 = new 2UX();
                r2.LIZ("account_num", C2528Rzg.LIZLLL);
                IAccountUserService LJFF = C2469Ryj.LIZIZ.LJFF();
                List<String> allUidList = LJFF.allUidList();
                n.LIZIZ(allUidList, "");
                ArrayList arrayList = new ArrayList();
                for (String findSignificanUserInfo : allUidList) {
                    C2477Ryr findSignificanUserInfo2 = LJFF.findSignificanUserInfo(findSignificanUserInfo);
                    if (findSignificanUserInfo2 != null) {
                        arrayList.add(findSignificanUserInfo2);
                    }
                }
                r2.LIZ("user_ids", Lea.LIZ(arrayList, ",", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, C2529Rzh.LIZ, 30));
                2nK.LIZ("multi_account_status", r2.LIZ);
            }
        }
    }

    /* JADX WARNING: type inference failed for: r3v1, types: [X.Rzz, X.Rzw, android.app.Dialog] */
    public void showLoginAndRegisterViewInner(3g2 r23) {
        boolean z;
        boolean z2;
        BaseLoginMethod LIZLLL;
        int i;
        3g2 r2 = r23;
        boolean z3 = r2.LIZLLL.getBoolean("is_fullscreen_dialog");
        if (r2.LIZLLL.getBoolean("force_use_default_login_method", false) || z3) {
            z = true;
        } else {
            z = false;
        }
        boolean z4 = r2.LIZLLL.getBoolean("show_login_page_first", MandatoryLoginService.createIMandatoryLoginServicebyMonsterPlugin(false).shouldShowLoginTabFirst());
        boolean z5 = r2.LIZLLL.getBoolean("is_disable_animation", false);
        List<BaseLoginMethod> LIZ = C2466Ryg.LIZLLL.LIZ((List<String>) C2469Ryj.LIZIZ.LJFF().allUidList());
        if (!C2469Ryj.LIZIZ.LJIIJJI().isOneKeyLoginExprimentEnable() || 878.LIZ(LIZ) || z3) {
            z2 = false;
        } else {
            z2 = true;
        }
        Serializable serializable = r2.LIZLLL.getSerializable("extra_param");
        if (serializable == null) {
            serializable = new HashMap();
            r2.LIZLLL.putSerializable("extra_param", serializable);
        }
        Map map = (Map) serializable;
        map.put("params_for_special", "uc_login");
        if (!r2.LIZLLL.getBoolean("from_third_party_login") && !z2) {
            BaseLoginMethod LIZLLL2 = C2466Ryg.LIZLLL();
            LoginMethodName loginMethodName = LIZLLL2.getLoginMethodName();
            if (loginMethodName == LoginMethodName.DEFAULT || z) {
                i = 1;
            } else {
                i = 0;
            }
            map.put("login_last_time", Integer.valueOf(i ^ 1));
            if (i == 0) {
                JtF LIZ2 = I18nSignUpActivity.LJI.LIZ(C2409Rxl.LIZIZ, C2409Rxl.LIZ, "click_login", r2.LIZLLL.getString("auth_from_app"), (Map<String, ? extends Object>) map);
                if (loginMethodName == LoginMethodName.THIRD_PARTY) {
                    LIZ2.LIZ(((TPLoginMethod) LIZLLL2).getPlatform() + "_is_show", 1);
                } else {
                    LIZ2.LIZ("phone_email_show", 1);
                }
                2nK.LIZ("login_notify", LIZ2.LIZ);
            }
        }
        if (z2) {
            if (C2466Ryg.LIZLLL.LIZJ() && !C2466Ryg.LIZLLL.LIZIZ()) {
                r2.LIZLLL.putString("enter_method", "reinstall");
            }
            r2.LIZLLL.putString("enter_type", "click_login");
            LoginMethodListActivity.LIZ.LIZ(r2.LIZ, r2.LIZLLL, LIZ, LoginService$$Lambda$0.$instance);
            3QA.LIZ(LoginService$$Lambda$1.$instance);
            return;
        }
        if (z) {
            LIZLLL = new BaseLoginMethod();
        } else {
            LIZLLL = C2466Ryg.LIZLLL();
        }
        if (LIZLLL.getLoginMethodName() == LoginMethodName.THIRD_PARTY) {
            if (C2466Ryg.LIZLLL.LIZJ() && !C2466Ryg.LIZLLL.LIZIZ()) {
                r2.LIZLLL.putString("enter_method", "reinstall");
            }
            TPLoginMethod tPLoginMethod = (TPLoginMethod) LIZLLL;
            if (C2471Ryl.LIZ.LIZ(tPLoginMethod.getPlatform(), false, r2.LIZIZ) == null) {
                if (TextUtils.isEmpty(r2.LIZLLL.getString("enter_type"))) {
                    r2.LIZLLL.putString("enter_type", "click_login");
                }
                Activity activity = r2.LIZ;
                Bundle bundle = r2.LIZLLL;
                M12.LIZ(activity, bundle, tPLoginMethod);
                ? rzz = new C2547Rzz(activity, bundle, tPLoginMethod);
                Window window = rzz.getWindow();
                if (window != null) {
                    WindowManager.LayoutParams attributes = window.getAttributes();
                    attributes.gravity = 80;
                    attributes.flags |= 2;
                    window.setAttributes(attributes);
                    window.setWindowAnimations(2131886922);
                }
                rzz.show();
                2fU.LIZ.LIZ(rzz);
                this.mLoginDialog = rzz;
                return;
            }
        } else {
            r2.LIZLLL.putBoolean("has_callBack", false);
            if (loginByMethod(r2.LIZ, r2.LIZLLL, LIZLLL)) {
                return;
            }
        }
        I18nSignUpActivity.LJI.LIZ(r2.LIZ, r2.LIZLLL, z4, r2.LIZLLL.getBoolean("need_callback", false), z5);
    }

    public static void INVOKEVIRTUAL_com_ss_android_ugc_aweme_services_LoginService_com_ss_android_ugc_tiktok_security_lancet_ContextLancet_startActivity(Activity activity, Intent intent) {
        3i8.LIZ(intent, activity);
        activity.startActivity(intent);
    }

    public void openCountryListActivity(Activity activity, FhI fhI) {
        Intent intent = new Intent(activity, MusCountryListActivity.class);
        MusCountryListActivity.LJI = fhI;
        INVOKEVIRTUAL_com_ss_android_ugc_aweme_services_LoginService_com_ss_android_ugc_tiktok_security_lancet_ContextLancet_startActivity(activity, intent);
    }

    public void saveDTicket(String str, String str2) {
        if (str == null) {
            str = "";
        }
        M12.LIZ(str2, "d_ticket", str);
        if (!TextUtils.isEmpty(str2)) {
            Keva.getRepo("aweme_user_config__".concat(String.valueOf(str2))).storeString("d_ticket", str);
        }
    }

    public void loginByPlatform(3g2 r27, KEl kEl) {
        C2162Rtm rtm;
        LoginMethodName loginMethodName;
        3g2 r5 = r27;
        KEl kEl2 = kEl;
        super.loginByPlatform(r5, kEl2);
        if (r5.LIZIZ.equals("find_account")) {
            try {
                JSONObject jSONObject = new JSONObject(r5.LIZLLL.getString("jsb_parmas"));
                jSONObject.optString("uid", "");
                String optString = jSONObject.optString("nickname", "");
                String optString2 = jSONObject.optString("email", "");
                String optString3 = jSONObject.optString("mobile", "");
                String optString4 = jSONObject.optString("not_login_ticket", "");
                Boolean valueOf = Boolean.valueOf(jSONObject.optBoolean("is_safe", false));
                String str = kEl2.LIZJ;
                C1551Rjv rjv = new C1551Rjv("", optString, optString2, optString3, (List<String>) null, optString4, valueOf.booleanValue(), valueOf.booleanValue());
                r5.LIZLLL.putString("args_email", optString2);
                r5.LIZLLL.putString("enter_from", "find_account");
                r5.LIZLLL.putString("enter_method", "find_account");
                r5.LIZLLL.putSerializable("recover_account_data", rjv);
                r5.LIZLLL.putInt("current_scene", C2160Rtk.RECOVER_ACCOUNT.getValue());
                r5.LIZLLL.putString("previous_uid", new C2555S0h().getCurUserId());
                if (valueOf.booleanValue()) {
                    if (!optString4.isEmpty() && "mobile".equals(str)) {
                        r5.LIZLLL.putInt("next_page", C2162Rtm.PHONE_SMS_LOGIN.getValue());
                        r5.LIZLLL.putInt("current_scene", C2160Rtk.RECOVER_ACCOUNT.getValue());
                        r5.LIZLLL.putInt("next_page", C2162Rtm.PHONE_SMS_LOGIN.getValue());
                        r5.LIZLLL.putBoolean("email_should_add_email", true);
                    }
                }
                if ("mobile".equals(str)) {
                    r5.LIZLLL.putInt("next_page", C2162Rtm.PHONE_EMAIL_LOGIN.getValue());
                    r5.LIZLLL.putInt("child_page", C2162Rtm.INPUT_PHONE_LOGIN.getValue());
                } else if ("email".equals(str)) {
                    r5.LIZLLL.putInt("next_page", C2162Rtm.PHONE_EMAIL_LOGIN.getValue());
                    r5.LIZLLL.putInt("child_page", C2162Rtm.INPUT_EMAIL_LOGIN.getValue());
                }
            } catch (JSONException e) {
                0HH.LIZ(e);
            }
        }
        if (r5.LIZLLL.getBoolean("is_login", true)) {
            if (TextUtils.equals(kEl2.LIZJ, "mobile")) {
                loginMethodName = LoginMethodName.PHONE_SMS;
            } else if (TextUtils.equals(kEl2.LIZJ, "email")) {
                loginMethodName = LoginMethodName.EMAIL_PASS;
            }
            if (loginMethodName != null) {
                loginByMethodName(r5.LIZ, r5.LIZLLL, loginMethodName, (String) null);
                return;
            }
        }
        String str2 = kEl2.LIZJ;
        str2.hashCode();
        if (str2.equals("mobile") || str2.equals("email")) {
            SmartRoute LIZIZ = C2376RxE.LIZIZ(r5.LIZ);
            if (TextUtils.equals(kEl2.LIZJ, "mobile")) {
                rtm = C2162Rtm.INPUT_PHONE_SIGN_UP;
            } else {
                rtm = C2162Rtm.INPUT_EMAIL_SIGN_UP;
            }
            LIZIZ.withParam("child_page", rtm.getValue());
            if (TextUtils.isEmpty(r5.LIZLLL.getString("enter_type"))) {
                r5.LIZLLL.putString("enter_type", "click_login");
            }
            LIZIZ.withParam(r5.LIZLLL);
            LIZIZ.open();
            return;
        }
        if (TextUtils.isEmpty(r5.LIZLLL.getString("enter_type"))) {
            r5.LIZLLL.putString("enter_type", "click_login");
        }
        C2471Ryl.LIZ.LIZ(r5.LIZ, kEl2.LIZJ, (C1908Rpg) new S0C(r5.LIZLLL.getString("enter_from", ""), r5.LIZLLL.getString("enter_method", ""), "click_login", "", r5.LIZLLL));
    }

    public void openFeedback(Activity activity, String str, String str2) {
        41H.LIZ(activity, str, str2);
    }

    public static void INVOKEVIRTUAL_com_ss_android_ugc_aweme_services_LoginService_com_ss_android_ugc_tiktok_security_lancet_ContextLancet_startActivityForResult(Activity activity, Intent intent, int i) {
        3i8.LIZ(intent, activity);
        activity.startActivityForResult(intent, i);
    }

    public void switchAccount(C2477Ryr ryr, Bundle bundle, S0N s0n) {
        C2505RzJ.LIZ(ryr.LIZ, bundle, false, false, s0n);
    }

    public static final /* synthetic */ void lambda$showLoginAndRegisterViewInner$1$LoginService(int i, int i2, Object obj) {
        C2469Ryj.LIZ(10, 4, "");
        if (i2 != 1) {
            3QA.LIZ(LoginService$$Lambda$3.$instance, 200);
        } else if (i == C2160Rtk.ONE_KEY_LOGIN.getValue()) {
            C2469Ryj.LIZ(1, 1, (Object) "");
            C2469Ryj.LIZ(C2469Ryj.LJFF());
        }
    }

    public boolean loginByMethod(Activity activity, Bundle bundle, BaseLoginMethod baseLoginMethod) {
        String platform;
        LoginMethodName loginMethodName = baseLoginMethod.getLoginMethodName();
        int i = AnonymousClass1.$SwitchMap$com$ss$android$ugc$aweme$account$login$model$LoginMethodName[loginMethodName.ordinal()];
        if (i != 1) {
            if (i == 2 || i == 3) {
                bundle.putSerializable("auto_fill_phone_number", ((PhoneLoginMethod) baseLoginMethod).getPhoneNumber());
            } else if (i == 4 || i == 5) {
                bundle.putSerializable("auto_fill_account_name", ((AccountPassLoginMethod) baseLoginMethod).getName());
            }
            platform = "";
        } else {
            platform = ((TPLoginMethod) baseLoginMethod).getPlatform();
        }
        return loginByMethodName(activity, bundle, loginMethodName, platform);
    }

    private boolean loginByMethodName(Activity activity, Bundle bundle, LoginMethodName loginMethodName, String str) {
        int i = AnonymousClass1.$SwitchMap$com$ss$android$ugc$aweme$account$login$model$LoginMethodName[loginMethodName.ordinal()];
        Bundle bundle2 = bundle;
        if (i == 1) {
            C2471Ryl.LIZ.LIZ(activity, str, (C1908Rpg) new S0C(bundle2.getString("enter_from", ""), bundle2.getString("enter_method", ""), "click_login", "", bundle2));
            return true;
        } else if (i == 2 || i == 3) {
            SmartRoute LIZJ = C2376RxE.LIZJ(activity);
            LIZJ.withParam("child_page", C2162Rtm.INPUT_PHONE_LOGIN.getValue());
            if (TextUtils.isEmpty(bundle2.getString("enter_type"))) {
                bundle2.putString("enter_type", "click_login");
            }
            LIZJ.withParam(bundle2);
            LIZJ.open();
            return true;
        } else if (i != 4 && i != 5) {
            return false;
        } else {
            SmartRoute LIZJ2 = C2376RxE.LIZJ(activity);
            LIZJ2.withParam("child_page", C2162Rtm.INPUT_EMAIL_LOGIN.getValue());
            if (TextUtils.isEmpty(bundle2.getString("enter_type"))) {
                bundle2.putString("enter_type", "click_login");
            }
            LIZJ2.withParam(bundle2);
            LIZJ2.open();
            return true;
        }
    }

    private void onThirdPartyLoginClick(Context context, String str, Bundle bundle, String str2, String str3) {
        if (!INVOKESTATIC_com_ss_android_ugc_aweme_services_LoginService_com_ss_android_ugc_aweme_net_lancet_NetworkLancet_isNetworkAvailableTwo(context)) {
            3BB r1 = new 3BB(context);
            r1.LIZIZ(2131827476);
            r1.LIZIZ();
            return;
        }
        JtF jtF = new JtF();
        jtF.LIZ("enter_method", str2);
        jtF.LIZ("enter_from", str3);
        jtF.LIZ("platform", str);
        jtF.LIZ("enter_type", "click_login");
        String str4 = "";
        if (bundle != null) {
            String string = bundle.getString("group_id");
            if (!TextUtils.isEmpty(string)) {
                str4 = string;
            }
        }
        jtF.LIZ("group_id", str4);
        jtF.LIZ("log_pb", 2MC.LIZ(bundle));
        2nK.LIZ("login_submit", jtF.LIZ);
        if (str != null) {
            C2117Rt3 rt3 = new C2117Rt3();
            rt3.LIZIZ = str2;
            rt3.LIZJ = str;
            rt3.LIZ();
            Intent intent = new Intent(context, AuthorizeActivity.class);
            if (bundle != null) {
                intent.putExtras(bundle);
            }
            intent.putExtra("platform", str);
            intent.putExtra("enter_from", str3);
            intent.putExtra("enter_method", str2);
            Activity LIZ = 3jJ.LIZ(context);
            if (LIZ != null) {
                INVOKEVIRTUAL_com_ss_android_ugc_aweme_services_LoginService_com_ss_android_ugc_tiktok_security_lancet_ContextLancet_startActivityForResult(LIZ, intent, 1001);
            }
            K1r.LIZ(str, str3, str2);
        }
    }
}
