package ca.canadapost.module.flex;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.k;
import androidx.lifecycle.c1;
import androidx.lifecycle.g0;
import androidx.navigation.fragment.NavHostFragment;
import ca.canadapost.core.data.model.CoreConstants;
import ca.canadapost.core.data.model.Event;
import ca.canadapost.module.flex.FlexOnBoardFragment;
import com.google.firebase.messaging.Constants;
import dn.l;
import gc.a2;
import gc.b2;
import gc.e2;
import gc.q0;
import hc.u;
import kotlin.Metadata;
import kotlin.jvm.internal.n;
import kotlin.jvm.internal.t;
import kotlin.jvm.internal.v;
import n8.m;
import n8.w;
import rm.i;
import rm.n0;
import v4.o;

@Metadata(d1 = {"\u0000J\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0006\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b\u001d\u0010\u001eJ\b\u0010\u0003\u001a\u00020\u0002H\u0002J\u0012\u0010\u0006\u001a\u00020\u00022\b\u0010\u0005\u001a\u0004\u0018\u00010\u0004H\u0016J&\u0010\f\u001a\u0004\u0018\u00010\u000b2\u0006\u0010\b\u001a\u00020\u00072\b\u0010\n\u001a\u0004\u0018\u00010\t2\b\u0010\u0005\u001a\u0004\u0018\u00010\u0004H\u0016J\u001a\u0010\u000e\u001a\u00020\u00022\u0006\u0010\r\u001a\u00020\u000b2\b\u0010\u0005\u001a\u0004\u0018\u00010\u0004H\u0016J\"\u0010\u0014\u001a\u00020\u00022\u0006\u0010\u0010\u001a\u00020\u000f2\u0006\u0010\u0011\u001a\u00020\u000f2\b\u0010\u0013\u001a\u0004\u0018\u00010\u0012H\u0017R\u0016\u0010\u0018\u001a\u00020\u00158\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b\u0016\u0010\u0017R\u0016\u0010\u001c\u001a\u00020\u00198\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b\u001a\u0010\u001b¨\u0006\u001f"}, d2 = {"Lca/canadapost/module/flex/FlexOnBoardFragment;", "Lu8/b;", "Lrm/n0;", "I", "Landroid/os/Bundle;", "savedInstanceState", "onCreate", "Landroid/view/LayoutInflater;", "inflater", "Landroid/view/ViewGroup;", "container", "Landroid/view/View;", "onCreateView", "view", "onViewCreated", "", "requestCode", "resultCode", "Landroid/content/Intent;", Constants.ScionAnalytics.MessageType.DATA_MESSAGE, "onActivityResult", "Lhc/u;", "s", "Lhc/u;", "binding", "Lgc/q0;", "t", "Lgc/q0;", "viewModel", "<init>", "()V", "flex_productionRelease"}, k = 1, mv = {1, 9, 0})
/* loaded from: classes4.dex */
public final class FlexOnBoardFragment extends u8.b {

    /* renamed from: s, reason: collision with root package name and from kotlin metadata */
    private u binding;

    /* renamed from: t, reason: collision with root package name and from kotlin metadata */
    private q0 viewModel;

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

        public final void a(Event event) {
            Boolean bool = (Boolean) event.getContentIfNotHandled();
            if (bool != null) {
                FlexOnBoardFragment flexOnBoardFragment = FlexOnBoardFragment.this;
                if (bool.booleanValue()) {
                    flexOnBoardFragment.I();
                }
            }
        }

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

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

        public final void a(Event event) {
            Boolean bool = (Boolean) event.getContentIfNotHandled();
            if (bool != null) {
                FlexOnBoardFragment flexOnBoardFragment = FlexOnBoardFragment.this;
                if (bool.booleanValue()) {
                    w.a aVar = w.f29869a;
                    k requireActivity = flexOnBoardFragment.requireActivity();
                    t.f(requireActivity, "requireActivity(...)");
                    aVar.a(requireActivity);
                }
            }
        }

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

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

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

        c(l function) {
            t.g(function, "function");
            this.f9405a = function;
        }

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

        @Override // androidx.lifecycle.g0
        public final /* synthetic */ void d(Object obj) {
            this.f9405a.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();
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final void I() {
        m.a aVar = m.f29859a;
        k requireActivity = requireActivity();
        t.f(requireActivity, "requireActivity(...)");
        m.a.b(aVar, requireActivity, null, false, 6, null);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void J(FlexOnBoardFragment this$0, Event event) {
        t.g(this$0, "this$0");
        Boolean bool = (Boolean) event.getContentIfNotHandled();
        if (bool != null) {
            boolean booleanValue = bool.booleanValue();
            o B = x4.d.a(this$0).B();
            boolean z10 = false;
            if (B != null && B.D() == a2.f19554x) {
                z10 = true;
            }
            if (z10 && booleanValue) {
                w8.w.d(NavHostFragment.INSTANCE.a(this$0), a2.f19537g, null, null, 6, null);
            }
        }
    }

    @Override // androidx.fragment.app.f
    public void onActivityResult(int i10, int i11, Intent intent) {
        if (i10 != 2892 || i11 != -1) {
            super.onActivityResult(i10, i11, intent);
            return;
        }
        if (intent == null || !intent.getBooleanExtra(CoreConstants.NAVIGATE_TO_SIGN_IN, false)) {
            return;
        }
        q0 q0Var = this.viewModel;
        if (q0Var == null) {
            t.y("viewModel");
            q0Var = null;
        }
        q0Var.T();
    }

    @Override // u8.b, androidx.fragment.app.f
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.viewModel = (q0) new c1(this, y()).a(q0.class);
    }

    @Override // androidx.fragment.app.f
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        t.g(inflater, "inflater");
        androidx.databinding.n h10 = androidx.databinding.f.h(inflater, b2.f19569k, container, false);
        t.f(h10, "inflate(...)");
        u uVar = (u) h10;
        this.binding = uVar;
        u uVar2 = null;
        if (uVar == null) {
            t.y("binding");
            uVar = null;
        }
        uVar.O(getViewLifecycleOwner());
        u uVar3 = this.binding;
        if (uVar3 == null) {
            t.y("binding");
            uVar3 = null;
        }
        q0 q0Var = this.viewModel;
        if (q0Var == null) {
            t.y("viewModel");
            q0Var = null;
        }
        uVar3.U(q0Var);
        u uVar4 = this.binding;
        if (uVar4 == null) {
            t.y("binding");
        } else {
            uVar2 = uVar4;
        }
        return uVar2.x();
    }

    @Override // u8.b, androidx.fragment.app.f
    public void onViewCreated(View view, Bundle bundle) {
        t.g(view, "view");
        super.onViewCreated(view, bundle);
        k activity = getActivity();
        if (activity != null) {
            activity.setTitle(getString(e2.N));
        }
        q0 q0Var = this.viewModel;
        q0 q0Var2 = null;
        if (q0Var == null) {
            t.y("viewModel");
            q0Var = null;
        }
        q0Var.R().j(getViewLifecycleOwner(), new c(new a()));
        q0 q0Var3 = this.viewModel;
        if (q0Var3 == null) {
            t.y("viewModel");
            q0Var3 = null;
        }
        q0Var3.S().j(getViewLifecycleOwner(), new c(new b()));
        q0 q0Var4 = this.viewModel;
        if (q0Var4 == null) {
            t.y("viewModel");
        } else {
            q0Var2 = q0Var4;
        }
        q0Var2.Q().j(getViewLifecycleOwner(), new g0() { // from class: gc.p0
            @Override // androidx.lifecycle.g0
            public final void d(Object obj) {
                FlexOnBoardFragment.J(FlexOnBoardFragment.this, (Event) obj);
            }
        });
    }
}
