package xd;

import android.app.Application;
import android.content.Context;
import androidx.lifecycle.a0;
import androidx.lifecycle.f0;
import ca.canadapost.core.data.auth.model.UserProfile;
import ca.canadapost.core.data.model.CoreConstants;
import ca.canadapost.core.data.model.PhoneNumber;
import d9.f;
import kotlin.jvm.internal.t;

/* loaded from: classes4.dex */
public final class k extends androidx.lifecycle.b {

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

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

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

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

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

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

    /* renamed from: i, reason: collision with root package name */
    private final l8.g f50789i;

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

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

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

    /* JADX WARN: Illegal instructions before constructor call */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public k(d9.f analyticsService, t7.c contextService, ja.d sharedPreferencesService, ka.b repository) {
        super((Application) r0);
        t.g(analyticsService, "analyticsService");
        t.g(contextService, "contextService");
        t.g(sharedPreferencesService, "sharedPreferencesService");
        t.g(repository, "repository");
        Context a10 = contextService.a();
        t.e(a10, "null cannot be cast to non-null type android.app.Application");
        this.f50783c = contextService;
        this.f50784d = sharedPreferencesService;
        UserProfile userProfile = (UserProfile) repository.a().f();
        String mfaPhone = userProfile != null ? userProfile.getMfaPhone() : null;
        mfaPhone = mfaPhone == null ? "" : mfaPhone;
        this.f50785e = mfaPhone;
        f0 f0Var = new f0();
        this.f50786f = f0Var;
        f0 f0Var2 = new f0();
        this.f50787g = f0Var2;
        this.f50788h = f0Var2;
        l8.g gVar = new l8.g();
        this.f50789i = gVar;
        this.f50790j = gVar;
        l8.g gVar2 = new l8.g();
        this.f50791k = gVar2;
        this.f50792l = gVar2;
        f0Var.q(mfaPhone);
        f.a.c(analyticsService, "2SV-YourMobilePhoneNumber", null, 2, null);
    }

    private final void W() {
        boolean z10 = this.f50784d.getBoolean(CoreConstants.ARG_SHOW_CASE_VIEW_FOR_TWO_SV, false);
        boolean z11 = this.f50784d.getBoolean(CoreConstants.ARG_SHOW_CASE_VIEW_FOR_TWO_SV_ONCE, false);
        if (z10 || z11) {
            return;
        }
        this.f50784d.putBoolean(CoreConstants.ARG_SHOW_CASE_VIEW_FOR_TWO_SV, true);
    }

    public final a0 Q() {
        return this.f50788h;
    }

    public final f0 R() {
        return this.f50786f;
    }

    public final a0 S() {
        return this.f50792l;
    }

    public final a0 T() {
        return this.f50790j;
    }

    public final void U() {
        W();
        this.f50791k.q(Boolean.valueOf(this.f50785e.length() > 0));
    }

    public final void V() {
        CharSequence charSequence = (CharSequence) this.f50786f.f();
        if (!(charSequence == null || charSequence.length() == 0)) {
            PhoneNumber.Companion companion = PhoneNumber.INSTANCE;
            String str = (String) this.f50786f.f();
            if (str == null) {
                str = "";
            }
            if (companion.isValidPhoneNumber(str)) {
                this.f50787g.q(null);
                l8.g gVar = this.f50789i;
                String str2 = (String) this.f50786f.f();
                gVar.q(companion.removeSpecChars(str2 != null ? str2 : ""));
                return;
            }
        }
        this.f50787g.q(this.f50783c.getString(ld.m.f27971a0));
    }
}
