Kufar v3.2.0版本的 MD5 值为:6a4d203db1c561c7e3bcd50d23fed59f

以下内容为反编译后的 SafeDealFragment.java 源代码,内容仅作参考


package by.kufar.safedeal.ui;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.ViewAnimator;
import androidx.core.view.ViewGroupKt;
import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import by.kufar.core.android.fragment.BaseFragment;
import by.kufar.re.ui.widget.dialog.AlertKufarDialogFragment;
import by.kufar.re.ui.widget.error.ErrorView;
import by.kufar.re.ui.widget.webview.WebViewActivity;
import by.kufar.safedeal.R$id;
import by.kufar.safedeal.R$layout;
import by.kufar.safedeal.R$string;
import by.kufar.safedeal.ui.SafeDealVM;
import by.kufar.safedeal.ui.adapter.SafeDealTipsController;
import by.kufar.safedeal.ui.widget.SafeDealToggle;
import by.kufar.sharedmodels.entity.SpanContent;
import com.tapjoy.TJAdUnitConstants;
import e80.t;
import java.util.Iterator;
import java.util.List;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.g0;
import kotlin.jvm.internal.o0;
import kotlin.jvm.internal.s;
import kotlin.jvm.internal.u;
import kotlin.reflect.KProperty;
import xk.d;

@Metadata(d1 = {"\u0000\u0098\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\f\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b_\u0010`J\b\u0010\u0003\u001a\u00020\u0002H\u0002J\b\u0010\u0004\u001a\u00020\u0002H\u0002J\u001a\u0010\t\u001a\u00020\u00022\u0006\u0010\u0006\u001a\u00020\u00052\b\u0010\b\u001a\u0004\u0018\u00010\u0007H\u0002J\u001a\u0010\u000b\u001a\u00020\u00022\u0006\u0010\u0006\u001a\u00020\u00052\b\u0010\n\u001a\u0004\u0018\u00010\u0007H\u0002J\b\u0010\f\u001a\u00020\u0002H\u0002J\u0010\u0010\u000e\u001a\u00020\u00022\u0006\u0010\r\u001a\u00020\u0005H\u0002J\u0010\u0010\u0011\u001a\u00020\u00022\u0006\u0010\u0010\u001a\u00020\u000fH\u0002J\b\u0010\u0012\u001a\u00020\u0002H\u0016J&\u0010\u001a\u001a\u0004\u0018\u00010\u00192\u0006\u0010\u0014\u001a\u00020\u00132\b\u0010\u0016\u001a\u0004\u0018\u00010\u00152\b\u0010\u0018\u001a\u0004\u0018\u00010\u0017H\u0016J\u001a\u0010\u001c\u001a\u00020\u00022\u0006\u0010\u001b\u001a\u00020\u00192\b\u0010\u0018\u001a\u0004\u0018\u00010\u0017H\u0016J\u000e\u0010\u001f\u001a\u00020\u00022\u0006\u0010\u001e\u001a\u00020\u001dR\"\u0010!\u001a\u00020 8\u0006@\u0006X\u0087.¢\u0006\u0012\n\u0004\b!\u0010\"\u001a\u0004\b#\u0010$\"\u0004\b%\u0010&R\"\u0010(\u001a\u00020'8\u0006@\u0006X\u0087.¢\u0006\u0012\n\u0004\b(\u0010)\u001a\u0004\b*\u0010+\"\u0004\b,\u0010-R\"\u0010/\u001a\u00020.8\u0006@\u0006X\u0087.¢\u0006\u0012\n\u0004\b/\u00100\u001a\u0004\b1\u00102\"\u0004\b3\u00104R\u001b\u0010:\u001a\u0002058BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b6\u00107\u001a\u0004\b8\u00109R\u001b\u0010>\u001a\u00020\u00198BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b;\u00107\u001a\u0004\b<\u0010=R\u001b\u0010A\u001a\u00020\u00198BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b?\u00107\u001a\u0004\b@\u0010=R\u001b\u0010F\u001a\u00020B8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\bC\u00107\u001a\u0004\bD\u0010ER\u001b\u0010K\u001a\u00020G8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\bH\u00107\u001a\u0004\bI\u0010JR\u001b\u0010P\u001a\u00020L8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\bM\u00107\u001a\u0004\bN\u0010OR\u001b\u0010U\u001a\u00020Q8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\bR\u00107\u001a\u0004\bS\u0010TR\u001b\u0010X\u001a\u00020L8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\bV\u00107\u001a\u0004\bW\u0010OR\u0016\u0010Z\u001a\u00020Y8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\bZ\u0010[R\u0016\u0010]\u001a\u00020\\8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b]\u0010^¨\u0006a"}, d2 = {"Lby/kufar/safedeal/ui/SafeDealFragment;", "Lby/kufar/core/android/fragment/BaseFragment;", "", "setupRecyclerView", "setupView", "", "shouldShowCards", "Lby/kufar/sharedmodels/entity/SpanContent;", "description", "safeDealOn", "title", "safeDealOff", "setupViewModel", "isSafeDealOn", "showErrorDialog", "Lby/kufar/safedeal/ui/SafeDealVM$a;", "state", "showState", "onInject", "Landroid/view/LayoutInflater;", "inflater", "Landroid/view/ViewGroup;", "container", "Landroid/os/Bundle;", "savedInstanceState", "Landroid/view/View;", "onCreateView", "view", "onViewCreated", "", "url", "onLinkClick", "Landroidx/lifecycle/ViewModelProvider$Factory;", "viewModelFactory", "Landroidx/lifecycle/ViewModelProvider$Factory;", "getViewModelFactory", "()Landroidx/lifecycle/ViewModelProvider$Factory;", "setViewModelFactory", "(Landroidx/lifecycle/ViewModelProvider$Factory;)V", "Lcb/b;", "mediator", "Lcb/b;", "getMediator", "()Lcb/b;", "setMediator", "(Lcb/b;)V", "Lvk/a;", "tracker", "Lvk/a;", "getTracker", "()Lvk/a;", "setTracker", "(Lvk/a;)V", "Lby/kufar/safedeal/ui/widget/SafeDealToggle;", "toggle$delegate", "Li6/c;", "getToggle", "()Lby/kufar/safedeal/ui/widget/SafeDealToggle;", "toggle", "cardsView$delegate", "getCardsView", "()Landroid/view/View;", "cardsView", "safeDealProgress$delegate", "getSafeDealProgress", "safeDealProgress", "Landroid/widget/ViewAnimator;", "animator$delegate", "getAnimator", "()Landroid/widget/ViewAnimator;", "animator", "Lby/kufar/re/ui/widget/error/ErrorView;", "error$delegate", "getError", "()Lby/kufar/re/ui/widget/error/ErrorView;", "error", "Landroid/widget/TextView;", "more$delegate", "getMore", "()Landroid/widget/TextView;", "more", "Landroidx/recyclerview/widget/RecyclerView;", "tips$delegate", "getTips", "()Landroidx/recyclerview/widget/RecyclerView;", "tips", "cardsDescription$delegate", "getCardsDescription", "cardsDescription", "Lby/kufar/safedeal/ui/SafeDealVM;", "safeDealVM", "Lby/kufar/safedeal/ui/SafeDealVM;", "Lby/kufar/safedeal/ui/adapter/SafeDealTipsController;", "controller", "Lby/kufar/safedeal/ui/adapter/SafeDealTipsController;", "<init>", "()V", "feature-safe-deal_googleRelease"}, k = 1, mv = {1, 9, 0})
public final class SafeDealFragment extends BaseFragment {
    static final KProperty<Object>[] $$delegatedProperties = {o0.i(new g0(SafeDealFragment.class, "toggle", "getToggle()Lby/kufar/safedeal/ui/widget/SafeDealToggle;", 0)), o0.i(new g0(SafeDealFragment.class, "cardsView", "getCardsView()Landroid/view/View;", 0)), o0.i(new g0(SafeDealFragment.class, "safeDealProgress", "getSafeDealProgress()Landroid/view/View;", 0)), o0.i(new g0(SafeDealFragment.class, "animator", "getAnimator()Landroid/widget/ViewAnimator;", 0)), o0.i(new g0(SafeDealFragment.class, "error", "getError()Lby/kufar/re/ui/widget/error/ErrorView;", 0)), o0.i(new g0(SafeDealFragment.class, "more", "getMore()Landroid/widget/TextView;", 0)), o0.i(new g0(SafeDealFragment.class, "tips", "getTips()Landroidx/recyclerview/widget/RecyclerView;", 0)), o0.i(new g0(SafeDealFragment.class, "cardsDescription", "getCardsDescription()Landroid/widget/TextView;", 0))};
    private SafeDealTipsController controller;
    public cb.b mediator;
    private SafeDealVM safeDealVM;
    public vk.a tracker;
    public ViewModelProvider.Factory viewModelFactory;

    private final i6.c toggle = bindView(R$id.f15940k);

    private final i6.c cardsView = bindView(R$id.f15931b);

    private final i6.c safeDealProgress = bindView(R$id.f15939j);

    private final i6.c animator = bindView(R$id.f15930a);

    private final i6.c error = bindView(R$id.f15936g);

    private final i6.c more = bindView(R$id.f15937h);

    private final i6.c tips = bindView(R$id.f15941l);

    private final i6.c cardsDescription = bindView(R$id.f15932c);

    @Metadata(d1 = {"\u0000\u000e\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003H\n¢\u0006\u0002\b\u0004"}, d2 = {"<anonymous>", "", "it", "", "invoke"}, k = 3, mv = {1, 9, 0}, xi = 48)
    public static final class a extends u implements Function1<String, Unit> {
        public a() {
            super(1);
        }

        @Override
        public Unit invoke(String str) {
            invoke2(str);
            return Unit.f82492a;
        }

        public final void invoke2(String it) {
            s.j(it, "it");
            SafeDealFragment.this.onLinkClick(it);
        }
    }

    @Metadata(d1 = {"\u0000\u0017\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u0010\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002H\u0016¨\u0006\u0006"}, d2 = {"by/kufar/safedeal/ui/SafeDealFragment$b", "Landroid/animation/AnimatorListenerAdapter;", "Landroid/animation/Animator;", TJAdUnitConstants.String.SPLIT_VIEW_ANIMATION, "", "onAnimationEnd", "feature-safe-deal_googleRelease"}, k = 1, mv = {1, 9, 0})
    public static final class b extends AnimatorListenerAdapter {
        public b() {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            s.j(animation, "animation");
            super.onAnimationEnd(animation);
            SafeDealFragment.this.getCardsView().setVisibility(8);
        }
    }

    @Metadata(d1 = {"\u0000\u000e\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003H\n¢\u0006\u0002\b\u0004"}, d2 = {"<anonymous>", "", "it", "", "invoke"}, k = 3, mv = {1, 9, 0}, xi = 48)
    public static final class c extends u implements Function1<String, Unit> {
        public c() {
            super(1);
        }

        @Override
        public Unit invoke(String str) {
            invoke2(str);
            return Unit.f82492a;
        }

        public final void invoke2(String it) {
            s.j(it, "it");
            SafeDealFragment.this.onLinkClick(it);
        }
    }

    @Metadata(d1 = {"\u0000\u0017\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u0010\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002H\u0016¨\u0006\u0006"}, d2 = {"by/kufar/safedeal/ui/SafeDealFragment$d", "Landroid/animation/AnimatorListenerAdapter;", "Landroid/animation/Animator;", TJAdUnitConstants.String.SPLIT_VIEW_ANIMATION, "", "onAnimationEnd", "feature-safe-deal_googleRelease"}, k = 1, mv = {1, 9, 0})
    public static final class d extends AnimatorListenerAdapter {
        public d() {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            s.j(animation, "animation");
            super.onAnimationEnd(animation);
            SafeDealFragment.this.getCardsView().setVisibility(0);
        }
    }

    @Metadata(d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\u0010\u0005\u001a\u00020\u00042\b\u0010\u0001\u001a\u0004\u0018\u00010\u00002\u0006\u0010\u0003\u001a\u00020\u0002H\n¢\u0006\u0004\b\u0005\u0010\u0006"}, d2 = {"Landroid/content/DialogInterface;", "dialogInterface", "Landroid/view/View;", "<anonymous parameter 1>", "", "a", "(Landroid/content/DialogInterface;Landroid/view/View;)V"}, k = 3, mv = {1, 9, 0})
    public static final class e extends u implements Function2<DialogInterface, View, Unit> {

        public static final e f16068d = new e();

        public e() {
            super(2);
        }

        public final void a(DialogInterface dialogInterface, View view) {
            s.j(view, "<anonymous parameter 1>");
            if (dialogInterface != null) {
                dialogInterface.dismiss();
            }
        }

        @Override
        public Unit mo1invoke(DialogInterface dialogInterface, View view) {
            a(dialogInterface, view);
            return Unit.f82492a;
        }
    }

    @Metadata(d1 = {"\u0000\u000e\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003H\n¢\u0006\u0002\b\u0004"}, d2 = {"<anonymous>", "", "it", "Landroid/view/View;", "invoke"}, k = 3, mv = {1, 9, 0}, xi = 48)
    public static final class f extends u implements Function1<View, Unit> {

        public final SafeDealVM.a f16070e;

        public f(SafeDealVM.a aVar) {
            super(1);
            this.f16070e = aVar;
        }

        @Override
        public Unit invoke(View view) {
            invoke2(view);
            return Unit.f82492a;
        }

        public final void invoke2(View it) {
            s.j(it, "it");
            SafeDealVM safeDealVM = SafeDealFragment.this.safeDealVM;
            if (safeDealVM == null) {
                s.B("safeDealVM");
                safeDealVM = null;
            }
            safeDealVM.changeSafeDeal(((yk.a) ((SafeDealVM.a.b) this.f16070e).getException()).getIsSafeDealEnabled());
        }
    }

    @Metadata(d1 = {"\u0000\u000e\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003H\n¢\u0006\u0002\b\u0004"}, d2 = {"<anonymous>", "", "it", "Landroid/view/View;", "invoke"}, k = 3, mv = {1, 9, 0}, xi = 48)
    public static final class g extends u implements Function1<View, Unit> {
        public g() {
            super(1);
        }

        @Override
        public Unit invoke(View view) {
            invoke2(view);
            return Unit.f82492a;
        }

        public final void invoke2(View it) {
            s.j(it, "it");
            SafeDealVM safeDealVM = SafeDealFragment.this.safeDealVM;
            if (safeDealVM == null) {
                s.B("safeDealVM");
                safeDealVM = null;
            }
            safeDealVM.refresh();
        }
    }

    private final ViewAnimator getAnimator() {
        return (ViewAnimator) this.animator.getValue(this, $$delegatedProperties[3]);
    }

    private final TextView getCardsDescription() {
        return (TextView) this.cardsDescription.getValue(this, $$delegatedProperties[7]);
    }

    public final View getCardsView() {
        return (View) this.cardsView.getValue(this, $$delegatedProperties[1]);
    }

    private final ErrorView getError() {
        return (ErrorView) this.error.getValue(this, $$delegatedProperties[4]);
    }

    private final TextView getMore() {
        return (TextView) this.more.getValue(this, $$delegatedProperties[5]);
    }

    private final View getSafeDealProgress() {
        return (View) this.safeDealProgress.getValue(this, $$delegatedProperties[2]);
    }

    private final RecyclerView getTips() {
        return (RecyclerView) this.tips.getValue(this, $$delegatedProperties[6]);
    }

    private final SafeDealToggle getToggle() {
        return (SafeDealToggle) this.toggle.getValue(this, $$delegatedProperties[0]);
    }

    private final void safeDealOff(boolean shouldShowCards, SpanContent title) {
        CharSequence c11;
        getToggle().setChecked(false);
        SafeDealToggle toggle = getToggle();
        if (title == null) {
            c11 = getString(R$string.f15950b);
            s.g(c11);
        } else {
            c11 = o5.d.c(o5.d.f87043a, title, false, null, new a(), 6, null);
        }
        toggle.setDescription(c11);
        SafeDealToggle toggle2 = getToggle();
        String string = getString(R$string.f15952d);
        s.i(string, "getString(...)");
        toggle2.setTitle(string);
        if (!shouldShowCards && getCardsView().getVisibility() != 0) {
            return;
        }
        getCardsView().setAlpha(1.0f);
        getCardsView().animate().alpha(0.0f).setListener(new b());
    }

    private final void safeDealOn(boolean shouldShowCards, SpanContent description) {
        CharSequence c11;
        boolean z11 = true;
        getToggle().setChecked(true);
        SafeDealToggle toggle = getToggle();
        if (description == null) {
            c11 = getString(R$string.f15951c);
            s.g(c11);
        } else {
            c11 = o5.d.c(o5.d.f87043a, description, false, null, new c(), 6, null);
        }
        toggle.setDescription(c11);
        SafeDealToggle toggle2 = getToggle();
        String string = getString(R$string.f15954f);
        s.i(string, "getString(...)");
        toggle2.setTitle(string);
        if (shouldShowCards) {
            if (getCardsView().getVisibility() != 0) {
                z11 = false;
            }
            if (!z11) {
                getCardsView().setVisibility(0);
                getCardsView().setAlpha(0.0f);
                getCardsView().animate().alpha(1.0f).setListener(new d());
            }
        }
    }

    private final void setupRecyclerView() {
        Context context = getContext();
        if (context == null) {
            return;
        }
        this.controller = new SafeDealTipsController();
        getTips().setLayoutManager(new LinearLayoutManager(context));
        RecyclerView tips = getTips();
        SafeDealTipsController safeDealTipsController = this.controller;
        if (safeDealTipsController == null) {
            s.B("controller");
            safeDealTipsController = null;
        }
        tips.setAdapter(safeDealTipsController.getAdapter());
    }

    private final void setupView() {
        getCardsDescription().setMovementMethod(LinkMovementMethod.getInstance());
        getCardsView().setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                SafeDealFragment.setupView$lambda$1(SafeDealFragment.this, view);
            }
        });
        getToggle().setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                SafeDealFragment.setupView$lambda$2(SafeDealFragment.this, view);
            }
        });
        getMore().setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                SafeDealFragment.setupView$lambda$4(SafeDealFragment.this, view);
            }
        });
    }

    public static final void setupView$lambda$1(SafeDealFragment this$0, View view) {
        s.j(this$0, "this$0");
        FragmentActivity activity = this$0.getActivity();
        if (activity != null) {
            activity.startActivity(this$0.getMediator().h().a(activity));
        }
    }

    public static final void setupView$lambda$2(SafeDealFragment this$0, View view) {
        s.j(this$0, "this$0");
        SafeDealVM safeDealVM = this$0.safeDealVM;
        if (safeDealVM == null) {
            s.B("safeDealVM");
            safeDealVM = null;
        }
        safeDealVM.changeSafeDeal(!this$0.getToggle().getIsChecked());
    }

    public static final void setupView$lambda$4(SafeDealFragment this$0, View view) {
        s.j(this$0, "this$0");
        Context context = this$0.getContext();
        if (context != null) {
            this$0.startActivity(WebViewActivity.Companion.b(WebViewActivity.INSTANCE, context, "https://support.kufar.by/hc/ru/articles/360006602178?utm_source=Android&utm_medium=SDLinkSeller&utm_campaign=SDSettings", false, null, false, false, 60, null));
        }
    }

    private final void setupViewModel() {
        SafeDealVM safeDealVM = (SafeDealVM) new ViewModelProvider(this, getViewModelFactory()).get(SafeDealVM.class);
        this.safeDealVM = safeDealVM;
        SafeDealVM safeDealVM2 = null;
        if (safeDealVM == null) {
            s.B("safeDealVM");
            safeDealVM = null;
        }
        safeDealVM.getState().observe(getViewLifecycleOwner(), new Observer() {
            @Override
            public final void onChanged(Object obj) {
                SafeDealFragment.setupViewModel$lambda$5(SafeDealFragment.this, (SafeDealVM.a) obj);
            }
        });
        SafeDealVM safeDealVM3 = this.safeDealVM;
        if (safeDealVM3 == null) {
            s.B("safeDealVM");
            safeDealVM3 = null;
        }
        safeDealVM3.getTips().observe(getViewLifecycleOwner(), new Observer() {
            @Override
            public final void onChanged(Object obj) {
                SafeDealFragment.setupViewModel$lambda$6(SafeDealFragment.this, (List) obj);
            }
        });
        SafeDealVM safeDealVM4 = this.safeDealVM;
        if (safeDealVM4 == null) {
            s.B("safeDealVM");
            safeDealVM4 = null;
        }
        safeDealVM4.getCardsDescription().observe(getViewLifecycleOwner(), new Observer() {
            @Override
            public final void onChanged(Object obj) {
                SafeDealFragment.setupViewModel$lambda$7(SafeDealFragment.this, (SpanContent) obj);
            }
        });
        SafeDealVM safeDealVM5 = this.safeDealVM;
        if (safeDealVM5 == null) {
            s.B("safeDealVM");
        } else {
            safeDealVM2 = safeDealVM5;
        }
        safeDealVM2.getErrorDialog().observe(getViewLifecycleOwner(), new Observer() {
            @Override
            public final void onChanged(Object obj) {
                SafeDealFragment.setupViewModel$lambda$8(SafeDealFragment.this, (by.kufar.core.android.arch.a) obj);
            }
        });
    }

    public static final void setupViewModel$lambda$5(SafeDealFragment this$0, SafeDealVM.a aVar) {
        s.j(this$0, "this$0");
        s.g(aVar);
        this$0.showState(aVar);
    }

    public static final void setupViewModel$lambda$6(SafeDealFragment this$0, List list) {
        s.j(this$0, "this$0");
        SafeDealTipsController safeDealTipsController = this$0.controller;
        if (safeDealTipsController == null) {
            s.B("controller");
            safeDealTipsController = null;
        }
        s.g(list);
        safeDealTipsController.setItems(list);
    }

    public static final void setupViewModel$lambda$7(SafeDealFragment this$0, SpanContent spanContent) {
        s.j(this$0, "this$0");
        fk.a.b(this$0.getCardsDescription(), spanContent, false, 2, null);
    }

    public static final void setupViewModel$lambda$8(SafeDealFragment this$0, by.kufar.core.android.arch.a aVar) {
        s.j(this$0, "this$0");
        Boolean bool = (Boolean) aVar.a();
        if (bool != null) {
            this$0.showErrorDialog(bool.booleanValue());
        }
    }

    private final void showErrorDialog(boolean isSafeDealOn) {
        int i11;
        AlertKufarDialogFragment.Companion companion = AlertKufarDialogFragment.INSTANCE;
        if (isSafeDealOn) {
            i11 = R$string.f15955g;
        } else {
            i11 = R$string.f15953e;
        }
        String string = getString(i11);
        s.g(string);
        String string2 = getString(R$string.f15949a);
        s.i(string2, "getString(...)");
        String string3 = getString(R$string.f15957i);
        s.i(string3, "getString(...)");
        AlertKufarDialogFragment.Companion.b(companion, string, string2, string3, null, false, false, 56, null).setPositiveClickListener(e.f16068d).show(getChildFragmentManager(), (String) null);
    }

    private final void showState(SafeDealVM.a state) {
        boolean z11;
        boolean z12;
        boolean z13;
        boolean z14;
        int i11 = -1;
        if (state instanceof SafeDealVM.a.C0297a) {
            getSafeDealProgress().setVisibility(8);
            ViewAnimator animator = getAnimator();
            int i12 = R$id.f15934e;
            Iterator<View> it = ViewGroupKt.getChildren(animator).iterator();
            int i13 = 0;
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                View next = it.next();
                if (i13 < 0) {
                    t.x();
                }
                if (next.getId() == i12) {
                    z14 = true;
                } else {
                    z14 = false;
                }
                if (z14) {
                    i11 = i13;
                    break;
                }
                i13++;
            }
            if (animator.getDisplayedChild() != i11) {
                if (i11 >= 0) {
                    animator.setDisplayedChild(i11);
                } else {
                    throw new IllegalArgumentException("View with ID " + i12 + " not found.");
                }
            }
            SafeDealVM.a.C0297a c0297a = (SafeDealVM.a.C0297a) state;
            if (c0297a.getIsSafeDealOn()) {
                safeDealOn(c0297a.getShouldShowCards(), c0297a.getSafeDealDescription());
                return;
            } else {
                safeDealOff(c0297a.getShouldShowCards(), c0297a.getSafeDealDescription());
                return;
            }
        }
        if (state instanceof SafeDealVM.a.c) {
            ViewAnimator animator2 = getAnimator();
            int i14 = R$id.f15938i;
            Iterator<View> it2 = ViewGroupKt.getChildren(animator2).iterator();
            int i15 = 0;
            while (true) {
                if (!it2.hasNext()) {
                    break;
                }
                View next2 = it2.next();
                if (i15 < 0) {
                    t.x();
                }
                if (next2.getId() == i14) {
                    z13 = true;
                } else {
                    z13 = false;
                }
                if (z13) {
                    i11 = i15;
                    break;
                }
                i15++;
            }
            if (animator2.getDisplayedChild() != i11) {
                if (i11 >= 0) {
                    animator2.setDisplayedChild(i11);
                    return;
                }
                throw new IllegalArgumentException("View with ID " + i14 + " not found.");
            }
            return;
        }
        if (state instanceof SafeDealVM.a.d) {
            getSafeDealProgress().setVisibility(0);
            ViewAnimator animator3 = getAnimator();
            int i16 = R$id.f15934e;
            Iterator<View> it3 = ViewGroupKt.getChildren(animator3).iterator();
            int i17 = 0;
            while (true) {
                if (!it3.hasNext()) {
                    break;
                }
                View next3 = it3.next();
                if (i17 < 0) {
                    t.x();
                }
                if (next3.getId() == i16) {
                    z12 = true;
                } else {
                    z12 = false;
                }
                if (z12) {
                    i11 = i17;
                    break;
                }
                i17++;
            }
            if (animator3.getDisplayedChild() != i11) {
                if (i11 >= 0) {
                    animator3.setDisplayedChild(i11);
                    return;
                }
                throw new IllegalArgumentException("View with ID " + i16 + " not found.");
            }
            return;
        }
        if (state instanceof SafeDealVM.a.b) {
            SafeDealVM.a.b bVar = (SafeDealVM.a.b) state;
            if (bVar.getException() instanceof yk.a) {
                getError().setupError(bVar.getException().getCause());
                getError().setOnRetryListener(new f(state));
            } else {
                getError().setupError(bVar.getException());
                getError().setOnRetryListener(new g());
            }
            ViewAnimator animator4 = getAnimator();
            int i18 = R$id.f15936g;
            Iterator<View> it4 = ViewGroupKt.getChildren(animator4).iterator();
            int i19 = 0;
            while (true) {
                if (!it4.hasNext()) {
                    break;
                }
                View next4 = it4.next();
                if (i19 < 0) {
                    t.x();
                }
                if (next4.getId() == i18) {
                    z11 = true;
                } else {
                    z11 = false;
                }
                if (z11) {
                    i11 = i19;
                    break;
                }
                i19++;
            }
            if (animator4.getDisplayedChild() != i11) {
                if (i11 >= 0) {
                    animator4.setDisplayedChild(i11);
                    return;
                }
                throw new IllegalArgumentException("View with ID " + i18 + " not found.");
            }
        }
    }

    public final cb.b getMediator() {
        cb.b bVar = this.mediator;
        if (bVar != null) {
            return bVar;
        }
        s.B("mediator");
        return null;
    }

    public final vk.a getTracker() {
        vk.a aVar = this.tracker;
        if (aVar != null) {
            return aVar;
        }
        s.B("tracker");
        return null;
    }

    public final ViewModelProvider.Factory getViewModelFactory() {
        ViewModelProvider.Factory factory = this.viewModelFactory;
        if (factory != null) {
            return factory;
        }
        s.B("viewModelFactory");
        return null;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        s.j(inflater, "inflater");
        return inflater.inflate(R$layout.f15946b, container, false);
    }

    @Override
    public void onInject() {
        super.onInject();
        d.a a11 = xk.b.a();
        Object obj = m5.a.d(this).get(xk.e.class);
        if (obj != null) {
            a11.a((xk.e) obj).a(this);
            return;
        }
        throw new NullPointerException("null cannot be cast to non-null type by.kufar.safedeal.di.SafeDealFeatureDependencies");
    }

    public final void onLinkClick(String url) {
        s.j(url, "url");
        Context context = getContext();
        if (context == null) {
            return;
        }
        startActivity(WebViewActivity.Companion.b(WebViewActivity.INSTANCE, context, url, false, null, false, false, 60, null));
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        s.j(view, "view");
        super.onViewCreated(view, savedInstanceState);
        getTracker().a();
        setupViewModel();
        setupView();
        setupRecyclerView();
    }

    public final void setMediator(cb.b bVar) {
        s.j(bVar, "<set-?>");
        this.mediator = bVar;
    }

    public final void setTracker(vk.a aVar) {
        s.j(aVar, "<set-?>");
        this.tracker = aVar;
    }

    public final void setViewModelFactory(ViewModelProvider.Factory factory) {
        s.j(factory, "<set-?>");
        this.viewModelFactory = factory;
    }
}