Remove push subscription when logging out of account
This commit is contained in:
parent
241e6f7e3a
commit
7a47b09b39
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import UserAccounts
|
import UserAccounts
|
||||||
|
import PushNotifications
|
||||||
|
import Pachyderm
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
class LogoutService {
|
class LogoutService {
|
||||||
|
@ -20,7 +22,12 @@ class LogoutService {
|
||||||
}
|
}
|
||||||
|
|
||||||
func run() {
|
func run() {
|
||||||
|
let accountInfo = self.accountInfo
|
||||||
Task.detached {
|
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()
|
try? await self.mastodonController.client.revokeAccessToken()
|
||||||
}
|
}
|
||||||
MastodonController.removeForAccount(accountInfo)
|
MastodonController.removeForAccount(accountInfo)
|
||||||
|
|
Loading…
Reference in New Issue