Skip to content

Commit

Permalink
Merge pull request #357 from remlostime/ck/fix-build-warning
Browse files Browse the repository at this point in the history
Fix build warning for AccountSettingReducer
  • Loading branch information
chihchy authored Jan 27, 2024
2 parents f306a31 + 4fae615 commit cf491b2
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions EhPanda/View/Setting/AccountSetting/AccountSettingReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ struct AccountSettingReducer: ReducerProtocol {
case setNavigation(Route?)
case onLogoutConfirmButtonTapped
case clearSubStates

case loadCookies
case copyCookies(GalleryHost)

case login(LoginReducer.Action)
case ehSetting(EhSettingReducer.Action)
}
Expand All @@ -51,7 +49,7 @@ struct AccountSettingReducer: ReducerProtocol {
Reduce { state, action in
switch action {
case .binding(\.$route):
return state.route == nil ? .init(value: .clearSubStates) : .none
return state.route == nil ? .send(.clearSubStates) : .none

case .binding(\.$ehCookiesState):
return cookieClient.setCookies(state: state.ehCookiesState).fireAndForget()
Expand All @@ -64,17 +62,17 @@ struct AccountSettingReducer: ReducerProtocol {

case .setNavigation(let route):
state.route = route
return route == nil ? .init(value: .clearSubStates) : .none
return route == nil ? .send(.clearSubStates) : .none

case .onLogoutConfirmButtonTapped:
return .init(value: .loadCookies)
return .send(.loadCookies)

case .clearSubStates:
state.loginState = .init()
state.ehSettingState = .init()
return .merge(
.init(value: .login(.teardown)),
.init(value: .ehSetting(.teardown))
.send(.login(.teardown)),
.send(.ehSetting(.teardown))
)

case .loadCookies:
Expand All @@ -85,13 +83,13 @@ struct AccountSettingReducer: ReducerProtocol {
case .copyCookies(let host):
let cookiesDescription = cookieClient.getCookiesDescription(host: host)
return .merge(
.init(value: .setNavigation(.hud)),
.send(.setNavigation(.hud)),
clipboardClient.saveText(cookiesDescription).fireAndForget(),
.fireAndForget({ hapticsClient.generateNotificationFeedback(.success) })
)

case .login(.loginDone):
return cookieClient.didLogin ? .init(value: .setNavigation(nil)) : .none
return cookieClient.didLogin ? .send(.setNavigation(nil)) : .none

case .login:
return .none
Expand Down

0 comments on commit cf491b2

Please sign in to comment.