导航菜单

页面标题

页面副标题

Crafto v9.3.3 - u1.java 源代码

正在查看: Crafto v9.3.3 应用的 u1.java JAVA 源代码文件

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


package L8;

import J9.l6;
import Q7.C1281d0;
import android.content.SharedPreferences;
import android.net.Uri;
import android.view.WindowManager;
import com.clevertap.android.sdk.CleverTapAPI;
import com.clevertap.android.sdk.db.Column;
import com.crafto.android.data.model.GoogleAuthVerificationData;
import com.crafto.android.data.model.MetaObject;
import com.crafto.android.data.model.OtpVerificationData;
import com.crafto.android.data.model.RegionData;
import com.crafto.android.data.model.User;
import com.crafto.android.data.model.UserAdditionalData;
import com.crafto.android.data.model.UserConfigData;
import com.crafto.android.data.model.business.BusinessCategory;
import com.crafto.android.data.model.remove_background.RemoveBackgroundPopup;
import com.crafto.android.data.repository.CommonRepository;
import com.crafto.android.ui.home.D7;
import com.crafto.android.usa.data.model.support.ContactUsData;
import com.crafto.android.utility.PreferencesHelper;
import com.crafto.android.utility.a;
import do.a;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.text.StringsKt;
import org.jetbrains.annotations.NotNull;
import org.json.JSONObject;

@Metadata
@SourceDebugExtension({"SMAP\nLoginViewModel.kt\nKotlin\n*S Kotlin\n*F\n+ 1 LoginViewModel.kt\ncom/crafto/android/ui/login/LoginViewModel\n+ 2 ArraysJVM.kt\nkotlin/collections/ArraysKt__ArraysJVMKt\n+ 3 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n+ 4 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,892:1\n37#2:893\n36#2,3:894\n1872#3,3:897\n1#4:900\n*S KotlinDebug\n*F\n+ 1 LoginViewModel.kt\ncom/crafto/android/ui/login/LoginViewModel\n*L\n347#1:893\n347#1:894,3\n860#1:897,3\n*E\n"})
public final class u1 extends androidx.lifecycle.r0 {

    @NotNull
    public final PreferencesHelper a;

    @NotNull
    public final c1 b;

    @NotNull
    public final CommonRepository c;

    @NotNull
    public final Ab.H d;
    public final Bb.j e;

    @NotNull
    public final androidx.lifecycle.S<Boolean> f;

    @NotNull
    public final androidx.lifecycle.S<Boolean> g;

    @NotNull
    public final androidx.lifecycle.S<Boolean> h;

    @NotNull
    public final androidx.lifecycle.S<Boolean> i;

    @NotNull
    public final androidx.lifecycle.S<OtpVerificationData> j;

    @NotNull
    public final androidx.lifecycle.S<OtpVerificationData> k;

    @NotNull
    public final androidx.lifecycle.S<OtpVerificationData> l;

    @NotNull
    public final androidx.lifecycle.S<User> m;

    @NotNull
    public final androidx.lifecycle.S<User> n;

    @NotNull
    public final androidx.lifecycle.S<Boolean> o;

    public u1(@NotNull PreferencesHelper preferencesHelper, @NotNull c1 c1Var, @NotNull CommonRepository commonRepository, @NotNull Ab.H h, Bb.j jVar) {
        Intrinsics.checkNotNullParameter(preferencesHelper, "preferencesHelper");
        Intrinsics.checkNotNullParameter(c1Var, "loginRepository");
        Intrinsics.checkNotNullParameter(commonRepository, "commonRepository");
        Intrinsics.checkNotNullParameter(h, "paramsConstants");
        this.a = preferencesHelper;
        this.b = c1Var;
        this.c = commonRepository;
        this.d = h;
        this.e = jVar;
        androidx.lifecycle.S<Boolean> s = new androidx.lifecycle.S<>();
        this.f = s;
        androidx.lifecycle.S<Boolean> s2 = new androidx.lifecycle.S<>();
        this.g = s2;
        this.h = new androidx.lifecycle.S<>();
        this.i = new androidx.lifecycle.S<>();
        this.j = new androidx.lifecycle.S<>();
        this.k = new androidx.lifecycle.S<>();
        this.l = new androidx.lifecycle.S<>();
        androidx.lifecycle.S s3 = new androidx.lifecycle.S();
        new androidx.lifecycle.S();
        this.m = new androidx.lifecycle.S<>();
        new androidx.lifecycle.S();
        this.n = new androidx.lifecycle.S<>();
        this.o = new androidx.lifecycle.S<>();
        UserConfigData e = preferencesHelper.e();
        if (e == null || !Intrinsics.areEqual(e.isProductSelectionUiUxExperiment(), Boolean.TRUE)) {
            kotlin.collections.t.e(new BusinessCategory[]{new BusinessCategory(null, null, null, null, null, null, false, false, null, false, 1023, null), new BusinessCategory(null, null, null, null, null, null, false, false, null, false, 1023, null), new BusinessCategory(null, null, null, null, null, null, false, false, null, false, 1023, null)});
        } else {
            kotlin.collections.t.e(new BusinessCategory[]{new BusinessCategory(null, null, null, null, null, null, false, false, null, false, 1023, null)});
        }
        Boolean bool = Boolean.FALSE;
        s.setValue(bool);
        s2.setValue(bool);
        s3.setValue(bool);
    }

    @NotNull
    public static ArrayList d(String str) {
        return Intrinsics.areEqual(str, a.e.z0) ? kotlin.collections.t.e(new String[]{"", "https://media.crafto.app/indiaDay0/39683a9c-ced5-49f1-b052-a9ed18686a88", "https://media.crafto.app/indiaDay0/6dd55d18-3a6d-4927-b322-3b5ea91a12d9", "https://media.crafto.app/indiaDay0/f09c5ce6-01cc-4abc-9ddb-c54059d96692", "https://media.crafto.app/indiaDay0/aa039cd2-5905-4ec8-99fd-90df0346f6b9", "https://media.crafto.app/indiaDay0/950b9023-c5d0-42de-8ea5-dcdf7e7c9c38", "https://media.crafto.app/indiaDay0/f4b03f71-66f3-4b7e-a7f5-5220be7a2151", "https://media.crafto.app/indiaDay0/61da2382-341c-4f70-a7c0-5ae9076fe218", "https://media.crafto.app/indiaDay0/d85062e9-7f6f-4a8d-bd6f-22126e2533e7"}) : kotlin.collections.t.e(new String[]{"", "https://media.crafto.app/indiaDay0/9c2cf60a-4a59-4bd6-8e06-d32a8ff90508", "https://media.crafto.app/indiaDay0/771e0d6c-2e40-495c-9aea-0bf3064851ae", "https://media.crafto.app/indiaDay0/386602b9-4543-4bef-bbf8-8ff0bfb5f1b6", "https://media.crafto.app/indiaDay0/bd17c353-0280-4e0c-a6f1-01867e121aa5", "https://media.crafto.app/indiaDay0/c2e02727-3862-4e51-abd3-226adf9bf0ea", "https://media.crafto.app/indiaDay0/5fc37fb3-da72-4b40-b725-66d17f398012", "https://media.crafto.app/indiaDay0/ae850a78-e66b-434e-9647-39ba6bb5fb89", "https://media.crafto.app/indiaDay0/94d2377f-8906-46ec-a113-88b6b7cec03a"});
    }

    public final String c() {
        String w = this.a.w();
        if (w == null) {
            return "";
        }
        Ab.H h = this.d;
        String queryParameter = StringsKt.C(w, h.O, false) ? Uri.parse(w).getQueryParameter(h.O) : "";
        return queryParameter == null ? "" : queryParameter;
    }

    public final void e() {
        HashMap<String, Object> hashMap = new HashMap<>();
        Ab.H h = this.d;
        String str = h.O;
        Cb.b.a.getClass();
        hashMap.put(str, Cb.b.a(this.a, h));
        CommonRepository commonRepository = this.c;
        Gb.f.a(commonRepository.getUserConfigData(hashMap), new C8.f(this, 2), new t1(0), false, 12);
        Gb.f.a(commonRepository.getRegions(), new j1(this, 0), new Function2() {
            public final Object invoke(Object obj, Object obj2) {
                u1 u1Var = u1.this;
                Intrinsics.checkNotNullParameter(u1Var, "this$0");
                Intrinsics.checkNotNullParameter((Throwable) obj, "<unused var>");
                Intrinsics.checkNotNullParameter((Db.a) obj2, "<unused var>");
                u1Var.a.k0((RegionData) null);
                return Unit.a;
            }
        }, false, 12);
    }

    @NotNull
    public final Gb.f<GoogleAuthVerificationData> f(String str, String str2) {
        this.f.postValue(Boolean.TRUE);
        HashMap<String, Object> hashMap = new HashMap<>();
        Ab.H h = this.d;
        if (str != null) {
            hashMap.put(h.a0, str);
        }
        if (str2 != null) {
            hashMap.put(h.j1, str2);
        }
        hashMap.put(h.D1, this.a.a());
        c1 c1Var = this.b;
        c1Var.getClass();
        Intrinsics.checkNotNullParameter(hashMap, "params");
        return Gb.g.a(c1Var.b.validateLoginFacebook(hashMap), c1Var.a);
    }

    @org.jetbrains.annotations.NotNull
    public final Gb.f<com.crafto.android.data.model.GoogleAuthVerificationData> g(com.google.android.gms.auth.api.signin.GoogleSignInAccount r6) {
        throw new UnsupportedOperationException("Method not decompiled: L8.u1.g(com.google.android.gms.auth.api.signin.GoogleSignInAccount):Gb.f");
    }

    public final void h(MetaObject<User> metaObject, User user, WindowManager windowManager, String str) {
        Boolean deeplinkQuoteRedirection;
        UserAdditionalData userBusinessData;
        UserAdditionalData userBusinessData2;
        UserAdditionalData userBusinessData3;
        UserAdditionalData userBusinessData4;
        RemoveBackgroundPopup removeBackgroundPopup;
        a.a aVar = do.a.a;
        StringBuilder a = defpackage.m.a(aVar, "mytag creation response: #1 " + metaObject.getData(), new Object[0], "mytag creation response: #2 ");
        User data = metaObject.getData();
        a.append(data != null ? data.getRemoveBackgroundPopup() : null);
        aVar.c(a.toString(), new Object[0]);
        User data2 = metaObject.getData();
        if (data2 != null && (removeBackgroundPopup = data2.getRemoveBackgroundPopup()) != null) {
            D7.T4 = removeBackgroundPopup;
        }
        aVar.c("createUserData success " + metaObject.getData(), new Object[0]);
        String profileImageUrl = user.getProfileImageUrl();
        PreferencesHelper preferencesHelper = this.a;
        preferencesHelper.a.edit().putString(preferencesHelper.s, profileImageUrl).apply();
        if (metaObject.getData() != null) {
            User data3 = metaObject.getData();
            if (data3 != null && (userBusinessData3 = data3.getUserBusinessData()) != null) {
                User E = preferencesHelper.E();
                userBusinessData3.setSelectedProducts((E == null || (userBusinessData4 = E.getUserBusinessData()) == null) ? null : userBusinessData4.getSelectedProducts());
            }
            User data4 = metaObject.getData();
            if (data4 != null && (userBusinessData = data4.getUserBusinessData()) != null) {
                User E2 = preferencesHelper.E();
                userBusinessData.setAdditionalCategory((E2 == null || (userBusinessData2 = E2.getUserBusinessData()) == null) ? null : userBusinessData2.getAdditionalCategory());
            }
            preferencesHelper.r0(metaObject.getData());
        }
        User data5 = metaObject.getData();
        boolean areEqual = data5 != null ? Intrinsics.areEqual(data5.isPoliticalPratyashiExp(), Boolean.TRUE) : false;
        SharedPreferences sharedPreferences = preferencesHelper.a;
        sharedPreferences.edit().putBoolean(preferencesHelper.C, areEqual).apply();
        User data6 = metaObject.getData();
        if (data6 != null && data6.getMetadata() != null) {
            if (str == null) {
                return;
            } else {
                sharedPreferences.edit().putString(preferencesHelper.A0, new JSONObject(str).getJSONObject(Column.DATA).getJSONObject("metadata").toString()).apply();
            }
        }
        User data7 = metaObject.getData();
        sharedPreferences.edit().putBoolean(preferencesHelper.F0, (data7 == null || (deeplinkQuoteRedirection = data7.getDeeplinkQuoteRedirection()) == null) ? true : deeplinkQuoteRedirection.booleanValue()).apply();
        e();
        if (metaObject.getData() != null) {
            User data8 = metaObject.getData();
            preferencesHelper.Q(data8 != null ? data8.getLanguage() : null);
            preferencesHelper.r0(metaObject.getData());
            sharedPreferences.edit().putBoolean(preferencesHelper.x0, true).apply();
            this.n.postValue(metaObject.getData());
        } else {
            String d = Eb.H0.d(metaObject);
            Intrinsics.checkNotNullExpressionValue(d, "toJson(...)");
            HashMap hashMap = new HashMap();
            Bb.j jVar = this.e;
            if (jVar != null) {
                Iterator it = Bb.j.p(d).iterator();
                int i = 0;
                while (it.hasNext()) {
                    Object next = it.next();
                    int i2 = i + 1;
                    if (i < 0) {
                        kotlin.collections.t.m();
                        throw null;
                    }
                    hashMap.put("JSON[" + i + ']', (String) next);
                    i = i2;
                }
            }
            if (jVar != null) {
                jVar.f("Response", hashMap, false);
            }
        }
        kotlin.collections.t.e(new BusinessCategory[]{new BusinessCategory(null, null, null, null, null, null, false, false, null, false, 1023, null), new BusinessCategory(null, null, null, null, null, null, false, false, null, false, 1023, null), new BusinessCategory(null, null, null, null, null, null, false, false, null, false, 1023, null)});
        i(metaObject.getData(), windowManager);
    }

    public final void i(User user, @NotNull WindowManager windowManager) {
        Intrinsics.checkNotNullParameter(windowManager, "windowManager");
        do.a.a.c(C1281d0.a(user, "processLoggedInData "), new Object[0]);
        if (user != null) {
            try {
                if (user.getUserId() != null) {
                    this.a.r0(user);
                    Bb.j jVar = this.e;
                    if (jVar != null) {
                        HashMap j = jVar.j(user, windowManager, false);
                        Intrinsics.checkNotNullParameter(j, "profileData");
                        try {
                            CleverTapAPI cleverTapAPI = jVar.c;
                            if (cleverTapAPI != null) {
                                cleverTapAPI.onUserLogin(j);
                            }
                        } catch (Exception e) {
                            do.a.a.e(e);
                        }
                        jVar.m(j);
                    }
                    if (jVar != null) {
                        jVar.n(user);
                    }
                    if (jVar != null) {
                        jVar.l();
                    }
                }
            } catch (Exception e2) {
                do.a.a.e(e2);
            }
        }
    }

    public final void j(@NotNull String str, @NotNull String str2, @NotNull String str3) {
        Intrinsics.checkNotNullParameter(str, "phoneNumber");
        Intrinsics.checkNotNullParameter(str2, "country");
        Intrinsics.checkNotNullParameter(str3, "provider");
        HashMap<String, Object> hashMap = new HashMap<>();
        Ab.H h = this.d;
        hashMap.put(h.n1, str);
        hashMap.put(h.Y0, str2);
        hashMap.put(h.c1, str3);
        Gb.f.a(this.c.getOtp(hashMap), new l6(this, 1), new n1(this, 0), false, 12);
    }

    public final void k(User user) {
        PreferencesHelper preferencesHelper = this.a;
        long j = preferencesHelper.a.getLong("temp_group_id", 0L);
        if (j > 0) {
            user.setCommunityId(Long.valueOf(j));
        }
        preferencesHelper.r0(user);
        Bb.j jVar = this.e;
        if (jVar != null) {
            jVar.n(user);
        }
        e();
        String phone = user.getPhone();
        HashMap<String, Object> hashMap = new HashMap<>();
        if (phone != null) {
            String v = preferencesHelper.v();
            Ab.H h = this.d;
            if (v != null) {
                hashMap.put(h.m0, v);
            }
            hashMap.put(h.O, c());
            Gb.f.a(this.c.getUserByPhone(phone, hashMap), new C8.d(this, 1), new s1(0), false, 12);
        }
    }

    public final void l(@NotNull User user) {
        Intrinsics.checkNotNullParameter(user, "user");
        HashMap<String, Object> hashMap = new HashMap<>();
        String v = this.a.v();
        Ab.H h = this.d;
        if (v != null) {
            hashMap.put(h.m0, v);
        }
        hashMap.put(h.O, c());
        String email = user.getEmail();
        if (email != null) {
            Gb.f.a(this.c.getUserByEmail(email, hashMap), new q1(this, 0), new r1(), false, 12);
        }
    }

    public final void n(@NotNull User user) {
        Intrinsics.checkNotNullParameter(user, "user");
        e();
        HashMap<String, Object> hashMap = new HashMap<>();
        String v = this.a.v();
        Ab.H h = this.d;
        if (v != null) {
            hashMap.put(h.m0, v);
        }
        String email = user.getEmail();
        if (email != null && !StringsKt.J(email)) {
            hashMap.put(h.o1, String.valueOf(user.getEmail()));
        }
        hashMap.put(h.O, c());
        String fbUserId = user.getFbUserId();
        if (fbUserId != null) {
            Gb.f.a(this.c.getUserByFacebookId(fbUserId, hashMap), new l1(this, 0), new m1(), false, 12);
        }
    }

    public final void o(final String str) {
        HashMap<String, Object> hashMap = new HashMap<>();
        if (str != null) {
            hashMap.put(this.d.a0, str);
            Gb.f.a(this.c.verifyFirebaseToken(hashMap), new Function1() {
                public final Object invoke(Object obj) {
                    OtpVerificationData otpVerificationData = (OtpVerificationData) obj;
                    String str2 = str;
                    Intrinsics.checkNotNullParameter(str2, "$it");
                    u1 u1Var = this;
                    Intrinsics.checkNotNullParameter(u1Var, "this$0");
                    Intrinsics.checkNotNullParameter(otpVerificationData, Column.DATA);
                    do.a.a.c("verifyFirebaseToken success %s", new Object[]{str2});
                    String accessToken = otpVerificationData.getAccessToken();
                    if (accessToken != null) {
                        u1Var.a.R(accessToken);
                    }
                    u1Var.l.postValue(otpVerificationData);
                    return Unit.a;
                }
            }, new Function2() {
                public final Object invoke(Object obj, Object obj2) {
                    Throwable th = (Throwable) obj;
                    u1 u1Var = u1.this;
                    Intrinsics.checkNotNullParameter(u1Var, "this$0");
                    Intrinsics.checkNotNullParameter(th, "throwable");
                    Intrinsics.checkNotNullParameter((Db.a) obj2, "failure");
                    do.a.a.f(th, "verifyFirebaseToken error", new Object[0]);
                    u1Var.l.postValue((Object) null);
                    return Unit.a;
                }
            }, false, 12);
        }
    }

    public final void p(@NotNull String str, @NotNull String str2, @NotNull String str3, @NotNull String str4) {
        Intrinsics.checkNotNullParameter(str, "phoneNumber");
        Intrinsics.checkNotNullParameter(str2, "otp");
        Intrinsics.checkNotNullParameter(str3, "country");
        Intrinsics.checkNotNullParameter(str4, "provider");
        HashMap<String, Object> hashMap = new HashMap<>();
        Ab.H h = this.d;
        hashMap.put(h.n1, str);
        hashMap.put(h.Y0, str3);
        hashMap.put(h.c1, str4);
        hashMap.put(h.l0, str2);
        final int i = 0;
        Gb.f.a(this.c.verifyOtp(hashMap), new Function1() {
            public final Object invoke(Object obj) {
                ib.c cVar = this;
                switch (i) {
                    case 0:
                        OtpVerificationData otpVerificationData = (OtpVerificationData) obj;
                        u1 u1Var = (u1) cVar;
                        Intrinsics.checkNotNullParameter(u1Var, "this$0");
                        Intrinsics.checkNotNullParameter(otpVerificationData, "it");
                        do.a.a.c("requestOtp success %s", new Object[]{otpVerificationData});
                        String accessToken = otpVerificationData.getAccessToken();
                        if (accessToken != null) {
                            u1Var.a.R(accessToken);
                        }
                        u1Var.j.postValue(otpVerificationData);
                        break;
                    default:
                        ContactUsData contactUsData = (ContactUsData) obj;
                        ib.c cVar2 = cVar;
                        Intrinsics.checkNotNullParameter(cVar2, "this$0");
                        Intrinsics.checkNotNullParameter(contactUsData, "it");
                        cVar2.e.postValue(contactUsData.getData());
                        break;
                }
                return Unit.a;
            }
        }, new p1(this, 0), false, 12);
    }
}