diff --git a/Riot/Managers/URLPreviews/URLPreviewService.swift b/Riot/Managers/URLPreviews/URLPreviewService.swift index 2f8d31791..3eb594e4e 100644 --- a/Riot/Managers/URLPreviews/URLPreviewService.swift +++ b/Riot/Managers/URLPreviews/URLPreviewService.swift @@ -33,6 +33,22 @@ 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 diff --git a/Riot/Modules/Application/AppCoordinator.swift b/Riot/Modules/Application/AppCoordinator.swift index 32121a0f6..bed586ef9 100755 --- a/Riot/Modules/Application/AppCoordinator.swift +++ b/Riot/Modules/Application/AppCoordinator.swift @@ -82,6 +82,8 @@ final class AppCoordinator: NSObject, AppCoordinatorType { // Setup navigation router store _ = NavigationRouterStore.shared + // Setup URL preview service observers + _ = URLPreviewService.shared if BuildSettings.enableSideMenu { self.addSideMenu()