mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-19 08:03:50 +02:00
Re-enable link detection in clearStore instead of via NotificationCenter.
This commit is contained in:
@@ -33,22 +33,6 @@ class URLPreviewService: NSObject {
|
||||
|
||||
/// A persistent store backed by Core Data to reduce network requests
|
||||
private let store = URLPreviewStore()
|
||||
/// The observer that re-enables link detection on sign out,
|
||||
private let resetLinkDetectionObserver: Any
|
||||
|
||||
// MARK: - Setup
|
||||
|
||||
override init() {
|
||||
resetLinkDetectionObserver = NotificationCenter.default.addObserver(forName: .mxkAccountManagerDidRemoveAccount, object: nil, queue: .main) { _ in
|
||||
MXKAppSettings.standard().enableBubbleComponentLinkDetection = true
|
||||
}
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
deinit {
|
||||
NotificationCenter.default.removeObserver(resetLinkDetectionObserver)
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
@@ -102,9 +86,11 @@ class URLPreviewService: NSObject {
|
||||
store.removeExpiredItems()
|
||||
}
|
||||
|
||||
/// Deletes all cached preview data and closed previews from the store.
|
||||
/// Deletes all cached preview data and closed previews from the store,
|
||||
/// re-enabling URL previews if they have been disabled by `checkForDisabledAPI`.
|
||||
func clearStore() {
|
||||
store.deleteAll()
|
||||
MXKAppSettings.standard().enableBubbleComponentLinkDetection = true
|
||||
}
|
||||
|
||||
/// Store the `eventId` and `roomId` of a closed preview.
|
||||
|
||||
Reference in New Issue
Block a user