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

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


package by.kufar.safety.ui;

import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.core.app.NotificationCompat;
import androidx.core.content.ContextCompat;
import androidx.core.os.BundleKt;
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.core.android.utils.Paginator;
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.safety.R$color;
import by.kufar.safety.R$id;
import by.kufar.safety.R$layout;
import by.kufar.safety.R$string;
import by.kufar.safety.ui.SafetyVM;
import by.kufar.safety.ui.adapter.SafetyController;
import by.kufar.sharedmodels.entity.SpanContent;
import com.google.android.material.snackbar.Snackbar;
import d80.k;
import d80.m;
import d80.u;
import db.w;
import el.d;
import hl.c;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.g0;
import kotlin.jvm.internal.o0;
import kotlin.jvm.internal.s;
import kotlin.reflect.KProperty;

@Metadata(d1 = {"\u0000®\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0005\n\u0002\u0010\u000e\n\u0002\b\u0003\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\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\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\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0002\b\t\u0018\u0000 c2\u00020\u00012\u00020\u0002:\u0001dB\u0007¢\u0006\u0004\ba\u0010bJ\b\u0010\u0004\u001a\u00020\u0003H\u0002J\b\u0010\u0005\u001a\u00020\u0003H\u0002J\b\u0010\u0006\u001a\u00020\u0003H\u0002J\b\u0010\u0007\u001a\u00020\u0003H\u0002J\b\u0010\b\u001a\u00020\u0003H\u0002J\u0010\u0010\u000b\u001a\u00020\u00032\u0006\u0010\n\u001a\u00020\tH\u0002J\b\u0010\f\u001a\u00020\u0003H\u0002J\u0010\u0010\u000f\u001a\u00020\u00032\u0006\u0010\u000e\u001a\u00020\rH\u0002J\b\u0010\u0010\u001a\u00020\u0003H\u0016J&\u0010\u0018\u001a\u0004\u0018\u00010\u00172\u0006\u0010\u0012\u001a\u00020\u00112\b\u0010\u0014\u001a\u0004\u0018\u00010\u00132\b\u0010\u0016\u001a\u0004\u0018\u00010\u0015H\u0016J\u001a\u0010\u001a\u001a\u00020\u00032\u0006\u0010\u0019\u001a\u00020\u00172\b\u0010\u0016\u001a\u0004\u0018\u00010\u0015H\u0016J\b\u0010\u001b\u001a\u00020\u0003H\u0016J\u0010\u0010\u001e\u001a\u00020\u00032\u0006\u0010\u001d\u001a\u00020\u001cH\u0016J\u0010\u0010\u001f\u001a\u00020\u00032\u0006\u0010\u001d\u001a\u00020\u001cH\u0016J\b\u0010 \u001a\u00020\u0003H\u0016J\u0010\u0010#\u001a\u00020\u00032\u0006\u0010\"\u001a\u00020!H\u0016J\u0010\u0010%\u001a\u00020\u00032\u0006\u0010\"\u001a\u00020$H\u0016J\b\u0010&\u001a\u00020\u0003H\u0016J\b\u0010'\u001a\u00020\u0003H\u0016J\b\u0010(\u001a\u00020\u0003H\u0016J\"\u0010.\u001a\u00020\u00032\u0006\u0010*\u001a\u00020)2\u0006\u0010+\u001a\u00020)2\b\u0010-\u001a\u0004\u0018\u00010,H\u0016R\"\u00100\u001a\u00020/8\u0006@\u0006X\u0087.¢\u0006\u0012\n\u0004\b0\u00101\u001a\u0004\b2\u00103\"\u0004\b4\u00105R\"\u00107\u001a\u0002068\u0006@\u0006X\u0087.¢\u0006\u0012\n\u0004\b7\u00108\u001a\u0004\b9\u0010:\"\u0004\b;\u0010<R\"\u0010>\u001a\u00020=8\u0006@\u0006X\u0087.¢\u0006\u0012\n\u0004\b>\u0010?\u001a\u0004\b@\u0010A\"\u0004\bB\u0010CR\u0016\u0010E\u001a\u00020D8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\bE\u0010FR\u0016\u0010H\u001a\u00020G8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\bH\u0010IR\u0018\u0010K\u001a\u0004\u0018\u00010J8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bK\u0010LR\u001b\u0010R\u001a\u00020M8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\bN\u0010O\u001a\u0004\bP\u0010QR\u001b\u0010V\u001a\u00020\u00178BX\u0082\u0084\u0002¢\u0006\f\n\u0004\bS\u0010O\u001a\u0004\bT\u0010UR\u001b\u0010[\u001a\u00020W8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\bX\u0010O\u001a\u0004\bY\u0010ZR\u001b\u0010_\u001a\u00020\\8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b]\u0010^\u001a\u0004\b_\u0010`¨\u0006e"}, d2 = {"Lby/kufar/safety/ui/SafetyFragment;", "Lby/kufar/core/android/fragment/BaseFragment;", "Lby/kufar/safety/ui/adapter/SafetyController$a;", "", "turnOnMfa", "showDisclaimerMfaTurnOffDialog", "changePassword", "setUpRecycler", "setUpViewModel", "", "url", "openUrl", "openLogin", "Lby/kufar/safety/ui/SafetyVM$a;", "state", "showState", "onInject", "Landroid/view/LayoutInflater;", "inflater", "Landroid/view/ViewGroup;", "container", "Landroid/os/Bundle;", "savedInstanceState", "Landroid/view/View;", "onCreateView", "view", "onViewCreated", "onStart", "Lhl/c$b;", NotificationCompat.CATEGORY_PROMO, "onMfaPromoActionClick", "onMfaPromoInfoClick", "onDeleteProfileClick", "Lhl/c$f;", "item", "onSessionLimiterClick", "Lhl/c$g;", "onSettingsButtonClick", "onProtectYourselfButtonClick", "onFinishSessionButtonClick", "onRetryClick", "", "requestCode", "resultCode", "Landroid/content/Intent;", "data", "onActivityResult", "Landroidx/lifecycle/ViewModelProvider$Factory;", "viewModelFactory", "Landroidx/lifecycle/ViewModelProvider$Factory;", "getViewModelFactory", "()Landroidx/lifecycle/ViewModelProvider$Factory;", "setViewModelFactory", "(Landroidx/lifecycle/ViewModelProvider$Factory;)V", "Lcl/a;", "safetyTracker", "Lcl/a;", "getSafetyTracker", "()Lcl/a;", "setSafetyTracker", "(Lcl/a;)V", "Lcb/b;", "mediator", "Lcb/b;", "getMediator", "()Lcb/b;", "setMediator", "(Lcb/b;)V", "Lby/kufar/safety/ui/SafetyVM;", "viewModel", "Lby/kufar/safety/ui/SafetyVM;", "Lby/kufar/safety/ui/adapter/SafetyController;", "controller", "Lby/kufar/safety/ui/adapter/SafetyController;", "Lby/kufar/core/android/utils/Paginator;", "paginator", "Lby/kufar/core/android/utils/Paginator;", "Landroidx/recyclerview/widget/RecyclerView;", "recycler$delegate", "Li6/c;", "getRecycler", "()Landroidx/recyclerview/widget/RecyclerView;", "recycler", "progress$delegate", "getProgress", "()Landroid/view/View;", "progress", "Lby/kufar/re/ui/widget/error/ErrorView;", "error$delegate", "getError", "()Lby/kufar/re/ui/widget/error/ErrorView;", "error", "", "isFromDeeplink$delegate", "Ld80/j;", "isFromDeeplink", "()Z", "<init>", "()V", "Companion", "a", "feature-safety_googleRelease"}, k = 1, mv = {1, 9, 0})
public final class SafetyFragment extends BaseFragment implements SafetyController.a {
    static final KProperty<Object>[] $$delegatedProperties = {o0.i(new g0(SafetyFragment.class, "recycler", "getRecycler()Landroidx/recyclerview/widget/RecyclerView;", 0)), o0.i(new g0(SafetyFragment.class, "progress", "getProgress()Landroid/view/View;", 0)), o0.i(new g0(SafetyFragment.class, "error", "getError()Lby/kufar/re/ui/widget/error/ErrorView;", 0))};

    public static final Companion INSTANCE = new Companion(null);
    public static final String KEY_IS_FROM_DEEPLINK = "IS_FROM_DEEPLINK";
    public static final int MFA_TURNING_REQUEST_CODE = 1000;
    private SafetyController controller;
    public cb.b mediator;
    private Paginator paginator;
    public cl.a safetyTracker;
    private SafetyVM viewModel;
    public ViewModelProvider.Factory viewModelFactory;

    private final i6.c recycler = bindView(R$id.f16120l);

    private final i6.c progress = bindView(R$id.f16118j);

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

    private final d80.j isFromDeeplink = k.a(m.f73493d, new j());

    @Metadata(d1 = {"\u0000$\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0005\b\u0086\u0003\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\f\u0010\rJ\u000e\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002R\u0014\u0010\u0007\u001a\u00020\u00068\u0006X\u0086T¢\u0006\u0006\n\u0004\b\u0007\u0010\bR\u0014\u0010\n\u001a\u00020\t8\u0006X\u0086T¢\u0006\u0006\n\u0004\b\n\u0010\u000b¨\u0006\u000e"}, d2 = {"Lby/kufar/safety/ui/SafetyFragment$a;", "", "", "isFromDeeplink", "Lby/kufar/safety/ui/SafetyFragment;", "a", "", "KEY_IS_FROM_DEEPLINK", "Ljava/lang/String;", "", "MFA_TURNING_REQUEST_CODE", "I", "<init>", "()V", "feature-safety_googleRelease"}, k = 1, mv = {1, 9, 0})
    public static final class Companion {
        public Companion() {
        }

        public Companion(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        public final SafetyFragment a(boolean isFromDeeplink) {
            SafetyFragment safetyFragment = new SafetyFragment();
            safetyFragment.setArguments(BundleKt.bundleOf(u.a("IS_FROM_DEEPLINK", Boolean.valueOf(isFromDeeplink))));
            return safetyFragment;
        }
    }

    @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;", "view", "", "a", "(Landroid/content/DialogInterface;Landroid/view/View;)V"}, k = 3, mv = {1, 9, 0})
    public static final class b extends kotlin.jvm.internal.u implements Function2<DialogInterface, View, Unit> {
        public b() {
            super(2);
        }

        public final void a(DialogInterface dialogInterface, View view) {
            s.j(view, "view");
            if (dialogInterface != null) {
                dialogInterface.dismiss();
            }
            SafetyVM safetyVM = SafetyFragment.this.viewModel;
            if (safetyVM == null) {
                s.B("viewModel");
                safetyVM = null;
            }
            safetyVM.finishAllSessions();
            SafetyFragment.this.getSafetyTracker().d();
        }

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

    @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;", "view", "", "a", "(Landroid/content/DialogInterface;Landroid/view/View;)V"}, k = 3, mv = {1, 9, 0})
    public static final class c extends kotlin.jvm.internal.u implements Function2<DialogInterface, View, Unit> {

        public static final c f16269d = new c();

        public c() {
            super(2);
        }

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

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

    @Metadata(k = 3, mv = {1, 9, 0}, xi = 48)
    public static final class d implements Observer, kotlin.jvm.internal.m {

        public final Function1 f16270b;

        public d(Function1 function) {
            s.j(function, "function");
            this.f16270b = function;
        }

        public final boolean equals(Object obj) {
            if (!(obj instanceof Observer) || !(obj instanceof kotlin.jvm.internal.m)) {
                return false;
            }
            return s.e(getFunctionDelegate(), ((kotlin.jvm.internal.m) obj).getFunctionDelegate());
        }

        @Override
        public final d80.f<?> getFunctionDelegate() {
            return this.f16270b;
        }

        public final int hashCode() {
            return getFunctionDelegate().hashCode();
        }

        @Override
        public final void onChanged(Object obj) {
            this.f16270b.invoke(obj);
        }
    }

    @Metadata(d1 = {"\u0000\u0010\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\u0010\u0004\u001a\u00020\u00032\u000e\u0010\u0002\u001a\n \u0001*\u0004\u0018\u00010\u00000\u0000H\n¢\u0006\u0004\b\u0004\u0010\u0005"}, d2 = {"", "kotlin.jvm.PlatformType", "it", "", "a", "(Ljava/lang/Boolean;)V"}, k = 3, mv = {1, 9, 0})
    public static final class e extends kotlin.jvm.internal.u implements Function1<Boolean, Unit> {
        public e() {
            super(1);
        }

        public final void a(Boolean bool) {
            s.g(bool);
            if (bool.booleanValue()) {
                SafetyFragment safetyFragment = SafetyFragment.this;
                Paginator.Companion companion = Paginator.INSTANCE;
                RecyclerView recycler = safetyFragment.getRecycler();
                SafetyVM safetyVM = SafetyFragment.this.viewModel;
                if (safetyVM == null) {
                    s.B("viewModel");
                    safetyVM = null;
                }
                safetyFragment.paginator = companion.a(recycler, safetyVM);
                return;
            }
            Paginator.INSTANCE.b(SafetyFragment.this.getRecycler(), SafetyFragment.this.paginator);
        }

        @Override
        public Unit invoke(Boolean bool) {
            a(bool);
            return Unit.f82492a;
        }
    }

    @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;", "view", "", "a", "(Landroid/content/DialogInterface;Landroid/view/View;)V"}, k = 3, mv = {1, 9, 0})
    public static final class f extends kotlin.jvm.internal.u implements Function2<DialogInterface, View, Unit> {
        public f() {
            super(2);
        }

        public final void a(DialogInterface dialogInterface, View view) {
            s.j(view, "view");
            if (dialogInterface != null) {
                dialogInterface.dismiss();
            }
            SafetyFragment.this.getSafetyTracker().f();
        }

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

    @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;", "view", "", "a", "(Landroid/content/DialogInterface;Landroid/view/View;)V"}, k = 3, mv = {1, 9, 0})
    public static final class g extends kotlin.jvm.internal.u implements Function2<DialogInterface, View, Unit> {
        public g() {
            super(2);
        }

        public final void a(DialogInterface dialogInterface, View view) {
            s.j(view, "view");
            if (dialogInterface != null) {
                dialogInterface.dismiss();
            }
            SafetyVM safetyVM = SafetyFragment.this.viewModel;
            if (safetyVM == null) {
                s.B("viewModel");
                safetyVM = null;
            }
            safetyVM.turnOffMfa();
        }

        @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 h extends kotlin.jvm.internal.u implements Function1<View, Unit> {
        public h() {
            super(1);
        }

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

        public final void invoke2(View it) {
            s.j(it, "it");
            SafetyVM safetyVM = SafetyFragment.this.viewModel;
            if (safetyVM == null) {
                s.B("viewModel");
                safetyVM = null;
            }
            safetyVM.finishAllSessions();
        }
    }

    @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 i extends kotlin.jvm.internal.u implements Function1<View, Unit> {
        public i() {
            super(1);
        }

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

        public final void invoke2(View it) {
            s.j(it, "it");
            SafetyVM safetyVM = SafetyFragment.this.viewModel;
            if (safetyVM == null) {
                s.B("viewModel");
                safetyVM = null;
            }
            safetyVM.refresh();
        }
    }

    @Metadata(d1 = {"\u0000\u0004\n\u0002\b\u0004\u0010\u0003\u001a\u00028\u0000\"\u0004\b\u0000\u0010\u0000H\n¢\u0006\u0004\b\u0001\u0010\u0002"}, d2 = {"T", "invoke", "()Ljava/lang/Object;", "<anonymous>"}, k = 3, mv = {1, 9, 0})
    public static final class j extends kotlin.jvm.internal.u implements Function0<Boolean> {
        public j() {
            super(0);
        }

        @Override
        public final Boolean invoke() {
            boolean z11;
            Bundle arguments = SafetyFragment.this.getArguments();
            if (arguments != null) {
                z11 = arguments.getBoolean("IS_FROM_DEEPLINK");
            } else {
                z11 = false;
            }
            return Boolean.valueOf(z11);
        }
    }

    private final void changePassword() {
        Context context = getContext();
        if (context == null) {
            return;
        }
        getSafetyTracker().b();
        startActivity(getMediator().F().c(context));
    }

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

    private final View getProgress() {
        return (View) this.progress.getValue(this, $$delegatedProperties[1]);
    }

    public final RecyclerView getRecycler() {
        return (RecyclerView) this.recycler.getValue(this, $$delegatedProperties[0]);
    }

    private final boolean isFromDeeplink() {
        return ((Boolean) this.isFromDeeplink.getValue()).booleanValue();
    }

    private final void openLogin() {
        Context context = getContext();
        if (context == null) {
            return;
        }
        startActivity(w.a.a(getMediator().D(), context, null, null, 6, null));
        startActivity(getMediator().F().a(context));
        FragmentActivity activity = getActivity();
        if (activity != null) {
            activity.finish();
        }
    }

    private final void openUrl(String url) {
        Context context = getContext();
        if (context == null) {
            return;
        }
        startActivity(WebViewActivity.Companion.b(WebViewActivity.INSTANCE, context, url, false, null, false, false, 60, null));
    }

    private final void setUpRecycler() {
        Context context = getContext();
        if (context == null) {
            return;
        }
        this.controller = new SafetyController(context, this);
        RecyclerView recycler = getRecycler();
        SafetyController safetyController = this.controller;
        if (safetyController == null) {
            s.B("controller");
            safetyController = null;
        }
        recycler.setAdapter(safetyController.getAdapter());
        getRecycler().setLayoutManager(new LinearLayoutManager(context));
    }

    private final void setUpViewModel() {
        SafetyVM safetyVM = (SafetyVM) new ViewModelProvider(this, getViewModelFactory()).get(SafetyVM.class);
        this.viewModel = safetyVM;
        if (safetyVM == null) {
            s.B("viewModel");
            safetyVM = null;
        }
        safetyVM.getState().observe(getViewLifecycleOwner(), new Observer() {
            @Override
            public final void onChanged(Object obj) {
                SafetyFragment.setUpViewModel$lambda$8$lambda$2(SafetyFragment.this, (SafetyVM.a) obj);
            }
        });
        safetyVM.getShowLogin().observe(getViewLifecycleOwner(), new Observer() {
            @Override
            public final void onChanged(Object obj) {
                SafetyFragment.setUpViewModel$lambda$8$lambda$3(SafetyFragment.this, (Unit) obj);
            }
        });
        safetyVM.getFooterProgress().observe(getViewLifecycleOwner(), new Observer() {
            @Override
            public final void onChanged(Object obj) {
                SafetyFragment.setUpViewModel$lambda$8$lambda$4(SafetyFragment.this, (Boolean) obj);
            }
        });
        safetyVM.getFooterError().observe(getViewLifecycleOwner(), new Observer() {
            @Override
            public final void onChanged(Object obj) {
                SafetyFragment.setUpViewModel$lambda$8$lambda$5(SafetyFragment.this, (Boolean) obj);
            }
        });
        safetyVM.getSnackError().observe(getViewLifecycleOwner(), new Observer() {
            @Override
            public final void onChanged(Object obj) {
                SafetyFragment.setUpViewModel$lambda$8$lambda$6(SafetyFragment.this, (by.kufar.core.android.arch.a) obj);
            }
        });
        safetyVM.getSnackErrorSpan().observe(getViewLifecycleOwner(), new Observer() {
            @Override
            public final void onChanged(Object obj) {
                SafetyFragment.setUpViewModel$lambda$8$lambda$7(SafetyFragment.this, (by.kufar.core.android.arch.a) obj);
            }
        });
        safetyVM.isPaginatorWorking().observe(getViewLifecycleOwner(), new d(new e()));
        safetyVM.refresh();
    }

    public static final void setUpViewModel$lambda$8$lambda$2(SafetyFragment this$0, SafetyVM.a aVar) {
        s.j(this$0, "this$0");
        s.g(aVar);
        this$0.showState(aVar);
    }

    public static final void setUpViewModel$lambda$8$lambda$3(SafetyFragment this$0, Unit unit) {
        s.j(this$0, "this$0");
        this$0.openLogin();
    }

    public static final void setUpViewModel$lambda$8$lambda$4(SafetyFragment this$0, Boolean bool) {
        s.j(this$0, "this$0");
        SafetyController safetyController = this$0.controller;
        if (safetyController == null) {
            s.B("controller");
            safetyController = null;
        }
        s.g(bool);
        safetyController.showFooterProgress(bool.booleanValue());
    }

    public static final void setUpViewModel$lambda$8$lambda$5(SafetyFragment this$0, Boolean bool) {
        s.j(this$0, "this$0");
        SafetyController safetyController = this$0.controller;
        if (safetyController == null) {
            s.B("controller");
            safetyController = null;
        }
        s.g(bool);
        safetyController.showFooterError(bool.booleanValue());
    }

    public static final void setUpViewModel$lambda$8$lambda$6(SafetyFragment this$0, by.kufar.core.android.arch.a aVar) {
        s.j(this$0, "this$0");
        Integer num = (Integer) aVar.a();
        if (num != null) {
            Snackbar s11 = ek.b.s(ek.b.f75340a, this$0.getView(), this$0.getString(num.intValue()), 0, null, 0, null, 56, null);
            if (s11 != null) {
                s11.W();
            }
        }
    }

    public static final void setUpViewModel$lambda$8$lambda$7(SafetyFragment this$0, by.kufar.core.android.arch.a aVar) {
        Snackbar r11;
        s.j(this$0, "this$0");
        SpanContent spanContent = (SpanContent) aVar.a();
        if (spanContent != null && (r11 = ek.b.r(ek.b.f75340a, this$0.getView(), spanContent, 0, null, 0, null, 56, null)) != null) {
            r11.W();
        }
    }

    private final void showDisclaimerMfaTurnOffDialog() {
        getSafetyTracker().g();
        AlertKufarDialogFragment.Companion companion = AlertKufarDialogFragment.INSTANCE;
        String string = getString(R$string.f16149k);
        s.i(string, "getString(...)");
        String string2 = getString(R$string.f16146h);
        s.i(string2, "getString(...)");
        String string3 = getString(R$string.f16148j);
        s.i(string3, "getString(...)");
        String string4 = getString(R$string.f16147i);
        s.i(string4, "getString(...)");
        AlertKufarDialogFragment.Companion.b(companion, string, string2, string3, string4, false, false, 48, null).setPositiveClickListener(new f()).setNegativeListener(new g()).show(getChildFragmentManager(), (String) null);
    }

    private final void showState(SafetyVM.a state) {
        if (state instanceof SafetyVM.a.C0299a) {
            SafetyController safetyController = this.controller;
            if (safetyController == null) {
                s.B("controller");
                safetyController = null;
            }
            safetyController.setItems(((SafetyVM.a.C0299a) state).a());
            getRecycler().setVisibility(0);
            getProgress().setVisibility(8);
            getError().setVisibility(8);
            return;
        }
        if (s.e(state, SafetyVM.a.c.f16279a)) {
            getRecycler().setVisibility(0);
            getProgress().setVisibility(0);
            getError().setVisibility(8);
        } else if (state instanceof SafetyVM.a.b) {
            getRecycler().setVisibility(8);
            getProgress().setVisibility(8);
            getError().setVisibility(0);
            SafetyVM.a.b bVar = (SafetyVM.a.b) state;
            getError().setupError(bVar.getException());
            if (bVar.getException() instanceof fl.a) {
                getError().setOnRetryListener(new h());
            } else {
                getError().setOnRetryListener(new i());
            }
        }
    }

    private final void turnOnMfa() {
        getSafetyTracker().h();
        Context context = getContext();
        if (context == null) {
            return;
        }
        startActivityForResult(getMediator().m().b(context), 1000);
    }

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

    public final cl.a getSafetyTracker() {
        cl.a aVar = this.safetyTracker;
        if (aVar != null) {
            return aVar;
        }
        s.B("safetyTracker");
        return null;
    }

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

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == 1000 && resultCode == -1) {
            SafetyVM safetyVM = this.viewModel;
            if (safetyVM == null) {
                s.B("viewModel");
                safetyVM = null;
            }
            safetyVM.onMfaTurnedOn();
        }
    }

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

    @Override
    public void onDeleteProfileClick() {
        Context context = getContext();
        if (context == null) {
            return;
        }
        getSafetyTracker().a();
        startActivity(getMediator().O().c(context));
    }

    @Override
    public void onFinishSessionButtonClick() {
        Context context = getContext();
        if (context == null) {
            return;
        }
        getSafetyTracker().c();
        SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
        ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(ContextCompat.getColor(context, R$color.f16103c));
        int length = spannableStringBuilder.length();
        spannableStringBuilder.append((CharSequence) getString(R$string.f16153o));
        spannableStringBuilder.setSpan(foregroundColorSpan, length, spannableStringBuilder.length(), 17);
        AlertKufarDialogFragment.Companion companion = AlertKufarDialogFragment.INSTANCE;
        String string = getString(R$string.f16155q);
        s.i(string, "getString(...)");
        String string2 = getString(R$string.f16154p);
        s.i(string2, "getString(...)");
        String string3 = getString(R$string.f16152n);
        s.i(string3, "getString(...)");
        AlertKufarDialogFragment.Companion.b(companion, string, string2, spannableStringBuilder, string3, false, false, 48, null).setPositiveClickListener(new b()).setNegativeListener(c.f16269d).show(getChildFragmentManager(), (String) null);
    }

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

    @Override
    public void onMfaPromoActionClick(c.MfaPromo promo) {
        s.j(promo, "promo");
        if (promo.getId() == R$id.f16122n) {
            turnOnMfa();
        }
    }

    @Override
    public void onMfaPromoInfoClick(c.MfaPromo promo) {
        s.j(promo, "promo");
        openUrl(promo.getInfoUrl());
    }

    @Override
    public void onProtectYourselfButtonClick() {
        openUrl("https://safety.kufar.by/buyers?utm_source=android&utm_medium=profile&utm_campaign=safety");
    }

    @Override
    public void onRetryClick() {
        SafetyVM safetyVM = this.viewModel;
        if (safetyVM == null) {
            s.B("viewModel");
            safetyVM = null;
        }
        safetyVM.refresh();
    }

    @Override
    public void onSessionLimiterClick(c.SessionLimiter item) {
        s.j(item, "item");
        SafetyVM safetyVM = this.viewModel;
        if (safetyVM == null) {
            s.B("viewModel");
            safetyVM = null;
        }
        safetyVM.onSessionLimiterClicked(item);
    }

    @Override
    public void onSettingsButtonClick(c.SettingsButton item) {
        s.j(item, "item");
        int id2 = item.getId();
        if (id2 == R$id.f16123o) {
            turnOnMfa();
        } else if (id2 == R$id.f16121m) {
            showDisclaimerMfaTurnOffDialog();
        } else if (id2 == R$id.f16125q) {
            changePassword();
        }
    }

    @Override
    public void onStart() {
        super.onStart();
        if (isFromDeeplink()) {
            getSafetyTracker().e();
        }
        getSafetyTracker().i();
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        s.j(view, "view");
        super.onViewCreated(view, savedInstanceState);
        setUpViewModel();
        setUpRecycler();
    }

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

    public final void setSafetyTracker(cl.a aVar) {
        s.j(aVar, "<set-?>");
        this.safetyTracker = aVar;
    }

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