Skip to content

Commit

Permalink
Delete all NSUserActivities when account is logging out
Browse files Browse the repository at this point in the history
Signed-off-by: Finn Behrens <[email protected]>
  • Loading branch information
kloenk committed Sep 28, 2021
1 parent 3fdb74b commit 8bf64aa
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Riot/Managers/Activities/UserActivityService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}

0 comments on commit 8bf64aa

Please sign in to comment.