Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ios/Kith.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
A3E58ADFB234FD1407023392 /* KithOnboardingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 416A75C69650AAD584FEE064 /* KithOnboardingView.swift */; };
A4336E3A96ACF2FE47DA6C35 /* HubSyncIssueTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A41324D637F7A736FAD6B80A /* HubSyncIssueTests.swift */; };
B11A9EBD171FF12E6F7B0045 /* KithUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69B0BA41F320166AEA1728A2 /* KithUITests.swift */; };
DAC253113D3DD2E0BB7067CC /* KithOnboardingReplayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80E19BA6F30BC6EADC0EA7CD /* KithOnboardingReplayTests.swift */; };
F3C48A6CA9EC720182B123BC /* Design.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE4DDB782CAF5D8FD571DC3B /* Design.swift */; };
F680576C1F45EE52AFBA44DE /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 2C466A859325D15A49C22248 /* PrivacyInfo.xcprivacy */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -106,6 +107,7 @@
79D378032A9722C9555ED8AE /* DemoData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoData.swift; sourceTree = "<group>"; };
7A8B5ADE80477C15D5324428 /* CloudStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CloudStore.swift; sourceTree = "<group>"; };
7AA76B6FCE2A1BD2FDDE7D45 /* BubbleField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BubbleField.swift; sourceTree = "<group>"; };
80E19BA6F30BC6EADC0EA7CD /* KithOnboardingReplayTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KithOnboardingReplayTests.swift; sourceTree = "<group>"; };
8E3415A5E88E90361208B65E /* CloudKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CloudKit.framework; path = System/Library/Frameworks/CloudKit.framework; sourceTree = SDKROOT; };
8FDEF1D744F055053CB588A9 /* KithCoreTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KithCoreTests.swift; sourceTree = "<group>"; };
A41324D637F7A736FAD6B80A /* HubSyncIssueTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HubSyncIssueTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -162,6 +164,7 @@
isa = PBXGroup;
children = (
A41324D637F7A736FAD6B80A /* HubSyncIssueTests.swift */,
80E19BA6F30BC6EADC0EA7CD /* KithOnboardingReplayTests.swift */,
);
name = KithAppTests;
path = Tests/KithAppTests;
Expand Down Expand Up @@ -437,6 +440,7 @@
buildActionMask = 2147483647;
files = (
A4336E3A96ACF2FE47DA6C35 /* HubSyncIssueTests.swift in Sources */,
DAC253113D3DD2E0BB7067CC /* KithOnboardingReplayTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
10 changes: 10 additions & 0 deletions ios/Sources/Kith/AppModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ final class AppModel {
private(set) var document: KithDocument = .empty
var isLoading = true
var isOnboardingPresented = false
private(set) var isReplayingOnboarding = false
private(set) var onboardingPersonID: UUID?
var selectedPersonID: UUID?
var isAddingPerson = false
Expand Down Expand Up @@ -208,10 +209,19 @@ final class AppModel {

func finishOnboarding(addAnother: Bool = false) {
isOnboardingPresented = false
isReplayingOnboarding = false
onboardingPersonID = nil
if addAnother { isAddingPerson = true }
}

/// Reopens the product tour without creating or editing a person.
func replayOnboarding() {
onboardingPersonID = nil
isReplayingOnboarding = true
isShowingConnection = false
isOnboardingPresented = true
}

func deletePerson(id: UUID) {
let deletedIDs = [id] + document.entries.filter { $0.personID == id }.map(\.id)
document.removePerson(id: id)
Expand Down
9 changes: 9 additions & 0 deletions ios/Sources/Kith/KithConnectionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@ struct KithConnectionView: View {
Text("Connection setup is unavailable in this build.")
.foregroundStyle(KithPalette.rust)
}

Button {
model.replayOnboarding()
} label: {
Label("Replay onboarding", systemImage: "sparkles")
.frame(maxWidth: .infinity, alignment: .leading)
}
.font(.headline)
.frame(minHeight: 44)
}
.padding(28)
}
Expand Down
26 changes: 25 additions & 1 deletion ios/Sources/Kith/KithOnboardingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,16 @@ struct KithOnboardingView: View {
ScrollView {
VStack(alignment: .leading, spacing: 24) {
introduction
lanternPreview
Image("KithOnboarding")
.resizable()
.scaledToFit()
.frame(maxHeight: 220)
.frame(maxWidth: .infinity)
.accessibilityLabel("A hand-drawn figure ties one remembered moment to the lantern of someone close.")
if model.isReplayingOnboarding {
replayActions
} else {
lanternPreview
VStack(alignment: .leading, spacing: 16) {
TextField("Their name", text: $name)
.textFieldStyle(.roundedBorder)
Expand Down Expand Up @@ -81,6 +90,7 @@ struct KithOnboardingView: View {
.font(.footnote)
.foregroundStyle(KithPalette.espresso.opacity(0.58))
.frame(maxWidth: .infinity, alignment: .center)
}
}
.frame(maxWidth: 620)
.padding(24)
Expand All @@ -89,6 +99,20 @@ struct KithOnboardingView: View {
.navigationBarTitleDisplayMode(.inline)
}

private var replayActions: some View {
VStack(alignment: .leading, spacing: 14) {
Text("Your existing constellation stays exactly as it is.")
.font(.body)
.foregroundStyle(KithPalette.espresso.opacity(0.66))
Button("Return to Kith") { model.finishOnboarding() }
.buttonStyle(ClayButtonStyle())
.frame(maxWidth: .infinity)
Button("Add someone in Kith") { model.finishOnboarding(addAnother: true) }
.font(.headline)
.frame(maxWidth: .infinity, minHeight: 44)
}
}

private var introduction: some View {
VStack(alignment: .leading, spacing: 10) {
Text("The people you keep close.")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "kith-onboarding.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions ios/Tests/KithAppTests/KithOnboardingReplayTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import XCTest

@testable import Kith

@MainActor
final class KithOnboardingReplayTests: XCTestCase {
func testReplayOpensNonDestructiveTourMode() {
let model = AppModel(platform: nil)

model.replayOnboarding()

XCTAssertTrue(model.isOnboardingPresented)
XCTAssertTrue(model.isReplayingOnboarding)
XCTAssertNil(model.onboardingPersonID)
}
}
Loading