Skip to content

Commit

Permalink
feat: CoachMark 3번 클릭 시 끝나도록 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
leemhyungyu committed Oct 30, 2024
1 parent 9e1c00e commit c543140
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,15 @@ extension SandBeachRootFeature {
return .none
}

// SandBeachCoachMark Delegate
case let .sandBeachCoachMark(.delegate(delegate)):
switch delegate {
case .coachMarkDidCompleted:
userClient.updateCoachMarkState(isViewed: true)
state.isCoachMarkViewed = true
return .none
}

case .profileSetupDidCompleted:
state.isLoading = false
state.path.removeAll()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public struct SandBeachRootView: View {
store.send(.selectedTabDidChanged(selectedTab: selectedTab))
}

if !store.isCoachMarkViewed {
if !store.isCoachMarkViewed && store.sandBeach.userState == .noIntroduction {
SandBeachCoachMarkView(
store: store.scope(state: \.sandBeachCoachMark, action: \.sandBeachCoachMark))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public struct SandBeachView: View {
}
}
}

.bottleAlert($store.scope(state: \.destination?.alert, action: \.destination.alert))
.onAppear {
store.send(.onAppear)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ extension SandBeachCoachMarkFeature {
switch action {
case .coachMarkDidTapped:
state.count += 1

if state.count == 3 {
return .send(.delegate(.coachMarkDidCompleted))
} else {
return .none
}

case .delegate:
return .none
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ public struct SandBeachCoachMarkFeature {

public enum Action {
case coachMarkDidTapped
case delegate(Delegate)

public enum Delegate {
case coachMarkDidCompleted
}
}

public var body: some ReducerOf<Self> {
Expand Down

0 comments on commit c543140

Please sign in to comment.