diff --git a/Tusker/API/LogoutService.swift b/Tusker/API/LogoutService.swift index e5837ee8..870765c4 100644 --- a/Tusker/API/LogoutService.swift +++ b/Tusker/API/LogoutService.swift @@ -8,6 +8,8 @@ import Foundation import UserAccounts +import PushNotifications +import Pachyderm @MainActor class LogoutService { @@ -20,7 +22,12 @@ class LogoutService { } func run() { + let accountInfo = self.accountInfo Task.detached { + if await PushManager.shared.pushSubscription(account: accountInfo) != nil { + _ = try? await self.mastodonController.run(Pachyderm.PushSubscription.delete()) + await PushManager.shared.removeSubscription(account: accountInfo) + } try? await self.mastodonController.client.revokeAccessToken() } MastodonController.removeForAccount(accountInfo)