From 899849fc32af1d6ee1d390fe8cf07b2b14517f99 Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Wed, 1 Oct 2025 16:28:14 +0200 Subject: [PATCH 1/3] Update NCFiles.swift --- iOSClient/Files/NCFiles.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/iOSClient/Files/NCFiles.swift b/iOSClient/Files/NCFiles.swift index 9a2a50a0ad..97e5e699b1 100644 --- a/iOSClient/Files/NCFiles.swift +++ b/iOSClient/Files/NCFiles.swift @@ -44,6 +44,15 @@ class NCFiles: NCCollectionViewCommon { } } + NotificationCenter.default.addObserver(forName: UIApplication.didBecomeActiveNotification, object: nil, queue: nil) { _ in + Task { @MainActor in + await (self.navigationController as? NCMainNavigationController)?.setNavigationLeftItems() + await (self.navigationController as? NCMainNavigationController)?.setNavigationRightItems() + + self.collectionView.reloadData() + } + } + NotificationCenter.default.addObserver(forName: UIApplication.didEnterBackgroundNotification, object: nil, queue: nil) { _ in self.stopSyncMetadata() } From 55bf318522fdd588b7199bb4dbff35eb6a0f28c2 Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Wed, 1 Oct 2025 17:34:32 +0200 Subject: [PATCH 2/3] Update NCFiles.swift --- iOSClient/Files/NCFiles.swift | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/iOSClient/Files/NCFiles.swift b/iOSClient/Files/NCFiles.swift index 97e5e699b1..7c40ad81e4 100644 --- a/iOSClient/Files/NCFiles.swift +++ b/iOSClient/Files/NCFiles.swift @@ -17,6 +17,8 @@ class NCFiles: NCCollectionViewCommon { internal var syncMetadatasTask: Task? + private var didBecomeActiveObserver: NSObjectProtocol? + required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) @@ -44,15 +46,6 @@ class NCFiles: NCCollectionViewCommon { } } - NotificationCenter.default.addObserver(forName: UIApplication.didBecomeActiveNotification, object: nil, queue: nil) { _ in - Task { @MainActor in - await (self.navigationController as? NCMainNavigationController)?.setNavigationLeftItems() - await (self.navigationController as? NCMainNavigationController)?.setNavigationRightItems() - - self.collectionView.reloadData() - } - } - NotificationCenter.default.addObserver(forName: UIApplication.didEnterBackgroundNotification, object: nil, queue: nil) { _ in self.stopSyncMetadata() } @@ -132,6 +125,14 @@ class NCFiles: NCCollectionViewCommon { await getServerData() } } + + didBecomeActiveObserver = NotificationCenter.default.addObserver(forName: UIApplication.didBecomeActiveNotification, object: nil, queue: nil) { _ in + Task { @MainActor in + await (self.navigationController as? NCMainNavigationController)?.setNavigationLeftItems() + + self.collectionView.reloadData() + } + } } override func viewWillDisappear(_ animated: Bool) { @@ -141,6 +142,10 @@ class NCFiles: NCCollectionViewCommon { Task { await NCNetworking.shared.networkingTasks.cancel(identifier: "\(self.serverUrl)_NCFiles") } + + if let didBecomeActiveObserver { + NotificationCenter.default.removeObserver(didBecomeActiveObserver) + } } override func viewDidDisappear(_ animated: Bool) { From b86eb2af61f87cdf0102a8bdba7e28f7bc37ebdb Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Wed, 1 Oct 2025 17:36:22 +0200 Subject: [PATCH 3/3] Update NCFiles.swift --- iOSClient/Files/NCFiles.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/iOSClient/Files/NCFiles.swift b/iOSClient/Files/NCFiles.swift index 7c40ad81e4..6176112256 100644 --- a/iOSClient/Files/NCFiles.swift +++ b/iOSClient/Files/NCFiles.swift @@ -142,10 +142,6 @@ class NCFiles: NCCollectionViewCommon { Task { await NCNetworking.shared.networkingTasks.cancel(identifier: "\(self.serverUrl)_NCFiles") } - - if let didBecomeActiveObserver { - NotificationCenter.default.removeObserver(didBecomeActiveObserver) - } } override func viewDidDisappear(_ animated: Bool) { @@ -153,6 +149,10 @@ class NCFiles: NCCollectionViewCommon { fileNameBlink = nil fileNameOpen = nil + + if let didBecomeActiveObserver { + NotificationCenter.default.removeObserver(didBecomeActiveObserver) + } } // MARK: - DataSource

AltStyle によって変換されたページ (->オリジナル) /