Skip to content
7 changes: 0 additions & 7 deletions Basic-Car-Maintenance/Shared/BasicCarMaintenanceApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ struct BasicCarMaintenanceApp: App {
@State private var actionService = ActionService.shared
@UIApplicationDelegateAdaptor(AppDelegate.self) var delegate

// Logic to load Onboarding screen when app was first launched
// @AppStorage("isFirstTime") private var isFirstTime: Bool = true

var body: some Scene {
WindowGroup {
MainTabView()
Expand All @@ -28,10 +25,6 @@ struct BasicCarMaintenanceApp: App {
.task {
try? Tips.configure()
}
// .sheet(isPresented: $isFirstTime) {
// WelcomeView()
// .interactiveDismissDisabled()
// }
}
}
}
Expand Down
35 changes: 25 additions & 10 deletions Basic-Car-Maintenance/Shared/Localizable.xcstrings
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"sourceLanguage" : "en",
"strings" : {
"" : {

},
"%@" : {
"comment" : "Maintenance list item description 'Date' formatted",
"localizations" : {
Expand Down Expand Up @@ -71,6 +74,9 @@
}
}
}
},
"%@ added successfully! 🎉" : {

},
"%@ on %@" : {
"comment" : "Maintenance list item for a vehicle on a date",
Expand Down Expand Up @@ -199,9 +205,6 @@
}
}
}
},
"about" : {

},
"Add" : {
"comment" : "Label for submit button on form to add an entry",
Expand Down Expand Up @@ -416,7 +419,7 @@
}
}
},
"Add the details below" : {
"Add the details below about " : {

},
"Add Vehicle" : {
Expand Down Expand Up @@ -814,9 +817,6 @@
}
}
}
},
"Back" : {

},
"Basic" : {

Expand Down Expand Up @@ -1800,6 +1800,9 @@
}
}
}
},
"Error" : {

},
"Failed To Add Vehicle" : {
"localizations" : {
Expand Down Expand Up @@ -4940,6 +4943,9 @@
},
"User-friendly interface for controlling car maintenance tasks." : {

},
"Validation Error" : {

},
"Vehicle" : {
"comment" : "Maintenance event vehicle picker header",
Expand Down Expand Up @@ -5005,6 +5011,9 @@
}
}
}
},
"Vehicle %@" : {

},
"Vehicle Color" : {
"localizations" : {
Expand Down Expand Up @@ -5215,6 +5224,9 @@
}
}
}
},
"Vehicle Make cannot be empty! 🚗" : {

},
"Vehicle Model" : {
"localizations" : {
Expand Down Expand Up @@ -5297,6 +5309,9 @@
}
}
}
},
"Vehicle Model cannot be empty! 🚗" : {

},
"Vehicle Name" : {
"localizations" : {
Expand Down Expand Up @@ -5379,6 +5394,9 @@
}
}
}
},
"Vehicle Name cannot be empty! 🚗" : {

},
"Vehicle VIN" : {
"localizations" : {
Expand Down Expand Up @@ -5784,9 +5802,6 @@
}
}
}
},
"Welcome 🥳" : {

},
"Welcome to" : {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ struct MainTabView: View {
@State private var authenticationViewModel = AuthenticationViewModel()
@State private var viewModel = MainTabViewModel()

// Logic to load `WelcomeView` when app is first launched
@AppStorage("isFirstTime") private var isFirstTime: Bool = true

init() {
_selectedTabId = State(initialValue: selectedTab)
}
Expand All @@ -77,6 +80,10 @@ struct MainTabView: View {
AlertView(alert: alert)
.presentationDetents([.medium])
}
.sheet(isPresented: $isFirstTime) {
WelcomeView(authenticationViewModel: authenticationViewModel)
.interactiveDismissDisabled()
}
.onChange(of: scenePhase) { _, newScenePhase in
guard
case .active = newScenePhase,
Expand Down
23 changes: 13 additions & 10 deletions Basic-Car-Maintenance/Shared/Onboarding/Views/WelcomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import SwiftUI

struct WelcomeView: View {
var authenticationViewModel: AuthenticationViewModel

var body: some View {
NavigationView {
Expand All @@ -17,10 +18,10 @@ struct WelcomeView: View {
HStack(spacing: 5) {
Text("Welcome to")
Text("Basic")
.foregroundStyle(Color("basicGreen"))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note we don't need to use strings anymore because assets automatically generate type safe names like .basicGreen

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You fixed this also, right? I see in commit 'fix colors, capitalization and comments', you changed all .basicGreen?

.foregroundStyle(.basicGreen)
}
Text("Car Maintenance")
.foregroundStyle(Color("basicGreen"))
.foregroundStyle(.basicGreen)
}
.font(.largeTitle.bold())
.multilineTextAlignment(.center)
Expand All @@ -32,19 +33,19 @@ struct WelcomeView: View {
pointView(
symbol: "car",
title: "Dashboard",
subTitle: "User-friendly interface for controlling car maintenance tasks."
subtitle: "User-friendly interface for controlling car maintenance tasks."
)

pointView(
symbol: "gauge.with.dots.needle.bottom.50percent.badge.plus",
title: "Odometer",
subTitle: "Tracks & displays total mileage, aiding timely maintenance planning."
subtitle: "Tracks & displays total mileage, aiding timely maintenance planning."
)

pointView(
symbol: "lock.open",
title: "Open Source",
subTitle: "Built collaboratively with contributors, enhancing the app functionality."
subtitle: "Built collaboratively with contributors, enhancing the app functionality."
)
}
.frame(maxWidth: .infinity, alignment: .leading)
Expand All @@ -53,7 +54,8 @@ struct WelcomeView: View {

Spacer(minLength: 10)

NavigationLink(destination: WelcomeViewAddVehicle()) {
NavigationLink(
destination: WelcomeViewAddVehicle()) {
Text("Continue")
.fontWeight(.bold)
.foregroundStyle(.white)
Expand All @@ -74,25 +76,26 @@ struct WelcomeView: View {
}

@ViewBuilder
func pointView(symbol: String, title: LocalizedStringKey, subTitle: LocalizedStringKey) -> some View {
// swiftlint:disable:next line_length
func pointView(symbol: String, title: LocalizedStringResource, subtitle: LocalizedStringResource) -> some View {
HStack(spacing: 20) {
Image(systemName: symbol)
.font(.largeTitle)
.foregroundStyle(Color("basicGreen"))
.foregroundStyle(.basicGreen)
.frame(width: 45)

VStack(alignment: .leading, spacing: 6) {
Text(title)
.font(.title3)
.fontWeight(.semibold)

Text(subTitle)
Text(subtitle)
.foregroundStyle(.gray)
}
}
}
}

#Preview {
WelcomeView()
WelcomeView(authenticationViewModel: AuthenticationViewModel())
}
Loading