Skip to content

Commit

Permalink
✨ :: [#72] SplashFeatue / Splash 로직 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
baekteun committed Jul 23, 2023
1 parent c730d76 commit 1c4d669
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
23 changes: 19 additions & 4 deletions Projects/Feature/SplashFeature/Sources/Scene/SplashStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,30 @@ final class SplashStore: BaseStore {
}

struct State {}
enum Action {}
enum Action {
case viewDidLoad
}
enum Mutation {}

func mutate(state: State, action: Action) -> SideEffect<Mutation, Never> {
.none
switch action {
case .viewDidLoad:
viewDidLoad()
}
return .none
}

func reduce(state: State, mutate: Mutation) -> State {
var newState = state
return newState
return state
}
}

private extension SplashStore {
func viewDidLoad() {
Task {
let isLoggedIn = await checkIsLoggedInUseCase()
let routePath = isLoggedIn ? DotoriRoutePath.main : .signin
route.send(routePath)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,11 @@ final class SplashViewController: BaseViewController<SplashStore> {
override func configureViewController() {
self.view.backgroundColor = .dotori(.background(.bg))
}

override func bindAction() {
viewDidLoadPublisher
.map { Store.Action.viewDidLoad }
.sink(receiveValue: store.send(_:))
.store(in: &subscription)
}
}

0 comments on commit 1c4d669

Please sign in to comment.