package com.vinfast.companion.main.ui.testdrive;

/* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
/* JADX INFO: loaded from: E:\ios\vf_dex\classes3.dex */
@kotlin.Metadata(d1 = {"\u0000F\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0006\b\u0007\u0018\u0000 \u001f2\b\u0012\u0004\u0012\u00020\u00020\u0001:\u0001 B\u0007¢\u0006\u0004\b\u0003\u0010\u0004J\u0019\u0010\b\u001a\u00020\u00072\b\u0010\u0006\u001a\u0004\u0018\u00010\u0005H\u0002¢\u0006\u0004\b\b\u0010\tJ\u0019\u0010\f\u001a\u00020\u00072\b\u0010\u000b\u001a\u0004\u0018\u00010\nH\u0002¢\u0006\u0004\b\f\u0010\rJ#\u0010\u0010\u001a\u00020\u00072\b\u0010\u000b\u001a\u0004\u0018\u00010\n2\b\b\u0002\u0010\u000f\u001a\u00020\u000eH\u0002¢\u0006\u0004\b\u0010\u0010\u0011J\u001b\u0010\u0013\u001a\u0004\u0018\u00010\u00122\b\u0010\u000b\u001a\u0004\u0018\u00010\nH\u0002¢\u0006\u0004\b\u0013\u0010\u0014J\u0019\u0010\u0016\u001a\u00020\u00072\b\u0010\u0015\u001a\u0004\u0018\u00010\u0005H\u0016¢\u0006\u0004\b\u0016\u0010\tJ\u0017\u0010\u0019\u001a\u00020\u00072\u0006\u0010\u0018\u001a\u00020\u0017H\u0014¢\u0006\u0004\b\u0019\u0010\u001aR\u0016\u0010\u001e\u001a\u0004\u0018\u00010\u001b8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u001c\u0010\u001d¨\u0006!"}, d2 = {"Lcom/vinfast/companion/main/ui/testdrive/TestDriveActivity;", "Lcom/vinfast/companion/core/base/activity/BaseActivity;", "Lcom/vinfast/companion/services/databinding/ActivityTestDriveBinding;", "<init>", "()V", "Landroid/os/Bundle;", "extras", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "c1", "(Landroid/os/Bundle;)V", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "appointmentId", "e1", "(Ljava/lang/String;)V", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "isFromNotification", "d1", "(Ljava/lang/String;Z)V", "Lcom/vinfast/companion/main/ui/testdrive/detail/TestDriveAppointmentDetailFragment;", "b1", "(Ljava/lang/String;)Lcom/vinfast/companion/main/ui/testdrive/detail/TestDriveAppointmentDetailFragment;", "savedInstanceState", "P0", "Landroid/content/Intent;", "intent", "onNewIntent", "(Landroid/content/Intent;)V", "Landroidx/navigation/fragment/NavHostFragment;", "a1", "()Landroidx/navigation/fragment/NavHostFragment;", "navHostFragment", "e6", "Companion", "services_release"}, k = 1, mv = {2, 2, 0}, xi = 48)
@dagger.hilt.android.AndroidEntryPoint
public final class TestDriveActivity extends com.vinfast.companion.main.ui.testdrive.Hilt_TestDriveActivity<com.vinfast.companion.services.databinding.ActivityTestDriveBinding> {

    /* JADX INFO: renamed from: e6, reason: from kotlin metadata */
    public static final com.vinfast.companion.main.ui.testdrive.TestDriveActivity.Companion INSTANCE = new com.vinfast.companion.main.ui.testdrive.TestDriveActivity.Companion(null);

    /* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
    @kotlin.Metadata(d1 = {"\u0000&\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\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\u0003\b\u0086\u0003\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0002\u0010\u0003J/\u0010\u000b\u001a\u00020\n2\u0006\u0010\u0005\u001a\u00020\u00042\n\b\u0002\u0010\u0007\u001a\u0004\u0018\u00010\u00062\n\b\u0002\u0010\t\u001a\u0004\u0018\u00010\bH\u0007¢\u0006\u0004\b\u000b\u0010\f¨\u0006\r"}, d2 = {"Lcom/vinfast/companion/main/ui/testdrive/TestDriveActivity$Companion;", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "<init>", "()V", "Landroid/content/Context;", "context", "Landroid/os/Bundle;", "extras", "Lcom/vinfast/companion/core/utils/notification/Notification;", "notification", "Landroid/content/Intent;", "a", "(Landroid/content/Context;Landroid/os/Bundle;Lcom/vinfast/companion/core/utils/notification/Notification;)Landroid/content/Intent;", "services_release"}, k = 1, mv = {2, 2, 0}, xi = 48)
    public static final class Companion {

        /* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
        @kotlin.Metadata(k = 3, mv = {2, 2, 0}, xi = 48)
        public static final /* synthetic */ class WhenMappings {
            public static final /* synthetic */ int[] a;

            static {
                int[] iArr = new int[com.vinfast.companion.core.utils.notification.NotificationCategory.values().length];
                try {
                    iArr[com.vinfast.companion.core.utils.notification.NotificationCategory.TestDriveReminder1Hour.ordinal()] = 1;
                } catch (java.lang.NoSuchFieldError unused) {
                }
                try {
                    iArr[com.vinfast.companion.core.utils.notification.NotificationCategory.TestDriveReminder24Hour.ordinal()] = 2;
                } catch (java.lang.NoSuchFieldError unused2) {
                }
                a = iArr;
            }
        }

        public /* synthetic */ Companion(kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        public static /* synthetic */ android.content.Intent b(com.vinfast.companion.main.ui.testdrive.TestDriveActivity.Companion companion, android.content.Context context, android.os.Bundle bundle, com.vinfast.companion.core.utils.notification.Notification notification, int i, java.lang.Object obj) {
            if ((i & 2) != 0) {
                bundle = null;
            }
            if ((i & 4) != 0) {
                notification = null;
            }
            return companion.a(context, bundle, notification);
        }

        public final android.content.Intent a(android.content.Context context, android.os.Bundle extras, com.vinfast.companion.core.utils.notification.Notification notification) {
            kotlin.jvm.internal.Intrinsics.l(context, "context");
            com.vinfast.companion.core.utils.notification.NotificationCategory notificationCategoryP = notification != null ? notification.p() : null;
            int i = notificationCategoryP == null ? -1 : com.vinfast.companion.main.ui.testdrive.TestDriveActivity.Companion.WhenMappings.a[notificationCategoryP.ordinal()];
            if (i == 1 || i == 2) {
                java.util.Map mapO = notification.o();
                extras = androidx.core.os.BundleKt.b(new kotlin.Pair[]{kotlin.TuplesKt.a("BUNDLE_SCREEN_TYPE", 32), kotlin.TuplesKt.a("BUNDLE_APPOINTMENT_ID", mapO != null ? (java.lang.String) mapO.get("appointmentId") : null), kotlin.TuplesKt.a("BUNDLE_FROM_NOTIFICATION", java.lang.Boolean.TRUE)});
            }
            android.content.Intent intent = new android.content.Intent(context, (java.lang.Class<?>) com.vinfast.companion.main.ui.testdrive.TestDriveActivity.class);
            if (extras != null) {
                intent.putExtras(extras);
            }
            return intent;
        }

        private Companion() {
        }
    }

    public TestDriveActivity() {
        super(new kotlin.jvm.functions.Function1() { // from class: com.vinfast.companion.main.ui.testdrive.a
            public final java.lang.Object invoke(java.lang.Object obj) {
                return com.vinfast.companion.main.ui.testdrive.TestDriveActivity.Z0((android.view.LayoutInflater) obj);
            }
        });
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final com.vinfast.companion.services.databinding.ActivityTestDriveBinding Z0(android.view.LayoutInflater layoutInflater) {
        kotlin.jvm.internal.Intrinsics.l(layoutInflater, "it");
        com.vinfast.companion.services.databinding.ActivityTestDriveBinding activityTestDriveBindingC = com.vinfast.companion.services.databinding.ActivityTestDriveBinding.c(layoutInflater);
        kotlin.jvm.internal.Intrinsics.k(activityTestDriveBindingC, "inflate(...)");
        return activityTestDriveBindingC;
    }

    private final androidx.navigation.fragment.NavHostFragment a1() {
        androidx.navigation.fragment.NavHostFragment navHostFragmentQ0 = getSupportFragmentManager().q0(com.vinfast.companion.services.R.id.nav_host);
        if (navHostFragmentQ0 instanceof androidx.navigation.fragment.NavHostFragment) {
            return navHostFragmentQ0;
        }
        return null;
    }

    private final com.vinfast.companion.main.ui.testdrive.detail.TestDriveAppointmentDetailFragment b1(java.lang.String appointmentId) {
        androidx.fragment.app.FragmentManager childFragmentManager;
        java.util.List listH0;
        androidx.navigation.fragment.NavHostFragment navHostFragmentA1 = a1();
        androidx.fragment.app.Fragment fragment = (navHostFragmentA1 == null || (childFragmentManager = navHostFragmentA1.getChildFragmentManager()) == null || (listH0 = childFragmentManager.H0()) == null) ? null : (androidx.fragment.app.Fragment) kotlin.collections.CollectionsKt.q0(listH0);
        if (fragment instanceof com.vinfast.companion.main.ui.testdrive.detail.TestDriveAppointmentDetailFragment) {
            com.vinfast.companion.main.ui.testdrive.detail.TestDriveAppointmentDetailFragment testDriveAppointmentDetailFragment = (com.vinfast.companion.main.ui.testdrive.detail.TestDriveAppointmentDetailFragment) fragment;
            if (kotlin.jvm.internal.Intrinsics.g(testDriveAppointmentDetailFragment.f2(), appointmentId)) {
                return testDriveAppointmentDetailFragment;
            }
        }
        return null;
    }

    private final void c1(android.os.Bundle extras) {
        java.lang.Integer numValueOf = extras != null ? java.lang.Integer.valueOf(extras.getInt("BUNDLE_SCREEN_TYPE")) : null;
        java.lang.String string = extras != null ? extras.getString("BUNDLE_APPOINTMENT_ID") : null;
        java.lang.Boolean boolValueOf = extras != null ? java.lang.Boolean.valueOf(extras.getBoolean("BUNDLE_FROM_NOTIFICATION", false)) : null;
        e1(string);
        if (numValueOf != null && numValueOf.intValue() == 32) {
            com.vinfast.companion.main.ui.testdrive.detail.TestDriveAppointmentDetailFragment testDriveAppointmentDetailFragmentB1 = b1(string);
            if (testDriveAppointmentDetailFragmentB1 != null) {
                testDriveAppointmentDetailFragmentB1.A1();
            } else {
                d1(string, boolValueOf != null ? boolValueOf.booleanValue() : false);
            }
        }
    }

    private final void d1(java.lang.String appointmentId, boolean isFromNotification) {
        androidx.navigation.NavController navControllerH0;
        com.vinfast.companion.main.ui.testdrive.detail.TestDriveAppointmentDetailFragmentDirections.Companion companion = com.vinfast.companion.main.ui.testdrive.detail.TestDriveAppointmentDetailFragmentDirections.INSTANCE;
        if (appointmentId == null) {
            appointmentId = okhttp3.HttpUrl.FRAGMENT_ENCODE_SET;
        }
        androidx.navigation.NavDirections navDirectionsC = com.vinfast.companion.main.ui.testdrive.detail.TestDriveAppointmentDetailFragmentDirections.Companion.c(companion, appointmentId, false, isFromNotification, 2, null);
        androidx.navigation.fragment.NavHostFragment navHostFragmentA1 = a1();
        if (navHostFragmentA1 == null || (navControllerH0 = navHostFragmentA1.h0()) == null) {
            return;
        }
        navControllerH0.Q(navDirectionsC);
    }

    /* JADX WARN: Multi-variable type inference failed */
    private final void e1(java.lang.String appointmentId) {
        androidx.navigation.fragment.NavHostFragment navHostFragmentQ0 = getSupportFragmentManager().q0(com.vinfast.companion.services.R.id.nav_host);
        androidx.navigation.NavGraph navGraphA = com.vinfast.companion.core.extensions.ActivityExtensionKt.a(this, navHostFragmentQ0 != null ? navHostFragmentQ0.h0() : null, com.vinfast.companion.services.R.navigation.test_drive_navigation);
        if (appointmentId == null || appointmentId.length() == 0) {
            androidx.navigation.fragment.NavHostFragment navHostFragmentA1 = a1();
            androidx.navigation.NavController navControllerH0 = navHostFragmentA1 != null ? navHostFragmentA1.h0() : null;
            if (navGraphA != null) {
                navGraphA.P(com.vinfast.companion.services.R.id.testDriveDashboardFragment);
                if (navControllerH0 != null) {
                    navControllerH0.k0(navGraphA, (android.os.Bundle) null);
                    return;
                }
                return;
            }
            return;
        }
        androidx.navigation.fragment.NavHostFragment navHostFragmentA2 = a1();
        androidx.navigation.NavController navControllerH1 = navHostFragmentA2 != null ? navHostFragmentA2.h0() : null;
        if (navGraphA != null) {
            navGraphA.P(com.vinfast.companion.services.R.id.testDriveAppointmentDetailFragment);
            if (navControllerH1 != null) {
                navControllerH1.k0(navGraphA, (android.os.Bundle) null);
            }
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    public void P0(android.os.Bundle savedInstanceState) {
        android.content.Intent intent = getIntent();
        c1(intent != null ? intent.getExtras() : null);
    }

    protected void onNewIntent(android.content.Intent intent) {
        kotlin.jvm.internal.Intrinsics.l(intent, "intent");
        super/*androidx.activity.ComponentActivity*/.onNewIntent(intent);
        c1(intent.getExtras());
    }
}
