Skip to content

Commit

Permalink
feat: Add Onboarding View (only UI) (#284)
Browse files Browse the repository at this point in the history
* feat: Add Onboarding View (only UI)

* Change names of files to WelcomeView and WelcomeViewAddVehicle

Rather than WelcomeScreen and WelcomeScreenDetails. fix some indentation, and the project wasn't built with all the strings properly

* Use LocalizedStringKey

---------

Co-authored-by: Mikaela Caron <mikaelacaron@gmail.com>
  • Loading branch information
maartinj and mikaelacaron authored Jul 9, 2024
1 parent cb560d6 commit 6c40d55
Show file tree
Hide file tree
Showing 5 changed files with 281 additions and 1 deletion.
24 changes: 24 additions & 0 deletions Basic-Car-Maintenance.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
8A3D748C2AD9C41D0000FEEB /* AlertItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A3D748B2AD9C41D0000FEEB /* AlertItem.swift */; };
8AEE816F2ACF37F800FC0C2A /* Action.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AEE816E2ACF37F800FC0C2A /* Action.swift */; };
8AEE81722ACF384D00FC0C2A /* MainTabView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AEE81712ACF384D00FC0C2A /* MainTabView.swift */; };
E4345E622B4CDA7B0086D04B /* WelcomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4345E612B4CDA7B0086D04B /* WelcomeView.swift */; };
E4345E642B4CE0500086D04B /* WelcomeViewAddVehicle.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4345E632B4CE0500086D04B /* WelcomeViewAddVehicle.swift */; };
E55B630D2B079E5A006BDDDF /* EditVehicleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E55B630C2B079E5A006BDDDF /* EditVehicleView.swift */; };
E58499662ACDDA8B00634660 /* ContributorsListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E58499652ACDDA8B00634660 /* ContributorsListView.swift */; };
E58499682ACDDA9A00634660 /* ContributorsProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E58499672ACDDA9A00634660 /* ContributorsProfileView.swift */; };
Expand Down Expand Up @@ -123,6 +125,8 @@
8AEE816E2ACF37F800FC0C2A /* Action.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Action.swift; sourceTree = "<group>"; };
8AEE81712ACF384D00FC0C2A /* MainTabView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTabView.swift; sourceTree = "<group>"; };
8AEE81732ACF394E00FC0C2A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
E4345E612B4CDA7B0086D04B /* WelcomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeView.swift; sourceTree = "<group>"; };
E4345E632B4CE0500086D04B /* WelcomeViewAddVehicle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeViewAddVehicle.swift; sourceTree = "<group>"; };
E55B630C2B079E5A006BDDDF /* EditVehicleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditVehicleView.swift; sourceTree = "<group>"; };
E58499652ACDDA8B00634660 /* ContributorsListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContributorsListView.swift; sourceTree = "<group>"; };
E58499672ACDDA9A00634660 /* ContributorsProfileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContributorsProfileView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -280,6 +284,23 @@
path = ViewModels;
sourceTree = "<group>";
};
E4345E602B4CDA4F0086D04B /* Onboarding */ = {
isa = PBXGroup;
children = (
E474A3A12B5953A40015DF51 /* Views */,
);
path = Onboarding;
sourceTree = "<group>";
};
E474A3A12B5953A40015DF51 /* Views */ = {
isa = PBXGroup;
children = (
E4345E612B4CDA7B0086D04B /* WelcomeView.swift */,
E4345E632B4CE0500086D04B /* WelcomeViewAddVehicle.swift */,
);
path = Views;
sourceTree = "<group>";
};
FF3DDF492AA4386C009D91C4 /* Views */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -384,6 +405,7 @@
FFC8CDA32AA385E800D129A6 /* GoogleService-Info.plist */,
8AEE81732ACF394E00FC0C2A /* Info.plist */,
FF5D13A62A86C2D600BC9BD6 /* BasicCarMaintenanceApp.swift */,
E4345E602B4CDA4F0086D04B /* Onboarding */,
8A3D74832AD6D9870000FEEB /* MainView */,
FFBFE08F2A98EFDD000A9BEB /* Models */,
FF755B3F2A908EC400F49A13 /* Dashboard */,
Expand Down Expand Up @@ -732,6 +754,7 @@
8A3D74862AD6D9A10000FEEB /* AlertView.swift in Sources */,
57CDD9A02ADC31A8002EFED0 /* AddOdometerReadingView.swift in Sources */,
57CDD99E2ADC3173002EFED0 /* OdometerViewModel.swift in Sources */,
E4345E642B4CE0500086D04B /* WelcomeViewAddVehicle.swift in Sources */,
E55B630D2B079E5A006BDDDF /* EditVehicleView.swift in Sources */,
FF755B3E2A908E7A00F49A13 /* SettingsView.swift in Sources */,
FF3DDF522AA4D28F009D91C4 /* DashboardViewModel.swift in Sources */,
Expand All @@ -750,6 +773,7 @@
E58499662ACDDA8B00634660 /* ContributorsListView.swift in Sources */,
FFBFE0932A98F212000A9BEB /* Vehicle.swift in Sources */,
FF5D13A72A86C2D600BC9BD6 /* BasicCarMaintenanceApp.swift in Sources */,
E4345E622B4CDA7B0086D04B /* WelcomeView.swift in Sources */,
8014A4D12AD76034005B51F6 /* ChooseAppIconView.swift in Sources */,
FF218EF62B00865F0025A533 /* AnalyticsService.swift in Sources */,
FF748B5E2AB3589C004748A5 /* AuthenticationViewModel.swift in Sources */,
Expand Down
7 changes: 7 additions & 0 deletions Basic-Car-Maintenance/Shared/BasicCarMaintenanceApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ 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 @@ -22,6 +25,10 @@ struct BasicCarMaintenanceApp: App {
.task {
try? Tips.configure()
}
// .sheet(isPresented: $isFirstTime) {
// WelcomeView()
// .interactiveDismissDisabled()
// }
}
}
}
Expand Down
44 changes: 43 additions & 1 deletion Basic-Car-Maintenance/Shared/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@
}
}
}
},
"about" : {

},
"Add" : {
"comment" : "Label for submit button on form to add an entry",
Expand Down Expand Up @@ -412,6 +415,9 @@
}
}
}
},
"Add the details below" : {

},
"Add Vehicle" : {
"comment" : "Label to add a vehicle.",
Expand Down Expand Up @@ -808,9 +814,18 @@
}
}
}
},
"Back" : {

},
"Basic" : {

},
"Basic Car" : {

},
"Built collaboratively with contributors, enhancing the app functionality." : {

},
"Can't Delete Last Vehicle" : {
"localizations" : {
Expand Down Expand Up @@ -909,6 +924,9 @@
}
}
}
},
"Car Maintenance" : {

},
"Change App Icon" : {
"localizations" : {
Expand Down Expand Up @@ -1101,6 +1119,9 @@
}
}
}
},
"Continue" : {

},
"Contributors" : {
"comment" : "Link to contributors list.",
Expand Down Expand Up @@ -3554,6 +3575,9 @@
}
}
}
},
"Open Source" : {

},
"Preferred units" : {
"comment" : "Label for units selected when adding an odometer reading",
Expand Down Expand Up @@ -4738,6 +4762,9 @@
}
}
}
},
"Tracks & displays total mileage, aiding timely maintenance planning." : {

},
"Unexpected error occured." : {
"extractionState" : "stale",
Expand Down Expand Up @@ -4907,6 +4934,9 @@
}
}
}
},
"User-friendly interface for controlling car maintenance tasks." : {

},
"Vehicle" : {
"comment" : "Maintenance event vehicle picker header",
Expand Down Expand Up @@ -5751,6 +5781,12 @@
}
}
}
},
"Welcome 🥳" : {

},
"Welcome to" : {

},
"Year" : {
"localizations" : {
Expand Down Expand Up @@ -5815,7 +5851,13 @@
}
}
}
},
"You can edit more data about the vehicle in the 'Settings' tab." : {

},
"your vehicle" : {

}
},
"version" : "1.0"
}
}
97 changes: 97 additions & 0 deletions Basic-Car-Maintenance/Shared/Onboarding/Views/WelcomeView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
//
// WelcomeView.swift
// Basic-Car-Maintenance
//
// Created by Marcin Jędrzejak on 09/01/2024.
//

import SwiftUI

struct WelcomeView: View {

var body: some View {
NavigationView {
VStack(spacing: 15) {
VStack {
HStack(spacing: 5) {
Text("Welcome to")
Text("Basic")
.foregroundStyle(Color("basicGreen"))
}
Text("Car Maintenance")
.foregroundStyle(Color("basicGreen"))
}
.font(.largeTitle.bold())
.multilineTextAlignment(.center)
.padding(.top, 65)
.padding(.bottom, 35)
.padding(15)

VStack(alignment: .leading, spacing: 25) {
pointView(
symbol: "car",
title: "Dashboard",
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."
)

pointView(
symbol: "lock.open",
title: "Open Source",
subTitle: "Built collaboratively with contributors, enhancing the app functionality."
)
}
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.horizontal, 15)
.padding(15)

Spacer(minLength: 10)

NavigationLink(destination: WelcomeViewAddVehicle()) {
Text("Continue")
.fontWeight(.bold)
.foregroundStyle(.white)
.frame(maxWidth: .infinity)
.padding(.vertical, 14)
.background(Color("basicGreen").gradient, in: .rect(cornerRadius: 12))
.contentShape(.rect)
}
.padding(15)
.padding(.horizontal, 15)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background {
Color(UIColor.secondarySystemBackground)
.ignoresSafeArea()
}
}
}

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

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

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

#Preview {
WelcomeView()
}
Loading

0 comments on commit 6c40d55

Please sign in to comment.