-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #435 from PermanentOrg/feature/VSP-1397-Chart-your…
…-path-screen VSP-1397 [iOS] Chart your path
- Loading branch information
Showing
11 changed files
with
351 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// OnboardingPath.swift | ||
// Permanent | ||
// | ||
// Created by Lucian Cerbu on 09.05.2024. | ||
|
||
import Foundation | ||
|
||
enum OnboardingPath: String, CaseIterable, Identifiable { | ||
var id: String { return self.rawValue } | ||
|
||
case capture, digitize, collaborate, createPublicArchive, shareArchive, createPlan, organize, somethingElse = "" | ||
|
||
var description: String { | ||
switch self { | ||
case .capture: | ||
return "Capture and preserve memories for storytelling" | ||
case .digitize: | ||
return "Digitize or transfer my materials securely" | ||
case .collaborate: | ||
return "Collaborate with others to build my archive" | ||
case .createPublicArchive: | ||
return "Create a public archive to share a legacy" | ||
case .shareArchive: | ||
return "Share my archive with others securely" | ||
case .createPlan: | ||
return "Create a plan for passing on my digital materials" | ||
case .organize: | ||
return "Organize my materials" | ||
case .somethingElse: | ||
return "Something else..." | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
Permanent/Modules/Onboarding/Views/OnboardingChartYourPathView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
// | ||
// OnboardingChartYourPathView.swift | ||
// Permanent | ||
// | ||
// Created by Lucian Cerbu on 08.05.2024. | ||
|
||
import SwiftUI | ||
|
||
struct OnboardingChartYourPathView: View { | ||
@State var presentSelectArchivesType: Bool = false | ||
@ObservedObject var onboardingValues: OnboardingStorageValues | ||
|
||
var backButton: (() -> Void) | ||
var nextButton: (() -> Void) | ||
var skipButton: (() -> Void) | ||
@State var isKeyboardPresented = false | ||
@State var textFieldText: String = "" | ||
|
||
var body: some View { | ||
if Constants.Design.isPhone { | ||
iPhoneBody | ||
} else { | ||
iPadBody | ||
} | ||
} | ||
|
||
var iPhoneBody: some View { | ||
ZStack(alignment: .bottom) { | ||
VStack { | ||
ScrollViewReader { scrollReader in | ||
ScrollView(showsIndicators: false) { | ||
VStack(alignment: .leading, spacing: 24) { | ||
Text("Chart your \npath to success") | ||
.textStyle(UsualXLargeLightTextStyle()) | ||
.foregroundColor(.white) | ||
Text("Let’s set some goals. Everyone has unique goals for preserving their legacy. We want to learn more about how we can help you achieve yours.") | ||
.textStyle(UsualSmallXRegularTextStyle()) | ||
.foregroundColor(.blue25) | ||
.lineSpacing(8.0) | ||
VStack(alignment: .leading) { | ||
ForEach(OnboardingPath.allCases, id: \.id) { path in | ||
Button { | ||
onboardingValues.togglePath(path: path) | ||
} label: { | ||
PathItemView(path: path, isSelected: onboardingValues.selectedPath.contains(path)) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
Spacer(minLength: 160) | ||
} | ||
VStack { | ||
RoundButtonRightImageView(type: .noBorder, text: "Skip this step", rightImage: Image(.onboardingForward), action: skipButton) | ||
HStack(alignment: .center) { | ||
SmallRoundButtonImageView(type: .noColor, imagePlace: .onLeft, text: "Back", image: Image(.leftArrowShort), action: backButton) | ||
SmallRoundButtonImageView(isDisabled: onboardingValues.textFieldText.isEmpty, text: "Next", action: nextButton) | ||
} | ||
} | ||
.padding(.bottom, 40) | ||
.sheet(isPresented: $presentSelectArchivesType, content: { | ||
OnboardingSelectArchiveTypeView(onboardingValues: onboardingValues) | ||
}) | ||
} | ||
} | ||
|
||
var iPadBody: some View { | ||
HStack(alignment: .top, spacing: 64) { | ||
ScrollView(showsIndicators: false) { | ||
VStack { | ||
HStack() { | ||
Text("Create your \n\(onboardingValues.archiveType.onboardingType) archive") | ||
.textStyle(UsualXXLargeLightTextStyle()) | ||
.foregroundColor(.white) | ||
.multilineTextAlignment(.leading) | ||
Spacer() | ||
} | ||
Spacer() | ||
} | ||
} | ||
ZStack(alignment: .bottom) { | ||
ScrollViewReader { scrollReader in | ||
ScrollView(showsIndicators: false) { | ||
VStack(alignment: .leading, spacing: 64) { | ||
Text("Name your new archive. This is the legal or official name of the person, family, group, or organization the archive is about. You can edit the name later if needed.") | ||
.textStyle(UsualRegularTextStyle()) | ||
.foregroundColor(.blue25) | ||
.lineSpacing(8.0) | ||
CustomBorderTextField(textFieldText: $onboardingValues.textFieldText, placeholder: "Name...") | ||
} | ||
} | ||
.onReceive(keyboardPublisher) { keyboard in | ||
if keyboard.isFirstResponder { | ||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1, execute: { | ||
withAnimation { | ||
scrollReader.scrollTo(1, anchor: .center) | ||
} | ||
}) | ||
} | ||
} | ||
.onAppear { | ||
UIScrollView.appearance().bounces = false | ||
} | ||
.onDisappear { | ||
UIScrollView.appearance().bounces = true | ||
} | ||
} | ||
HStack(spacing: 32) { | ||
SmallRoundButtonImageView(type: .noColor, imagePlace: .onLeft, text: "Back", image: Image(.backArrowOnboarding), action: backButton) | ||
.frame(width: 120) | ||
RoundButtonRightImageView(isDisabled: onboardingValues.textFieldText.isEmpty, text: "Create the archive", action: nextButton) | ||
} | ||
.padding(.bottom, 40) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.