From 5e3944c512ea0798f1eeefc75cfffa22774f00b5 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Mon, 13 Nov 2023 10:31:45 +0200 Subject: [PATCH] Fixes #1619 - Remove push notification registration on logout --- ElementX/Sources/Application/AppCoordinator.swift | 4 +++- changelog.d/1619.bugfix | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelog.d/1619.bugfix diff --git a/ElementX/Sources/Application/AppCoordinator.swift b/ElementX/Sources/Application/AppCoordinator.swift index 2cbc672da..f8d56edb2 100644 --- a/ElementX/Sources/Application/AppCoordinator.swift +++ b/ElementX/Sources/Application/AppCoordinator.swift @@ -527,11 +527,13 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationCoordinatorDelegate, return } - // The user will log out, clear any existing notifications + // The user will log out, clear any existing notifications and unregister from receving new ones UNUserNotificationCenter.current().removeAllPendingNotificationRequests() UNUserNotificationCenter.current().removeAllDeliveredNotifications() UIApplication.shared.applicationIconBadgeNumber = 0 + unregisterForRemoteNotifications() + Task { // First log out from the server let accountLogoutURL = await userSession.clientProxy.logout() diff --git a/changelog.d/1619.bugfix b/changelog.d/1619.bugfix new file mode 100644 index 000000000..2de929316 --- /dev/null +++ b/changelog.d/1619.bugfix @@ -0,0 +1 @@ +Remove push notification registration on logout \ No newline at end of file