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 27, 2021
1 parent 26d03d2 commit e10102c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 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 @@ -76,4 +77,8 @@ class UserActivityService: NSObject {
guard let roomId = notification.userInfo?[kMXSessionNotificationRoomIdKey] as? String else { return }
NSUserActivity.deleteSavedUserActivities(withPersistentIdentifiers: [roomId], completionHandler: { })
}

func didLogOut(_ notification: Notification) {
NSUserActivity.deleteAllSavedUserActivities(completionHandler: { })
}
}

0 comments on commit e10102c

Please sign in to comment.