diff --git a/EhPanda/View/Reading/ReadingReducer.swift b/EhPanda/View/Reading/ReadingReducer.swift index 87279252..8f2100be 100644 --- a/EhPanda/View/Reading/ReadingReducer.swift +++ b/EhPanda/View/Reading/ReadingReducer.swift @@ -208,16 +208,10 @@ struct ReadingReducer: Reducer { case .setOrientationPortrait(let isPortrait): var effects = [Effect]() if isPortrait { - effects.append(.run { _ in - appDelegateClient.setPortraitOrientationMask() - }) - effects.append(.run { _ in - await appDelegateClient.setPortraitOrientation() - }) + effects.append(.run(operation: { _ in appDelegateClient.setPortraitOrientationMask() })) + effects.append(.run(operation: { _ in await appDelegateClient.setPortraitOrientation() })) } else { - effects.append(.run { _ in - appDelegateClient.setAllOrientationMask() - }) + effects.append(.run(operation: { _ in appDelegateClient.setAllOrientationMask() })) } return .merge(effects) @@ -453,9 +447,11 @@ struct ReadingReducer: Reducer { fetchImageURLIndices.forEach { effects.append(.send(.fetchImageURLs($0))) } - effects.append(.run { [prefetchImageURLs] _ in - imageClient.prefetchImages(prefetchImageURLs) - }) + effects.append( + .run { [prefetchImageURLs] _ in + imageClient.prefetchImages(prefetchImageURLs) + } + ) return .merge(effects) case .fetchThumbnailURLs(let index): @@ -552,9 +548,7 @@ struct ReadingReducer: Reducer { case .success(let (imageURLs, response)): var effects = [Effect]() if let response = response { - effects.append(.run { _ in - cookieClient.setSkipServer(response: response) - }) + effects.append(.run(operation: { _ in cookieClient.setSkipServer(response: response) })) } guard !imageURLs.isEmpty else { state.imageURLLoadingStates[index] = .failed(.notFound) diff --git a/EhPanda/View/Setting/Login/LoginReducer.swift b/EhPanda/View/Setting/Login/LoginReducer.swift index b66dd23b..72a743f8 100644 --- a/EhPanda/View/Setting/Login/LoginReducer.swift +++ b/EhPanda/View/Setting/Login/LoginReducer.swift @@ -85,19 +85,13 @@ struct LoginReducer: Reducer { var effects = [Effect]() if cookieClient.didLogin { state.loginState = .idle - effects.append(.run { _ in - hapticsClient.generateNotificationFeedback(.success) - }) + effects.append(.run(operation: { _ in hapticsClient.generateNotificationFeedback(.success) })) } else { state.loginState = .failed(.unknown) - effects.append(.run { _ in - hapticsClient.generateNotificationFeedback(.error) - }) + effects.append(.run(operation: { _ in hapticsClient.generateNotificationFeedback(.error) })) } if case .success(let response) = result, let response = response { - effects.append(.run { _ in - cookieClient.setCredentials(response: response) - }) + effects.append(.run(operation: { _ in cookieClient.setCredentials(response: response) })) } return .merge(effects) } diff --git a/EhPanda/View/Setting/SettingReducer.swift b/EhPanda/View/Setting/SettingReducer.swift index 969f0968..78d5bd39 100644 --- a/EhPanda/View/Setting/SettingReducer.swift +++ b/EhPanda/View/Setting/SettingReducer.swift @@ -173,9 +173,7 @@ struct SettingReducer: Reducer { .send(.syncSetting) ] if !newValue && !deviceClient.isPad() { - effects.append(.run { _ in - appDelegateClient.setPortraitOrientationMask() - }) + effects.append(.run(operation: { _ in appDelegateClient.setPortraitOrientationMask() })) } return .merge(effects) } @@ -320,9 +318,7 @@ struct SettingReducer: Reducer { case .fetchIgneousDone(let result): var effects = [Effect]() if case .success(let response) = result { - effects.append(.run { _ in - cookieClient.setCredentials(response: response) - }) + effects.append(.run(operation: { _ in cookieClient.setCredentials(response: response) })) } effects.append(.send(.account(.loadCookies))) return .merge(effects) @@ -447,19 +443,19 @@ struct SettingReducer: Reducer { let cookieValue = cookieClient.getCookie(hostURL, selectedProfileKey) if cookieValue.rawValue != profileValueString { - effects.append(.run { _ in - cookieClient.setOrEditCookie( - for: hostURL, key: selectedProfileKey, value: profileValueString - ) - }) + effects.append( + .run { _ in + cookieClient.setOrEditCookie( + for: hostURL, key: selectedProfileKey, value: profileValueString + ) + } + ) } } else if response.isProfileNotFound { effects.append(.send(.createDefaultEhProfile)) } else { let message = "Found profile but failed in parsing value." - effects.append(.run { _ in - loggerClient.error(message, nil) - }) + effects.append(.run(operation: { _ in loggerClient.error(message, nil) })) } } return effects.isEmpty ? .none : .merge(effects)