From 448ed1a4e69b5150e371a660ab20f4f12f221744 Mon Sep 17 00:00:00 2001 From: Finn Behrens Date: Tue, 28 Sep 2021 10:16:08 +0200 Subject: [PATCH] Delete all NSUserActivities when account is logging out Signed-off-by: Finn Behrens --- Riot/Managers/Activities/UserActivityService.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Riot/Managers/Activities/UserActivityService.swift b/Riot/Managers/Activities/UserActivityService.swift index b40cb43a0b..773845b9bc 100644 --- a/Riot/Managers/Activities/UserActivityService.swift +++ b/Riot/Managers/Activities/UserActivityService.swift @@ -32,6 +32,7 @@ class UserActivityService: NSObject { super.init() NotificationCenter.default.addObserver(self, selector: #selector(didLeaveRoom(_:)), name: .mxSessionDidLeaveRoom, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(didLogOut(_:)), name: .mxkAccountManagerDidRemoveAccount, object: nil) } // MARK: - Public @@ -78,4 +79,9 @@ class UserActivityService: NSObject { NSUserActivity.deleteSavedUserActivities(withPersistentIdentifiers: [roomId], completionHandler: { }) CSSearchableIndex.default().deleteSearchableItems(withDomainIdentifiers: [roomId], completionHandler: nil) } + + func didLogOut(_ notification: Notification) { + NSUserActivity.deleteAllSavedUserActivities(completionHandler: { }) + CSSearchableIndex.default().deleteAllSearchableItems(completionHandler: nil) + } }