diff options
author | Marino Faggiana <ios@nextcloud.com> | 2022-10-21 14:23:14 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-21 14:23:14 +0300 |
commit | 307c1576024febb958bcea152b171fbbb3cbfbef (patch) | |
tree | 1f9beeff2d507e6f6edd1fc10dd32dedc5babe7a | |
parent | 6b7e7aee3694fcc3559b231e8ed98e74b67c84d8 (diff) | |
parent | 3feeccc1ee2a6046f79c2bc762a4cd5f9867e34d (diff) |
Merge pull request #2205 from nextcloud/develop4.5.1
V 4.5.1
28 files changed, 177 insertions, 243 deletions
diff --git a/.github/workflows/xcode.yml b/.github/workflows/xcode.old index 1e30e7d98..1e30e7d98 100644 --- a/.github/workflows/xcode.yml +++ b/.github/workflows/xcode.old diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj index 2dcdbc533..06a726455 100644 --- a/Nextcloud.xcodeproj/project.pbxproj +++ b/Nextcloud.xcodeproj/project.pbxproj @@ -3607,7 +3607,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 20; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = NKUJUXUJ3B; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -3631,7 +3631,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 4.5.0; + MARKETING_VERSION = 4.5.1; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ""; SDKROOT = iphoneos; @@ -3670,7 +3670,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 20; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = NKUJUXUJ3B; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -3692,7 +3692,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 4.5.0; + MARKETING_VERSION = 4.5.1; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ""; SDKROOT = iphoneos; @@ -3900,7 +3900,7 @@ repositoryURL = "https://github.com/nextcloud/NextcloudKit"; requirement = { kind = exactVersion; - version = 1.0.0; + version = 1.1.0; }; }; F788ECC5263AAAF900ADC67F /* XCRemoteSwiftPackageReference "MarkdownKit" */ = { diff --git a/Share/NCShareExtension.swift b/Share/NCShareExtension.swift index 00abd8072..4fb28f661 100644 --- a/Share/NCShareExtension.swift +++ b/Share/NCShareExtension.swift @@ -329,6 +329,7 @@ extension NCShareExtension { conflict.serverUrl = self.serverUrl conflict.metadatasUploadInConflict = conflicts conflict.delegate = self + conflict.isE2EE = CCUtility.isFolderEncrypted(self.serverUrl, e2eEncrypted: false, account: activeAccount.account, urlBase: activeAccount.urlBase) self.present(conflict, animated: true, completion: nil) } else { upload() diff --git a/Widget/Dashboard/DashboardData.swift b/Widget/Dashboard/DashboardData.swift index e733fb351..915b80454 100644 --- a/Widget/Dashboard/DashboardData.swift +++ b/Widget/Dashboard/DashboardData.swift @@ -46,6 +46,7 @@ struct DashboardData: Identifiable, Hashable { let icon: UIImage let template: Bool let avatar: Bool + let imageColor: UIColor? } struct DashboardDataButton: Hashable { @@ -55,16 +56,16 @@ struct DashboardDataButton: Hashable { } let dashboardDatasTest: [DashboardData] = [ - .init(id: 0, title: "title0", subTitle: "subTitle-description0", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(named: "widget")!, template: true, avatar: false), - .init(id: 1, title: "title1", subTitle: "subTitle-description1", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(named: "widget")!, template: true, avatar: false), - .init(id: 2, title: "title2", subTitle: "subTitle-description2", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(named: "widget")!, template: true, avatar: false), - .init(id: 3, title: "title3", subTitle: "subTitle-description3", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(named: "widget")!, template: true, avatar: false), - .init(id: 4, title: "title4", subTitle: "subTitle-description4", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(named: "widget")!, template: true, avatar: false), - .init(id: 5, title: "title5", subTitle: "subTitle-description5", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(named: "widget")!, template: true, avatar: false), - .init(id: 6, title: "title6", subTitle: "subTitle-description6", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(named: "widget")!, template: true, avatar: false), - .init(id: 7, title: "title7", subTitle: "subTitle-description7", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(named: "widget")!, template: true, avatar: false), - .init(id: 8, title: "title8", subTitle: "subTitle-description8", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(named: "widget")!, template: true, avatar: false), - .init(id: 9, title: "title9", subTitle: "subTitle-description9", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(named: "widget")!, template: true, avatar: false) + .init(id: 0, title: "title0", subTitle: "subTitle-description0", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(named: "widget")!, template: true, avatar: false, imageColor: nil), + .init(id: 1, title: "title1", subTitle: "subTitle-description1", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(named: "widget")!, template: true, avatar: false, imageColor: nil), + .init(id: 2, title: "title2", subTitle: "subTitle-description2", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(named: "widget")!, template: true, avatar: false, imageColor: nil), + .init(id: 3, title: "title3", subTitle: "subTitle-description3", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(named: "widget")!, template: true, avatar: false, imageColor: nil), + .init(id: 4, title: "title4", subTitle: "subTitle-description4", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(named: "widget")!, template: true, avatar: false, imageColor: nil), + .init(id: 5, title: "title5", subTitle: "subTitle-description5", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(named: "widget")!, template: true, avatar: false, imageColor: nil), + .init(id: 6, title: "title6", subTitle: "subTitle-description6", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(named: "widget")!, template: true, avatar: false, imageColor: nil), + .init(id: 7, title: "title7", subTitle: "subTitle-description7", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(named: "widget")!, template: true, avatar: false, imageColor: nil), + .init(id: 8, title: "title8", subTitle: "subTitle-description8", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(named: "widget")!, template: true, avatar: false, imageColor: nil), + .init(id: 9, title: "title9", subTitle: "subTitle-description9", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(named: "widget")!, template: true, avatar: false, imageColor: nil) ] func getDashboardItems(displaySize: CGSize, withButton: Bool) -> Int { @@ -161,8 +162,11 @@ func getDashboardDataEntry(intent: Applications?, isPreview: Bool, displaySize: if let entryLink = item.link, let url = URL(string: entryLink) { link = url } var icon = UIImage(named: "file")! var iconFileName: String? - var template: Bool = false - var avatar: Bool = false + + var imageTemplate: Bool = false + var imageAvatar: Bool = false + var imageColorized: Bool = false + var imageColor: UIColor? if let iconUrl = item.iconUrl, let url = URL(string: iconUrl) { if let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false) { @@ -172,24 +176,31 @@ func getDashboardDataEntry(intent: Applications?, isPreview: Bool, displaySize: let queryItems = urlComponents.queryItems if (pathComponents.last as? NSString)?.pathExtension.lowercased() == "svg" { - template = true + imageTemplate = true } - if let item = CCUtility.value(forKey: "fileId", fromQueryItems: queryItems) { iconFileName = item } else if pathComponents.contains("avatar") { iconFileName = pathComponents[pathComponents.count-2] - avatar = true + imageAvatar = true + } else if pathComponents.contains("getCalendarDotSvg") { + imageColorized = true } else { iconFileName = ((path.lastPathComponent) as NSString).deletingPathExtension } } - if let fileName = iconFileName { + // Color + if imageColorized, let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false) { + let path = (urlComponents.path as NSString) + let colorString = ((path.lastPathComponent) as NSString).deletingPathExtension + imageColor = UIColor(hex: colorString) + icon = UIImage(systemName: "circle.fill")! + } else if let fileName = iconFileName { let fileNamePath: String = CCUtility.getDirectoryUserData() + "/" + fileName + ".png" if FileManager().fileExists(atPath: fileNamePath), let image = UIImage(contentsOfFile: fileNamePath) { icon = image } else { - let (_, data, _) = await NCNetworking.shared.getPreview(url: url) + let (_, data, _) = await NextcloudKit.shared.getPreview(url: url) if let image = NCUtility.shared.convertDataToImage(data: data, size: CGSize(width: 256, height: 256), fileNameToWrite: fileName) { icon = image } @@ -197,7 +208,7 @@ func getDashboardDataEntry(intent: Applications?, isPreview: Bool, displaySize: } } - let data = DashboardData(id: counter, title: title, subTitle: subtitle, link: link, icon: icon, template: template, avatar: avatar) + let data = DashboardData(id: counter, title: title, subTitle: subtitle, link: link, icon: icon, template: imageTemplate, avatar: imageAvatar, imageColor: imageColor) datas.append(data) if datas.count == dashboardItems { break } diff --git a/Widget/Dashboard/DashboardWidgetView.swift b/Widget/Dashboard/DashboardWidgetView.swift index 8ebbe1fc7..8a6348155 100644 --- a/Widget/Dashboard/DashboardWidgetView.swift +++ b/Widget/Dashboard/DashboardWidgetView.swift @@ -68,6 +68,12 @@ struct DashboardWidgetView: View { Circle() .fill(Color(.systemGray4)) .frame(width: 35, height: 35) + } else if let color = element.imageColor { + Image(uiImage: element.icon) + .renderingMode(.template) + .resizable() + .frame(width: 20, height: 20) + .foregroundColor(Color(color)) } else if element.template { if entry.dashboard?.itemIconsRound ?? false { Image(uiImage: element.icon) @@ -76,8 +82,7 @@ struct DashboardWidgetView: View { .scaledToFill() .frame(width: 20, height: 20) .foregroundColor(.white) - .padding(8 - ) + .padding(8) .background(Color(.systemGray4)) .clipShape(Circle()) } else { diff --git a/Widget/Files/FilesData.swift b/Widget/Files/FilesData.swift index 73f59ad7b..806b103eb 100644 --- a/Widget/Files/FilesData.swift +++ b/Widget/Files/FilesData.swift @@ -230,23 +230,10 @@ func getFilesDataEntry(isPreview: Bool, displaySize: CGSize, completion: @escapi let fileNamePathOrFileId = CCUtility.returnFileNamePath(fromFileName: file.fileName, serverUrl: file.serverUrl, urlBase: file.urlBase, account: account.account)! let fileNamePreviewLocalPath = CCUtility.getDirectoryProviderStoragePreviewOcId(file.ocId, etag: file.etag)! let fileNameIconLocalPath = CCUtility.getDirectoryProviderStorageIconOcId(file.ocId, etag: file.etag)! - let (_, _, imageIcon, _, _, _) = await NCNetworking.shared.downloadPreview(fileNamePathOrFileId: fileNamePathOrFileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, widthPreview: NCGlobal.shared.sizePreview, heightPreview: NCGlobal.shared.sizePreview, fileNameIconLocalPath: fileNameIconLocalPath, sizeIcon: NCGlobal.shared.sizeIcon) + let (_, _, imageIcon, _, _, _) = await NextcloudKit.shared.downloadPreview(fileNamePathOrFileId: fileNamePathOrFileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, widthPreview: NCGlobal.shared.sizePreview, heightPreview: NCGlobal.shared.sizePreview, fileNameIconLocalPath: fileNameIconLocalPath, sizeIcon: NCGlobal.shared.sizeIcon) if let image = imageIcon { imageRecent = image } - /* - do { - let fileNamePathOrFileId = CCUtility.returnFileNamePath(fromFileName: file.fileName, serverUrl: file.serverUrl, urlBase: file.urlBase, account: account.account)! - let fileNamePreviewLocalPath = CCUtility.getDirectoryProviderStoragePreviewOcId(file.ocId, etag: file.etag)! - let fileNameIconLocalPath = CCUtility.getDirectoryProviderStorageIconOcId(file.ocId, etag: file.etag)! - let (_, _, imageIcon, _, _) = try await NextcloudKit.shared.downloadPreview(fileNamePathOrFileId: fileNamePathOrFileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, widthPreview: NCGlobal.shared.sizePreview, heightPreview: NCGlobal.shared.sizePreview, fileNameIconLocalPath: fileNameIconLocalPath, sizeIcon: NCGlobal.shared.sizeIcon) - if let image = imageIcon { - imageRecent = image - } - } catch { - print(error) - } - */ } // DATA diff --git a/iOSClient/AppDelegate.swift b/iOSClient/AppDelegate.swift index 462ace5fe..82a4b6ea9 100644 --- a/iOSClient/AppDelegate.swift +++ b/iOSClient/AppDelegate.swift @@ -203,6 +203,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD networkingProcessUpload?.verifyUploadZombie() } + // Start Auto Upload + NCAutoUpload.shared.initAutoUpload(viewController: nil) { items in + NKCommon.shared.writeLog("[INFO] Initialize Auto upload with \(items) uploads") + DispatchQueue.main.async { self.networkingProcessUpload = NCNetworkingProcessUpload() } + } + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterApplicationDidBecomeActive) } @@ -215,13 +221,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD // Account changed ?? if activeAccount.account != account { settingAccount(activeAccount.account, urlBase: activeAccount.urlBase, user: activeAccount.user, userId: activeAccount.userId, password: CCUtility.getPassword(activeAccount.account)) - } else { - // Initialize Auto upload - NCAutoUpload.shared.initAutoUpload(viewController: nil) { items in - NKCommon.shared.writeLog("[INFO] Initialize Auto upload with \(items) uploads") - // START UPLOAD PROCESS - DispatchQueue.main.async { self.networkingProcessUpload = NCNetworkingProcessUpload() } - } } // Required unsubscribing / subscribing @@ -309,12 +308,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD // Registeration push notification NCPushNotification.shared().pushNotification() - // Start Auto Upload - NCAutoUpload.shared.initAutoUpload(viewController: nil) { items in - NKCommon.shared.writeLog("[INFO] Initialize Auto upload with \(items) uploads") - DispatchQueue.main.async { self.networkingProcessUpload = NCNetworkingProcessUpload() } - } - // Start services NCService.shared.startRequestServicesServer() diff --git a/iOSClient/Data/NCDatabase.swift b/iOSClient/Data/NCDatabase.swift index 191280f30..3a4f3e845 100644 --- a/iOSClient/Data/NCDatabase.swift +++ b/iOSClient/Data/NCDatabase.swift @@ -133,9 +133,11 @@ class tableActivity: Object, DateCompareable { } class tableActivityLatestId: Object { + @objc dynamic var account = "" @objc dynamic var activityFirstKnown: Int = 0 @objc dynamic var activityLastGiven: Int = 0 + override static func primaryKey() -> String { return "account" } @@ -479,7 +481,8 @@ class tablePhotoLibrary: Object { } } -class tableShare: Object { +typealias tableShare = tableShareV2 +class tableShareV2: Object { @objc dynamic var account = "" @objc dynamic var canEdit: Bool = false @@ -504,6 +507,7 @@ class tableShare: Object { @objc dynamic var password: String = "" @objc dynamic var path = "" @objc dynamic var permissions: Int = 0 + @objc dynamic var primaryKey = "" @objc dynamic var sendPasswordByTalk: Bool = false @objc dynamic var serverUrl = "" @objc dynamic var shareType: Int = 0 @@ -521,7 +525,7 @@ class tableShare: Object { @objc dynamic var userStatus = "" override static func primaryKey() -> String { - return "idShare" + return "primaryKey" } } diff --git a/iOSClient/Data/NCManageDatabase.swift b/iOSClient/Data/NCManageDatabase.swift index fd70a8657..086539348 100644 --- a/iOSClient/Data/NCManageDatabase.swift +++ b/iOSClient/Data/NCManageDatabase.swift @@ -86,90 +86,12 @@ class NCManageDatabase: NSObject { migrationBlock: { migration, oldSchemaVersion in - if oldSchemaVersion < 61 { - migration.deleteData(forType: tableShare.className()) - } - - if oldSchemaVersion < 74 { - migration.enumerateObjects(ofType: tableLocalFile.className()) { oldObject, newObject in - newObject!["ocId"] = oldObject!["fileID"] - } - migration.enumerateObjects(ofType: tableTrash.className()) { oldObject, newObject in - newObject!["fileId"] = oldObject!["fileID"] - } - migration.enumerateObjects(ofType: tableTag.className()) { oldObject, newObject in - newObject!["ocId"] = oldObject!["fileID"] - } - migration.enumerateObjects(ofType: tableE2eEncryptionLock.className()) { oldObject, newObject in - newObject!["ocId"] = oldObject!["fileID"] - } - } - - if oldSchemaVersion < 87 { - migration.deleteData(forType: tableActivity.className()) - migration.deleteData(forType: tableActivityPreview.className()) - migration.deleteData(forType: tableActivitySubjectRich.className()) - migration.deleteData(forType: tableExternalSites.className()) - migration.deleteData(forType: tableGPS.className()) - migration.deleteData(forType: tableTag.className()) - } - - if oldSchemaVersion < 120 { - migration.deleteData(forType: tableCapabilities.className()) - migration.deleteData(forType: tableComments.className()) - } - - if oldSchemaVersion < 134 { - migration.deleteData(forType: tableDirectEditingCreators.className()) - migration.deleteData(forType: tableDirectEditingEditors.className()) - migration.deleteData(forType: tableExternalSites.className()) - } - - if oldSchemaVersion < 141 { - migration.enumerateObjects(ofType: tableAccount.className()) { oldObject, newObject in - newObject!["urlBase"] = oldObject!["url"] - } - } - - if oldSchemaVersion < 162 { - migration.enumerateObjects(ofType: tableAccount.className()) { oldObject, newObject in - newObject!["userId"] = oldObject!["userID"] - migration.deleteData(forType: tableMetadata.className()) - } - } - - if oldSchemaVersion < 212 { - migration.deleteData(forType: tableDirectory.className()) - migration.deleteData(forType: tableE2eEncryption.className()) - migration.deleteData(forType: tableE2eEncryptionLock.className()) - migration.deleteData(forType: tableMetadata.className()) - migration.deleteData(forType: tableShare.className()) - migration.deleteData(forType: tableTrash.className()) - migration.deleteData(forType: tableVideo.className()) - // Delete OLD avatar image - if var pathUrl = CCUtility.getDirectoryGroup() { - pathUrl.appendPathComponent(NCGlobal.shared.appUserData) - do { - let fileURLs = try FileManager.default.contentsOfDirectory(at: pathUrl, includingPropertiesForKeys: nil, options: .skipsHiddenFiles) - for fileURL in fileURLs { - try FileManager.default.removeItem(at: fileURL) - } - } catch { } - } - } - - if oldSchemaVersion < 227 { - migration.deleteData(forType: tableMetadata.className()) - migration.deleteData(forType: tableDirectory.className()) - migration.deleteData(forType: tableTrash.className()) - } - - if oldSchemaVersion < 250 { + if oldSchemaVersion < 254 { migration.deleteData(forType: tableActivity.className()) migration.deleteData(forType: tableActivityLatestId.className()) migration.deleteData(forType: tableActivityPreview.className()) migration.deleteData(forType: tableActivitySubjectRich.className()) - migration.deleteData(forType: tableShare.className()) + migration.deleteData(forType: tableMetadata.className()) } }, shouldCompactOnLaunch: { totalBytes, usedBytes in @@ -1382,9 +1304,6 @@ class NCManageDatabase: NSObject { do { try realm.safeWrite { - let results = realm.objects(tableShare.self).filter("account == %@", account) - realm.delete(results) - for share in shares { let serverUrlPath = home + share.path @@ -1420,6 +1339,7 @@ class NCManageDatabase: NSObject { object.password = share.password object.path = share.path object.permissions = share.permissions + object.primaryKey = account + " " + String(share.idShare) object.sendPasswordByTalk = share.sendPasswordByTalk object.shareType = share.shareType object.shareWith = share.shareWith @@ -1435,7 +1355,7 @@ class NCManageDatabase: NSObject { object.userMessage = share.userMessage object.userStatus = share.userStatus - realm.add(object) + realm.add(object, update: .all) } } } catch let error { diff --git a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift index 5cf32ca81..06b363cf2 100644 --- a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift +++ b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift @@ -434,11 +434,15 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS serverUrl == self.serverUrl, let account = userInfo["account"] as? String, account == appDelegate.account, - let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) + let e2ee = userInfo["e2ee"] as? Bool else { return } - reloadDataSource() - pushMetadata(metadata) + if e2ee { + reloadDataSourceNetwork(forced: true) + } else if let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) { + reloadDataSource() + pushMetadata(metadata) + } } @objc func favoriteFile(_ notification: NSNotification) { @@ -550,7 +554,12 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS account == appDelegate.account else { return } - guard let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) else { return } + // do not exists metadata ? + guard let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) else { + reloadDataSource() + return + } + if metadata.livePhoto && metadata.classFile == NKCommon.typeClassFile.video.rawValue { return } let (indexPath, sameSections) = dataSource.reloadMetadata(ocId: metadata.ocId, ocIdTemp: ocIdTemp) if let indexPath = indexPath { diff --git a/iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift b/iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift index 4bcf4ed7b..1eca7852d 100644 --- a/iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift +++ b/iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift @@ -394,6 +394,7 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate { conflict.metadatasNOConflict = metadatasNOConflict conflict.metadatasUploadInConflict = metadatasUploadInConflict conflict.delegate = self.appDelegate + conflict.isE2EE = CCUtility.isFolderEncrypted(self.serverUrl, e2eEncrypted: false, account: self.appDelegate.account, urlBase: self.appDelegate.urlBase) self.appDelegate.window?.rootViewController?.present(conflict, animated: true, completion: nil) } diff --git a/iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift b/iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift index f114b90a8..7e57a43cd 100644 --- a/iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift +++ b/iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift @@ -57,6 +57,7 @@ extension NCCreateFormUploadConflictDelegate { @objc weak var delegate: NCCreateFormUploadConflictDelegate? @objc var alwaysNewFileNameNumber: Bool = false @objc var textLabelDetailNewFile: String? + @objc var isE2EE: Bool = false var metadatasConflictNewFiles: [String] = [] var metadatasConflictAlreadyExistingFiles: [String] = [] @@ -148,15 +149,17 @@ extension NCCreateFormUploadConflictDelegate { let conflictAlert = UIAlertController(title: tile, message: "", preferredStyle: .alert) // REPLACE - conflictAlert.addAction(UIAlertAction(title: titleReplace, style: .default, handler: { action in + if !isE2EE { + conflictAlert.addAction(UIAlertAction(title: titleReplace, style: .default, handler: { action in - for metadata in self.metadatasUploadInConflict { - self.metadatasNOConflict.append(metadata) - } - - self.buttonContinueTouch(action) - })) + for metadata in self.metadatasUploadInConflict { + self.metadatasNOConflict.append(metadata) + } + self.buttonContinueTouch(action) + })) + } + // KEEP BOTH conflictAlert.addAction(UIAlertAction(title: titleKeep, style: .default, handler: { action in @@ -174,10 +177,12 @@ extension NCCreateFormUploadConflictDelegate { } })) - conflictAlert.addAction(UIAlertAction(title: NSLocalizedString("_more_action_title_", comment: ""), style: .default, handler: { _ in - self.blurView.removeFromSuperview() - })) - + if !isE2EE { + conflictAlert.addAction(UIAlertAction(title: NSLocalizedString("_more_action_title_", comment: ""), style: .default, handler: { _ in + self.blurView.removeFromSuperview() + })) + } + self.present(conflictAlert, animated: true, completion: nil) } diff --git a/iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift b/iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift index c42127c0d..21b24e6bb 100644 --- a/iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift +++ b/iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift @@ -272,14 +272,16 @@ import XLForm let metadataForUpload = NCManageDatabase.shared.createMetadata(account: appDelegate.account, user: appDelegate.user, userId: appDelegate.userId, fileName: String(describing: fileNameForm), fileNameView: String(describing: fileNameForm), ocId: "", serverUrl: serverUrl, urlBase: appDelegate.urlBase, url: "", contentType: "") - guard let conflictViewController = UIStoryboard(name: "NCCreateFormUploadConflict", bundle: nil).instantiateInitialViewController() as? NCCreateFormUploadConflict else { return } - conflictViewController.textLabelDetailNewFile = NSLocalizedString("_now_", comment: "") - conflictViewController.alwaysNewFileNameNumber = true - conflictViewController.serverUrl = serverUrl - conflictViewController.metadatasUploadInConflict = [metadataForUpload] - conflictViewController.delegate = self - - self.present(conflictViewController, animated: true, completion: nil) + guard let conflict = UIStoryboard(name: "NCCreateFormUploadConflict", bundle: nil).instantiateInitialViewController() as? NCCreateFormUploadConflict else { return } + + conflict.textLabelDetailNewFile = NSLocalizedString("_now_", comment: "") + conflict.alwaysNewFileNameNumber = true + conflict.serverUrl = serverUrl + conflict.metadatasUploadInConflict = [metadataForUpload] + conflict.delegate = self + conflict.isE2EE = CCUtility.isFolderEncrypted(serverUrl, e2eEncrypted: false, account: appDelegate.account, urlBase: appDelegate.urlBase) + + self.present(conflict, animated: true, completion: nil) } else { diff --git a/iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift b/iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift index 901361826..4e46599ad 100644 --- a/iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift +++ b/iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift @@ -406,13 +406,15 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC if NCManageDatabase.shared.getMetadataConflict(account: appDelegate.account, serverUrl: serverUrl, fileName: fileNameSave) != nil { - guard let conflictViewController = UIStoryboard(name: "NCCreateFormUploadConflict", bundle: nil).instantiateInitialViewController() as? NCCreateFormUploadConflict else { return } - conflictViewController.textLabelDetailNewFile = NSLocalizedString("_now_", comment: "") - conflictViewController.serverUrl = serverUrl - conflictViewController.metadatasUploadInConflict = [metadataForUpload] - conflictViewController.delegate = self + guard let conflict = UIStoryboard(name: "NCCreateFormUploadConflict", bundle: nil).instantiateInitialViewController() as? NCCreateFormUploadConflict else { return } - self.present(conflictViewController, animated: true, completion: nil) + conflict.textLabelDetailNewFile = NSLocalizedString("_now_", comment: "") + conflict.serverUrl = serverUrl + conflict.metadatasUploadInConflict = [metadataForUpload] + conflict.delegate = self + conflict.isE2EE = CCUtility.isFolderEncrypted(serverUrl, e2eEncrypted: false, account: appDelegate.account, urlBase: appDelegate.urlBase) + + self.present(conflict, animated: true, completion: nil) } else { diff --git a/iOSClient/Main/Create cloud/NCCreateFormUploadVoiceNote.swift b/iOSClient/Main/Create cloud/NCCreateFormUploadVoiceNote.swift index 36876db4e..d38a6cce5 100644 --- a/iOSClient/Main/Create cloud/NCCreateFormUploadVoiceNote.swift +++ b/iOSClient/Main/Create cloud/NCCreateFormUploadVoiceNote.swift @@ -233,13 +233,15 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud if NCManageDatabase.shared.getMetadataConflict(account: appDelegate.account, serverUrl: serverUrl, fileName: fileNameSave) != nil { - guard let conflictViewController = UIStoryboard(name: "NCCreateFormUploadConflict", bundle: nil).instantiateInitialViewController() as? NCCreateFormUploadConflict else { return } - conflictViewController.textLabelDetailNewFile = NSLocalizedString("_now_", comment: "") - conflictViewController.serverUrl = serverUrl - conflictViewController.metadatasUploadInConflict = [metadataForUpload] - conflictViewController.delegate = self - - self.present(conflictViewController, animated: true, completion: nil) + guard let conflict = UIStoryboard(name: "NCCreateFormUploadConflict", bundle: nil).instantiateInitialViewController() as? NCCreateFormUploadConflict else { return } + + conflict.textLabelDetailNewFile = NSLocalizedString("_now_", comment: "") + conflict.serverUrl = serverUrl + conflict.metadatasUploadInConflict = [metadataForUpload] + conflict.delegate = self + conflict.isE2EE = CCUtility.isFolderEncrypted(serverUrl, e2eEncrypted: false, account: appDelegate.account, urlBase: appDelegate.urlBase) + + self.present(conflict, animated: true, completion: nil) } else { diff --git a/iOSClient/Main/NCPickerViewController.swift b/iOSClient/Main/NCPickerViewController.swift index 075a39f83..be8f7af75 100644 --- a/iOSClient/Main/NCPickerViewController.swift +++ b/iOSClient/Main/NCPickerViewController.swift @@ -165,9 +165,11 @@ class NCDocumentPickerViewController: NSObject, UIDocumentPickerDelegate { if NCManageDatabase.shared.getMetadataConflict(account: appDelegate.account, serverUrl: serverUrl, fileName: fileName) != nil { if let conflict = UIStoryboard(name: "NCCreateFormUploadConflict", bundle: nil).instantiateInitialViewController() as? NCCreateFormUploadConflict { + conflict.delegate = appDelegate conflict.serverUrl = serverUrl conflict.metadatasUploadInConflict = [metadataForUpload] + conflict.isE2EE = CCUtility.isFolderEncrypted(serverUrl, e2eEncrypted: false, account: appDelegate.account, urlBase: appDelegate.urlBase) appDelegate.window?.rootViewController?.present(conflict, animated: true, completion: nil) } diff --git a/iOSClient/Menu/NCMenuAction.swift b/iOSClient/Menu/NCMenuAction.swift index 2f5d49792..027150e03 100644 --- a/iOSClient/Menu/NCMenuAction.swift +++ b/iOSClient/Menu/NCMenuAction.swift @@ -117,7 +117,7 @@ extension NCMenuAction { var fileList = "" for (ix, metadata) in selectedMetadatas.enumerated() { guard ix < 3 else { fileList += "\n - ..."; break } - fileList += "\n - " + metadata.fileName + fileList += "\n - " + metadata.fileNameView } return NCMenuAction( diff --git a/iOSClient/NCGlobal.swift b/iOSClient/NCGlobal.swift index 2b6e1c443..3316e61fd 100644 --- a/iOSClient/NCGlobal.swift +++ b/iOSClient/NCGlobal.swift @@ -116,7 +116,7 @@ class NCGlobal: NSObject { // Database Realm // let databaseDefault = "nextcloud.realm" - let databaseSchemaVersion: UInt64 = 250 + let databaseSchemaVersion: UInt64 = 254 // Intro selector // @@ -358,7 +358,7 @@ class NCGlobal: NSObject { let notificationCenterProgressTask = "progressTask" // userInfo: account, ocId, serverUrl, status, progress, totalBytes, totalBytesExpected - let notificationCenterCreateFolder = "createFolder" // userInfo: ocId, serverUrl, account + let notificationCenterCreateFolder = "createFolder" // userInfo: ocId, serverUrl, account, e2ee let notificationCenterDeleteFile = "deleteFile" // userInfo: ocId, fileNameView, serverUrl, account, classFile, onlyLocalCache let notificationCenterRenameFile = "renameFile" // userInfo: ocId, account let notificationCenterMoveFile = "moveFile" // userInfo: ocId, account, serverUrlFrom diff --git a/iOSClient/Networking/NCAutoUpload.swift b/iOSClient/Networking/NCAutoUpload.swift index 84d2adef2..8f430aafe 100644 --- a/iOSClient/Networking/NCAutoUpload.swift +++ b/iOSClient/Networking/NCAutoUpload.swift @@ -168,7 +168,7 @@ class NCAutoUpload: NSObject { } self.endForAssetToUpload = true - if selector == NCGlobal.shared.selectorUploadAutoUploadAll { + if selector == NCGlobal.shared.selectorUploadAutoUploadAll || self.applicationState == .active { self.appDelegate?.networkingProcessUpload?.createProcessUploads(metadatas: metadatas, completion: completion) } else { var metadatasForUpload: [tableMetadata] = [] @@ -177,7 +177,7 @@ class NCAutoUpload: NSObject { metadatasForUpload.append(metadata) } NCManageDatabase.shared.addMetadatas(metadatasForUpload) - NCNetworking.shared.createUploadProcessAutoUpload(completion: completion) + NCNetworking.shared.createUploadProcessAutoUploadInBackground(completion: completion) } } } diff --git a/iOSClient/Networking/NCNetworking.swift b/iOSClient/Networking/NCNetworking.swift index 46b6e61f1..9a52f7a26 100644 --- a/iOSClient/Networking/NCNetworking.swift +++ b/iOSClient/Networking/NCNetworking.swift @@ -412,7 +412,7 @@ import Photos completion(error) } } else { - self.uploadFileInBackground(metadata: metadata, start: start) { error in + uploadFileInBackground(metadata: metadata, start: start) { error in completion(error) } } @@ -506,7 +506,6 @@ import Photos return } let ocIdTemp = metadata.ocId - var errorDescription = error.errorDescription let selector = metadata.sessionSelector if error == .success, let ocId = ocId, size == metadata.size { @@ -554,7 +553,7 @@ import Photos } else { - NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: nil, sessionError: errorDescription, sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusUploadError) + NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: nil, sessionError: error.errorDescription, sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusUploadError) NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "fileName": metadata.fileName, "ocIdTemp": ocIdTemp, "error": error]) } } @@ -594,7 +593,7 @@ import Photos } } - func createUploadProcessAutoUpload(completion: @escaping (_ items: Int) -> Void) { + func createUploadProcessAutoUploadInBackground(completion: @escaping (_ items: Int) -> Void) { var numStartUpload: Int = 0 let isWiFi = NCNetworking.shared.networkReachability == NKCommon.typeReachability.reachableEthernetOrWiFi @@ -1045,7 +1044,7 @@ import Photos NCManageDatabase.shared.addDirectory(encrypted: metadata.e2eEncrypted, favorite: metadata.favorite, ocId: metadata.ocId, fileId: metadata.fileId, etag: nil, permissions: metadata.permissions, serverUrl: fileNameFolderUrl, account: account) } if let metadata = NCManageDatabase.shared.getMetadataFromOcId(metadataFolder?.ocId) { - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterCreateFolder, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account]) + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterCreateFolder, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "e2ee": false]) } } completion(error) @@ -1491,16 +1490,6 @@ import Photos } }) } - - func createFolder(_ serverUrlFileName: String, - options: NKRequestOptions = NKRequestOptions()) async -> (account: String, ocId: String?, date: NSDate?, error: NKError) { - - await withUnsafeContinuation({ continuation in - NextcloudKit.shared.createFolder(serverUrlFileName, options: options) { account, ocId, date, error in - continuation.resume(returning: (account: account, ocId:ocId, date:date, error:error)) - } - }) - } } extension Array where Element == URLQueryItem { diff --git a/iOSClient/Networking/NCNetworkingE2EE.swift b/iOSClient/Networking/NCNetworkingE2EE.swift index 98941fe62..99916f4fe 100644 --- a/iOSClient/Networking/NCNetworkingE2EE.swift +++ b/iOSClient/Networking/NCNetworkingE2EE.swift @@ -95,8 +95,8 @@ import Alamofire if let tableLock = NCManageDatabase.shared.getE2ETokenLock(account: account, serverUrl: serverUrl) { NextcloudKit.shared.lockE2EEFolder(fileId: tableLock.fileId, e2eToken: tableLock.e2eToken, method: "DELETE") { _, _, _, _ in } } - if error == .success { - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterCreateFolder, userInfo: nil) + if error == .success, let ocId = ocId { + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterCreateFolder, userInfo: ["ocId": ocId, "serverUrl": serverUrl, "account": account, "e2ee": true]) } completion(error) } @@ -290,43 +290,43 @@ import Alamofire }) { account, ocId, etag, date, _, _, afError, error in - NCNetworking.shared.uploadRequest.removeValue(forKey: fileNameLocalPath) - if let metadata = NCManageDatabase.shared.getMetadataFromOcId(metadata.ocId) { - if afError?.isExplicitlyCancelledError ?? false { + NCNetworkingE2EE.shared.unlock(account: metadata.account, serverUrl: serverUrl) { _, _, errorLock in - CCUtility.removeFile(atPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId)) - NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)) - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "fileName": metadata.fileName, "ocIdTemp": ocIdTemp, "error": error]) - completion(NKError()) + NCNetworking.shared.uploadRequest.removeValue(forKey: fileNameLocalPath) + if let metadata = NCManageDatabase.shared.getMetadataFromOcId(metadata.ocId) { + if afError?.isExplicitlyCancelledError ?? false { - } else if error == .success && ocId != nil { + CCUtility.removeFile(atPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId)) + NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)) + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "fileName": metadata.fileName, "ocIdTemp": ocIdTemp, "error": error]) - NCUtilityFileSystem.shared.moveFileInBackground(atPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId), toPath: CCUtility.getDirectoryProviderStorageOcId(ocId)) + } else if error == .success && ocId != nil { - metadata.date = date ?? NSDate() - metadata.etag = etag ?? "" - metadata.ocId = ocId! + NCUtilityFileSystem.shared.moveFileInBackground(atPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId), toPath: CCUtility.getDirectoryProviderStorageOcId(ocId)) - metadata.session = "" - metadata.sessionError = "" - metadata.sessionTaskIdentifier = 0 - metadata.status = NCGlobal.shared.metadataStatusNormal + metadata.date = date ?? NSDate() + metadata.etag = etag ?? "" + metadata.ocId = ocId! - NCManageDatabase.shared.addMetadata(metadata) - NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", ocIdTemp)) - NCManageDatabase.shared.addLocalFile(metadata: metadata) + metadata.session = "" + metadata.sessionError = "" + metadata.sessionTaskIdentifier = 0 + metadata.status = NCGlobal.shared.metadataStatusNormal - NCUtility.shared.createImageFrom(fileNameView: metadata.fileNameView, ocId: metadata.ocId, etag: metadata.etag, classFile: metadata.classFile) - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "fileName": metadata.fileName, "ocIdTemp": ocIdTemp, "error": error]) + NCManageDatabase.shared.addMetadata(metadata) + NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", ocIdTemp)) + NCManageDatabase.shared.addLocalFile(metadata: metadata) - } else { + NCUtility.shared.createImageFrom(fileNameView: metadata.fileNameView, ocId: metadata.ocId, etag: metadata.etag, classFile: metadata.classFile) + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "fileName": metadata.fileName, "ocIdTemp": ocIdTemp, "error": error]) + + } else { - NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: nil, sessionError: error.errorDescription, sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusUploadError) + NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: nil, sessionError: error.errorDescription, sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusUploadError) - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "fileName": metadata.fileName, "ocIdTemp": ocIdTemp, "error": error]) + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "fileName": metadata.fileName, "ocIdTemp": ocIdTemp, "error": error]) + } } - } - NCNetworkingE2EE.shared.unlock(account: metadata.account, serverUrl: serverUrl) { _, _, _ in completion(error) } } diff --git a/iOSClient/Networking/NCNetworkingProcessUpload.swift b/iOSClient/Networking/NCNetworkingProcessUpload.swift index ad77bae98..db00a289a 100644 --- a/iOSClient/Networking/NCNetworkingProcessUpload.swift +++ b/iOSClient/Networking/NCNetworkingProcessUpload.swift @@ -34,22 +34,22 @@ class NCNetworkingProcessUpload: NSObject { startTimer() } - private func startProcess(completion: @escaping (_ items: Int) -> Void) { + private func startProcess() { if timerProcess?.isValid ?? false { - DispatchQueue.main.async { self.processForeground() } + DispatchQueue.main.async { self.process() } } } func startTimer() { timerProcess?.invalidate() - timerProcess = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(processForeground), userInfo: nil, repeats: true) + timerProcess = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(process), userInfo: nil, repeats: true) } func stopTimer() { timerProcess?.invalidate() } - @objc private func processForeground() { + @objc private func process() { guard let account = NCManageDatabase.shared.getActiveAccount(), UIApplication.shared.applicationState == .active else { return } let metadatasUpload = NCManageDatabase.shared.getMetadatas(predicate: NSPredicate(format: "status == %d OR status == %d", NCGlobal.shared.metadataStatusInUpload, NCGlobal.shared.metadataStatusUploading)) @@ -183,7 +183,8 @@ class NCNetworkingProcessUpload: NSObject { metadatasForUpload.append(metadata) } NCManageDatabase.shared.addMetadatas(metadatasForUpload) - startProcess(completion: completion) + startProcess() + completion(metadatasForUpload.count) } // MARK: - diff --git a/iOSClient/Networking/NCService.swift b/iOSClient/Networking/NCService.swift index 2e2a5d6ba..a6393e3c6 100644 --- a/iOSClient/Networking/NCService.swift +++ b/iOSClient/Networking/NCService.swift @@ -197,10 +197,9 @@ class NCService: NSObject { if isFilesSharingEnabled { NextcloudKit.shared.readShares(parameters: NKShareParameter(), options: options) { account, shares, data, error in if error == .success { + NCManageDatabase.shared.deleteTableShare(account: account) if let shares = shares, !shares.isEmpty { NCManageDatabase.shared.addShare(urlBase: self.appDelegate.urlBase, account: account, shares: shares) - } else { - NCManageDatabase.shared.deleteTableShare(account: account) } self.appDelegate.shares = NCManageDatabase.shared.getTableShares(account: account) } @@ -279,7 +278,7 @@ class NCService: NSObject { NCManageDatabase.shared.addDashboardWidget(account: account, dashboardWidgets: dashboardWidgets) for widget in dashboardWidgets { if let url = URL(string: widget.iconUrl), let fileName = widget.iconClass { - let (_, data, error) = await NCNetworking.shared.getPreview(url: url) + let (_, data, error) = await NextcloudKit.shared.getPreview(url: url) if error == .success { NCUtility.shared.convertDataToImage(data: data, size: CGSize(width: 256, height: 256), fileNameToWrite: fileName) } diff --git a/iOSClient/Settings/NCManageEndToEndEncryption.m b/iOSClient/Settings/NCManageEndToEndEncryption.m index dfe5f6230..df491e296 100644 --- a/iOSClient/Settings/NCManageEndToEndEncryption.m +++ b/iOSClient/Settings/NCManageEndToEndEncryption.m @@ -376,22 +376,24 @@ - (void)deleteCertificate:(XLFormRowDescriptor *)sender { [self deselectFormRow:sender]; - - [[NextcloudKit shared] deleteE2EECertificateWithCustomUserAgent:nil addCustomHeaders:nil queue:dispatch_get_main_queue() completionHandler:^(NSString *account, NKError *error) { - if (error == NKError.success && [account isEqualToString:appDelegate.account]) { - NKError *error = [[NKError alloc] initWithErrorCode:NCGlobal.shared.errorInternalError errorDescription:@"Success"]; - [[NCContentPresenter shared] messageNotification:@"E2E delete certificate" error:error delay:[[NCGlobal shared] dismissAfterSecond] type:messageTypeSuccess]; - } else { - [[NCContentPresenter shared] messageNotification:@"E2E delete certificate" error:error delay:[[NCGlobal shared] dismissAfterSecond] type:messageTypeError]; - } + + NKRequestOptions *options = [[NKRequestOptions alloc] initWithEndpoint:nil customHeader:nil customUserAgent:nil contentType:nil e2eToken: nil timeout:60 queue:dispatch_get_main_queue()]; + [[NextcloudKit shared] deleteE2EECertificateWithOptions:options completionHandler:^(NSString *account, NKError *error) { + if (error == NKError.success && [account isEqualToString:appDelegate.account]) { + NKError *error = [[NKError alloc] initWithErrorCode:NCGlobal.shared.errorInternalError errorDescription:@"Success"]; + [[NCContentPresenter shared] messageNotification:@"E2E delete certificate" error:error delay:[[NCGlobal shared] dismissAfterSecond] type:messageTypeSuccess]; + } else { + [[NCContentPresenter shared] messageNotification:@"E2E delete certificate" error:error delay:[[NCGlobal shared] dismissAfterSecond] type:messageTypeError]; + } }]; } - (void)deletePrivateKey:(XLFormRowDescriptor *)sender { [self deselectFormRow:sender]; - - [[NextcloudKit shared] deleteE2EEPrivateKeyWithCustomUserAgent:nil addCustomHeaders:nil queue:dispatch_get_main_queue() completionHandler:^(NSString *account, NKError *error) { + + NKRequestOptions *options = [[NKRequestOptions alloc] initWithEndpoint:nil customHeader:nil customUserAgent:nil contentType:nil e2eToken: nil timeout:60 queue:dispatch_get_main_queue()]; + [[NextcloudKit shared] deleteE2EEPrivateKeyWithOptions: options completionHandler:^(NSString *account, NKError *error) { if (error == NKError.success && [account isEqualToString:appDelegate.account]) { NKError *error = [[NKError alloc] initWithErrorCode:NCGlobal.shared.errorInternalError errorDescription:@"Success"]; [[NCContentPresenter shared] messageNotification:@"E2E delete privateKey" error:error delay:[[NCGlobal shared] dismissAfterSecond] type:messageTypeSuccess]; diff --git a/iOSClient/Shares/NCShares.swift b/iOSClient/Shares/NCShares.swift index 7f5819fc8..7ce079ebc 100644 --- a/iOSClient/Shares/NCShares.swift +++ b/iOSClient/Shares/NCShares.swift @@ -98,10 +98,9 @@ class NCShares: NCCollectionViewCommon { } if error == .success { + NCManageDatabase.shared.deleteTableShare(account: account) if let shares = shares, !shares.isEmpty { NCManageDatabase.shared.addShare(urlBase: self.appDelegate.urlBase, account: account, shares: shares) - } else { - NCManageDatabase.shared.deleteTableShare(account: account) } self.appDelegate.shares = NCManageDatabase.shared.getTableShares(account: account) self.reloadDataSource() diff --git a/iOSClient/Supporting Files/bg_BG.lproj/Localizable.strings b/iOSClient/Supporting Files/bg_BG.lproj/Localizable.strings Binary files differindex ed7365921..f38ba9f3d 100644 --- a/iOSClient/Supporting Files/bg_BG.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/bg_BG.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/sv.lproj/Localizable.strings b/iOSClient/Supporting Files/sv.lproj/Localizable.strings Binary files differindex 83402457d..87dadabe5 100644 --- a/iOSClient/Supporting Files/sv.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/sv.lproj/Localizable.strings diff --git a/iOSClient/Utility/NCContentPresenter.swift b/iOSClient/Utility/NCContentPresenter.swift index 8365da0c4..9bdac7417 100644 --- a/iOSClient/Utility/NCContentPresenter.swift +++ b/iOSClient/Utility/NCContentPresenter.swift @@ -97,7 +97,7 @@ class NCContentPresenter: NSObject { func messageNotification(_ title: String, error: NKError, delay: TimeInterval, type: messageType, priority: EKAttributes.Precedence.Priority = .normal, dropEnqueuedEntries: Bool = false) { // No notification message for: - if error.errorCode == NSURLErrorCancelled || error.errorCode == NCGlobal.shared.errorRequestExplicityCancelled { return } // Cancelled transfer + if error.errorCode == NSURLErrorCancelled || error.errorCode == NCGlobal.shared.errorRequestExplicityCancelled || error.errorCode == 423 { return } else if error == .success && type == messageType.error { return } DispatchQueue.main.async { |