Skip to content

Commit

Permalink
feat: 🎸 create invitation code
Browse files Browse the repository at this point in the history
  • Loading branch information
tomokisun committed Nov 22, 2023
1 parent 0eaf79a commit 662bbc7
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions Packages/GodPackage/Sources/OnboardFeature/InvitationCode.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import AnalyticsClient
import ComposableArchitecture
import SwiftUI

@Reducer
public struct InvitationCodeLogic {
public init() {}

public struct State: Equatable {
public init() {}
}

public enum Action: Equatable {
case onTask
case onAppear
}

@Dependency(\.analytics) var analytics

public var body: some Reducer<State, Action> {
Reduce<State, Action> { _, action in
switch action {
case .onTask:
return .none

case .onAppear:
analytics.logScreen(screenName: "InvitationCode", of: self)
return .none
}
}
}
}

public struct InvitationCodeView: View {
let store: StoreOf<InvitationCodeLogic>

public init(store: StoreOf<InvitationCodeLogic>) {
self.store = store
}

public var body: some View {
WithViewStore(store, observe: { $0 }) { viewStore in
List {
Text("InvitationCode", bundle: .module)
}
.navigationTitle("InvitationCode")
.navigationBarTitleDisplayMode(.inline)
.task { await store.send(.onTask).finish() }
.onAppear { store.send(.onAppear) }
}
}
}

#Preview {
InvitationCodeView(
store: .init(
initialState: InvitationCodeLogic.State(),
reducer: { InvitationCodeLogic() }
)
)
}

0 comments on commit 662bbc7

Please sign in to comment.