导航菜单

页面标题

页面副标题

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

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

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


package com.olxgroup.panamera.app.seller.posting.activities;

import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.fragment.app.Fragment;
import com.google.gson.Gson;
import com.olx.southasia.p;
import com.olxgroup.panamera.app.common.infra.m2;
import com.olxgroup.panamera.app.common.utils.l1;
import com.olxgroup.panamera.app.common.utils.z0;
import com.olxgroup.panamera.app.monetization.myOrder.activities.PackageListingActivity;
import com.olxgroup.panamera.app.seller.posting.fragments.PostingAttributesWithTitleFragment;
import com.olxgroup.panamera.app.seller.posting.fragments.PostingFlowBaseFragment;
import com.olxgroup.panamera.app.seller.posting.fragments.PostingLocationFragment;
import com.olxgroup.panamera.app.seller.posting.fragments.PostingPhoneVerificationStepOneFragment;
import com.olxgroup.panamera.app.seller.posting.fragments.PostingPhoneVerificationStepTwoFragment;
import com.olxgroup.panamera.app.seller.posting.fragments.PostingPhoneVerificationStepTwoFragmentV2;
import com.olxgroup.panamera.app.seller.posting.fragments.PostingPhotosFragment;
import com.olxgroup.panamera.app.seller.posting.fragments.PostingPriceFragment;
import com.olxgroup.panamera.app.seller.posting.fragments.PostingTransitionFragment;
import com.olxgroup.panamera.app.seller.posting.fragments.RcUploadValuePropositionFragment;
import com.olxgroup.panamera.app.users.auth.activities.LoginActivity;
import com.olxgroup.panamera.data.buyers.recentlyviewed.source.local.entity.RecentlyViewedAdEntity;
import com.olxgroup.panamera.domain.buyers.common.entity.ad.AdItem;
import com.olxgroup.panamera.domain.common.tracking.repository.TrackingContextRepository;
import com.olxgroup.panamera.domain.common.tracking.repository.TrackingService;
import com.olxgroup.panamera.domain.monetization.common.entity.PaymentContext;
import com.olxgroup.panamera.domain.monetization.listings.entity.ConsumptionPackage;
import com.olxgroup.panamera.domain.monetization.listings.utils.FeatureOrigin;
import com.olxgroup.panamera.domain.monetization.listings.utils.MonetizationFeatureCodes;
import com.olxgroup.panamera.domain.seller.posting.entity.PostingDraft;
import com.olxgroup.panamera.domain.seller.posting.entity.PostingDraftPhoto;
import com.olxgroup.panamera.domain.seller.posting.entity.PostingFlow;
import com.olxgroup.panamera.domain.seller.posting.presentation_impl.PostingActivityPresenter;
import com.olxgroup.panamera.domain.seller.posting.repository.PostingDraftRepository;
import com.olxgroup.panamera.domain.seller.posting.repository.PostingPhotoUploadRepository;
import com.olxgroup.panamera.domain.seller.posting.repository.PostingTrackingService;
import com.olxgroup.panamera.domain.users.auth.tracking.AuthTrackingService;
import com.payu.custombrowser.util.CBConstant;
import io.reactivex.r;
import io.reactivex.t;
import io.reactivex.u;
import io.reactivex.y;
import io.reactivex.z;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import olx.com.delorean.dialog.u;
import olx.com.delorean.domain.actions.posting.StartPostingFlow;
import olx.com.delorean.domain.entity.category.Category;
import olx.com.delorean.domain.executor.PostExecutionThread;
import olx.com.delorean.domain.interactor.UseCaseObserver;
import olx.com.delorean.domain.model.posting.draft.Drafts;
import olx.com.delorean.domain.model.posting.flow.PostingFlow;
import olx.com.delorean.domain.repository.CategorizationRepository;
import olx.com.delorean.domain.repository.UserSessionRepository;
import olx.com.delorean.domain.service.ab.ABTestService;
import olx.com.delorean.domain.utils.TextUtils;
import olx.com.delorean.view.posting.a;
import olx.com.delorean.view.posting.category.PostingCategoryFirstFragment;
import olx.com.delorean.view.posting.category.PostingCategorySelectionFragment;
import olx.com.delorean.view.posting.mergeaccount.PostingMergeAccountFragment;

public class PostingActivity extends com.olxgroup.panamera.app.seller.posting.activities.b implements olx.com.delorean.view.posting.mergeaccount.b {
    PostingDraftRepository i0;
    ABTestService j0;
    PostingTrackingService k0;
    PostExecutionThread l0;
    public olx.com.delorean.view.posting.g m0;
    TrackingContextRepository n0;
    UserSessionRepository o0;
    CategorizationRepository p0;
    StartPostingFlow q0;
    Drafts r0;
    PostingActivityPresenter s0;
    protected PostingFlow u0;
    PostingPhotoUploadRepository v0;
    Gson w0;
    TrackingService x0;
    private final io.reactivex.disposables.b t0 = new io.reactivex.disposables.b();
    private boolean y0 = false;

    class a extends olx.com.delorean.view.posting.interceptor.d {
        a(PostingFlow.PostingFlowStep postingFlowStep) {
            super(postingFlowStep);
        }

        public boolean a(PostingFlow.PostingFlowStep postingFlowStep) {
            return false;
        }
    }

    static class b {
        static final int[] a;

        static {
            int[] iArr = new int[PostingFlow.PostingFlowStep.values().length];
            a = iArr;
            try {
                iArr[PostingFlow.PostingFlowStep.CATEGORY.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                a[PostingFlow.PostingFlowStep.PHOTOS.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                a[PostingFlow.PostingFlowStep.PRICE.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                a[PostingFlow.PostingFlowStep.POST.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                a[PostingFlow.PostingFlowStep.CODE_VERIFICATION.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                a[PostingFlow.PostingFlowStep.MERGE_ACCOUNT.ordinal()] = 6;
            } catch (NoSuchFieldError unused6) {
            }
            try {
                a[PostingFlow.PostingFlowStep.CHECKLIST.ordinal()] = 7;
            } catch (NoSuchFieldError unused7) {
            }
            try {
                a[PostingFlow.PostingFlowStep.ATTRIBUTES.ordinal()] = 8;
            } catch (NoSuchFieldError unused8) {
            }
            try {
                a[PostingFlow.PostingFlowStep.LOCATION.ordinal()] = 9;
            } catch (NoSuchFieldError unused9) {
            }
            try {
                a[PostingFlow.PostingFlowStep.TRANSITION.ordinal()] = 10;
            } catch (NoSuchFieldError unused10) {
            }
        }
    }

    private void B3() {
        PostingDraft postingDraft;
        if (this.o0.isUserLogged() && (postingDraft = this.i0.getPostingDraft()) != null && postingDraft.getUploadPhotosPending()) {
            postingDraft.setUploadPhotosPending(false);
            this.i0.updatePostingDraft(postingDraft);
            List<PostingDraftPhoto> photos = postingDraft.getPhotos();
            if (photos.isEmpty()) {
                return;
            }
            this.v0.uploadPhotos(photos);
        }
    }

    private void E3() {
        PostingDraft postingDraft = this.i0.getPostingDraft();
        if (postingDraft == null || TextUtils.isEmpty(postingDraft.getAdId())) {
            return;
        }
        this.i0.clearPostingDraft();
    }

    private void F3() {
        PostingDraft createPostingDraft = this.i0.createPostingDraft();
        createPostingDraft.setAdIndexId(this.n0.getAdIndexId());
        this.i0.updatePostingDraft(createPostingDraft);
        this.n0.setPostingFlowType("posting_no_draft");
        this.k0.setPostingFlowType("posting_no_draft");
    }

    private int G3() {
        return com.olx.southasia.g.pic_error;
    }

    private PostingFlowBaseFragment I3() {
        return this.j0.isAutomaticPhoneVerificationEnabled() ? new PostingPhoneVerificationStepTwoFragmentV2() : new PostingPhoneVerificationStepTwoFragment();
    }

    public PostingFlowBaseFragment a4(PostingFlow.PostingFlowStep postingFlowStep) {
        return c4(postingFlowStep, null);
    }

    public PostingFlowBaseFragment c4(PostingFlow.PostingFlowStep postingFlowStep, Map map) {
        this.i0.getPostingDraft();
        switch (b.a[postingFlowStep.ordinal()]) {
            case 1:
                if (this.p0.getTopCategoriesForPost().size() != 0) {
                    return new PostingCategoryFirstFragment();
                }
                this.k0.postingCategoryFail();
                return new PostingCategorySelectionFragment();
            case 2:
                return new PostingPhotosFragment();
            case 3:
                return new PostingPriceFragment();
            case 4:
                return new PostingPhoneVerificationStepOneFragment();
            case 5:
                return I3();
            case 6:
                return new PostingMergeAccountFragment();
            case 7:
                return RcUploadValuePropositionFragment.R5(T3());
            case CBConstant.SUBMIT_OTP_COLLAPSED:
                return map != null ? PostingAttributesWithTitleFragment.K6(map) : new PostingAttributesWithTitleFragment();
            case 9:
                return new PostingLocationFragment();
            case 10:
                return map != null ? PostingTransitionFragment.j6(map) : new PostingTransitionFragment();
            default:
                return null;
        }
    }

    private void P3(Bundle bundle) {
        if (!"attributes".equals(bundle.getString("nav_action"))) {
            if (n4(bundle)) {
                HashMap hashMap = new HashMap();
                if (bundle.containsKey("notificationtype")) {
                    hashMap.put("notificationtype", bundle.getString("notificationtype"));
                }
                hashMap.put("nav_action", "monetization");
                hashMap.put(RecentlyViewedAdEntity.COLUMN_AD_ITEM, bundle.getSerializable(RecentlyViewedAdEntity.COLUMN_AD_ITEM));
                j4(hashMap);
                return;
            }
            return;
        }
        HashMap hashMap2 = new HashMap();
        if (bundle.containsKey("push_id")) {
            hashMap2.put("push_id", bundle.getString("push_id"));
        }
        if (bundle.containsKey("notificationtype")) {
            hashMap2.put("notificationtype", bundle.getString("notificationtype"));
        }
        PostingDraft postingDraft = this.i0.getPostingDraft();
        if (postingDraft != null) {
            if (bundle.containsKey("ad_index_id")) {
                String string = bundle.getString("ad_index_id");
                this.n0.setAdIndexId(string);
                this.k0.setAdIndexId(string);
                postingDraft.setAdIndexId(string);
            }
            if (bundle.containsKey("category_id")) {
                postingDraft.setCategoryId(bundle.getString("category_id"));
                this.i0.updatePostingDraft(postingDraft);
                g4(PostingFlow.PostingFlowStep.CATEGORY, hashMap2);
            }
        }
    }

    private void Q3() {
        if (J3() != null) {
            this.i0.updatePostingDraft(null);
            AdItem J3 = J3();
            Boolean bool = Boolean.FALSE;
            startActivity(PackageListingActivity.s3(J3, (ConsumptionPackage) null, bool, FeatureOrigin.POSTING, MonetizationFeatureCodes.LIMIT, bool, (PaymentContext) null, Boolean.valueOf(!T3())));
            finish();
        }
    }

    private void R3(Intent intent) {
        Bundle bundleExtra;
        if (intent == null || !intent.hasExtra("extra_data") || (bundleExtra = intent.getBundleExtra("extra_data")) == null || !bundleExtra.containsKey("nav_action")) {
            return;
        }
        this.y0 = "document_upload".equals(bundleExtra.getString("nav_action"));
    }

    private void S3() {
        if (!com.olxgroup.panamera.app.buyers.home.util.b.a()) {
            S2("sell_button");
        }
        ((com.olxgroup.panamera.app.common.activities.i) this).g0 = true;
        T2();
        k4();
        l4();
        A3(this);
        this.s0.start();
        if (!U3() && this.m0.k()) {
            q4(this.m0.g(), true);
        } else if (PostingFlow.PostingFlowStep.SUCCESS.equals(this.m0.g())) {
            N3();
        }
    }

    public void W3(Category category, t tVar) {
        if (z0.b(category.getId())) {
            this.m0.c();
        } else {
            this.m0.o();
        }
        tVar.onComplete();
    }

    public void X3(String str, DialogInterface dialogInterface, int i) {
        this.k0.isPostingDraftDiscarded(l1.e.DISCARD.getValue(), str);
        finish();
        this.i0.clearPostingDraft();
    }

    public void Y3(String str, DialogInterface dialogInterface, int i) {
        this.k0.isPostingDraftDiscarded(l1.e.CANCEL.getValue(), str);
    }

    public void Z3(View view) {
        finish();
    }

    public void b4(PostingFlowBaseFragment postingFlowBaseFragment) {
        if (this.m0.k()) {
            c3(postingFlowBaseFragment, false, true);
        } else {
            k3(postingFlowBaseFragment);
        }
    }

    public void d4(PostingFlowBaseFragment postingFlowBaseFragment) {
        if (this.m0.k()) {
            c3(postingFlowBaseFragment, false, true);
        } else {
            k3(postingFlowBaseFragment);
        }
    }

    public void e4(StartPostingFlow.Result result) {
        if (result instanceof StartPostingFlow.Result.Success) {
            this.u0 = ((StartPostingFlow.Result.Success) result).getFlow();
        }
    }

    public void V3(PostingFlow.PostingFlowStep postingFlowStep) {
        g4(postingFlowStep, null);
    }

    private void g4(PostingFlow.PostingFlowStep postingFlowStep, Map map) {
        PostingFlow.PostingFlowStep h = this.m0.h(postingFlowStep);
        if (h == null) {
            return;
        }
        if (h == PostingFlow.PostingFlowStep.SUCCESS) {
            N3();
        } else {
            r4(h, true, map);
        }
    }

    private void goBack() {
        PostingFlowBaseFragment o0 = getSupportFragmentManager().o0(com.olx.southasia.i.container);
        if (o0 == null || o0.canDoOnBackPressed()) {
            PostingDraft postingDraft = this.i0.getPostingDraft();
            if (postingDraft != null) {
                postingDraft.removeCompletedStep(this.m0.g());
                this.i0.updatePostingDraft(postingDraft);
            }
            this.m0.i();
            super.onBackPressed();
        }
    }

    private void i4(Intent intent) {
        Bundle bundleExtra;
        if (this.s0.isPostingDisabled()) {
            p4();
        } else {
            if (intent == null || !intent.hasExtra("extra_data") || (bundleExtra = intent.getBundleExtra("extra_data")) == null || !bundleExtra.containsKey("nav_action")) {
                return;
            }
            P3(bundleExtra);
        }
    }

    private void j4(Map map) {
        for (PostingFlow.PostingFlowStep postingFlowStep : this.m0.e()) {
            PostingDraft postingDraft = this.i0.getPostingDraft();
            if (postingDraft != null) {
                postingDraft.addCompletedStep(postingFlowStep);
                this.i0.updatePostingDraft(postingDraft);
            }
            if (this.m0.h(postingFlowStep).equals(PostingFlow.PostingFlowStep.TRANSITION)) {
                this.m0.i();
                g4(postingFlowStep, map);
                V3(postingFlowStep);
                return;
            }
        }
    }

    private void k4() {
        if (this.i0.getPostingDraft() == null || TextUtils.isEmpty(this.i0.getPostingDraft().getAdId())) {
            return;
        }
        this.m0.l();
    }

    private void l4() {
        PostingDraft postingDraft = this.i0.getPostingDraft();
        if (postingDraft == null || TextUtils.isEmpty(postingDraft.getAdId()) || z0.b(postingDraft.getCategoryId())) {
            return;
        }
        this.m0.o();
    }

    private boolean n4(Bundle bundle) {
        return "monetization".equals(bundle.getString("nav_action"));
    }

    private void p4() {
        new a.a(this).c(G3()).h(getString(p.posting_message_shutdown_title)).d(getString(p.posting_message_shutdown_message)).e(getString(p.posting_message_shutdown_button)).f(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                PostingActivity.this.Z3(view);
            }
        }).g();
    }

    private void q4(final PostingFlow.PostingFlowStep postingFlowStep, boolean z) {
        this.t0.c(z.p(new Callable() {
            @Override
            public final Object call() {
                PostingFlowBaseFragment a4;
                a4 = PostingActivity.this.a4(postingFlowStep);
                return a4;
            }
        }).D(io.reactivex.schedulers.a.c()).u(io.reactivex.android.schedulers.a.a()).A(new io.reactivex.functions.g() {
            @Override
            public final void accept(Object obj) {
                PostingActivity.this.b4((PostingFlowBaseFragment) obj);
            }
        }));
    }

    private void r4(final PostingFlow.PostingFlowStep postingFlowStep, boolean z, final Map map) {
        this.t0.c(z.p(new Callable() {
            @Override
            public final Object call() {
                PostingFlowBaseFragment c4;
                c4 = PostingActivity.this.c4(postingFlowStep, map);
                return c4;
            }
        }).D(io.reactivex.schedulers.a.c()).u(io.reactivex.android.schedulers.a.a()).A(new io.reactivex.functions.g() {
            @Override
            public final void accept(Object obj) {
                PostingActivity.this.d4((PostingFlowBaseFragment) obj);
            }
        }));
    }

    public void A3(PostingActivity postingActivity) {
        this.m0.b(new a(PostingFlow.PostingFlowStep.PHOTOS));
        this.m0.d(new olx.com.delorean.view.posting.interceptor.a() {
            public final void a(PostingFlow.PostingFlowStep postingFlowStep) {
                PostingActivity.this.V3(postingFlowStep);
            }
        });
    }

    public void C3(PostingFlow.PostingFlowStep postingFlowStep) {
        if (this.o0.isUserLogged()) {
            B3();
            V3(postingFlowStep);
        } else {
            ((AuthTrackingService) m2.a.A1().getValue()).setOriginLoginFlow("posting");
            startActivityForResult(LoginActivity.u3(), 671);
        }
    }

    public AdItem J3() {
        return this.i0.getPostedAd();
    }

    public void M3(PostingFlow.PostingFlowStep postingFlowStep) {
        int f = this.m0.f(postingFlowStep);
        for (int i = 0; i < f; i++) {
            this.m0.i();
            this.m0.n();
            getSupportFragmentManager().r1();
        }
    }

    public void N3() {
        AdItem J3 = J3();
        if (J3 != null) {
            if (J3.getAdMonetizable() == null || J3.getAdMonetizable().getCurrentPackage() == null) {
                Q3();
                return;
            }
            this.i0.clearPostingDraft();
            startActivity(olx.com.delorean.a.q1(J3));
            finish();
        }
    }

    public void O3(PostingFlow.PostingFlowStep postingFlowStep) {
        this.m0.b.c(postingFlowStep);
    }

    public void P2() {
        getSupportActionBar().m();
    }

    public boolean T3() {
        return false;
    }

    public boolean U3() {
        return this.y0;
    }

    public void f3() {
        getSupportActionBar().G();
    }

    public void h4(final Category category, UseCaseObserver useCaseObserver) {
        r.create(new u() {
            @Override
            public final void subscribe(t tVar) {
                PostingActivity.this.W3(category, tVar);
            }
        }).subscribeOn(io.reactivex.schedulers.a.c()).observeOn(this.l0.getScheduler()).subscribe((y) useCaseObserver);
        s4(category);
    }

    public void m4(String str) {
        M2().setTitle(str);
    }

    public void o4() {
        PostingDraft postingDraft = this.i0.getPostingDraft();
        final String adIndexId = postingDraft != null ? postingDraft.getAdIndexId() : null;
        new u.a(this).n(getString(p.breadcrumb_discard_dialog_title)).e(getString(p.breadcrumb_discard_dialog_description)).l(getString(p.edit_item_dialog_pending_ok)).g(getString(p.edit_item_dialog_pending_cancel)).b(false).c(false).k(new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                PostingActivity.this.X3(adIndexId, dialogInterface, i);
            }
        }).i(new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                PostingActivity.this.Y3(adIndexId, dialogInterface, i);
            }
        }).m();
    }

    protected void onActivityResult(int i, int i2, Intent intent) {
        Fragment o0 = getSupportFragmentManager().o0(com.olx.southasia.i.container);
        super/*com.olxgroup.panamera.app.common.activities.c*/.onActivityResult(i, i2, intent);
        if (11032 == i && i2 == 0) {
            this.i0.clearPostingDraft();
            finish();
        }
        if (o0 != null) {
            if (intent == null) {
                intent = new Intent();
            }
            o0.onActivityResult(i, i2, intent);
        }
    }

    public void onBackPressed() {
        goBack();
    }

    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setSupportActionBar(M2());
        if (this.i0.getPostingDraft() == null) {
            F3();
        } else {
            this.n0.setPostingFlowType("posting_draft");
            if (this.i0.getPostingDraft() != null && !TextUtils.isEmpty(this.i0.getPostingDraft().getCategoryId())) {
                this.k0.setCategoryId(this.i0.getPostingDraft().getCategoryId());
            }
            this.k0.setPostingFlowType("posting_draft");
        }
        R3(getIntent());
        S3();
        i4(getIntent());
    }

    protected void onDestroy() {
        super/*com.olxgroup.panamera.app.common.activities.c*/.onDestroy();
        E3();
        this.t0.d();
        this.n0.resetAdIndexId();
        this.k0.resetAdIndexId();
    }

    protected void onNewIntent(Intent intent) {
        super/*androidx.activity.ComponentActivity*/.onNewIntent(intent);
        i4(intent);
    }

    public boolean onSupportNavigateUp() {
        goBack();
        return true;
    }

    public void q() {
        M3(PostingFlow.PostingFlowStep.POST);
    }

    public void s() {
        O3(PostingFlow.PostingFlowStep.MERGE_ACCOUNT);
    }

    protected void s4(Category category) {
        this.t0.c(this.q0.invoke(category).D(io.reactivex.schedulers.a.c()).u(io.reactivex.android.schedulers.a.a()).A(new io.reactivex.functions.g() {
            @Override
            public final void accept(Object obj) {
                PostingActivity.this.e4((StartPostingFlow.Result) obj);
            }
        }));
    }

    public void y3(boolean z) {
        this.o0.hasPhoneVerification();
        this.m0.m();
    }

    public void z3() {
        this.m0.a();
    }
}