package lf;

import android.app.Application;
import android.content.Context;
import androidx.lifecycle.a0;
import ca.canadapost.core.data.model.RepositoryError;
import ca.canadapost.core.data.model.ResultWrapper;
import d9.f;
import g9.k;
import kn.l;
import kotlin.jvm.internal.g0;
import kotlin.jvm.internal.p0;
import kotlin.jvm.internal.t;
import l8.g;
import p9.h;

/* loaded from: classes4.dex */
public final class d extends androidx.lifecycle.b implements l8.c {

    /* renamed from: s, reason: collision with root package name */
    static final /* synthetic */ l[] f28058s = {p0.h(new g0(d.class, "doubleClickGuard", "getDoubleClickGuard()Z", 0))};

    /* renamed from: c, reason: collision with root package name */
    private final f f28059c;

    /* renamed from: d, reason: collision with root package name */
    private final t7.c f28060d;

    /* renamed from: e, reason: collision with root package name */
    private final g9.d f28061e;

    /* renamed from: f, reason: collision with root package name */
    private final k f28062f;

    /* renamed from: g, reason: collision with root package name */
    private final ja.d f28063g;

    /* renamed from: h, reason: collision with root package name */
    private final h f28064h;

    /* renamed from: i, reason: collision with root package name */
    private final /* synthetic */ l8.d f28065i;

    /* renamed from: j, reason: collision with root package name */
    private final l8.e f28066j;

    /* renamed from: k, reason: collision with root package name */
    private final g f28067k;

    /* renamed from: l, reason: collision with root package name */
    private final a0 f28068l;

    /* renamed from: m, reason: collision with root package name */
    private final g f28069m;

    /* renamed from: n, reason: collision with root package name */
    private final a0 f28070n;

    /* renamed from: o, reason: collision with root package name */
    private final g f28071o;

    /* renamed from: p, reason: collision with root package name */
    private final a0 f28072p;

    /* renamed from: q, reason: collision with root package name */
    private final androidx.lifecycle.g0 f28073q;

    /* renamed from: r, reason: collision with root package name */
    private final String f28074r;

    /* JADX WARN: Illegal instructions before constructor call */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public d(f analyticsService, t7.c contextService, g9.d sessionRepository, k registrationRepository, ja.d sharedPreferencesService, h featureFlagRepository) {
        super((Application) r0);
        t.g(analyticsService, "analyticsService");
        t.g(contextService, "contextService");
        t.g(sessionRepository, "sessionRepository");
        t.g(registrationRepository, "registrationRepository");
        t.g(sharedPreferencesService, "sharedPreferencesService");
        t.g(featureFlagRepository, "featureFlagRepository");
        Context a10 = contextService.a();
        t.e(a10, "null cannot be cast to non-null type android.app.Application");
        this.f28059c = analyticsService;
        this.f28060d = contextService;
        this.f28061e = sessionRepository;
        this.f28062f = registrationRepository;
        this.f28063g = sharedPreferencesService;
        this.f28064h = featureFlagRepository;
        this.f28065i = new l8.d();
        this.f28066j = new l8.e(false, 0L, 3, null);
        g gVar = new g();
        this.f28067k = gVar;
        this.f28068l = gVar;
        g gVar2 = new g();
        this.f28069m = gVar2;
        this.f28070n = gVar2;
        g gVar3 = new g();
        this.f28071o = gVar3;
        this.f28072p = gVar3;
        androidx.lifecycle.g0 g0Var = new androidx.lifecycle.g0() { // from class: lf.c
            @Override // androidx.lifecycle.g0
            public final void d(Object obj) {
                d.Z(d.this, (Boolean) obj);
            }
        };
        this.f28073q = g0Var;
        sessionRepository.i().k(g0Var);
        String str = t.b(gVar3.f(), Boolean.FALSE) ? "Quickdrop_signin" : "Quickdrop_returnapackage";
        this.f28074r = str;
        f.a.c(analyticsService, str, null, 2, null);
    }

    private final boolean S() {
        return this.f28066j.a(this, f28058s[0]).booleanValue();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void Z(d this$0, Boolean bool) {
        t.g(this$0, "this$0");
        this$0.f28071o.q(bool);
    }

    private final void e0(String str) {
        this.f28059c.b(str, d9.e.f15943f.a("Quickdrop_scanbarcode"));
    }

    private final void f0() {
        k kVar = this.f28062f;
        String str = this.f28074r;
        kVar.m("MOBILE_ANDROID_QUICK_DROP", str, str);
    }

    /* JADX INFO: Access modifiers changed from: protected */
    @Override // androidx.lifecycle.z0
    public void O() {
        this.f28061e.i().o(this.f28073q);
        super.O();
    }

    public final boolean R() {
        return this.f28063g.getBoolean("SELFSCAN_TERMS_AGREED", false);
    }

    public final boolean T() {
        return this.f28063g.getBoolean("SELFSCAN_SHOW_FIRST_TIME", true);
    }

    public final a0 U() {
        return this.f28068l;
    }

    public final a0 V() {
        return this.f28070n;
    }

    public void W(ResultWrapper.Error error, boolean z10) {
        t.g(error, "error");
        this.f28065i.a(error, z10);
    }

    public final void X(dn.a block) {
        t.g(block, "block");
        if (S()) {
            return;
        }
        w8.g0 g0Var = w8.g0.f40967a;
        Context a10 = this.f28060d.a();
        t.f(a10, "getApplicationContext(...)");
        if (!g0Var.a(a10)) {
            W(new ResultWrapper.Error(null, null, RepositoryError.NoNetworkError, null, 8, null), true);
        } else {
            e0("quickdrop_scan_Adobe");
            block.invoke();
        }
    }

    public final a0 Y() {
        return this.f28072p;
    }

    public final void a0(dn.a block) {
        t.g(block, "block");
        if (S()) {
            return;
        }
        w8.g0 g0Var = w8.g0.f40967a;
        Context a10 = this.f28060d.a();
        t.f(a10, "getApplicationContext(...)");
        if (!g0Var.a(a10)) {
            W(new ResultWrapper.Error(null, null, RepositoryError.NoNetworkError, null, 8, null), true);
        } else {
            e0("quickdrop_trackevent_Adobe");
            block.invoke();
        }
    }

    public final void b0(dn.a block) {
        t.g(block, "block");
        if (S()) {
            return;
        }
        block.invoke();
    }

    public final void c0() {
        if (S()) {
            return;
        }
        f0();
        this.f28067k.s();
    }

    public final void d0() {
        if (S()) {
            return;
        }
        f0();
        this.f28069m.s();
    }

    @Override // l8.c
    public a0 o() {
        return this.f28065i.o();
    }

    @Override // l8.c
    public a0 t() {
        return this.f28065i.t();
    }
}
