Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/ios.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarino Faggiana <ios@nextcloud.com>2022-08-08 15:26:37 +0300
committerGitHub <noreply@github.com>2022-08-08 15:26:37 +0300
commit93bac88eb1f6211db8c433b22be817b6632e7f02 (patch)
treeb4de4f3b8df0125dac92fa18c19f34bb85bf4db5
parenta009535e8e1e9c97707c7094e6514737ff712dcb (diff)
parentfe8eafe6ee768dd2916197930882c40a72458b42 (diff)
Merge pull request #2108 from nextcloud/fix/441
Fix/441
-rw-r--r--Nextcloud.xcodeproj/project.pbxproj4
-rw-r--r--iOSClient/AppDelegate.swift5
-rw-r--r--iOSClient/Data/NCManageDatabase+Metadata.swift2
-rw-r--r--iOSClient/Files/NCFiles.swift2
-rw-r--r--iOSClient/Main/Collection Common/NCCollectionViewCommon.swift10
-rw-r--r--iOSClient/Main/NCMainTabBar.swift25
-rw-r--r--iOSClient/NCGlobal.swift3
-rw-r--r--iOSClient/Networking/NCNetworking.swift2
-rw-r--r--iOSClient/Networking/NCNetworkingProcessUpload.swift5
9 files changed, 29 insertions, 29 deletions
diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj
index 009689bc0..973cccf6a 100644
--- a/Nextcloud.xcodeproj/project.pbxproj
+++ b/Nextcloud.xcodeproj/project.pbxproj
@@ -2997,7 +2997,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 15;
+ CURRENT_PROJECT_VERSION = 16;
DEVELOPMENT_TEAM = 6JLRKY9ZV7;
ENABLE_BITCODE = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -3060,7 +3060,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 15;
+ CURRENT_PROJECT_VERSION = 16;
DEVELOPMENT_TEAM = 6JLRKY9ZV7;
ENABLE_BITCODE = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
diff --git a/iOSClient/AppDelegate.swift b/iOSClient/AppDelegate.swift
index 95409596b..344dbd835 100644
--- a/iOSClient/AppDelegate.swift
+++ b/iOSClient/AppDelegate.swift
@@ -258,7 +258,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterApplicationWillEnterForeground)
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterRichdocumentGrabFocus)
- NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSourceNetworkForced)
+ NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSourceNetwork)
}
// L' applicazione si dimetterà dallo stato di attivo
@@ -380,7 +380,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
NCAutoUpload.shared.initAutoUpload(viewController: nil) { _ in
DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
- NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUpdateBadgeNumber)
NCCommunicationCommon.shared.writeLog("Completition handler refresh task with [Auto upload]")
task.setTaskCompleted(success: true)
}
@@ -404,7 +403,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
NCService.shared.synchronizeOffline(account: account)
DispatchQueue.main.asyncAfter(deadline: .now() + 25) {
- NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUpdateBadgeNumber)
NCCommunicationCommon.shared.writeLog("Completition handler processing task [Synchronize Favorite & Offline]")
task.setTaskCompleted(success: true)
}
@@ -422,7 +420,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
NCCommunicationCommon.shared.writeLog("Start perform Fetch [Auto upload]")
NCAutoUpload.shared.initAutoUpload(viewController: nil) { items in
- NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUpdateBadgeNumber)
NCCommunicationCommon.shared.writeLog("Completition perform Fetch with \(items) uploads [Auto upload]")
if items == 0 {
completionHandler(UIBackgroundFetchResult.noData)
diff --git a/iOSClient/Data/NCManageDatabase+Metadata.swift b/iOSClient/Data/NCManageDatabase+Metadata.swift
index 0a818f3f3..c98b0aa17 100644
--- a/iOSClient/Data/NCManageDatabase+Metadata.swift
+++ b/iOSClient/Data/NCManageDatabase+Metadata.swift
@@ -357,7 +357,7 @@ extension NCManageDatabase {
// update
// Workaround: check lock bc no etag changes if lock runs out in directory
// https://github.com/nextcloud/server/issues/8477
- if result.status == NCGlobal.shared.metadataStatusNormal && (result.etag != metadata.etag || result.fileNameView != metadata.fileNameView || result.date != metadata.date || result.permissions != metadata.permissions || result.hasPreview != metadata.hasPreview || result.note != metadata.note || result.lock != metadata.lock || result.shareType != metadata.shareType || result.sharePermissionsCloudMesh != metadata.sharePermissionsCloudMesh || result.sharePermissionsCollaborationServices != metadata.sharePermissionsCollaborationServices) {
+ if result.status == NCGlobal.shared.metadataStatusNormal && (result.etag != metadata.etag || result.fileNameView != metadata.fileNameView || result.date != metadata.date || result.permissions != metadata.permissions || result.hasPreview != metadata.hasPreview || result.note != metadata.note || result.lock != metadata.lock || result.shareType != metadata.shareType || result.sharePermissionsCloudMesh != metadata.sharePermissionsCloudMesh || result.sharePermissionsCollaborationServices != metadata.sharePermissionsCollaborationServices || result.favorite != metadata.favorite) {
ocIdsUdate.append(metadata.ocId)
realm.add(tableMetadata.init(value: metadata), update: .all)
} else if result.status == NCGlobal.shared.metadataStatusNormal && addCompareLivePhoto && result.livePhoto != metadata.livePhoto {
diff --git a/iOSClient/Files/NCFiles.swift b/iOSClient/Files/NCFiles.swift
index 790f37d18..07cfab334 100644
--- a/iOSClient/Files/NCFiles.swift
+++ b/iOSClient/Files/NCFiles.swift
@@ -147,7 +147,7 @@ class NCFiles: NCCollectionViewCommon {
self.richWorkspaceText = tableDirectory?.richWorkspace
if metadatasUpdate?.count ?? 0 > 0 || metadatasDelete?.count ?? 0 > 0 || forced {
- self.reloadDataSource(forced: false)
+ self.reloadDataSource()
} else if self.dataSource.getMetadataSourceForAllSections().isEmpty {
DispatchQueue.main.async {
self.collectionView.reloadData()
diff --git a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift
index ff6fce011..f1af07cd3 100644
--- a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift
+++ b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift
@@ -178,6 +178,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
NotificationCenter.default.addObserver(self, selector: #selector(setNavigationItem), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterReloadAvatar), object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(reloadDataSource(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterReloadDataSource), object: nil)
+ NotificationCenter.default.addObserver(self, selector: #selector(reloadDataSourceNetwork), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterReloadDataSourceNetwork), object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(reloadDataSourceNetworkForced(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterReloadDataSourceNetworkForced), object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(deleteFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterDeleteFile), object: nil)
@@ -232,6 +233,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterReloadAvatar), object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterReloadDataSource), object: nil)
+ NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterReloadDataSourceNetwork), object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterReloadDataSourceNetworkForced), object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterDeleteFile), object: nil)
@@ -239,7 +241,6 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterCopyFile), object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterRenameFile), object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterCreateFolder), object: nil)
- NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterFavoriteFile), object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterProgressTask), object: nil)
@@ -436,7 +437,12 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
let ocId = userInfo["ocId"] as? String,
let serverUrl = userInfo["serverUrl"] as? String,
serverUrl == self.serverUrl
- else { return }
+ else {
+ if self is NCFavorite {
+ reloadDataSource()
+ }
+ return
+ }
dataSource.reloadMetadata(ocId: ocId)
collectionView?.reloadData()
diff --git a/iOSClient/Main/NCMainTabBar.swift b/iOSClient/Main/NCMainTabBar.swift
index ce3d0dd6c..ef65b4361 100644
--- a/iOSClient/Main/NCMainTabBar.swift
+++ b/iOSClient/Main/NCMainTabBar.swift
@@ -47,14 +47,7 @@ class NCMainTabBar: UITabBar {
NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterChangeTheming), object: nil)
- NotificationCenter.default.addObserver(self, selector: #selector(updateBadgeNumber), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterUpdateBadgeNumber), object: nil)
- NotificationCenter.default.addObserver(self, selector: #selector(updateBadgeNumber), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterApplicationDidBecomeActive), object: nil)
- NotificationCenter.default.addObserver(self, selector: #selector(updateBadgeNumber), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterApplicationWillEnterForeground), object: nil)
-
- NotificationCenter.default.addObserver(self, selector: #selector(updateBadgeNumber), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterUploadStartFile), object: nil)
- NotificationCenter.default.addObserver(self, selector: #selector(updateBadgeNumber), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterUploadedFile), object: nil)
- NotificationCenter.default.addObserver(self, selector: #selector(updateBadgeNumber), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterUploadCancelFile), object: nil)
-
+ NotificationCenter.default.addObserver(self, selector: #selector(updateBadgeNumber(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterUpdateBadgeNumber), object: nil)
barTintColor = NCBrandColor.shared.secondarySystemBackground
backgroundColor = NCBrandColor.shared.secondarySystemBackground
@@ -214,16 +207,16 @@ class NCMainTabBar: UITabBar {
self.addSubview(centerButton)
}
- @objc func updateBadgeNumber() {
- guard !appDelegate.account.isEmpty else { return }
-
- let counterUpload = NCManageDatabase.shared.getMetadatas(predicate: NSPredicate(format: "status == %d OR status == %d OR status == %d", NCGlobal.shared.metadataStatusWaitUpload, NCGlobal.shared.metadataStatusInUpload, NCGlobal.shared.metadataStatusUploading)).count
+ @objc func updateBadgeNumber(_ notification: NSNotification) {
- UIApplication.shared.applicationIconBadgeNumber = counterUpload
+ guard let userInfo = notification.userInfo as NSDictionary?,
+ let counter = userInfo["counter"] as? Int
+ else { return }
- if let item = items?[0] {
- if counterUpload > 0 {
- item.badgeValue = String(counterUpload)
+ UIApplication.shared.applicationIconBadgeNumber = counter
+ if let item = self.items?[0] {
+ if counter > 0 {
+ item.badgeValue = String(counter)
} else {
item.badgeValue = nil
}
diff --git a/iOSClient/NCGlobal.swift b/iOSClient/NCGlobal.swift
index e95fa4b20..b9e663a2f 100644
--- a/iOSClient/NCGlobal.swift
+++ b/iOSClient/NCGlobal.swift
@@ -328,10 +328,11 @@ class NCGlobal: NSObject {
let notificationCenterRichdocumentGrabFocus = "richdocumentGrabFocus"
let notificationCenterReloadDataNCShare = "reloadDataNCShare"
let notificationCenterCloseRichWorkspaceWebView = "closeRichWorkspaceWebView"
- let notificationCenterUpdateBadgeNumber = "updateBadgeNumber"
+ let notificationCenterUpdateBadgeNumber = "updateBadgeNumber" // userInfo: counter
let notificationCenterReloadAvatar = "reloadAvatar"
@objc let notificationCenterReloadDataSource = "reloadDataSource" // userInfo: serverUrl?
+ let notificationCenterReloadDataSourceNetwork = "reloadDataSourceNetwork" // userInfo: serverUrl?
let notificationCenterReloadDataSourceNetworkForced = "reloadDataSourceNetworkForced" // userInfo: serverUrl?
let notificationCenterChangeStatusFolderE2EE = "changeStatusFolderE2EE" // userInfo: serverUrl
diff --git a/iOSClient/Networking/NCNetworking.swift b/iOSClient/Networking/NCNetworking.swift
index bb1394aa1..87b65b2fd 100644
--- a/iOSClient/Networking/NCNetworking.swift
+++ b/iOSClient/Networking/NCNetworking.swift
@@ -343,7 +343,7 @@ import Photos
}) { (account, etag, date, _, allHeaderFields, error, errorCode, errorDescription) in
- self.downloadRequest[fileNameLocalPath] = nil
+ self.downloadRequest.removeValue(forKey:fileNameLocalPath)
if error?.isExplicitlyCancelledError ?? false {
diff --git a/iOSClient/Networking/NCNetworkingProcessUpload.swift b/iOSClient/Networking/NCNetworkingProcessUpload.swift
index 07a757b68..7f4a9aed9 100644
--- a/iOSClient/Networking/NCNetworkingProcessUpload.swift
+++ b/iOSClient/Networking/NCNetworkingProcessUpload.swift
@@ -66,6 +66,10 @@ class NCNetworkingProcessUpload: NSObject {
print("[LOG] PROCESS-UPLOAD \(counterUpload)")
+ // Update Badge
+ let counterBadge = NCManageDatabase.shared.getMetadatas(predicate: NSPredicate(format: "status == %d OR status == %d OR status == %d", NCGlobal.shared.metadataStatusWaitUpload, NCGlobal.shared.metadataStatusInUpload, NCGlobal.shared.metadataStatusUploading))
+ NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUpdateBadgeNumber, userInfo: ["counter":counterBadge.count])
+
NCNetworking.shared.getOcIdInBackgroundSession(queue: DispatchQueue.global(qos: .background), completion: { listOcId in
for sessionSelector in sessionSelectors {
@@ -75,7 +79,6 @@ class NCNetworkingProcessUpload: NSObject {
let metadatas = NCManageDatabase.shared.getAdvancedMetadatas(predicate: NSPredicate(format: "sessionSelector == %@ AND status == %d", sessionSelector, NCGlobal.shared.metadataStatusWaitUpload), page: 1, limit: limit, sorted: "date", ascending: true)
if metadatas.count > 0 {
NCCommunicationCommon.shared.writeLog("PROCESS-UPLOAD find \(metadatas.count) items")
- NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUpdateBadgeNumber)
}
for metadata in metadatas {