forked from shadowfacts/Tusker
Remove push subscription when logging out of account
This commit is contained in:
parent
241e6f7e3a
commit
7a47b09b39
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user