mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-29 04:36:58 +02:00
Refine poll push rule sync logic
This commit is contained in:
+10
@@ -43,3 +43,13 @@ protocol NotificationSettingsServiceType {
|
||||
/// - completion: The completion of the operation.
|
||||
func updatePushRuleActions(for ruleId: String, enabled: Bool, actions: NotificationActions?, completion: ((Result<Void, Error>) -> Void)?)
|
||||
}
|
||||
|
||||
extension NotificationSettingsServiceType {
|
||||
func updatePushRuleActions(for ruleId: String, enabled: Bool, actions: NotificationActions?) async throws {
|
||||
try await withCheckedThrowingContinuation { continuation in
|
||||
updatePushRuleActions(for: ruleId, enabled: enabled, actions: actions) { result in
|
||||
continuation.resume(with: result)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
-9
@@ -187,16 +187,17 @@ private extension NotificationSettingsViewModel {
|
||||
notificationSettingsService.updatePushRuleActions(
|
||||
for: id.rawValue,
|
||||
enabled: enabled,
|
||||
actions: standardActions.actions) { [weak self] result in
|
||||
switch result {
|
||||
case .success:
|
||||
#warning("TODO: sync the update of these rules with the completion")
|
||||
self?.updatePushActions(for: rules, enabled: enabled, standardActions: standardActions)
|
||||
completion?(.success(()))
|
||||
case .failure(let error):
|
||||
completion?(.failure(error))
|
||||
}
|
||||
actions: standardActions.actions
|
||||
) { [weak self] result in
|
||||
switch result {
|
||||
case .success:
|
||||
#warning("TODO: sync the update of these rules with the completion")
|
||||
self?.updatePushActions(for: rules, enabled: enabled, standardActions: standardActions)
|
||||
completion?(.success(()))
|
||||
case .failure(let error):
|
||||
completion?(.failure(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func updatePushActions(for ids: [NotificationPushRuleId], enabled: Bool, standardActions: NotificationStandardActions) {
|
||||
|
||||
Reference in New Issue
Block a user