Skip to content

Commit

Permalink
feat: 🎸 user property
Browse files Browse the repository at this point in the history
  • Loading branch information
tomokisun committed Nov 21, 2023
1 parent 5d4f6dc commit 22d5da9
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public struct SchoolSettingLogic {
@Dependency(\.openURL) var openURL
@Dependency(\.godClient) var godClient
@Dependency(\.analytics) var analytics

enum Cancel {
case school
}

public var body: some Reducer<State, Action> {
Reduce<State, Action> { state, action in
Expand All @@ -45,6 +49,7 @@ public struct SchoolSettingLogic {
} catch: { error, send in
await send(.schoolsResponse(.failure(error)))
}
.cancellable(id: Cancel.school, cancelInFlight: true)

case .onAppear:
analytics.logScreen(screenName: "SchoolSetting", of: self)
Expand All @@ -56,7 +61,10 @@ public struct SchoolSettingLogic {
}

case let .schoolButtonTapped(id):
return .send(.delegate(.nextScreen(id: id)))
return .run { send in
analytics.setUserProperty(key: .schoolId, value: id)
await send(.delegate(.nextScreen(id: id)))
}

case let .schoolsResponse(.success(data)):
state.schools = data.schools.edges.map(\.node)
Expand Down

0 comments on commit 22d5da9

Please sign in to comment.