From 7a47b09b3997e90aafd9ff16fac9697dde8623bb Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 8 Apr 2024 22:50:39 -0400 Subject: [PATCH] Remove push subscription when logging out of account --- Tusker/API/LogoutService.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Tusker/API/LogoutService.swift b/Tusker/API/LogoutService.swift index e5837ee8c0..870765c406 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)