导航菜单

页面标题

页面副标题

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

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

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


package com.olxgroup.panamera.app.buyers.partnership.viewmodel;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.SavedStateHandle;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelKt;
import com.olxgroup.panamera.app.buyers.adDetails.utils.a;
import com.olxgroup.panamera.app.buyers.partnership.uievents.a;
import com.olxgroup.panamera.app.buyers.partnership.uievents.b;
import com.olxgroup.panamera.data.buyers.partnership.usecase.GetCampaignConfigUseCase;
import com.olxgroup.panamera.domain.buyers.addetails.usecase.GetRedirectionUseCase;
import com.olxgroup.panamera.domain.buyers.common.entity.ad.NavigationType;
import com.olxgroup.panamera.domain.buyers.partnership.entity.CampaignConfig;
import com.olxgroup.panamera.domain.common.DispatcherProvider;
import com.olxgroup.panamera.domain.location.entity.Location;
import com.olxgroup.panamera.domain.location.entity.PlaceDescription;
import com.olxgroup.panamera.domain.location.entity.UserLocation;
import com.olxgroup.panamera.domain.shell.LoggerDomainContract;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Pair;
import kotlin.ResultKt;
import kotlin.TuplesKt;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.collections.MapsKt;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.coroutines.jvm.internal.ContinuationImpl;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
import kotlinx.coroutines.i;
import kotlinx.coroutines.o0;
import kotlinx.coroutines.q0;
import olx.com.delorean.domain.repository.UserSessionRepository;
import olx.com.delorean.domain.utils.EventWrapper;

public final class b extends ViewModel {
    public static final a l = new a(null);
    public static final int m = 8;
    private final GetCampaignConfigUseCase a;
    private final GetRedirectionUseCase b;
    private final UserSessionRepository c;
    private final DispatcherProvider d;
    private final LoggerDomainContract e;
    private final String f;
    private final Map g;
    private final String h;
    private final Function1 i;
    private final MutableLiveData j;
    private final LiveData k;

    public static final class a {
        public a(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        private a() {
        }
    }

    public class C0242b {
        public static final int[] $EnumSwitchMapping$0;

        static {
            int[] iArr = new int[NavigationType.values().length];
            try {
                iArr[NavigationType.Deeplink.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            $EnumSwitchMapping$0 = iArr;
        }
    }

    static final class c extends ContinuationImpl {
        Object a;
        Object b;
        int d;

        c(Continuation continuation) {
            super(continuation);
        }

        public final Object invokeSuspend(Object obj) {
            this.b = obj;
            this.d |= Integer.MIN_VALUE;
            return b.this.u0(null, this);
        }
    }

    static final class d extends SuspendLambda implements Function2 {
        int a;
        final com.olxgroup.panamera.app.buyers.partnership.uievents.a b;
        final b c;

        d(com.olxgroup.panamera.app.buyers.partnership.uievents.a aVar, b bVar, Continuation continuation) {
            super(2, continuation);
            this.b = aVar;
            this.c = bVar;
        }

        public final Continuation create(Object obj, Continuation continuation) {
            return new d(this.b, this.c, continuation);
        }

        public final Object invokeSuspend(Object obj) {
            Object g = IntrinsicsKt.g();
            int i = this.a;
            if (i == 0) {
                ResultKt.b(obj);
                if (!Intrinsics.d(this.b, a.C0240a.a)) {
                    throw new NoWhenBranchMatchedException();
                }
                b bVar = this.c;
                this.a = 1;
                if (bVar.z0(this) == g) {
                    return g;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                ResultKt.b(obj);
            }
            return Unit.a;
        }

        public final Object invoke(o0 o0Var, Continuation continuation) {
            return create(o0Var, continuation).invokeSuspend(Unit.a);
        }
    }

    static final class e extends ContinuationImpl {
        Object a;
        Object b;
        int d;

        e(Continuation continuation) {
            super(continuation);
        }

        public final Object invokeSuspend(Object obj) {
            this.b = obj;
            this.d |= Integer.MIN_VALUE;
            return b.this.z0(this);
        }
    }

    static final class f extends SuspendLambda implements Function2 {
        int a;
        final com.olxgroup.panamera.app.buyers.partnership.uievents.b c;

        f(com.olxgroup.panamera.app.buyers.partnership.uievents.b bVar, Continuation continuation) {
            super(2, continuation);
            this.c = bVar;
        }

        public final Continuation create(Object obj, Continuation continuation) {
            return b.this.new f(this.c, continuation);
        }

        public final Object invokeSuspend(Object obj) {
            IntrinsicsKt.g();
            if (this.a != 0) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            ResultKt.b(obj);
            b.this.j.setValue(new EventWrapper(this.c));
            return Unit.a;
        }

        public final Object invoke(o0 o0Var, Continuation continuation) {
            return create(o0Var, continuation).invokeSuspend(Unit.a);
        }
    }

    public b(SavedStateHandle savedStateHandle, GetCampaignConfigUseCase getCampaignConfigUseCase, GetRedirectionUseCase getRedirectionUseCase, UserSessionRepository userSessionRepository, DispatcherProvider dispatcherProvider, LoggerDomainContract loggerDomainContract) {
        this.a = getCampaignConfigUseCase;
        this.b = getRedirectionUseCase;
        this.c = userSessionRepository;
        this.d = dispatcherProvider;
        this.e = loggerDomainContract;
        String str = (String) savedStateHandle.get("uri_actions");
        str = str == null ? "" : str;
        this.f = str;
        Map v0 = v0(str);
        this.g = v0;
        String str2 = (String) v0.get("action");
        this.h = str2 != null ? str2 : "";
        this.i = new Function1() {
            public final Object invoke(Object obj) {
                Unit D0;
                D0 = b.D0(b.this, (com.olxgroup.panamera.app.buyers.partnership.uievents.a) obj);
                return D0;
            }
        };
        MutableLiveData mutableLiveData = new MutableLiveData();
        this.j = mutableLiveData;
        this.k = mutableLiveData;
        y0(a.C0240a.a);
    }

    private final void A0(String str) {
        this.e.log(com.naspers.olxautos.shell_common.common.logger.a.WARNING, "CLMCampaignsViewModel", str);
    }

    private final Object B0(com.olxgroup.panamera.app.buyers.partnership.uievents.b bVar, Continuation continuation) {
        Object g = i.g(this.d.getMain(), new f(bVar, null), continuation);
        return g == IntrinsicsKt.g() ? g : Unit.a;
    }

    private final boolean C0(CampaignConfig campaignConfig) {
        return Intrinsics.d(campaignConfig.getLoginMandatory(), Boolean.TRUE);
    }

    public static final Unit D0(b bVar, com.olxgroup.panamera.app.buyers.partnership.uievents.a aVar) {
        bVar.y0(aVar);
        return Unit.a;
    }

    public final java.lang.Object u0(com.olxgroup.panamera.domain.buyers.partnership.entity.CampaignConfig r6, kotlin.coroutines.Continuation r7) {
        throw new UnsupportedOperationException("Method not decompiled: com.olxgroup.panamera.app.buyers.partnership.viewmodel.b.u0(com.olxgroup.panamera.domain.buyers.partnership.entity.CampaignConfig, kotlin.coroutines.Continuation):java.lang.Object");
    }

    private final Map v0(String str) {
        int f0 = StringsKt.f0(str, "?", 0, false, 6, (Object) null);
        if (f0 == -1) {
            return MapsKt.i();
        }
        List H0 = StringsKt.H0(str.substring(f0 + 1), new String[]{"&"}, false, 0, 6, (Object) null);
        ArrayList arrayList = new ArrayList();
        Iterator it = H0.iterator();
        while (it.hasNext()) {
            List H02 = StringsKt.H0((String) it.next(), new String[]{"="}, false, 0, 6, (Object) null);
            Pair pair = null;
            if (!(!H02.isEmpty())) {
                H02 = null;
            }
            if (H02 != null) {
                Object obj = H02.get(0);
                String str2 = (String) CollectionsKt.j0(H02, 1);
                if (str2 == null) {
                    str2 = "";
                }
                pair = TuplesKt.a(obj, str2);
            }
            if (pair != null) {
                arrayList.add(pair);
            }
        }
        return MapsKt.s(arrayList);
    }

    private final Map w0(CampaignConfig campaignConfig) {
        PlaceDescription placeDescription;
        List<PlaceDescription> levels;
        PlaceDescription placeDescription2;
        Location location;
        Map m2 = MapsKt.m(new Pair[]{TuplesKt.a(a.EnumC0149a.CALLBACK_URL, "https://www.olx.in/"), TuplesKt.a(a.EnumC0149a.ASSET_EXIST, "n")});
        UserLocation lastUserLocation = this.c.getLastUserLocation();
        String countryName = (lastUserLocation == null || (placeDescription2 = lastUserLocation.getPlaceDescription()) == null || (location = placeDescription2.getLocation()) == null) ? null : location.getCountryName();
        UserLocation lastUserLocation2 = this.c.getLastUserLocation();
        if (lastUserLocation2 != null && (placeDescription = lastUserLocation2.getPlaceDescription()) != null && (levels = placeDescription.getLevels()) != null) {
            for (PlaceDescription placeDescription3 : levels) {
                String type = placeDescription3.getType();
                if (Intrinsics.d(type, "CITY")) {
                    a.EnumC0149a enumC0149a = a.EnumC0149a.USER_CITY;
                    String name = placeDescription3.getName();
                    m2.put(enumC0149a, (name == null || StringsKt.i0(name)) ? countryName : placeDescription3.getName());
                } else if (Intrinsics.d(type, "STATE")) {
                    a.EnumC0149a enumC0149a2 = a.EnumC0149a.USER_STATE;
                    String name2 = placeDescription3.getName();
                    m2.put(enumC0149a2, (name2 == null || StringsKt.i0(name2)) ? countryName : placeDescription3.getName());
                }
            }
        }
        com.olxgroup.panamera.app.buyers.adDetails.utils.a aVar = com.olxgroup.panamera.app.buyers.adDetails.utils.a.a;
        List requiredFields = campaignConfig.getRequiredFields();
        if (requiredFields == null) {
            requiredFields = CollectionsKt.k();
        }
        return com.olxgroup.panamera.app.buyers.adDetails.utils.a.h(aVar, requiredFields, null, this.c.getLoggedUser(), m2, 2, null);
    }

    private final Object x0(CampaignConfig campaignConfig, Continuation continuation) {
        return (!C0(campaignConfig) || this.c.isUserLogged()) ? (!C0(campaignConfig) || this.c.hasPhoneVerification()) ? u0(campaignConfig, continuation) : b.d.a : b.c.a;
    }

    private final void y0(com.olxgroup.panamera.app.buyers.partnership.uievents.a aVar) {
        i.d(ViewModelKt.getViewModelScope(this), this.d.getIo(), (q0) null, new d(aVar, this, null), 2, (Object) null);
    }

    public final java.lang.Object z0(kotlin.coroutines.Continuation r11) {
        throw new UnsupportedOperationException("Method not decompiled: com.olxgroup.panamera.app.buyers.partnership.viewmodel.b.z0(kotlin.coroutines.Continuation):java.lang.Object");
    }

    public final LiveData a() {
        return this.k;
    }

    public final Function1 t() {
        return this.i;
    }
}