Skip to content

Commit 1b9c15d

Browse files
committed
Delete all NSUserActivities when account is logging out
Signed-off-by: Finn Behrens <[email protected]>
1 parent 91d107a commit 1b9c15d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Riot/Managers/Activities/UserActivityService.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class UserActivityService: NSObject {
4949
super.init()
5050

5151
NotificationCenter.default.addObserver(self, selector: #selector(didLeaveRoom(_:)), name: .mxSessionDidLeaveRoom, object: nil)
52+
NotificationCenter.default.addObserver(self, selector: #selector(didLogOut(_:)), name: .mxkAccountManagerDidRemoveAccount, object: nil)
5253
}
5354

5455
// MARK: - Public
@@ -92,7 +93,10 @@ class UserActivityService: NSObject {
9293

9394
func didLeaveRoom(_ notification: Notification) {
9495
guard let roomId = notification.userInfo?[kMXSessionNotificationRoomIdKey] as? String else { return }
95-
// TODO: Remove the room from spotlight
9696
NSUserActivity.deleteSavedUserActivities(withPersistentIdentifiers: [roomId], completionHandler: { })
9797
}
98+
99+
func didLogOut(_ notification: Notification) {
100+
NSUserActivity.deleteAllSavedUserActivities(completionHandler: { })
101+
}
98102
}

0 commit comments

Comments
 (0)