feat: implement Live Activity registration service and enhance notifications handling

This commit is contained in:
2026-05-24 23:53:40 +07:00
parent d991d06f17
commit 802d32e9a0
13 changed files with 379 additions and 154 deletions
+2
View File
@@ -83,6 +83,7 @@ final class AuthViewModel {
// Clear anyway
keychain.clearTokens()
}
LiveActivityRegistrationService.shared.stop()
isAuthenticated = false
currentUser = nil
}
@@ -92,5 +93,6 @@ final class AuthViewModel {
if granted {
PushNotificationService.shared.registerForRemoteNotifications()
}
LiveActivityRegistrationService.shared.start()
}
}
@@ -38,7 +38,7 @@ final class NotificationsViewModel {
let page = try await service.getNotifications(limit: limit, offset: 0)
notifications = page.notifications
unreadCount = page.unreadCount
hasMore = notifications.count < page.total
hasMore = page.hasMore
updateBadge()
} catch {
self.error = error.localizedDescription
@@ -55,7 +55,7 @@ final class NotificationsViewModel {
notifications.append(contentsOf: page.notifications)
unreadCount = page.unreadCount
currentOffset = nextOffset
hasMore = notifications.count < page.total
hasMore = page.hasMore
} catch {
self.error = error.localizedDescription
}