mirror of
https://github.com/pointfreeco/swift-composable-architecture.git
synced 2025-12-24 12:14:25 +01:00
Run swift-format
This commit is contained in:
committed by
GitHub Actions
parent
6f1bc259e4
commit
2bd9b7568e
@@ -51,36 +51,36 @@ public let loginReducer = Reducer<LoginState, LoginAction, LoginEnvironment>.com
|
||||
)
|
||||
}
|
||||
),
|
||||
|
||||
|
||||
.init {
|
||||
state, action, environment in
|
||||
switch action {
|
||||
case .alertDismissed:
|
||||
state.alert = nil
|
||||
return .none
|
||||
|
||||
|
||||
case let .emailChanged(email):
|
||||
state.email = email
|
||||
state.isFormValid = !state.email.isEmpty && !state.password.isEmpty
|
||||
return .none
|
||||
|
||||
|
||||
case let .loginResponse(.success(response)):
|
||||
state.isLoginRequestInFlight = false
|
||||
if response.twoFactorRequired {
|
||||
state.twoFactor = TwoFactorState(token: response.token)
|
||||
}
|
||||
return .none
|
||||
|
||||
|
||||
case let .loginResponse(.failure(error)):
|
||||
state.alert = .init(title: TextState(error.localizedDescription))
|
||||
state.isLoginRequestInFlight = false
|
||||
return .none
|
||||
|
||||
|
||||
case let .passwordChanged(password):
|
||||
state.password = password
|
||||
state.isFormValid = !state.email.isEmpty && !state.password.isEmpty
|
||||
return .none
|
||||
|
||||
|
||||
case .loginButtonTapped:
|
||||
state.isLoginRequestInFlight = true
|
||||
return environment.authenticationClient
|
||||
@@ -88,10 +88,10 @@ public let loginReducer = Reducer<LoginState, LoginAction, LoginEnvironment>.com
|
||||
.receive(on: environment.mainQueue)
|
||||
.catchToEffect()
|
||||
.map(LoginAction.loginResponse)
|
||||
|
||||
|
||||
case .twoFactor:
|
||||
return .none
|
||||
|
||||
|
||||
case .twoFactorDismissed:
|
||||
state.twoFactor = nil
|
||||
return .cancel(id: TwoFactorTearDownToken())
|
||||
|
||||
@@ -15,7 +15,8 @@ public struct GameView: View {
|
||||
self.board = state.board.map { $0.map { $0?.label ?? "" } }
|
||||
self.isGameDisabled = state.board.hasWinner || state.board.isFilled
|
||||
self.isPlayAgainButtonVisible = state.board.hasWinner || state.board.isFilled
|
||||
self.title = state.board.hasWinner
|
||||
self.title =
|
||||
state.board.hasWinner
|
||||
? "Winner! Congrats \(state.currentPlayerName)!"
|
||||
: state.board.isFilled
|
||||
? "Tied game!"
|
||||
|
||||
@@ -97,7 +97,8 @@ public struct LoginView: View {
|
||||
.padding(.horizontal)
|
||||
}
|
||||
}
|
||||
.navigationBarTitle("Login") }
|
||||
.navigationBarTitle("Login")
|
||||
}
|
||||
}
|
||||
|
||||
extension LoginAction {
|
||||
|
||||
@@ -35,7 +35,8 @@ public struct NewGameView: View {
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
WithViewStore(self.store.scope(state: ViewState.init, action: NewGameAction.init)) { viewStore in
|
||||
WithViewStore(self.store.scope(state: ViewState.init, action: NewGameAction.init)) {
|
||||
viewStore in
|
||||
ScrollView {
|
||||
VStack(spacing: 16) {
|
||||
VStack(alignment: .leading) {
|
||||
|
||||
@@ -18,7 +18,8 @@ public final class GameViewController: UIViewController {
|
||||
self.board = state.board.map { $0.map { $0?.label ?? "" } }
|
||||
self.isGameEnabled = !state.board.hasWinner && !state.board.isFilled
|
||||
self.isPlayAgainButtonHidden = !state.board.hasWinner && !state.board.isFilled
|
||||
self.title = state.board.hasWinner
|
||||
self.title =
|
||||
state.board.hasWinner
|
||||
? "Winner! Congrats \(state.currentPlayerName)!"
|
||||
: state.board.isFilled
|
||||
? "Tied game!"
|
||||
|
||||
Reference in New Issue
Block a user