From ede45a9d46341ae75f982caff448ca184c614f4a Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Tue, 26 Dec 2023 13:56:28 +0100 Subject: [PATCH] Fix #1769 --- IceCubesApp/App/Tabs/NotificationTab.swift | 3 +++ .../Sources/Notifications/NotificationsViewModel.swift | 7 ------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/IceCubesApp/App/Tabs/NotificationTab.swift b/IceCubesApp/App/Tabs/NotificationTab.swift index d8dcd8b6..ba1b47dd 100644 --- a/IceCubesApp/App/Tabs/NotificationTab.swift +++ b/IceCubesApp/App/Tabs/NotificationTab.swift @@ -103,6 +103,9 @@ struct NotificationsTab: View { if selectedTab == .notifications || isSecondaryColumn { if let token = appAccount.currentAccount.oauthToken { userPreferences.notificationsCount[token] = 0 + Task { + let _: ServerError = try await client.post(endpoint: Notifications.clear) + } } watcher.unreadNotificationsCount = 0 } diff --git a/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift b/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift index 7255fe9b..3ddc8f47 100644 --- a/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift +++ b/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift @@ -162,13 +162,6 @@ import SwiftUI } } - func clear() async { - guard let client else { return } - do { - let _: ServerError = try await client.post(endpoint: Notifications.clear) - } catch {} - } - func handleEvent(event: any StreamEvent) { Task { // Check if the event is a notification,