package ca.canadapost.module.epostprofile.userprofile;

import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.k;
import androidx.lifecycle.c1;
import androidx.lifecycle.d1;
import androidx.lifecycle.e1;
import androidx.lifecycle.g0;
import androidx.lifecycle.u;
import androidx.lifecycle.z0;
import ca.canadapost.core.data.model.ResultWrapper;
import ca.canadapost.module.epostprofile.userprofile.UserNotificationsDialogFragment;
import cc.d4;
import kotlin.Metadata;
import kotlin.jvm.internal.n;
import kotlin.jvm.internal.t;
import kotlin.jvm.internal.v;
import l8.h;
import n8.s;
import ob.h;
import ob.i;
import ob.j;
import rm.c0;
import rm.n0;
import rm.o;
import u7.x;
import w8.l;
import w8.p0;
import zb.q3;

@Metadata(d1 = {"\u0000|\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\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\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\n\b\u0007\u0018\u00002\u00020\u00012\b\u0012\u0004\u0012\u00020\u00030\u00022\u00020\u0004B\u0007¢\u0006\u0004\b7\u00108J5\u0010\u0010\u001a\u00020\u000f2\u0006\u0010\u0006\u001a\u00020\u00052\b\u0010\b\u001a\u0004\u0018\u00010\u00072\b\u0010\n\u001a\u0004\u0018\u00010\t2\u0006\u0010\f\u001a\u00020\u000b2\u0006\u0010\u000e\u001a\u00020\rH\u0096\u0001J\u0019\u0010\u0016\u001a\u00020\u00152\u0006\u0010\u0012\u001a\u00020\u00112\u0006\u0010\u0014\u001a\u00020\u0013H\u0096\u0001J\u0019\u0010\u001b\u001a\u00020\u00152\u0006\u0010\u0018\u001a\u00020\u00172\u0006\u0010\u001a\u001a\u00020\u0019H\u0096\u0001J\u0019\u0010\u001c\u001a\u00020\u00152\u0006\u0010\u0014\u001a\u00020\u00132\u0006\u0010\u001a\u001a\u00020\u0019H\u0096\u0001J$\u0010\u001d\u001a\u00020\u000f2\u0006\u0010\u0006\u001a\u00020\u00052\b\u0010\b\u001a\u0004\u0018\u00010\u00072\b\u0010\n\u001a\u0004\u0018\u00010\tH\u0016J\n\u0010\u001f\u001a\u0004\u0018\u00010\u001eH\u0016J\b\u0010!\u001a\u00020 H\u0016J\b\u0010#\u001a\u00020\"H\u0016J\u001a\u0010%\u001a\u00020\u00152\u0006\u0010$\u001a\u00020\u000f2\b\u0010\n\u001a\u0004\u0018\u00010\tH\u0017J\b\u0010&\u001a\u00020\u0015H\u0016R\"\u0010.\u001a\u00020'8\u0006@\u0006X\u0087.¢\u0006\u0012\n\u0004\b(\u0010)\u001a\u0004\b*\u0010+\"\u0004\b,\u0010-R\u001b\u0010\u000e\u001a\u00020/8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b0\u00101\u001a\u0004\b2\u00103R\u0014\u00106\u001a\u00020\u00038\u0016X\u0096\u0005¢\u0006\u0006\u001a\u0004\b4\u00105¨\u00069"}, d2 = {"Lca/canadapost/module/epostprofile/userprofile/UserNotificationsDialogFragment;", "Lca/canadapost/core/common/ui/b;", "", "Lzb/q3;", "Lw8/p0;", "Landroid/view/LayoutInflater;", "inflater", "Landroid/view/ViewGroup;", "container", "Landroid/os/Bundle;", "savedInstanceState", "Landroidx/lifecycle/u;", "viewLifecycleOwner", "Landroidx/lifecycle/z0;", "viewModel", "Landroid/view/View;", "M", "Ll8/h;", "spinnerVM", "Landroidx/fragment/app/f;", "fragment", "Lrm/n0;", "I", "Landroid/app/Activity;", "activity", "Ll8/h$b;", "event", "c", "p", "onCreateView", "Landroidx/appcompat/widget/Toolbar;", "C", "", "B", "", "A", "view", "onViewCreated", "onResume", "Landroidx/lifecycle/c1$c;", "r", "Landroidx/lifecycle/c1$c;", "L", "()Landroidx/lifecycle/c1$c;", "setViewModelFactory", "(Landroidx/lifecycle/c1$c;)V", "viewModelFactory", "Lcc/d4;", "s", "Lrm/o;", "K", "()Lcc/d4;", "J", "()Lzb/q3;", "binding", "<init>", "()V", "epostprofile_productionRelease"}, k = 1, mv = {1, 9, 0})
/* loaded from: classes4.dex */
public final class UserNotificationsDialogFragment extends ca.canadapost.core.common.ui.b implements p0 {

    /* renamed from: r, reason: collision with root package name and from kotlin metadata */
    public c1.c viewModelFactory;

    /* renamed from: p, reason: collision with root package name */
    private final /* synthetic */ x f9097p = new x(j.f31219j0);

    /* renamed from: q, reason: collision with root package name */
    private final /* synthetic */ l f9098q = new l();

    /* renamed from: s, reason: collision with root package name and from kotlin metadata */
    private final o viewModel = androidx.fragment.app.p0.a(this, kotlin.jvm.internal.p0.b(d4.class), new f(new e(this)), new g());

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes4.dex */
    public static final class a extends v implements dn.a {
        a() {
            super(0);
        }

        @Override // dn.a
        public /* bridge */ /* synthetic */ Object invoke() {
            m130invoke();
            return n0.f34904a;
        }

        /* renamed from: invoke, reason: collision with other method in class */
        public final void m130invoke() {
            UserNotificationsDialogFragment.this.K().Z();
        }
    }

    /* loaded from: classes4.dex */
    static final class b extends v implements dn.l {
        b() {
            super(1);
        }

        public final void a(n0 n0Var) {
            s.a aVar = s.f29865a;
            k requireActivity = UserNotificationsDialogFragment.this.requireActivity();
            t.f(requireActivity, "requireActivity(...)");
            aVar.a(requireActivity);
        }

        @Override // dn.l
        public /* bridge */ /* synthetic */ Object invoke(Object obj) {
            a((n0) obj);
            return n0.f34904a;
        }
    }

    /* loaded from: classes4.dex */
    static final class c extends v implements dn.l {
        c() {
            super(1);
        }

        public final void a(ResultWrapper.Error error) {
            x4.d.a(UserNotificationsDialogFragment.this).N(i.I0, androidx.core.os.c.a(c0.a("error_title", UserNotificationsDialogFragment.this.getString(ob.l.W1)), c0.a("error_message", UserNotificationsDialogFragment.this.getString(ob.l.V1)), c0.a("button_text", UserNotificationsDialogFragment.this.getString(ob.l.G1))));
        }

        @Override // dn.l
        public /* bridge */ /* synthetic */ Object invoke(Object obj) {
            a((ResultWrapper.Error) obj);
            return n0.f34904a;
        }
    }

    /* loaded from: classes4.dex */
    static final class d implements g0, n {

        /* renamed from: a, reason: collision with root package name */
        private final /* synthetic */ dn.l f9104a;

        d(dn.l function) {
            t.g(function, "function");
            this.f9104a = function;
        }

        @Override // kotlin.jvm.internal.n
        public final rm.i b() {
            return this.f9104a;
        }

        @Override // androidx.lifecycle.g0
        public final /* synthetic */ void d(Object obj) {
            this.f9104a.invoke(obj);
        }

        public final boolean equals(Object obj) {
            if ((obj instanceof g0) && (obj instanceof n)) {
                return t.b(b(), ((n) obj).b());
            }
            return false;
        }

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

    /* loaded from: classes4.dex */
    public static final class e extends v implements dn.a {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ androidx.fragment.app.f f9105p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public e(androidx.fragment.app.f fVar) {
            super(0);
            this.f9105p = fVar;
        }

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final androidx.fragment.app.f invoke() {
            return this.f9105p;
        }
    }

    /* loaded from: classes4.dex */
    public static final class f extends v implements dn.a {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ dn.a f9106p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public f(dn.a aVar) {
            super(0);
            this.f9106p = aVar;
        }

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final d1 invoke() {
            d1 viewModelStore = ((e1) this.f9106p.invoke()).getViewModelStore();
            t.f(viewModelStore, "ownerProducer().viewModelStore");
            return viewModelStore;
        }
    }

    /* loaded from: classes4.dex */
    static final class g extends v implements dn.a {
        g() {
            super(0);
        }

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final c1.c invoke() {
            return UserNotificationsDialogFragment.this.L();
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final d4 K() {
        return (d4) this.viewModel.getValue();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final boolean N(UserNotificationsDialogFragment this$0, View view, MotionEvent motionEvent) {
        t.g(this$0, "this$0");
        if (motionEvent.getAction() != 0) {
            return false;
        }
        u8.g gVar = new u8.g();
        gVar.v(this$0.getString(ob.l.f31267e3));
        gVar.u(this$0.getString(ob.l.f31257c3));
        gVar.n(this$0.getString(ob.l.f31262d3));
        gVar.p(this$0.getString(ob.l.R0));
        gVar.o(new a());
        gVar.x(this$0.requireContext());
        return true;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final boolean O(UserNotificationsDialogFragment this$0, View view, MotionEvent motionEvent) {
        t.g(this$0, "this$0");
        if (motionEvent.getAction() != 0) {
            return false;
        }
        this$0.K().T();
        return true;
    }

    @Override // ca.canadapost.core.common.ui.b
    public int A() {
        return h.A;
    }

    @Override // ca.canadapost.core.common.ui.b
    public String B() {
        String string = getString(ob.l.F2);
        t.f(string, "getString(...)");
        return string;
    }

    @Override // ca.canadapost.core.common.ui.b
    public Toolbar C() {
        u7.c appBarBinding = J().B.getAppBarBinding();
        if (appBarBinding != null) {
            return appBarBinding.B;
        }
        return null;
    }

    public void I(l8.h spinnerVM, androidx.fragment.app.f fragment) {
        t.g(spinnerVM, "spinnerVM");
        t.g(fragment, "fragment");
        this.f9098q.b(spinnerVM, fragment);
    }

    public q3 J() {
        return (q3) this.f9097p.b();
    }

    public final c1.c L() {
        c1.c cVar = this.viewModelFactory;
        if (cVar != null) {
            return cVar;
        }
        t.y("viewModelFactory");
        return null;
    }

    public View M(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState, u viewLifecycleOwner, z0 viewModel) {
        t.g(inflater, "inflater");
        t.g(viewLifecycleOwner, "viewLifecycleOwner");
        t.g(viewModel, "viewModel");
        return this.f9097p.c(inflater, container, savedInstanceState, viewLifecycleOwner, viewModel);
    }

    @Override // w8.p0
    public void c(Activity activity, h.b event) {
        t.g(activity, "activity");
        t.g(event, "event");
        this.f9098q.c(activity, event);
    }

    @Override // androidx.fragment.app.f
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        t.g(inflater, "inflater");
        LayoutInflater from = LayoutInflater.from(getContext());
        t.f(from, "from(...)");
        u viewLifecycleOwner = getViewLifecycleOwner();
        t.f(viewLifecycleOwner, "getViewLifecycleOwner(...)");
        return M(from, null, savedInstanceState, viewLifecycleOwner, K());
    }

    @Override // androidx.fragment.app.f
    public void onResume() {
        super.onResume();
        K().S();
    }

    @Override // ca.canadapost.core.common.ui.b, androidx.fragment.app.f
    public void onViewCreated(View view, Bundle bundle) {
        t.g(view, "view");
        super.onViewCreated(view, bundle);
        I(K(), this);
        J().C.A.setOnTouchListener(new View.OnTouchListener() { // from class: cc.a4
            @Override // android.view.View.OnTouchListener
            public final boolean onTouch(View view2, MotionEvent motionEvent) {
                boolean N;
                N = UserNotificationsDialogFragment.N(UserNotificationsDialogFragment.this, view2, motionEvent);
                return N;
            }
        });
        J().A.A.setOnTouchListener(new View.OnTouchListener() { // from class: cc.b4
            @Override // android.view.View.OnTouchListener
            public final boolean onTouch(View view2, MotionEvent motionEvent) {
                boolean O;
                O = UserNotificationsDialogFragment.O(UserNotificationsDialogFragment.this, view2, motionEvent);
                return O;
            }
        });
        K().U().j(getViewLifecycleOwner(), new d(new b()));
        K().t().j(getViewLifecycleOwner(), new d(new c()));
    }

    @Override // w8.p0
    public void p(androidx.fragment.app.f fragment, h.b event) {
        t.g(fragment, "fragment");
        t.g(event, "event");
        this.f9098q.p(fragment, event);
    }
}
