diff options
author | Marino Faggiana <ios@nextcloud.com> | 2022-10-17 11:18:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-17 11:18:41 +0300 |
commit | cc64ac49e94ccaa65312a1a0c00d35742cb89316 (patch) | |
tree | 43b1dedafadf500f31371ead28707c2624efe346 | |
parent | 785041f03cbbc0c015eee227b6b3cf344440d84d (diff) | |
parent | f8b9193b30f1d7c32c8e3542aba1d3f79a0fe17c (diff) |
Merge pull request #2196 from nextcloud/develop4.5.0
Version 4.5
458 files changed, 7388 insertions, 4028 deletions
diff --git a/.github/workflows/xcode.yml b/.github/workflows/xcode.yml index 02d4facef..1e30e7d98 100644 --- a/.github/workflows/xcode.yml +++ b/.github/workflows/xcode.yml @@ -54,4 +54,15 @@ jobs: run: | xcodebuild build -project $PROJECT -scheme "$SCHEME" -destination "$DESTINATION" env: - SCHEME: Notification Service Extension
\ No newline at end of file + SCHEME: Notification Service Extension + - name: Build iOS Widget + run: | + xcodebuild build -project $PROJECT -scheme "$SCHEME" -destination "$DESTINATION" + env: + SCHEME: Widget + - name: Build iOS Widget Dashboard IntentHandler + run: | + xcodebuild build -project $PROJECT -scheme "$SCHEME" -destination "$DESTINATION" + env: + SCHEME: WidgetDashboardIntentHandler +
\ No newline at end of file diff --git a/.swiftlint.yml b/.swiftlint.yml index 296f31a28..bc78a39d7 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -41,6 +41,14 @@ excluded: - File Provider Extension/FileProviderExtension.swift - File Provider Extension/FileProviderUtility.swift - Notification Service Extension/NotificationService.swift + - Widget/Widget.swift + - Widget/Dashboard/DashboardData.swift + - Widget/Dashboard/DashboardWidgetView.swift + - Widget/Files/FilesData.swift + - Widget/Files/FilesWidgetView.swift + - Widget/Lockscreen/LockscreenData.swift + - Widget/Lockscreen/LockscreenWidgetView.swift + - Widget/Lockscreen/LockscreenWidgetProvider.swift - iOSClient/Activity/NCActivity.swift - iOSClient/Activity/NCActivityTableViewCell.swift - iOSClient/AppDelegate.swift @@ -56,6 +64,7 @@ excluded: - iOSClient/Data/NCManageDatabase.swift - iOSClient/Data/NCManageDatabase+Metadata.swift - iOSClient/Data/NCManageDatabase+Video.swift + - iOSClient/Data/NCManageDatabase+DashboardWidget.swift - iOSClient/Diagnostics/NCCapabilitiesViewController.swift - iOSClient/EmptyView/NCEmptyDataSet.swift - iOSClient/Extensions/UIColor+Extensions.swift @@ -122,6 +131,7 @@ excluded: - iOSClient/Utility/NCStoreReview.swift - iOSClient/Utility/NCUtility.swift - iOSClient/Utility/NCUtilityFileSystem.swift + - iOSClient/Utility/NCUtilityGUI.swift - iOSClient/Viewer/NCViewer.swift - iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayer.swift - iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift @@ -133,5 +143,4 @@ excluded: - iOSClient/Viewer/NCViewerProviderContextMenu.swift - iOSClient/Viewer/NCViewerRichdocument/NCViewerRichdocument.swift - reporter: "xcode" diff --git a/File Provider Extension/FileProviderData.swift b/File Provider Extension/FileProviderData.swift index 0bfc1d1d8..a24fc3b49 100644 --- a/File Provider Extension/FileProviderData.swift +++ b/File Provider Extension/FileProviderData.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit class fileProviderData: NSObject { static let shared: fileProviderData = { @@ -77,11 +77,11 @@ class fileProviderData: NSObject { // LOG if let pathDirectoryGroup = CCUtility.getDirectoryGroup()?.path { - NCCommunicationCommon.shared.pathLog = pathDirectoryGroup + NKCommon.shared.pathLog = pathDirectoryGroup let levelLog = CCUtility.getLogLevel() - NCCommunicationCommon.shared.levelLog = levelLog + NKCommon.shared.levelLog = levelLog let version = NSString(format: NCBrandOptions.shared.textCopyrightNextcloudiOS as NSString, NCUtility.shared.getVersionApp()) as String - NCCommunicationCommon.shared.writeLog("Start File Provider session with level \(levelLog) " + version + " (File Provider Extension)") + NKCommon.shared.writeLog("[INFO] Start File Provider session with level \(levelLog) " + version + " (File Provider Extension)") } // NO DOMAIN -> Set default account @@ -89,7 +89,6 @@ class fileProviderData: NSObject { guard let activeAccount = NCManageDatabase.shared.getActiveAccount() else { return nil } let serverVersionMajor = NCManageDatabase.shared.getCapabilitiesServerInt(account: activeAccount.account, elements: NCElementsJSON.shared.capabilitiesVersionMajor) - let webDav = NCUtilityFileSystem.shared.getWebDAV(account: activeAccount.account) account = activeAccount.account user = activeAccount.user @@ -97,7 +96,7 @@ class fileProviderData: NSObject { accountUrlBase = activeAccount.urlBase homeServerUrl = NCUtilityFileSystem.shared.getHomeServer(account: activeAccount.account) - NCCommunicationCommon.shared.setup(account: activeAccount.account, user: activeAccount.user, userId: activeAccount.userId, password: CCUtility.getPassword(activeAccount.account), urlBase: activeAccount.urlBase, userAgent: CCUtility.getUserAgent(), webDav: webDav, nextcloudVersion: serverVersionMajor, delegate: NCNetworking.shared) + NKCommon.shared.setup(account: activeAccount.account, user: activeAccount.user, userId: activeAccount.userId, password: CCUtility.getPassword(activeAccount.account), urlBase: activeAccount.urlBase, userAgent: CCUtility.getUserAgent(), nextcloudVersion: serverVersionMajor, delegate: NCNetworking.shared) NCNetworking.shared.delegate = providerExtension as? NCNetworkingDelegate return tableAccount.init(value: activeAccount) @@ -114,7 +113,6 @@ class fileProviderData: NSObject { if accountDomain == domain!.identifier.rawValue { let serverVersionMajor = NCManageDatabase.shared.getCapabilitiesServerInt(account: activeAccount.account, elements: NCElementsJSON.shared.capabilitiesVersionMajor) - let webDav = NCUtilityFileSystem.shared.getWebDAV(account: activeAccount.account) account = activeAccount.account user = activeAccount.user @@ -122,7 +120,7 @@ class fileProviderData: NSObject { accountUrlBase = activeAccount.urlBase homeServerUrl = NCUtilityFileSystem.shared.getHomeServer(account: activeAccount.account) - NCCommunicationCommon.shared.setup(account: activeAccount.account, user: activeAccount.user, userId: activeAccount.userId, password: CCUtility.getPassword(activeAccount.account), urlBase: activeAccount.urlBase, userAgent: CCUtility.getUserAgent(), webDav: webDav, nextcloudVersion: serverVersionMajor, delegate: NCNetworking.shared) + NKCommon.shared.setup(account: activeAccount.account, user: activeAccount.user, userId: activeAccount.userId, password: CCUtility.getPassword(activeAccount.account), urlBase: activeAccount.urlBase, userAgent: CCUtility.getUserAgent(), nextcloudVersion: serverVersionMajor, delegate: NCNetworking.shared) NCNetworking.shared.delegate = providerExtension as? NCNetworkingDelegate return tableAccount.init(value: activeAccount) diff --git a/File Provider Extension/FileProviderEnumerator.swift b/File Provider Extension/FileProviderEnumerator.swift index 5e06d2fca..d1b335a19 100644 --- a/File Provider Extension/FileProviderEnumerator.swift +++ b/File Provider Extension/FileProviderEnumerator.swift @@ -23,7 +23,7 @@ import UIKit import FileProvider -import NCCommunication +import NextcloudKit class FileProviderEnumerator: NSObject, NSFileProviderEnumerator { @@ -203,15 +203,15 @@ class FileProviderEnumerator: NSObject, NSFileProviderEnumerator { directoryEtag = tableDirectory.etag } - NCCommunication.shared.readFileOrFolder(serverUrlFileName: serverUrl, depth: "0", showHiddenFiles: CCUtility.getShowHiddenFiles()) { account, files, _, errorCode, _ in + NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrl, depth: "0", showHiddenFiles: CCUtility.getShowHiddenFiles()) { account, files, _, error in if directoryEtag != files.first?.etag { - NCCommunication.shared.readFileOrFolder(serverUrlFileName: serverUrl, depth: "1", showHiddenFiles: CCUtility.getShowHiddenFiles()) { account, files, _, errorCode, _ in + NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrl, depth: "1", showHiddenFiles: CCUtility.getShowHiddenFiles()) { account, files, _, error in - if errorCode == 0 { + if error == .success { DispatchQueue.global().async { - NCManageDatabase.shared.convertNCCommunicationFilesToMetadatas(files, useMetadataFolder: true, account: account) { _, metadatasFolder, metadatas in + NCManageDatabase.shared.convertNKFilesToMetadatas(files, useMetadataFolder: true, account: account) { _, metadatasFolder, metadatas in let metadatasResult = NCManageDatabase.shared.getMetadatas(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND status == %d", account, serverUrl, NCGlobal.shared.metadataStatusNormal)) NCManageDatabase.shared.updateMetadatas(metadatas, metadatasResult: metadatasResult) for metadata in metadatasFolder { diff --git a/File Provider Extension/FileProviderExtension+Actions.swift b/File Provider Extension/FileProviderExtension+Actions.swift index b45f61009..b7c01570f 100644 --- a/File Provider Extension/FileProviderExtension+Actions.swift +++ b/File Provider Extension/FileProviderExtension+Actions.swift @@ -23,7 +23,7 @@ import UIKit import FileProvider -import NCCommunication +import NextcloudKit extension FileProviderExtension { @@ -37,13 +37,13 @@ extension FileProviderExtension { let directoryName = NCUtilityFileSystem.shared.createFileName(directoryName, serverUrl: tableDirectory.serverUrl, account: fileProviderData.shared.account) let serverUrlFileName = tableDirectory.serverUrl + "/" + directoryName - NCCommunication.shared.createFolder(serverUrlFileName) { account, ocId, _, errorCode, _ in + NextcloudKit.shared.createFolder(serverUrlFileName) { account, ocId, _, error in - if errorCode == 0 { + if error == .success { - NCCommunication.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0", showHiddenFiles: CCUtility.getShowHiddenFiles()) { account, files, _, errorCode, _ in + NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0", showHiddenFiles: CCUtility.getShowHiddenFiles()) { account, files, _, error in - if errorCode == 0 && files.count > 0 { + if error == .success && files.count > 0 { let file = files.first! let metadata = NCManageDatabase.shared.convertNCFileToMetadata(file, isEncrypted: false, account: fileProviderData.shared.account) @@ -88,9 +88,9 @@ extension FileProviderExtension { let serverUrl = metadata.serverUrl let fileName = metadata.fileName - NCCommunication.shared.deleteFileOrFolder(serverUrlFileName) { account, errorCode, _ in + NextcloudKit.shared.deleteFileOrFolder(serverUrlFileName) { account, error in - if errorCode == 0 { // || error == kOCErrorServerPathNotFound { + if error == .success { // || error == kOCErrorServerPathNotFound { let fileNamePath = CCUtility.getDirectoryProviderStorageOcId(itemIdentifier.rawValue)! do { @@ -138,9 +138,9 @@ extension FileProviderExtension { let serverUrlTo = tableDirectoryTo.serverUrl let fileNameTo = serverUrlTo + "/" + itemFrom.filename - NCCommunication.shared.moveFileOrFolder(serverUrlFileNameSource: fileNameFrom, serverUrlFileNameDestination: fileNameTo, overwrite: false) { account, errorCode, _ in + NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: fileNameFrom, serverUrlFileNameDestination: fileNameTo, overwrite: false) { account, error in - if errorCode == 0 { + if error == .success { if metadataFrom.directory { NCManageDatabase.shared.deleteDirectoryAndSubDirectory(serverUrl: serverUrlFrom, account: account) @@ -180,9 +180,9 @@ extension FileProviderExtension { let fileNamePathTo = metadata.serverUrl + "/" + itemName let ocId = metadata.ocId - NCCommunication.shared.moveFileOrFolder(serverUrlFileNameSource: fileNamePathFrom, serverUrlFileNameDestination: fileNamePathTo, overwrite: false) { account, errorCode, _ in + NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: fileNamePathFrom, serverUrlFileNameDestination: fileNamePathTo, overwrite: false) { account, error in - if errorCode == 0 { + if error == .success { // Rename metadata NCManageDatabase.shared.renameMetadata(fileNameTo: itemName, ocId: ocId) @@ -247,9 +247,9 @@ extension FileProviderExtension { if (favorite == true && metadata.favorite == false) || (favorite == false && metadata.favorite == true) { let fileNamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, urlBase: metadata.urlBase, account: metadata.account)! - NCCommunication.shared.setFavorite(fileName: fileNamePath, favorite: favorite) { _, errorCode, _ in + NextcloudKit.shared.setFavorite(fileName: fileNamePath, favorite: favorite) { _, error in - if errorCode == 0 { + if error == .success { guard let metadataTemp = NCManageDatabase.shared.getMetadataFromOcId(ocId) else { completionHandler(nil, NSFileProviderError(.noSuchItem)) diff --git a/File Provider Extension/FileProviderExtension+Thumbnail.swift b/File Provider Extension/FileProviderExtension+Thumbnail.swift index 2e5babea5..87fd9875e 100644 --- a/File Provider Extension/FileProviderExtension+Thumbnail.swift +++ b/File Provider Extension/FileProviderExtension+Thumbnail.swift @@ -23,7 +23,7 @@ import UIKit import FileProvider -import NCCommunication +import NextcloudKit extension FileProviderExtension { @@ -45,20 +45,26 @@ extension FileProviderExtension { let fileNamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, urlBase: metadata.urlBase, account: metadata.account)! let fileNameIconLocalPath = CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag)! - NCCommunication.shared.getPreview(fileNamePath: fileNamePath, widthPreview: NCGlobal.shared.sizeIcon, heightPreview: NCGlobal.shared.sizeIcon) { _, data, errorCode, _ in - if errorCode == 0 && data != nil { - do { - try data!.write(to: URL(fileURLWithPath: fileNameIconLocalPath), options: .atomic) - } catch { } - perThumbnailCompletionHandler(itemIdentifier, data, nil) - } else { - perThumbnailCompletionHandler(itemIdentifier, nil, NSFileProviderError(.serverUnreachable)) - } - counterProgress += 1 - if counterProgress == progress.totalUnitCount { - completionHandler(nil) + if let urlBase = metadata.urlBase.urlEncoded, + let fileNamePath = fileNamePath.urlEncoded, + let url = URL(string: "\(urlBase)/index.php/core/preview.png?file=\(fileNamePath)&x=\(size)&y=\(size)&a=1&mode=cover") { + + NextcloudKit.shared.getPreview(url: url) { _, data, error in + if error == .success && data != nil { + do { + try data!.write(to: URL(fileURLWithPath: fileNameIconLocalPath), options: .atomic) + } catch { } + perThumbnailCompletionHandler(itemIdentifier, data, nil) + } else { + perThumbnailCompletionHandler(itemIdentifier, nil, NSFileProviderError(.serverUnreachable)) + } + counterProgress += 1 + if counterProgress == progress.totalUnitCount { + completionHandler(nil) + } } } + } else { counterProgress += 1 if counterProgress == progress.totalUnitCount { diff --git a/File Provider Extension/FileProviderExtension.swift b/File Provider Extension/FileProviderExtension.swift index 9643b4fdd..f646b4b0b 100644 --- a/File Provider Extension/FileProviderExtension.swift +++ b/File Provider Extension/FileProviderExtension.swift @@ -23,7 +23,7 @@ import UIKit import FileProvider -import NCCommunication +import NextcloudKit import Alamofire /* ----------------------------------------------------------------------------------------------------------------------------------------------- @@ -119,7 +119,7 @@ class FileProviderExtension: NSFileProviderExtension, NCNetworkingDelegate { metadata.fileName = "root" metadata.fileNameView = "root" metadata.serverUrl = fileProviderData.shared.homeServerUrl - metadata.classFile = NCCommunicationCommon.typeClassFile.directory.rawValue + metadata.classFile = NKCommon.typeClassFile.directory.rawValue return FileProviderItem(metadata: metadata, parentItemIdentifier: NSFileProviderItemIdentifier(NSFileProviderItemIdentifier.rootContainer.rawValue)) @@ -209,7 +209,7 @@ class FileProviderExtension: NSFileProviderExtension, NCNetworkingDelegate { NCManageDatabase.shared.setMetadataStatus(ocId: metadata.ocId, status: NCGlobal.shared.metadataStatusDownloading) fileProviderData.shared.signalEnumerator(ocId: metadata.ocId, update: true) - NCCommunication.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, requestHandler: { _ in + NextcloudKit.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, requestHandler: { _ in }, taskHandler: { task in @@ -218,7 +218,7 @@ class FileProviderExtension: NSFileProviderExtension, NCNetworkingDelegate { }, progressHandler: { _ in - }) { _, etag, date, _, _, _, errorCode, errorDescription in + }) { _, etag, date, _, _, _, error in self.outstandingSessionTasks.removeValue(forKey: url) guard var metadata = fileProviderUtility.shared.getTableMetadataFromItemIdentifier(identifier) else { @@ -227,7 +227,7 @@ class FileProviderExtension: NSFileProviderExtension, NCNetworkingDelegate { } metadata = tableMetadata.init(value: metadata) - if errorCode == 0 { + if error == .success { metadata.status = NCGlobal.shared.metadataStatusNormal metadata.date = date ?? NSDate() @@ -238,7 +238,7 @@ class FileProviderExtension: NSFileProviderExtension, NCNetworkingDelegate { completionHandler(nil) - } else if errorCode == 200 { + } else if error.errorCode == 200 { NCManageDatabase.shared.setMetadataStatus(ocId: metadata.ocId, status: NCGlobal.shared.metadataStatusNormal) @@ -247,7 +247,7 @@ class FileProviderExtension: NSFileProviderExtension, NCNetworkingDelegate { } else { metadata.status = NCGlobal.shared.metadataStatusDownloadError - metadata.sessionError = errorDescription + metadata.sessionError = error.errorDescription NCManageDatabase.shared.addMetadata(metadata) completionHandler(NSFileProviderError(.noSuchItem)) @@ -277,7 +277,7 @@ class FileProviderExtension: NSFileProviderExtension, NCNetworkingDelegate { let serverUrlFileName = metadata.serverUrl + "/" + fileName let fileNameLocalPath = url.path - if let task = NCCommunicationBackground.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, dateCreationFile: nil, dateModificationFile: nil, description: metadata.ocId, session: NCNetworking.shared.sessionManagerBackgroundExtension) { + if let task = NKBackground.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, dateCreationFile: nil, dateModificationFile: nil, description: metadata.ocId, session: NCNetworking.shared.sessionManagerBackgroundExtension) { fileProviderData.shared.fileProviderManager.register(task, forItemWithIdentifier: NSFileProviderItemIdentifier(metadata.fileId)) { _ in } } @@ -357,7 +357,7 @@ class FileProviderExtension: NSFileProviderExtension, NCNetworkingDelegate { let serverUrlFileName = tableDirectory.serverUrl + "/" + fileName let fileNameLocalPath = CCUtility.getDirectoryProviderStorageOcId(ocIdTemp, fileNameView: fileName)! - if let task = NCCommunicationBackground.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, dateCreationFile: nil, dateModificationFile: nil, description: ocIdTemp, session: NCNetworking.shared.sessionManagerBackgroundExtension) { + if let task = NKBackground.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, dateCreationFile: nil, dateModificationFile: nil, description: ocIdTemp, session: NCNetworking.shared.sessionManagerBackgroundExtension) { self.outstandingSessionTasks[URL(fileURLWithPath: fileNameLocalPath)] = task as URLSessionTask @@ -371,7 +371,7 @@ class FileProviderExtension: NSFileProviderExtension, NCNetworkingDelegate { } } - func uploadComplete(fileName: String, serverUrl: String, ocId: String?, etag: String?, date: NSDate?, size: Int64, description: String?, task: URLSessionTask, errorCode: Int, errorDescription: String) { + func uploadComplete(fileName: String, serverUrl: String, ocId: String?, etag: String?, date: NSDate?, size: Int64, description: String?, task: URLSessionTask, error: NKError) { guard let ocIdTemp = description else { return } guard let metadataTemp = NCManageDatabase.shared.getMetadataFromOcId(ocIdTemp) else { return } @@ -383,7 +383,7 @@ class FileProviderExtension: NSFileProviderExtension, NCNetworkingDelegate { } outstandingOcIdTemp[ocIdTemp] = ocId - if errorCode == 0 { + if error == .success { // New file if ocId != ocIdTemp { diff --git a/File Provider Extension/FileProviderItem.swift b/File Provider Extension/FileProviderItem.swift index 28f752099..a0e2c9a96 100644 --- a/File Provider Extension/FileProviderItem.swift +++ b/File Provider Extension/FileProviderItem.swift @@ -23,7 +23,7 @@ import UIKit import FileProvider -import NCCommunication +import NextcloudKit class FileProviderItem: NSObject, NSFileProviderItem { @@ -43,7 +43,7 @@ class FileProviderItem: NSObject, NSFileProviderItem { } var typeIdentifier: String { - let results = NCCommunicationCommon.shared.getInternalType(fileName: metadata.fileNameView, mimeType: "", directory: metadata.directory) + let results = NKCommon.shared.getInternalType(fileName: metadata.fileNameView, mimeType: "", directory: metadata.directory) return results.typeIdentifier } diff --git a/MDM/AppConfig/specfile.xml b/MDM/AppConfig/specfile.xml deleted file mode 100644 index 57435fb1d..000000000 --- a/MDM/AppConfig/specfile.xml +++ /dev/null @@ -1,47 +0,0 @@ -<managedAppConfiguration> - <version>1.0.0</version> - <bundleId>it.twsweb.Nextcloud</bundleId> - <dict> - <string keyName="serverUrl"> - <defaultValue> - <value>https://cloud.nextcloud.com</value> - </defaultValue> - </string> - <string keyName="username"> - <defaultValue> - <value>marino.faggiana</value> - </defaultValue> - </string> - <string keyName="password"> - <defaultValue> - <value>password</value> - </defaultValue> - </string> - </dict> - <presentation defaultLocale="en-US"> - <field keyName="serverUrl" type="input"> - <label> - <language value="en-US">serverUrl</language> - </label> - <description> - <language value="en-US">Nextcloud server url</language> - </description> - </field> - <field keyName="username" type="input"> - <label> - <language value="en-US">username</language> - </label> - <description> - <language value="en-US">User Name</language> - </description> - </field> - <field keyName="password" type="input"> - <label> - <language value="en-US">password</language> - </label> - <description> - <language value="en-US">Password</language> - </description> - </field> - </presentation> -</managedAppConfiguration>
\ No newline at end of file diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj index eede78bd1..fa77edbbe 100644 --- a/Nextcloud.xcodeproj/project.pbxproj +++ b/Nextcloud.xcodeproj/project.pbxproj @@ -11,7 +11,7 @@ 2C1D5D7623E2DE3300334ABB /* NCManageDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7BAADB51ED5A87C00B7EAD4 /* NCManageDatabase.swift */; }; 2C1D5D7923E2DE9100334ABB /* NCBrand.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76B3CCD1EAE01BD00921AC9 /* NCBrand.swift */; }; 2C33C48223E2C475005F963B /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C33C48123E2C475005F963B /* NotificationService.swift */; }; - 2C33C48623E2C475005F963B /* Notification Service Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 2C33C47F23E2C475005F963B /* Notification Service Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 2C33C48623E2C475005F963B /* Notification Service Extension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 2C33C47F23E2C475005F963B /* Notification Service Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 2CB7D1CA23E2EDCB00376EF9 /* NCPushNotificationEncryption.m in Sources */ = {isa = PBXBuildFile; fileRef = F72D1005210B6882009C96B7 /* NCPushNotificationEncryption.m */; }; 3704EB2A23D5A58400455C5B /* NCMenu.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3704EB2923D5A58400455C5B /* NCMenu.storyboard */; }; 370D26AF248A3D7A00121797 /* NCCellProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 370D26AE248A3D7A00121797 /* NCCellProtocol.swift */; }; @@ -127,6 +127,7 @@ F710FC84277B7D3500AA9FBF /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = F710FC83277B7D3500AA9FBF /* RealmSwift */; }; F710FC86277B7D3F00AA9FBF /* Realm in Frameworks */ = {isa = PBXBuildFile; productRef = F710FC85277B7D3F00AA9FBF /* Realm */; }; F710FC88277B7D3F00AA9FBF /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = F710FC87277B7D3F00AA9FBF /* RealmSwift */; }; + F711D63128F44801003F43C8 /* IntentHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7C9739428F17131002C43E2 /* IntentHandler.swift */; }; F7134186259747BA00768D21 /* NCPushNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = F7134185259747BA00768D21 /* NCPushNotification.m */; }; F713FF002472764100214AF6 /* UIImage+animatedGIF.m in Sources */ = {isa = PBXBuildFile; fileRef = F713FEFF2472764100214AF6 /* UIImage+animatedGIF.m */; }; F71459D21D12E3B700CAFEEC /* CCUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = F7053E3D1C639DF500741EA5 /* CCUtility.m */; }; @@ -155,16 +156,33 @@ F7245927289BB59300474787 /* ThreadSafeDictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7245923289BB50B00474787 /* ThreadSafeDictionary.swift */; }; F72685E727C78E490019EF5E /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F72685E927C78E490019EF5E /* InfoPlist.strings */; }; F726EEEC1FED1C820030B9C8 /* NCEndToEndInitialize.swift in Sources */ = {isa = PBXBuildFile; fileRef = F726EEEB1FED1C820030B9C8 /* NCEndToEndInitialize.swift */; }; - F72928A0253B0937009CA4FD /* NCMainNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F729289F253B0937009CA4FD /* NCMainNavigationController.swift */; }; + F72A17D828B221E300F3F159 /* DashboardWidgetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F72A17D728B221E300F3F159 /* DashboardWidgetView.swift */; }; F72A47EC2487B06B005AD489 /* NCOperationQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = F72A47EB2487B06B005AD489 /* NCOperationQueue.swift */; }; + F72AD70D28C24B93006CB92D /* NextcloudKit in Frameworks */ = {isa = PBXBuildFile; productRef = F72AD70C28C24B93006CB92D /* NextcloudKit */; }; + F72AD70F28C24BA1006CB92D /* NextcloudKit in Frameworks */ = {isa = PBXBuildFile; productRef = F72AD70E28C24BA1006CB92D /* NextcloudKit */; }; + F72AD71128C24BBB006CB92D /* NextcloudKit in Frameworks */ = {isa = PBXBuildFile; productRef = F72AD71028C24BBB006CB92D /* NextcloudKit */; }; + F72AD71328C24BCC006CB92D /* NextcloudKit in Frameworks */ = {isa = PBXBuildFile; productRef = F72AD71228C24BCC006CB92D /* NextcloudKit */; }; F72CD01227A7E92400E59476 /* JGProgressHUD in Frameworks */ = {isa = PBXBuildFile; productRef = F72CD01127A7E92400E59476 /* JGProgressHUD */; }; F72CD63A25C19EBF00F46F9A /* NCAutoUpload.swift in Sources */ = {isa = PBXBuildFile; fileRef = F72CD63925C19EBF00F46F9A /* NCAutoUpload.swift */; }; F72D1007210B6882009C96B7 /* NCPushNotificationEncryption.m in Sources */ = {isa = PBXBuildFile; fileRef = F72D1005210B6882009C96B7 /* NCPushNotificationEncryption.m */; }; F72D404923D2082500A97FD0 /* NCViewerNextcloudText.swift in Sources */ = {isa = PBXBuildFile; fileRef = F72D404823D2082500A97FD0 /* NCViewerNextcloudText.swift */; }; F72D7EB7263B1207000B3DFC /* MarkdownKit in Frameworks */ = {isa = PBXBuildFile; productRef = F72D7EB6263B1207000B3DFC /* MarkdownKit */; }; F72DA9B425F53E4E00B87DB1 /* SwiftRichString in Frameworks */ = {isa = PBXBuildFile; productRef = F72DA9B325F53E4E00B87DB1 /* SwiftRichString */; }; + F72EA95228B7BA2A00C88F0C /* DashboardWidgetProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = F72EA95128B7BA2A00C88F0C /* DashboardWidgetProvider.swift */; }; + F72EA95428B7BABA00C88F0C /* FilesWidgetProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = F72EA95328B7BABA00C88F0C /* FilesWidgetProvider.swift */; }; + F72EA95828B7BC4F00C88F0C /* FilesData.swift in Sources */ = {isa = PBXBuildFile; fileRef = F72EA95728B7BC4F00C88F0C /* FilesData.swift */; }; + F72EA95A28B7BD0D00C88F0C /* FilesWidgetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F72EA95928B7BD0D00C88F0C /* FilesWidgetView.swift */; }; F732D23327CF8AED000B0F1B /* NCPlayerToolBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = F732D23227CF8AED000B0F1B /* NCPlayerToolBar.xib */; }; F733598125C1C188002ABA72 /* NCAskAuthorization.swift in Sources */ = {isa = PBXBuildFile; fileRef = F733598025C1C188002ABA72 /* NCAskAuthorization.swift */; }; + F7346E1228B0EF5B006CE2D2 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7346E1128B0EF5B006CE2D2 /* WidgetKit.framework */; }; + F7346E1328B0EF5B006CE2D2 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F79BCEEA270B49C800B5B71F /* SwiftUI.framework */; }; + F7346E1628B0EF5C006CE2D2 /* Widget.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7346E1528B0EF5C006CE2D2 /* Widget.swift */; }; + F7346E1C28B0EF5E006CE2D2 /* Widget.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = F7346E1028B0EF5B006CE2D2 /* Widget.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + F7346E2328B0FEBA006CE2D2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F7346E2228B0FEBA006CE2D2 /* Assets.xcassets */; }; + F7346E2528B0FEFA006CE2D2 /* UICKeyChainStore in Frameworks */ = {isa = PBXBuildFile; productRef = F7346E2428B0FEFA006CE2D2 /* UICKeyChainStore */; }; + F7346E2728B0FFF2006CE2D2 /* Realm in Frameworks */ = {isa = PBXBuildFile; productRef = F7346E2628B0FFF2006CE2D2 /* Realm */; }; + F7346E2928B0FFF2006CE2D2 /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = F7346E2828B0FFF2006CE2D2 /* RealmSwift */; }; + F734B06628E75C0100E180D5 /* TLPhotoPicker in Frameworks */ = {isa = PBXBuildFile; productRef = F734B06528E75C0100E180D5 /* TLPhotoPicker */; }; F7362A1F220C853A005101B5 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7362A1E220C853A005101B5 /* LaunchScreen.storyboard */; }; F7381EE1218218C9000B1560 /* NCOffline.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7381EDA218218C9000B1560 /* NCOffline.swift */; }; F7381EE5218218C9000B1560 /* NCOffline.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7381EDE218218C9000B1560 /* NCOffline.storyboard */; }; @@ -198,7 +216,7 @@ F749C10C23C4A5340027D966 /* NCIntroViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F749C10823C4A5330027D966 /* NCIntroViewController.swift */; }; F749C10D23C4A5340027D966 /* NCIntro.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F749C10923C4A5330027D966 /* NCIntro.storyboard */; }; F749C10E23C4A5340027D966 /* NCIntroCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F749C10A23C4A5340027D966 /* NCIntroCollectionViewCell.xib */; }; - F749E4E91DC1FB38009BA2FD /* Share.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = F7CE8AFB1DC1F8D8009CAE48 /* Share.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + F749E4E91DC1FB38009BA2FD /* Share.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = F7CE8AFB1DC1F8D8009CAE48 /* Share.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; F74AF3A4247FB6AE00AC767B /* NCUtilityFileSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = F74AF3A3247FB6AE00AC767B /* NCUtilityFileSystem.swift */; }; F74AF3A5247FB6AE00AC767B /* NCUtilityFileSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = F74AF3A3247FB6AE00AC767B /* NCUtilityFileSystem.swift */; }; F74AF3A6247FB6AE00AC767B /* NCUtilityFileSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = F74AF3A3247FB6AE00AC767B /* NCUtilityFileSystem.swift */; }; @@ -261,7 +279,9 @@ F76DA963277B760E0082465B /* Queuer in Frameworks */ = {isa = PBXBuildFile; productRef = F76DA962277B760E0082465B /* Queuer */; }; F76DA966277B76F30082465B /* UICKeyChainStore in Frameworks */ = {isa = PBXBuildFile; productRef = F76DA965277B76F30082465B /* UICKeyChainStore */; }; F76DA969277B77EA0082465B /* DropDown in Frameworks */ = {isa = PBXBuildFile; productRef = F76DA968277B77EA0082465B /* DropDown */; }; - F76DA96F277B78AE0082465B /* TLPhotoPicker in Frameworks */ = {isa = PBXBuildFile; productRef = F76DA96E277B78AE0082465B /* TLPhotoPicker */; }; + F76DEE9728F808AF0041B1C9 /* LockscreenData.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76DEE9428F808AF0041B1C9 /* LockscreenData.swift */; }; + F76DEE9828F808AF0041B1C9 /* LockscreenWidgetProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76DEE9528F808AF0041B1C9 /* LockscreenWidgetProvider.swift */; }; + F76DEE9928F808AF0041B1C9 /* LockscreenWidgetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76DEE9628F808AF0041B1C9 /* LockscreenWidgetView.swift */; }; F7707687263A853700A1BA94 /* NCContentPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F765608E23BF813500765969 /* NCContentPresenter.swift */; }; F7707689263A896A00A1BA94 /* UIImage+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7B7504A2397D38E004E13EC /* UIImage+Extensions.swift */; }; F770768A263A8A2500A1BA94 /* NCUtilityFileSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = F74AF3A3247FB6AE00AC767B /* NCUtilityFileSystem.swift */; }; @@ -269,7 +289,7 @@ F771E3D320E2392D00AFB62D /* FileProviderExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F771E3D220E2392D00AFB62D /* FileProviderExtension.swift */; }; F771E3D520E2392D00AFB62D /* FileProviderItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = F771E3D420E2392D00AFB62D /* FileProviderItem.swift */; }; F771E3D720E2392D00AFB62D /* FileProviderEnumerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = F771E3D620E2392D00AFB62D /* FileProviderEnumerator.swift */; }; - F771E3EB20E2392E00AFB62D /* File Provider Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = F771E3D020E2392D00AFB62D /* File Provider Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + F771E3EB20E2392E00AFB62D /* File Provider Extension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = F771E3D020E2392D00AFB62D /* File Provider Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; F771E3F320E239A600AFB62D /* FileProviderData.swift in Sources */ = {isa = PBXBuildFile; fileRef = F771E3F220E239A600AFB62D /* FileProviderData.swift */; }; F771E3F720E239B500AFB62D /* FileProviderExtension+Actions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F771E3F420E239B400AFB62D /* FileProviderExtension+Actions.swift */; }; F771E3F820E239B500AFB62D /* FileProviderExtension+Thumbnail.swift in Sources */ = {isa = PBXBuildFile; fileRef = F771E3F520E239B400AFB62D /* FileProviderExtension+Thumbnail.swift */; }; @@ -293,19 +313,38 @@ F77BB746289984CA0090FC19 /* UIViewController+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F77BB745289984CA0090FC19 /* UIViewController+Extension.swift */; }; F77BB748289985270090FC19 /* UITabBarController+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F77BB747289985270090FC19 /* UITabBarController+Extension.swift */; }; F77BB74A2899857B0090FC19 /* UINavigationController+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F77BB7492899857B0090FC19 /* UINavigationController+Extension.swift */; }; + F77ED59128C9CE9D00E24ED0 /* ToolbarData.swift in Sources */ = {isa = PBXBuildFile; fileRef = F77ED59028C9CE9D00E24ED0 /* ToolbarData.swift */; }; + F77ED59328C9CEA000E24ED0 /* ToolbarWidgetProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = F77ED59228C9CEA000E24ED0 /* ToolbarWidgetProvider.swift */; }; + F77ED59528C9CEA400E24ED0 /* ToolbarWidgetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F77ED59428C9CEA300E24ED0 /* ToolbarWidgetView.swift */; }; F78071091EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m in Sources */ = {isa = PBXBuildFile; fileRef = F78071081EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m */; }; F780710A1EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m in Sources */ = {isa = PBXBuildFile; fileRef = F78071081EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m */; }; F78295311F962EFA00A572F5 /* NCEndToEndEncryption.m in Sources */ = {isa = PBXBuildFile; fileRef = F70CAE391F8CF31A008125FD /* NCEndToEndEncryption.m */; }; F782FDC424E6933900666099 /* NCUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70BFC7320E0FA7C00C67599 /* NCUtility.swift */; }; + F78302F628B4C3C500B84583 /* NCDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7BAADB41ED5A87C00B7EAD4 /* NCDatabase.swift */; }; + F78302F728B4C3C900B84583 /* NCManageDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7BAADB51ED5A87C00B7EAD4 /* NCManageDatabase.swift */; }; + F78302F828B4C3E100B84583 /* NCManageDatabase+Activity.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF4BF61D27562B3F0081CEEF /* NCManageDatabase+Activity.swift */; }; + F78302F928B4C3E600B84583 /* NCManageDatabase+Account.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF4BF613275629E20081CEEF /* NCManageDatabase+Account.swift */; }; + F78302FA28B4C3EA00B84583 /* NCManageDatabase+Metadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF4BF61827562A4B0081CEEF /* NCManageDatabase+Metadata.swift */; }; + F78302FB28B4C3EE00B84583 /* NCManageDatabase+Video.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E98C1527E0D0FC001F9F19 /* NCManageDatabase+Video.swift */; }; + F78302FC28B4C3F300B84583 /* NCElementsJSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = F73D5E46246DE09200DF6467 /* NCElementsJSON.swift */; }; + F78302FD28B4C42B00B84583 /* NCUserBaseUrl.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF817EF0274BC781009ED85B /* NCUserBaseUrl.swift */; }; + F78302FE28B4C44700B84583 /* NCBrand.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76B3CCD1EAE01BD00921AC9 /* NCBrand.swift */; }; + F78302FF28B4C45000B84583 /* NCUtilityFileSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = F74AF3A3247FB6AE00AC767B /* NCUtilityFileSystem.swift */; }; + F783030028B4C45800B84583 /* NCGlobal.swift in Sources */ = {isa = PBXBuildFile; fileRef = F702F2CE25EE5B5C008F8E80 /* NCGlobal.swift */; }; + F783030128B4C49700B84583 /* UIImage+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7B7504A2397D38E004E13EC /* UIImage+Extensions.swift */; }; + F783030228B4C4B800B84583 /* NCUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70BFC7320E0FA7C00C67599 /* NCUtility.swift */; }; + F783030328B4C4DD00B84583 /* ThreadSafeDictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7245923289BB50B00474787 /* ThreadSafeDictionary.swift */; }; + F783030528B4C50600B84583 /* SVGKit in Frameworks */ = {isa = PBXBuildFile; productRef = F783030428B4C50600B84583 /* SVGKit */; }; + F783030628B4C51E00B84583 /* String+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7A0D1342591FBC5008F8A13 /* String+Extensions.swift */; }; + F783030728B4C52800B84583 /* UIColor+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70CEF5523E9C7E50007035B /* UIColor+Extensions.swift */; }; + F783030D28B4C59A00B84583 /* SwiftEntryKit in Frameworks */ = {isa = PBXBuildFile; productRef = F783030C28B4C59A00B84583 /* SwiftEntryKit */; }; + F783031228B4C8EC00B84583 /* CCUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = F7053E3D1C639DF500741EA5 /* CCUtility.m */; }; + F783034428B5142B00B84583 /* NextcloudKit in Frameworks */ = {isa = PBXBuildFile; productRef = F783034328B5142B00B84583 /* NextcloudKit */; }; F785EE9D246196DF00B3F945 /* NCNetworkingE2EE.swift in Sources */ = {isa = PBXBuildFile; fileRef = F785EE9C246196DF00B3F945 /* NCNetworkingE2EE.swift */; }; F785EE9E2461A09900B3F945 /* NCNetworking.swift in Sources */ = {isa = PBXBuildFile; fileRef = F75A9EE523796C6F0044CFCE /* NCNetworking.swift */; }; F785EEA42461A4A600B3F945 /* NCUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70BFC7320E0FA7C00C67599 /* NCUtility.swift */; }; F785EEA52461A4CF00B3F945 /* CCUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = F7053E3D1C639DF500741EA5 /* CCUtility.m */; }; F785EEA62461A4FB00B3F945 /* CCUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = F7053E3D1C639DF500741EA5 /* CCUtility.m */; }; - F786D58D253454BF00E3DD7B /* NCCommunication in Frameworks */ = {isa = PBXBuildFile; productRef = F786D58C253454BF00E3DD7B /* NCCommunication */; }; - F786D593253454CE00E3DD7B /* NCCommunication in Frameworks */ = {isa = PBXBuildFile; productRef = F786D592253454CE00E3DD7B /* NCCommunication */; }; - F786D595253454D300E3DD7B /* NCCommunication in Frameworks */ = {isa = PBXBuildFile; productRef = F786D594253454D300E3DD7B /* NCCommunication */; }; - F786D597253454D800E3DD7B /* NCCommunication in Frameworks */ = {isa = PBXBuildFile; productRef = F786D596253454D800E3DD7B /* NCCommunication */; }; F787704F22E7019900F287A9 /* NCShareLinkCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F787704E22E7019900F287A9 /* NCShareLinkCell.xib */; }; F788ECC7263AAAFA00ADC67F /* MarkdownKit in Frameworks */ = {isa = PBXBuildFile; productRef = F788ECC6263AAAFA00ADC67F /* MarkdownKit */; }; F78A18B623CDD07D00F681F3 /* NCViewerRichWorkspaceWebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F78A18B523CDD07D00F681F3 /* NCViewerRichWorkspaceWebView.swift */; }; @@ -322,6 +361,12 @@ F78F74342163757000C2ADAD /* NCTrash.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F78F74332163757000C2ADAD /* NCTrash.storyboard */; }; F78F74362163781100C2ADAD /* NCTrash.swift in Sources */ = {isa = PBXBuildFile; fileRef = F78F74352163781100C2ADAD /* NCTrash.swift */; }; F790110E21415BF600D7B136 /* NCViewerRichdocument.swift in Sources */ = {isa = PBXBuildFile; fileRef = F790110D21415BF600D7B136 /* NCViewerRichdocument.swift */; }; + F793E59D28B761E7005E4B02 /* NCNetworking.swift in Sources */ = {isa = PBXBuildFile; fileRef = F75A9EE523796C6F0044CFCE /* NCNetworking.swift */; }; + F793E59E28B763C2005E4B02 /* NCAskAuthorization.swift in Sources */ = {isa = PBXBuildFile; fileRef = F733598025C1C188002ABA72 /* NCAskAuthorization.swift */; }; + F793E59F28B764F6005E4B02 /* NCContentPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F765608E23BF813500765969 /* NCContentPresenter.swift */; }; + F793E5A028B7651B005E4B02 /* NCViewCertificateDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7BC287F26663F85004D46C5 /* NCViewCertificateDetails.swift */; }; + F793E5A128B76541005E4B02 /* NotificationCenter+MainThread.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70460512499061800BB98A7 /* NotificationCenter+MainThread.swift */; }; + F793E5A228B76580005E4B02 /* NCNetworkingChunkedUpload.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7B8CD90261AF3F7007C1359 /* NCNetworkingChunkedUpload.swift */; }; F798F0E225880608000DAFFD /* UIColor+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70CEF5523E9C7E50007035B /* UIColor+Extensions.swift */; }; F798F0E725880609000DAFFD /* UIColor+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70CEF5523E9C7E50007035B /* UIColor+Extensions.swift */; }; F798F0EC2588060A000DAFFD /* UIColor+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70CEF5523E9C7E50007035B /* UIColor+Extensions.swift */; }; @@ -343,6 +388,30 @@ F7A321AD1E9E6AD50069AD1B /* CCAdvanced.m in Sources */ = {isa = PBXBuildFile; fileRef = F7A321AC1E9E6AD50069AD1B /* CCAdvanced.m */; }; F7A76DC8256A71CD00119AB3 /* UIImage+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7B7504A2397D38E004E13EC /* UIImage+Extensions.swift */; }; F7A76DCD256A71CE00119AB3 /* UIImage+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7B7504A2397D38E004E13EC /* UIImage+Extensions.swift */; }; + F7A8D72428F1771B008BBE1C /* NextcloudKit in Frameworks */ = {isa = PBXBuildFile; productRef = F7A8D72328F1771B008BBE1C /* NextcloudKit */; }; + F7A8D72628F17728008BBE1C /* Realm in Frameworks */ = {isa = PBXBuildFile; productRef = F7A8D72528F17728008BBE1C /* Realm */; }; + F7A8D72828F17728008BBE1C /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = F7A8D72728F17728008BBE1C /* RealmSwift */; }; + F7A8D72A28F17733008BBE1C /* SVGKit in Frameworks */ = {isa = PBXBuildFile; productRef = F7A8D72928F17733008BBE1C /* SVGKit */; }; + F7A8D72C28F17742008BBE1C /* SwiftEntryKit in Frameworks */ = {isa = PBXBuildFile; productRef = F7A8D72B28F17742008BBE1C /* SwiftEntryKit */; }; + F7A8D72E28F17764008BBE1C /* UICKeyChainStore in Frameworks */ = {isa = PBXBuildFile; productRef = F7A8D72D28F17764008BBE1C /* UICKeyChainStore */; }; + F7A8D73428F17E12008BBE1C /* NCDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7BAADB41ED5A87C00B7EAD4 /* NCDatabase.swift */; }; + F7A8D73528F17E16008BBE1C /* NCManageDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7BAADB51ED5A87C00B7EAD4 /* NCManageDatabase.swift */; }; + F7A8D73628F17E1A008BBE1C /* NCManageDatabase+Activity.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF4BF61D27562B3F0081CEEF /* NCManageDatabase+Activity.swift */; }; + F7A8D73728F17E1E008BBE1C /* NCManageDatabase+Account.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF4BF613275629E20081CEEF /* NCManageDatabase+Account.swift */; }; + F7A8D73828F17E21008BBE1C /* NCManageDatabase+DashboardWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7D68FCB28CB9051009139F3 /* NCManageDatabase+DashboardWidget.swift */; }; + F7A8D73928F17E25008BBE1C /* NCManageDatabase+Metadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF4BF61827562A4B0081CEEF /* NCManageDatabase+Metadata.swift */; }; + F7A8D73A28F17E28008BBE1C /* NCManageDatabase+Video.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E98C1527E0D0FC001F9F19 /* NCManageDatabase+Video.swift */; }; + F7A8D73B28F17E2C008BBE1C /* NCElementsJSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = F73D5E46246DE09200DF6467 /* NCElementsJSON.swift */; }; + F7A8D73C28F181BC008BBE1C /* NCBrand.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76B3CCD1EAE01BD00921AC9 /* NCBrand.swift */; }; + F7A8D73D28F181D3008BBE1C /* NCUtilityFileSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = F74AF3A3247FB6AE00AC767B /* NCUtilityFileSystem.swift */; }; + F7A8D73E28F181E2008BBE1C /* NCUserBaseUrl.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF817EF0274BC781009ED85B /* NCUserBaseUrl.swift */; }; + F7A8D73F28F181EF008BBE1C /* NCGlobal.swift in Sources */ = {isa = PBXBuildFile; fileRef = F702F2CE25EE5B5C008F8E80 /* NCGlobal.swift */; }; + F7A8D74028F18212008BBE1C /* UIImage+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7B7504A2397D38E004E13EC /* UIImage+Extensions.swift */; }; + F7A8D74128F18254008BBE1C /* UIColor+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70CEF5523E9C7E50007035B /* UIColor+Extensions.swift */; }; + F7A8D74228F18261008BBE1C /* NCUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70BFC7320E0FA7C00C67599 /* NCUtility.swift */; }; + F7A8D74328F1826F008BBE1C /* String+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7A0D1342591FBC5008F8A13 /* String+Extensions.swift */; }; + F7A8D74428F1827B008BBE1C /* ThreadSafeDictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7245923289BB50B00474787 /* ThreadSafeDictionary.swift */; }; + F7A8D74528F1828E008BBE1C /* CCUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = F7053E3D1C639DF500741EA5 /* CCUtility.m */; }; F7AC1CB028AB94490032D99F /* Array+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7AC1CAF28AB94490032D99F /* Array+Extensions.swift */; }; F7AE00F5230D5F9E007ACF8A /* NCLoginWeb.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7AE00F4230D5F9E007ACF8A /* NCLoginWeb.swift */; }; F7AE00F8230E81CB007ACF8A /* NCBrowserWeb.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7AE00F7230E81CB007ACF8A /* NCBrowserWeb.swift */; }; @@ -362,9 +431,15 @@ F7BC288026663F85004D46C5 /* NCViewCertificateDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7BC287F26663F85004D46C5 /* NCViewCertificateDetails.swift */; }; F7BD71E62636EAFC00643C34 /* NCNetworkingE2EE.swift in Sources */ = {isa = PBXBuildFile; fileRef = F785EE9C246196DF00B3F945 /* NCNetworkingE2EE.swift */; }; F7C1EEA525053A9C00866ACC /* NCDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7C1EEA425053A9C00866ACC /* NCDataSource.swift */; }; + F7C7B25028B8AD4500E7115D /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = F7E70DE91A24DE4100E1B66A /* Localizable.strings */; }; + F7C7B25128B8B0C400E7115D /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F7F67BB81A24D27800EE80DA /* Images.xcassets */; }; F7C7B489245EBA4100D93E60 /* NCViewerQuickLook.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7C7B488245EBA4100D93E60 /* NCViewerQuickLook.swift */; }; F7C9555321F0C4CA0024296E /* NCActivity.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7C9555221F0C4CA0024296E /* NCActivity.storyboard */; }; F7C9555521F0C5470024296E /* NCActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7C9555421F0C5470024296E /* NCActivity.swift */; }; + F7C9739228F17131002C43E2 /* Intents.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7C9739128F17131002C43E2 /* Intents.framework */; }; + F7C9739528F17131002C43E2 /* IntentHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7C9739428F17131002C43E2 /* IntentHandler.swift */; }; + F7C9739928F17131002C43E2 /* WidgetDashboardIntentHandler.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = F7C9739028F17131002C43E2 /* WidgetDashboardIntentHandler.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + F7C9739D28F1733B002C43E2 /* Dashboard.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = F7FABE3928D1DAD00000A325 /* Dashboard.intentdefinition */; }; F7CA212D25F1333300826ABB /* NCAccountRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7CA212B25F1333200826ABB /* NCAccountRequest.swift */; }; F7CA212E25F1333300826ABB /* NCAccountRequest.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7CA212C25F1333200826ABB /* NCAccountRequest.storyboard */; }; F7CB689A2541676B0050EC94 /* NCMore.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7CB68992541676B0050EC94 /* NCMore.storyboard */; }; @@ -374,10 +449,15 @@ F7D1612023CF19E30039EBBF /* NCViewerRichWorkspace.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7D1611F23CF19E30039EBBF /* NCViewerRichWorkspace.storyboard */; }; F7D57C8626317BDA00DE301D /* NCAccountRequest.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7CA212C25F1333200826ABB /* NCAccountRequest.storyboard */; }; F7D57C8B26317BDE00DE301D /* NCAccountRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7CA212B25F1333200826ABB /* NCAccountRequest.swift */; }; + F7D68FCC28CB9051009139F3 /* NCManageDatabase+DashboardWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7D68FCB28CB9051009139F3 /* NCManageDatabase+DashboardWidget.swift */; }; + F7D68FCD28CB9051009139F3 /* NCManageDatabase+DashboardWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7D68FCB28CB9051009139F3 /* NCManageDatabase+DashboardWidget.swift */; }; + F7D68FCE28CB9051009139F3 /* NCManageDatabase+DashboardWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7D68FCB28CB9051009139F3 /* NCManageDatabase+DashboardWidget.swift */; }; + F7D68FCF28CB9051009139F3 /* NCManageDatabase+DashboardWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7D68FCB28CB9051009139F3 /* NCManageDatabase+DashboardWidget.swift */; }; + F7D68FD028CB9051009139F3 /* NCManageDatabase+DashboardWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7D68FCB28CB9051009139F3 /* NCManageDatabase+DashboardWidget.swift */; }; F7D96FCC246ED7E200536D73 /* NCNetworkingCheckRemoteUser.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7D96FCB246ED7E100536D73 /* NCNetworkingCheckRemoteUser.swift */; }; - F7DBC37C23325E02001A85BA /* NCAppConfigView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7DBC37B23325E01001A85BA /* NCAppConfigView.swift */; }; F7DFB7F0219C5B8000680748 /* NCCreateFormUploadAssets.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7DFB7EF219C5B8000680748 /* NCCreateFormUploadAssets.swift */; }; F7DFB7F4219C5CA800680748 /* NCCreateFormUploadScanDocument.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7DFB7F3219C5CA800680748 /* NCCreateFormUploadScanDocument.swift */; }; + F7E0710128B13BB00001B882 /* DashboardData.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E0710028B13BB00001B882 /* DashboardData.swift */; }; F7E0CDCF265CE8610044854E /* NCUserStatus.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7E0CDCE265CE8610044854E /* NCUserStatus.storyboard */; }; F7E4D9C422ED929B003675FD /* NCShareCommentsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E4D9C322ED929B003675FD /* NCShareCommentsCell.swift */; }; F7E572FD278F146C00F8C99E /* OpenSSL.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = F70B86802642CF5400ED5349 /* OpenSSL.xcframework */; }; @@ -390,9 +470,6 @@ F7EBCDCF277B81FF00A4EF67 /* UICKeyChainStore in Frameworks */ = {isa = PBXBuildFile; productRef = F7EBCDCE277B81FF00A4EF67 /* UICKeyChainStore */; }; F7EBCDD1277B820D00A4EF67 /* UICKeyChainStore in Frameworks */ = {isa = PBXBuildFile; productRef = F7EBCDD0277B820D00A4EF67 /* UICKeyChainStore */; }; F7EBCDD3277B821700A4EF67 /* UICKeyChainStore in Frameworks */ = {isa = PBXBuildFile; productRef = F7EBCDD2277B821700A4EF67 /* UICKeyChainStore */; }; - F7EBCDD5277B82DE00A4EF67 /* Queuer in Frameworks */ = {isa = PBXBuildFile; productRef = F7EBCDD4277B82DE00A4EF67 /* Queuer */; }; - F7EBCDD7277B834400A4EF67 /* Queuer in Frameworks */ = {isa = PBXBuildFile; productRef = F7EBCDD6277B834400A4EF67 /* Queuer */; }; - F7EBCDD9277B834F00A4EF67 /* Queuer in Frameworks */ = {isa = PBXBuildFile; productRef = F7EBCDD8277B834F00A4EF67 /* Queuer */; }; F7ED547C25EEA65400956C55 /* QRCodeReader in Frameworks */ = {isa = PBXBuildFile; productRef = F7ED547B25EEA65400956C55 /* QRCodeReader */; }; F7EDE4CC262D7B6F00414FE6 /* NCEmptyDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7239870253D86B600257F49 /* NCEmptyDataSet.swift */; }; F7EDE4D1262D7B8400414FE6 /* NCDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7C1EEA425053A9C00866ACC /* NCDataSource.swift */; }; @@ -422,6 +499,9 @@ F7F878AE1FB9E3B900599E4F /* NCEndToEndMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7F878AD1FB9E3B900599E4F /* NCEndToEndMetadata.swift */; }; F7F878AF1FB9E3B900599E4F /* NCEndToEndMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7F878AD1FB9E3B900599E4F /* NCEndToEndMetadata.swift */; }; F7F9D1BB25397CE000D9BFF5 /* NCViewer.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7F9D1BA25397CE000D9BFF5 /* NCViewer.swift */; }; + F7FABE3628D1DAD00000A325 /* Dashboard.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = F7FABE3928D1DAD00000A325 /* Dashboard.intentdefinition */; }; + F7FABE3728D1DAD00000A325 /* Dashboard.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = F7FABE3928D1DAD00000A325 /* Dashboard.intentdefinition */; settings = {ATTRIBUTES = (codegen, ); }; }; + F7FAFD3A28BFA948000777FE /* NCNotification+Menu.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7FAFD3928BFA947000777FE /* NCNotification+Menu.swift */; }; F7FF2CB12842159500EBB7A1 /* NCSectionHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7FF2CB02842159500EBB7A1 /* NCSectionHeader.xib */; }; /* End PBXBuildFile section */ @@ -447,6 +527,13 @@ remoteGlobalIDString = F71459B41D12E3B700CAFEEC; remoteInfo = "Share Ext Nextcloud"; }; + F7346E1A28B0EF5E006CE2D2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = F7F67BA01A24D27800EE80DA /* Project object */; + proxyType = 1; + remoteGlobalIDString = F7346E0F28B0EF5B006CE2D2; + remoteInfo = DashboardWidgetExtension; + }; F771E3E920E2392E00AFB62D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = F7F67BA01A24D27800EE80DA /* Project object */; @@ -454,6 +541,13 @@ remoteGlobalIDString = F771E3CF20E2392D00AFB62D; remoteInfo = "File Provider Extension"; }; + F7C9739728F17131002C43E2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = F7F67BA01A24D27800EE80DA /* Project object */; + proxyType = 1; + remoteGlobalIDString = F7C9738F28F17131002C43E2; + remoteInfo = WidgetDashboardIntentHandler; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -471,17 +565,19 @@ name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; }; - F77B0F981D118A16002130FE /* Embed App Extensions */ = { + F77B0F981D118A16002130FE /* Embed Foundation Extensions */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 13; files = ( - F771E3EB20E2392E00AFB62D /* File Provider Extension.appex in Embed App Extensions */, - F749E4E91DC1FB38009BA2FD /* Share.appex in Embed App Extensions */, - 2C33C48623E2C475005F963B /* Notification Service Extension.appex in Embed App Extensions */, + F771E3EB20E2392E00AFB62D /* File Provider Extension.appex in Embed Foundation Extensions */, + F749E4E91DC1FB38009BA2FD /* Share.appex in Embed Foundation Extensions */, + 2C33C48623E2C475005F963B /* Notification Service Extension.appex in Embed Foundation Extensions */, + F7C9739928F17131002C43E2 /* WidgetDashboardIntentHandler.appex in Embed Foundation Extensions */, + F7346E1C28B0EF5E006CE2D2 /* Widget.appex in Embed Foundation Extensions */, ); - name = "Embed App Extensions"; + name = "Embed Foundation Extensions"; runOnlyForDeploymentPostprocessing = 0; }; /* End PBXCopyFilesBuildPhase section */ @@ -616,6 +712,7 @@ F710D1F42405770F00A6033D /* NCViewerPDF.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCViewerPDF.swift; sourceTree = "<group>"; }; F710D2012405826100A6033D /* NCViewer+Menu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NCViewer+Menu.swift"; sourceTree = "<group>"; }; F710E80F1EF95C9C00DC2427 /* ImagesIntro.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = ImagesIntro.xcassets; sourceTree = "<group>"; }; + F711D63328F47A66003F43C8 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Dashboard.strings; sourceTree = "<group>"; }; F7134184259747BA00768D21 /* NCPushNotification.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NCPushNotification.h; sourceTree = "<group>"; }; F7134185259747BA00768D21 /* NCPushNotification.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NCPushNotification.m; sourceTree = "<group>"; }; F713FEFE2472764000214AF6 /* UIImage+animatedGIF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+animatedGIF.h"; sourceTree = "<group>"; }; @@ -657,18 +754,28 @@ F726EEEB1FED1C820030B9C8 /* NCEndToEndInitialize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCEndToEndInitialize.swift; sourceTree = "<group>"; }; F728B2BB23E83AD200E12DA0 /* Notification_Service_Extension.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Notification_Service_Extension.plist; sourceTree = "<group>"; }; F728B2BC23E83AD200E12DA0 /* Notification_Service_Extension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Notification_Service_Extension.entitlements; sourceTree = "<group>"; }; - F729289F253B0937009CA4FD /* NCMainNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCMainNavigationController.swift; sourceTree = "<group>"; }; + F72A17D728B221E300F3F159 /* DashboardWidgetView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DashboardWidgetView.swift; sourceTree = "<group>"; }; F72A47EB2487B06B005AD489 /* NCOperationQueue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCOperationQueue.swift; sourceTree = "<group>"; }; F72CD63925C19EBF00F46F9A /* NCAutoUpload.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCAutoUpload.swift; sourceTree = "<group>"; }; F72D1005210B6882009C96B7 /* NCPushNotificationEncryption.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NCPushNotificationEncryption.m; sourceTree = "<group>"; }; F72D1006210B6882009C96B7 /* NCPushNotificationEncryption.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NCPushNotificationEncryption.h; sourceTree = "<group>"; }; F72D404823D2082500A97FD0 /* NCViewerNextcloudText.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCViewerNextcloudText.swift; sourceTree = "<group>"; }; F72E0B9C21AD60BC00898D7B /* WeScan.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WeScan.framework; path = Carthage/Build/iOS/WeScan.framework; sourceTree = "<group>"; }; + F72EA95128B7BA2A00C88F0C /* DashboardWidgetProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashboardWidgetProvider.swift; sourceTree = "<group>"; }; + F72EA95328B7BABA00C88F0C /* FilesWidgetProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilesWidgetProvider.swift; sourceTree = "<group>"; }; + F72EA95728B7BC4F00C88F0C /* FilesData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilesData.swift; sourceTree = "<group>"; }; + F72EA95928B7BD0D00C88F0C /* FilesWidgetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilesWidgetView.swift; sourceTree = "<group>"; }; F7320934201B812F008A0888 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/Localizable.strings; sourceTree = "<group>"; }; F732093B201B81E4008A0888 /* es-419 */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-419"; path = "es-419.lproj/Localizable.strings"; sourceTree = "<group>"; }; F732D23227CF8AED000B0F1B /* NCPlayerToolBar.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCPlayerToolBar.xib; sourceTree = "<group>"; }; F733598025C1C188002ABA72 /* NCAskAuthorization.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCAskAuthorization.swift; sourceTree = "<group>"; }; F733B65121997CC1001C1FFA /* TLPhotoPicker.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = TLPhotoPicker.framework; path = Carthage/Build/iOS/TLPhotoPicker.framework; sourceTree = "<group>"; }; + F7346E1028B0EF5B006CE2D2 /* Widget.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = Widget.appex; sourceTree = BUILT_PRODUCTS_DIR; }; + F7346E1128B0EF5B006CE2D2 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; }; + F7346E1528B0EF5C006CE2D2 /* Widget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Widget.swift; sourceTree = "<group>"; }; + F7346E2028B0FA3A006CE2D2 /* Widget-Brinding-header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Widget-Brinding-header.h"; sourceTree = "<group>"; }; + F7346E2128B0FBEE006CE2D2 /* Widget.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Widget.plist; sourceTree = "<group>"; }; + F7346E2228B0FEBA006CE2D2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; F7362A1E220C853A005101B5 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; }; F736B551234DCF57008A5C9F /* Alamofire.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Alamofire.framework; path = Carthage/Build/iOS/Alamofire.framework; sourceTree = "<group>"; }; F7381EDA218218C9000B1560 /* NCOffline.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCOffline.swift; sourceTree = "<group>"; }; @@ -744,6 +851,9 @@ F76D3CF02428B40E005DFA87 /* NCViewerPDFSearch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCViewerPDFSearch.swift; sourceTree = "<group>"; }; F76D3CF22428B94E005DFA87 /* NCViewerPDFSearchCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCViewerPDFSearchCell.xib; sourceTree = "<group>"; }; F76D3CF42428D0C0005DFA87 /* NCViewerPDF.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = NCViewerPDF.storyboard; sourceTree = "<group>"; }; + F76DEE9428F808AF0041B1C9 /* LockscreenData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LockscreenData.swift; sourceTree = "<group>"; }; + F76DEE9528F808AF0041B1C9 /* LockscreenWidgetProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LockscreenWidgetProvider.swift; sourceTree = "<group>"; }; + F76DEE9628F808AF0041B1C9 /* LockscreenWidgetView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LockscreenWidgetView.swift; sourceTree = "<group>"; }; F76E71E42244DF6900690001 /* Zip.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Zip.framework; path = Carthage/Build/iOS/Zip.framework; sourceTree = "<group>"; }; F76FDEAA24859C3D0095B6C2 /* Queuer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Queuer.framework; path = Carthage/Build/iOS/Queuer.framework; sourceTree = "<group>"; }; F771E3D020E2392D00AFB62D /* File Provider Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "File Provider Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -786,8 +896,15 @@ F77BB745289984CA0090FC19 /* UIViewController+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIViewController+Extension.swift"; sourceTree = "<group>"; }; F77BB747289985270090FC19 /* UITabBarController+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITabBarController+Extension.swift"; sourceTree = "<group>"; }; F77BB7492899857B0090FC19 /* UINavigationController+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UINavigationController+Extension.swift"; sourceTree = "<group>"; }; + F77ED59028C9CE9D00E24ED0 /* ToolbarData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolbarData.swift; sourceTree = "<group>"; }; + F77ED59228C9CEA000E24ED0 /* ToolbarWidgetProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolbarWidgetProvider.swift; sourceTree = "<group>"; }; + F77ED59428C9CEA300E24ED0 /* ToolbarWidgetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolbarWidgetView.swift; sourceTree = "<group>"; }; F78071071EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSNotificationCenter+MainThread.h"; sourceTree = "<group>"; }; F78071081EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSNotificationCenter+MainThread.m"; sourceTree = "<group>"; }; + F783030E28B4C83F00B84583 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; }; + F783031028B4C86200B84583 /* libc++.1.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.1.tbd"; path = "usr/lib/libc++.1.tbd"; sourceTree = SDKROOT; }; + F783031128B4C86200B84583 /* libc++abi.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++abi.tbd"; path = "usr/lib/libc++abi.tbd"; sourceTree = SDKROOT; }; + F783033F28B50B7E00B84583 /* Widget.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Widget.entitlements; sourceTree = "<group>"; }; F785EE9C246196DF00B3F945 /* NCNetworkingE2EE.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCNetworkingE2EE.swift; sourceTree = "<group>"; }; F787704E22E7019900F287A9 /* NCShareLinkCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCShareLinkCell.xib; sourceTree = "<group>"; }; F78A18B523CDD07D00F681F3 /* NCViewerRichWorkspaceWebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCViewerRichWorkspaceWebView.swift; sourceTree = "<group>"; }; @@ -823,6 +940,9 @@ F7A0D1342591FBC5008F8A13 /* String+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extensions.swift"; sourceTree = "<group>"; }; F7A321AB1E9E6AD50069AD1B /* CCAdvanced.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCAdvanced.h; sourceTree = "<group>"; }; F7A321AC1E9E6AD50069AD1B /* CCAdvanced.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCAdvanced.m; sourceTree = "<group>"; }; + F7A8D72228F176B6008BBE1C /* WidgetDashboardIntentHandler-Brinding-header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "WidgetDashboardIntentHandler-Brinding-header.h"; sourceTree = "<group>"; }; + F7A8D73028F17C44008BBE1C /* WidgetDashboardIntentHandler.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = WidgetDashboardIntentHandler.entitlements; sourceTree = "<group>"; }; + F7A8D73328F17C62008BBE1C /* WidgetDashboardIntentHandler.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = WidgetDashboardIntentHandler.plist; sourceTree = "<group>"; }; F7AA41B827C7CF4600494705 /* ca */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ca; path = ca.lproj/InfoPlist.strings; sourceTree = "<group>"; }; F7AA41B927C7CF4B00494705 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/InfoPlist.strings"; sourceTree = "<group>"; }; F7AA41BA27C7CF5000494705 /* zh-Hant-TW */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant-TW"; path = "zh-Hant-TW.lproj/InfoPlist.strings"; sourceTree = "<group>"; }; @@ -907,12 +1027,58 @@ F7C7B488245EBA4100D93E60 /* NCViewerQuickLook.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCViewerQuickLook.swift; sourceTree = "<group>"; }; F7C9555221F0C4CA0024296E /* NCActivity.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCActivity.storyboard; sourceTree = "<group>"; }; F7C9555421F0C5470024296E /* NCActivity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCActivity.swift; sourceTree = "<group>"; }; + F7C9739028F17131002C43E2 /* WidgetDashboardIntentHandler.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = WidgetDashboardIntentHandler.appex; sourceTree = BUILT_PRODUCTS_DIR; }; + F7C9739128F17131002C43E2 /* Intents.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Intents.framework; path = System/Library/Frameworks/Intents.framework; sourceTree = SDKROOT; }; + F7C9739428F17131002C43E2 /* IntentHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IntentHandler.swift; sourceTree = "<group>"; }; F7CA212B25F1333200826ABB /* NCAccountRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCAccountRequest.swift; sourceTree = "<group>"; }; F7CA212C25F1333200826ABB /* NCAccountRequest.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = NCAccountRequest.storyboard; sourceTree = "<group>"; }; F7CB68992541676B0050EC94 /* NCMore.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCMore.storyboard; sourceTree = "<group>"; }; F7CB689F254169530050EC94 /* NCSettings.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCSettings.storyboard; sourceTree = "<group>"; }; F7CBC31B24F78E79004D3812 /* NCSortMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCSortMenu.swift; sourceTree = "<group>"; }; F7CC04E61F5AD50D00378CEF /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = "<group>"; }; + F7CD836428F6B4DA00E93B11 /* eu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = eu; path = eu.lproj/Dashboard.strings; sourceTree = "<group>"; }; + F7CD836628F6B4DA00E93B11 /* ca */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ca; path = ca.lproj/Dashboard.strings; sourceTree = "<group>"; }; + F7CD836828F6B4DB00E93B11 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD836A28F6B4DC00E93B11 /* zh-Hant-TW */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant-TW"; path = "zh-Hant-TW.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD836C28F6B4DC00E93B11 /* cs-CZ */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "cs-CZ"; path = "cs-CZ.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD836E28F6B4DD00E93B11 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Dashboard.strings; sourceTree = "<group>"; }; + F7CD837028F6B4E100E93B11 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Dashboard.strings; sourceTree = "<group>"; }; + F7CD837228F6B4E300E93B11 /* en-GB */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "en-GB"; path = "en-GB.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD837428F6B4E700E93B11 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Dashboard.strings; sourceTree = "<group>"; }; + F7CD837628F6B4E800E93B11 /* gl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = gl; path = gl.lproj/Dashboard.strings; sourceTree = "<group>"; }; + F7CD837828F6B4EA00E93B11 /* ka-GE */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "ka-GE"; path = "ka-GE.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD837A28F6B4EC00E93B11 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Dashboard.strings; sourceTree = "<group>"; }; + F7CD837C28F6B4ED00E93B11 /* hu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/Dashboard.strings; sourceTree = "<group>"; }; + F7CD837E28F6B4EE00E93B11 /* is */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = is; path = is.lproj/Dashboard.strings; sourceTree = "<group>"; }; + F7CD838028F6B4EF00E93B11 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Dashboard.strings; sourceTree = "<group>"; }; + F7CD838228F6B4F000E93B11 /* ja-JP */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "ja-JP"; path = "ja-JP.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD838428F6B4F200E93B11 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/Dashboard.strings; sourceTree = "<group>"; }; + F7CD838628F6B4F300E93B11 /* nb-NO */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "nb-NO"; path = "nb-NO.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD838828F6B4F400E93B11 /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Dashboard.strings; sourceTree = "<group>"; }; + F7CD838A28F6B4F800E93B11 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD838C28F6B4F900E93B11 /* pt-PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-PT"; path = "pt-PT.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD838E28F6B4F900E93B11 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Dashboard.strings; sourceTree = "<group>"; }; + F7CD839028F6B4FA00E93B11 /* sr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sr; path = sr.lproj/Dashboard.strings; sourceTree = "<group>"; }; + F7CD839228F6B4FB00E93B11 /* sk-SK */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "sk-SK"; path = "sk-SK.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD839428F6B4FC00E93B11 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Dashboard.strings; sourceTree = "<group>"; }; + F7CD839628F6B4FC00E93B11 /* es-CL */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-CL"; path = "es-CL.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD839828F6B4FD00E93B11 /* es-CO */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-CO"; path = "es-CO.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD839A28F6B4FE00E93B11 /* es-CR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-CR"; path = "es-CR.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD839C28F6B4FF00E93B11 /* es-DO */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-DO"; path = "es-DO.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD839E28F6B4FF00E93B11 /* es-EC */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-EC"; path = "es-EC.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD83A028F6B50000E93B11 /* es-SV */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-SV"; path = "es-SV.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD83A228F6B50100E93B11 /* es-GT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-GT"; path = "es-GT.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD83A428F6B50100E93B11 /* es-HN */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-HN"; path = "es-HN.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD83A628F6B50200E93B11 /* es-419 */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-419"; path = "es-419.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD83A828F6B50300E93B11 /* es-MX */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-MX"; path = "es-MX.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD83AA28F6B50400E93B11 /* es-NI */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-NI"; path = "es-NI.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD83AC28F6B50400E93B11 /* es-PA */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-PA"; path = "es-PA.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD83AE28F6B50500E93B11 /* es-PY */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-PY"; path = "es-PY.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD83B028F6B50600E93B11 /* es-PE */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-PE"; path = "es-PE.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD83B228F6B50700E93B11 /* es-PR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-PR"; path = "es-PR.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD83B428F6B50700E93B11 /* es-UY */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-UY"; path = "es-UY.lproj/Dashboard.strings"; sourceTree = "<group>"; }; + F7CD83B628F6B50800E93B11 /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/Dashboard.strings; sourceTree = "<group>"; }; + F7CD83B828F6B50800E93B11 /* tr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = tr; path = tr.lproj/Dashboard.strings; sourceTree = "<group>"; }; F7CE8AFA1DC1F8D8009CAE48 /* Nextcloud.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Nextcloud.app; sourceTree = BUILT_PRODUCTS_DIR; }; F7CE8AFB1DC1F8D8009CAE48 /* Share.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = Share.appex; sourceTree = BUILT_PRODUCTS_DIR; }; F7D0F33D264144FC0097D4A3 /* Background.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Background.xcassets; sourceTree = "<group>"; }; @@ -923,12 +1089,13 @@ F7D532541F5D4155006568B1 /* sk-SK */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "sk-SK"; path = "sk-SK.lproj/Localizable.strings"; sourceTree = "<group>"; }; F7D5328F1F5D443B006568B1 /* en-GB */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "en-GB"; path = "en-GB.lproj/Localizable.strings"; sourceTree = "<group>"; }; F7D532A41F5D4461006568B1 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; }; + F7D68FCB28CB9051009139F3 /* NCManageDatabase+DashboardWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCManageDatabase+DashboardWidget.swift"; sourceTree = "<group>"; }; F7D96FCB246ED7E100536D73 /* NCNetworkingCheckRemoteUser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCNetworkingCheckRemoteUser.swift; sourceTree = "<group>"; }; - F7DBC37B23325E01001A85BA /* NCAppConfigView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCAppConfigView.swift; sourceTree = "<group>"; }; F7DBD82B23E46A4700ECB7C6 /* MarkdownKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MarkdownKit.framework; path = Carthage/Build/iOS/MarkdownKit.framework; sourceTree = "<group>"; }; F7DE9AB01F482FA5008DFE10 /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/Localizable.strings; sourceTree = "<group>"; }; F7DFB7EF219C5B8000680748 /* NCCreateFormUploadAssets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCCreateFormUploadAssets.swift; sourceTree = "<group>"; }; F7DFB7F3219C5CA800680748 /* NCCreateFormUploadScanDocument.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCCreateFormUploadScanDocument.swift; sourceTree = "<group>"; }; + F7E0710028B13BB00001B882 /* DashboardData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashboardData.swift; sourceTree = "<group>"; }; F7E0CDCE265CE8610044854E /* NCUserStatus.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCUserStatus.storyboard; sourceTree = "<group>"; }; F7E45E6D21E75BF200579249 /* ja-JP */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "ja-JP"; path = "ja-JP.lproj/Localizable.strings"; sourceTree = "<group>"; }; F7E4D9C322ED929B003675FD /* NCShareCommentsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCShareCommentsCell.swift; sourceTree = "<group>"; }; @@ -957,6 +1124,8 @@ F7F67BB81A24D27800EE80DA /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; }; F7F878AD1FB9E3B900599E4F /* NCEndToEndMetadata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCEndToEndMetadata.swift; sourceTree = "<group>"; }; F7F9D1BA25397CE000D9BFF5 /* NCViewer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCViewer.swift; sourceTree = "<group>"; }; + F7FABE3828D1DAD00000A325 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.intentdefinition; name = Base; path = Base.lproj/Dashboard.intentdefinition; sourceTree = "<group>"; }; + F7FAFD3928BFA947000777FE /* NCNotification+Menu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NCNotification+Menu.swift"; sourceTree = "<group>"; }; F7FC7D551DC1F93800BB2C6A /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; F7FF2CB02842159500EBB7A1 /* NCSectionHeader.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCSectionHeader.xib; sourceTree = "<group>"; }; /* End PBXFileReference section */ @@ -966,12 +1135,11 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F72AD71128C24BBB006CB92D /* NextcloudKit in Frameworks */, F710FC88277B7D3F00AA9FBF /* RealmSwift in Frameworks */, - F7EBCDD9277B834F00A4EF67 /* Queuer in Frameworks */, F710FC86277B7D3F00AA9FBF /* Realm in Frameworks */, F7EBCDD3277B821700A4EF67 /* UICKeyChainStore in Frameworks */, F75E57C325BF0ED2002B72C2 /* SVGKit in Frameworks */, - F786D597253454D800E3DD7B /* NCCommunication in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -988,28 +1156,41 @@ files = ( F7E57302278F14FF00F8C99E /* OpenSSL.xcframework in Frameworks */, F710FC80277B7D2700AA9FBF /* RealmSwift in Frameworks */, + F72AD70F28C24BA1006CB92D /* NextcloudKit in Frameworks */, F72CD01227A7E92400E59476 /* JGProgressHUD in Frameworks */, F710FC7E277B7D2600AA9FBF /* Realm in Frameworks */, F73ADD2126554F8E0069EA0D /* SwiftEntryKit in Frameworks */, F7EBCDCF277B81FF00A4EF67 /* UICKeyChainStore in Frameworks */, F75E57BF25BF0EC8002B72C2 /* SVGKit in Frameworks */, - F7EBCDD5277B82DE00A4EF67 /* Queuer in Frameworks */, - F786D593253454CE00E3DD7B /* NCCommunication in Frameworks */, F72D7EB7263B1207000B3DFC /* MarkdownKit in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; + F7346E0D28B0EF5B006CE2D2 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + F783030528B4C50600B84583 /* SVGKit in Frameworks */, + F7346E2528B0FEFA006CE2D2 /* UICKeyChainStore in Frameworks */, + F783034428B5142B00B84583 /* NextcloudKit in Frameworks */, + F7346E1328B0EF5B006CE2D2 /* SwiftUI.framework in Frameworks */, + F7346E2728B0FFF2006CE2D2 /* Realm in Frameworks */, + F7346E2928B0FFF2006CE2D2 /* RealmSwift in Frameworks */, + F783030D28B4C59A00B84583 /* SwiftEntryKit in Frameworks */, + F7346E1228B0EF5B006CE2D2 /* WidgetKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; F771E3CD20E2392D00AFB62D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( F7EBCDD1277B820D00A4EF67 /* UICKeyChainStore in Frameworks */, F75E57C125BF0ECD002B72C2 /* SVGKit in Frameworks */, - F7EBCDD7277B834400A4EF67 /* Queuer in Frameworks */, F73ADD2426554FE20069EA0D /* SwiftEntryKit in Frameworks */, F710FC82277B7D3500AA9FBF /* Realm in Frameworks */, F710FC84277B7D3500AA9FBF /* RealmSwift in Frameworks */, - F786D595253454D300E3DD7B /* NCCommunication in Frameworks */, + F72AD71328C24BCC006CB92D /* NextcloudKit in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1021,16 +1202,16 @@ F7ED547C25EEA65400956C55 /* QRCodeReader in Frameworks */, F788ECC7263AAAFA00ADC67F /* MarkdownKit in Frameworks */, F7BB7E4727A18C56009B9F29 /* Parchment in Frameworks */, + F734B06628E75C0100E180D5 /* TLPhotoPicker in Frameworks */, F770768E263A8C3400A1BA94 /* FloatingPanel in Frameworks */, F710FC7C277B7D0000AA9FBF /* RealmSwift in Frameworks */, F7E572FD278F146C00F8C99E /* OpenSSL.xcframework in Frameworks */, - F786D58D253454BF00E3DD7B /* NCCommunication in Frameworks */, F758A01227A7F03E0069468B /* JGProgressHUD in Frameworks */, - F76DA96F277B78AE0082465B /* TLPhotoPicker in Frameworks */, F76DA966277B76F30082465B /* UICKeyChainStore in Frameworks */, F753BA93281FD8020015BFB6 /* EasyTipView in Frameworks */, F76DA95B277B75A90082465B /* TOPasscodeViewController.xcframework in Frameworks */, F76DA963277B760E0082465B /* Queuer in Frameworks */, + F72AD70D28C24B93006CB92D /* NextcloudKit in Frameworks */, F75E57BD25BF0EC1002B72C2 /* SVGKit in Frameworks */, F70B86752642CE3B00ED5349 /* FirebaseCrashlytics in Frameworks */, F76DA969277B77EA0082465B /* DropDown in Frameworks */, @@ -1043,6 +1224,20 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + F7C9738D28F17131002C43E2 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + F7A8D72A28F17733008BBE1C /* SVGKit in Frameworks */, + F7A8D72828F17728008BBE1C /* RealmSwift in Frameworks */, + F7A8D72E28F17764008BBE1C /* UICKeyChainStore in Frameworks */, + F7A8D72C28F17742008BBE1C /* SwiftEntryKit in Frameworks */, + F7A8D72628F17728008BBE1C /* Realm in Frameworks */, + F7A8D72428F1771B008BBE1C /* NextcloudKit in Frameworks */, + F7C9739228F17131002C43E2 /* Intents.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -1061,6 +1256,7 @@ 3704EB2923D5A58400455C5B /* NCMenu.storyboard */, 371B5A2D23D0B04500FAFAE9 /* NCMenu.swift */, AF68326927BE65A90010BF0B /* NCMenuAction.swift */, + F7FAFD3928BFA947000777FE /* NCNotification+Menu.swift */, AF935066276B84E700BD078F /* NCMenu+FloatingPanel.swift */, 3781B9AF23DB2B7E006B4B1D /* AppDelegate+Menu.swift */, 8491B1CC273BBA82001C8C5B /* UIViewController+Menu.swift */, @@ -1111,7 +1307,6 @@ 370D26AE248A3D7A00121797 /* NCCellProtocol.swift */, F7226EDB1EE4089300EBECB1 /* Main.storyboard */, F7682FDF23C36B0500983A04 /* NCMainTabBar.swift */, - F729289F253B0937009CA4FD /* NCMainNavigationController.swift */, F75B0ABC244C4DBB00E58DCA /* NCFunctionCenter.swift */, F77444F7222816D5000D5EB0 /* NCPickerViewController.swift */, ); @@ -1163,6 +1358,14 @@ path = "Rename file"; sourceTree = "<group>"; }; + F70EA92828D4B97C00920635 /* Intent */ = { + isa = PBXGroup; + children = ( + F7FABE3928D1DAD00000A325 /* Dashboard.intentdefinition */, + ); + path = Intent; + sourceTree = "<group>"; + }; F710E80C1EF95C9C00DC2427 /* Intro */ = { isa = PBXGroup; children = ( @@ -1260,6 +1463,41 @@ name = Localizations; sourceTree = "<group>"; }; + F72EA95528B7BAD100C88F0C /* Dashboard */ = { + isa = PBXGroup; + children = ( + F70EA92828D4B97C00920635 /* Intent */, + F7E0710028B13BB00001B882 /* DashboardData.swift */, + F72EA95128B7BA2A00C88F0C /* DashboardWidgetProvider.swift */, + F72A17D728B221E300F3F159 /* DashboardWidgetView.swift */, + ); + path = Dashboard; + sourceTree = "<group>"; + }; + F72EA95628B7BAE700C88F0C /* Files */ = { + isa = PBXGroup; + children = ( + F72EA95728B7BC4F00C88F0C /* FilesData.swift */, + F72EA95328B7BABA00C88F0C /* FilesWidgetProvider.swift */, + F72EA95928B7BD0D00C88F0C /* FilesWidgetView.swift */, + ); + path = Files; + sourceTree = "<group>"; + }; + F7346E1428B0EF5B006CE2D2 /* Widget */ = { + isa = PBXGroup; + children = ( + F7346E2228B0FEBA006CE2D2 /* Assets.xcassets */, + F72EA95528B7BAD100C88F0C /* Dashboard */, + F72EA95628B7BAE700C88F0C /* Files */, + F76DEE9A28F808BC0041B1C9 /* Lockscreen */, + F77ED59628C9CEEE00E24ED0 /* Toolbar */, + F7346E2028B0FA3A006CE2D2 /* Widget-Brinding-header.h */, + F7346E1528B0EF5C006CE2D2 /* Widget.swift */, + ); + path = Widget; + sourceTree = "<group>"; + }; F7381ED9218218A4000B1560 /* Offline */ = { isa = PBXGroup; children = ( @@ -1346,6 +1584,16 @@ path = NCViewerPDF; sourceTree = "<group>"; }; + F76DEE9A28F808BC0041B1C9 /* Lockscreen */ = { + isa = PBXGroup; + children = ( + F76DEE9428F808AF0041B1C9 /* LockscreenData.swift */, + F76DEE9528F808AF0041B1C9 /* LockscreenWidgetProvider.swift */, + F76DEE9628F808AF0041B1C9 /* LockscreenWidgetView.swift */, + ); + path = Lockscreen; + sourceTree = "<group>"; + }; F771E3D120E2392D00AFB62D /* File Provider Extension */ = { isa = PBXGroup; children = ( @@ -1371,6 +1619,16 @@ path = Files; sourceTree = "<group>"; }; + F77ED59628C9CEEE00E24ED0 /* Toolbar */ = { + isa = PBXGroup; + children = ( + F77ED59028C9CE9D00E24ED0 /* ToolbarData.swift */, + F77ED59228C9CEA000E24ED0 /* ToolbarWidgetProvider.swift */, + F77ED59428C9CEA300E24ED0 /* ToolbarWidgetView.swift */, + ); + path = Toolbar; + sourceTree = "<group>"; + }; F78ACD4721903F850088454D /* Cell */ = { isa = PBXGroup; children = ( @@ -1543,6 +1801,7 @@ F7BAADB51ED5A87C00B7EAD4 /* NCManageDatabase.swift */, AF4BF61D27562B3F0081CEEF /* NCManageDatabase+Activity.swift */, AF4BF613275629E20081CEEF /* NCManageDatabase+Account.swift */, + F7D68FCB28CB9051009139F3 /* NCManageDatabase+DashboardWidget.swift */, AF4BF61827562A4B0081CEEF /* NCManageDatabase+Metadata.swift */, F7E98C1527E0D0FC001F9F19 /* NCManageDatabase+Video.swift */, F73D5E46246DE09200DF6467 /* NCElementsJSON.swift */, @@ -1553,7 +1812,6 @@ F7BFFA621A24D7300044ED85 /* Login */ = { isa = PBXGroup; children = ( - F7DBC37B23325E01001A85BA /* NCAppConfigView.swift */, F702F2F025EE5CDA008F8E80 /* NCLogin.storyboard */, F702F2F625EE5CEC008F8E80 /* NCLogin.swift */, F738D48F2756740100CD1D38 /* NCLoginNavigationController.swift */, @@ -1635,10 +1893,23 @@ F728B2BB23E83AD200E12DA0 /* Notification_Service_Extension.plist */, F7C742D01E7BD35B00D9C973 /* Share.entitlements */, F7496B83208F5652004B299C /* Share.plist */, + F783033F28B50B7E00B84583 /* Widget.entitlements */, + F7346E2128B0FBEE006CE2D2 /* Widget.plist */, + F7A8D73028F17C44008BBE1C /* WidgetDashboardIntentHandler.entitlements */, + F7A8D73328F17C62008BBE1C /* WidgetDashboardIntentHandler.plist */, ); name = "Supporting Files"; sourceTree = "<group>"; }; + F7C9739328F17131002C43E2 /* WidgetDashboardIntentHandler */ = { + isa = PBXGroup; + children = ( + F7A8D72228F176B6008BBE1C /* WidgetDashboardIntentHandler-Brinding-header.h */, + F7C9739428F17131002C43E2 /* IntentHandler.swift */, + ); + path = WidgetDashboardIntentHandler; + sourceTree = "<group>"; + }; F7CA213725F1372B00826ABB /* Account Request */ = { isa = PBXGroup; children = ( @@ -1758,11 +2029,15 @@ F7C0F46D1C8880540059EC54 /* Share */, 2C33C48023E2C475005F963B /* Notification Service Extension */, AF8ED1FA2757821000B8DBC4 /* NextcloudTests */, + F7346E1428B0EF5B006CE2D2 /* Widget */, + F7C9739328F17131002C43E2 /* WidgetDashboardIntentHandler */, F7FC7D651DC1F98700BB2C6A /* Products */, F7FC7D541DC1F93700BB2C6A /* Frameworks */, F771E3D020E2392D00AFB62D /* File Provider Extension.appex */, 2C33C47F23E2C475005F963B /* Notification Service Extension.appex */, AF8ED1F92757821000B8DBC4 /* NextcloudTests.xctest */, + F7346E1028B0EF5B006CE2D2 /* Widget.appex */, + F7C9739028F17131002C43E2 /* WidgetDashboardIntentHandler.appex */, ); sourceTree = "<group>"; }; @@ -1823,6 +2098,9 @@ F7FC7D541DC1F93700BB2C6A /* Frameworks */ = { isa = PBXGroup; children = ( + F783031028B4C86200B84583 /* libc++.1.tbd */, + F783031128B4C86200B84583 /* libc++abi.tbd */, + F783030E28B4C83F00B84583 /* libc++.tbd */, F702867E2773609C00ADA8BE /* libiconv.tbd */, F702864E27735D1400ADA8BE /* ffmpegkit.xcframework */, F702865127735D1500ADA8BE /* gmp.xcframework */, @@ -1916,6 +2194,8 @@ 08EA97471E6554FC004C83FA /* GoogleToolboxForMac.framework */, 08DC3BD41E64727E00F036D3 /* AdSupport.framework */, F7FC7D551DC1F93800BB2C6A /* libz.tbd */, + F7346E1128B0EF5B006CE2D2 /* WidgetKit.framework */, + F7C9739128F17131002C43E2 /* Intents.framework */, ); name = Frameworks; sourceTree = "<group>"; @@ -1960,12 +2240,11 @@ ); name = "Notification Service Extension"; packageProductDependencies = ( - F786D596253454D800E3DD7B /* NCCommunication */, F75E57C225BF0ED2002B72C2 /* SVGKit */, F710FC85277B7D3F00AA9FBF /* Realm */, F710FC87277B7D3F00AA9FBF /* RealmSwift */, F7EBCDD2277B821700A4EF67 /* UICKeyChainStore */, - F7EBCDD8277B834F00A4EF67 /* Queuer */, + F72AD71028C24BBB006CB92D /* NextcloudKit */, ); productName = "Notification Service Extension"; productReference = 2C33C47F23E2C475005F963B /* Notification Service Extension.appex */; @@ -2003,20 +2282,44 @@ ); name = Share; packageProductDependencies = ( - F786D592253454CE00E3DD7B /* NCCommunication */, F75E57BE25BF0EC8002B72C2 /* SVGKit */, F72D7EB6263B1207000B3DFC /* MarkdownKit */, F73ADD2026554F8E0069EA0D /* SwiftEntryKit */, F710FC7D277B7D2600AA9FBF /* Realm */, F710FC7F277B7D2700AA9FBF /* RealmSwift */, F7EBCDCE277B81FF00A4EF67 /* UICKeyChainStore */, - F7EBCDD4277B82DE00A4EF67 /* Queuer */, F72CD01127A7E92400E59476 /* JGProgressHUD */, + F72AD70E28C24BA1006CB92D /* NextcloudKit */, ); productName = "Share Ext"; productReference = F7CE8AFB1DC1F8D8009CAE48 /* Share.appex */; productType = "com.apple.product-type.app-extension"; }; + F7346E0F28B0EF5B006CE2D2 /* Widget */ = { + isa = PBXNativeTarget; + buildConfigurationList = F7346E1F28B0EF5E006CE2D2 /* Build configuration list for PBXNativeTarget "Widget" */; + buildPhases = ( + F7346E0C28B0EF5B006CE2D2 /* Sources */, + F7346E0D28B0EF5B006CE2D2 /* Frameworks */, + F7346E0E28B0EF5B006CE2D2 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Widget; + packageProductDependencies = ( + F7346E2428B0FEFA006CE2D2 /* UICKeyChainStore */, + F7346E2628B0FFF2006CE2D2 /* Realm */, + F7346E2828B0FFF2006CE2D2 /* RealmSwift */, + F783030428B4C50600B84583 /* SVGKit */, + F783030C28B4C59A00B84583 /* SwiftEntryKit */, + F783034328B5142B00B84583 /* NextcloudKit */, + ); + productName = DashboardWidgetExtension; + productReference = F7346E1028B0EF5B006CE2D2 /* Widget.appex */; + productType = "com.apple.product-type.app-extension"; + }; F771E3CF20E2392D00AFB62D /* File Provider Extension */ = { isa = PBXNativeTarget; buildConfigurationList = F771E3EF20E2392E00AFB62D /* Build configuration list for PBXNativeTarget "File Provider Extension" */; @@ -2031,13 +2334,12 @@ ); name = "File Provider Extension"; packageProductDependencies = ( - F786D594253454D300E3DD7B /* NCCommunication */, F75E57C025BF0ECD002B72C2 /* SVGKit */, F73ADD2326554FE20069EA0D /* SwiftEntryKit */, F710FC81277B7D3500AA9FBF /* Realm */, F710FC83277B7D3500AA9FBF /* RealmSwift */, F7EBCDD0277B820D00A4EF67 /* UICKeyChainStore */, - F7EBCDD6277B834400A4EF67 /* Queuer */, + F72AD71228C24BCC006CB92D /* NextcloudKit */, ); productName = "File Provider Extension"; productReference = F771E3D020E2392D00AFB62D /* File Provider Extension.appex */; @@ -2050,8 +2352,7 @@ F77B0DEF1D118A16002130FE /* Sources */, F77B0EDC1D118A16002130FE /* Frameworks */, F77B0EE91D118A16002130FE /* Resources */, - F77B0F981D118A16002130FE /* Embed App Extensions */, - F7439BF8265669E800406313 /* Run Script */, + F77B0F981D118A16002130FE /* Embed Foundation Extensions */, AFBFD01327551A54002244BC /* ShellScript */, F76DA934277B75710082465B /* Embed Frameworks */, ); @@ -2061,10 +2362,11 @@ F7145A321D12E65F00CAFEEC /* PBXTargetDependency */, F771E3EA20E2392E00AFB62D /* PBXTargetDependency */, 2C33C48523E2C475005F963B /* PBXTargetDependency */, + F7346E1B28B0EF5E006CE2D2 /* PBXTargetDependency */, + F7C9739828F17131002C43E2 /* PBXTargetDependency */, ); name = Nextcloud; packageProductDependencies = ( - F786D58C253454BF00E3DD7B /* NCCommunication */, F75E57BC25BF0EC1002B72C2 /* SVGKit */, F7ED547B25EEA65400956C55 /* QRCodeReader */, F72DA9B325F53E4E00B87DB1 /* SwiftRichString */, @@ -2077,25 +2379,51 @@ F76DA962277B760E0082465B /* Queuer */, F76DA965277B76F30082465B /* UICKeyChainStore */, F76DA968277B77EA0082465B /* DropDown */, - F76DA96E277B78AE0082465B /* TLPhotoPicker */, F710FC79277B7D0000AA9FBF /* Realm */, F710FC7B277B7D0000AA9FBF /* RealmSwift */, F7BB7E4627A18C56009B9F29 /* Parchment */, F758A01127A7F03E0069468B /* JGProgressHUD */, F753BA92281FD8020015BFB6 /* EasyTipView */, + F72AD70C28C24B93006CB92D /* NextcloudKit */, + F734B06528E75C0100E180D5 /* TLPhotoPicker */, ); productName = "Crypto Cloud"; productReference = F7CE8AFA1DC1F8D8009CAE48 /* Nextcloud.app */; productType = "com.apple.product-type.application"; }; + F7C9738F28F17131002C43E2 /* WidgetDashboardIntentHandler */ = { + isa = PBXNativeTarget; + buildConfigurationList = F7C9739A28F17132002C43E2 /* Build configuration list for PBXNativeTarget "WidgetDashboardIntentHandler" */; + buildPhases = ( + F7C9738C28F17131002C43E2 /* Sources */, + F7C9738D28F17131002C43E2 /* Frameworks */, + F7C9738E28F17131002C43E2 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = WidgetDashboardIntentHandler; + packageProductDependencies = ( + F7A8D72328F1771B008BBE1C /* NextcloudKit */, + F7A8D72528F17728008BBE1C /* Realm */, + F7A8D72728F17728008BBE1C /* RealmSwift */, + F7A8D72928F17733008BBE1C /* SVGKit */, + F7A8D72B28F17742008BBE1C /* SwiftEntryKit */, + F7A8D72D28F17764008BBE1C /* UICKeyChainStore */, + ); + productName = WidgetDashboardIntentHandler; + productReference = F7C9739028F17131002C43E2 /* WidgetDashboardIntentHandler.appex */; + productType = "com.apple.product-type.app-extension"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ F7F67BA01A24D27800EE80DA /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 1310; - LastUpgradeCheck = 1330; + LastSwiftUpdateCheck = 1400; + LastUpgradeCheck = 1400; ORGANIZATIONNAME = "Marino Faggiana"; TargetAttributes = { 2C33C47E23E2C475005F963B = { @@ -2117,6 +2445,9 @@ }; }; }; + F7346E0F28B0EF5B006CE2D2 = { + CreatedOnToolsVersion = 13.4.1; + }; F771E3CF20E2392D00AFB62D = { CreatedOnToolsVersion = 9.4.1; LastSwiftMigration = 1020; @@ -2134,6 +2465,9 @@ }; }; }; + F7C9738F28F17131002C43E2 = { + CreatedOnToolsVersion = 14.0; + }; }; }; buildConfigurationList = F7F67BA31A24D27800EE80DA /* Build configuration list for PBXProject "Nextcloud" */; @@ -2189,7 +2523,6 @@ ); mainGroup = F7F67B9F1A24D27800EE80DA; packageReferences = ( - F786D58B253454BF00E3DD7B /* XCRemoteSwiftPackageReference "ios-communication-library" */, F75E57A725BF0D61002B72C2 /* XCRemoteSwiftPackageReference "SVGKit" */, F7ED547A25EEA65400956C55 /* XCRemoteSwiftPackageReference "QRCodeReader" */, F72DA9B225F53E4E00B87DB1 /* XCRemoteSwiftPackageReference "SwiftRichString" */, @@ -2202,17 +2535,20 @@ F76DA961277B760E0082465B /* XCRemoteSwiftPackageReference "Queuer" */, F76DA964277B76F10082465B /* XCRemoteSwiftPackageReference "UICKeyChainStore" */, F76DA967277B77E90082465B /* XCRemoteSwiftPackageReference "DropDown" */, - F76DA96D277B78AE0082465B /* XCRemoteSwiftPackageReference "TLPhotoPicker" */, F710FC78277B7CFF00AA9FBF /* XCRemoteSwiftPackageReference "realm-swift" */, F7BB7E4527A18C56009B9F29 /* XCRemoteSwiftPackageReference "Parchment" */, F72CD01027A7E92400E59476 /* XCRemoteSwiftPackageReference "JGProgressHUD" */, F753BA91281FD8010015BFB6 /* XCRemoteSwiftPackageReference "EasyTipView" */, + F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */, + F734B06428E75C0100E180D5 /* XCRemoteSwiftPackageReference "TLPhotoPicker" */, ); productRefGroup = F7F67B9F1A24D27800EE80DA; projectDirPath = ""; projectRoot = ""; targets = ( F77B0DEB1D118A16002130FE /* Nextcloud */, + F7346E0F28B0EF5B006CE2D2 /* Widget */, + F7C9738F28F17131002C43E2 /* WidgetDashboardIntentHandler */, F71459B41D12E3B700CAFEEC /* Share */, F771E3CF20E2392D00AFB62D /* File Provider Extension */, 2C33C47E23E2C475005F963B /* Notification Service Extension */, @@ -2258,6 +2594,16 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + F7346E0E28B0EF5B006CE2D2 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F7C7B25128B8B0C400E7115D /* Images.xcassets in Resources */, + F7C7B25028B8AD4500E7115D /* Localizable.strings in Resources */, + F7346E2328B0FEBA006CE2D2 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; F771E3CE20E2392D00AFB62D /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -2353,27 +2699,17 @@ ); runOnlyForDeploymentPostprocessing = 0; }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - AFBFD01327551A54002244BC /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; + F7C9738E28F17131002C43E2 /* Resources */ = { + isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - outputFileListPaths = ( - ); - outputPaths = ( - ); runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if test -d \"/opt/homebrew/bin/\"; then\n PATH=\"/opt/homebrew/bin/:${PATH}\"\nfi\n\nexport PATH\n\nif which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; }; - F7439BF8265669E800406313 /* Run Script */ = { +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + AFBFD01327551A54002244BC /* ShellScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -2382,14 +2718,13 @@ ); inputPaths = ( ); - name = "Run Script"; outputFileListPaths = ( ); outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n\nTAGS=\"TODO:|FIXME:\"\nERRORTAG=\"ERROR:\"\nfind \"${SRCROOT}\" \\( -name \"*.h\" -or -name \"*.m\" -or -name \"*.swift\" \\) -print0 | xargs -0 egrep --with-filename --line-number --only-matching \"($TAGS).*\\$|($ERRORTAG).*\\$\" | perl -p -e \"s/($TAGS)/ warning: \\$1/\" | perl -p -e \"s/($ERRORTAG)/ error: \\$1/\"\n"; + shellScript = "if test -d \"/opt/homebrew/bin/\"; then\n PATH=\"/opt/homebrew/bin/:${PATH}\"\nfi\n\nexport PATH\n\nif which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; }; /* End PBXShellScriptBuildPhase section */ @@ -2409,6 +2744,7 @@ 2C1D5D7523E2DE3300334ABB /* NCDatabase.swift in Sources */, F7E98C1927E0D0FC001F9F19 /* NCManageDatabase+Video.swift in Sources */, 2C1D5D7623E2DE3300334ABB /* NCManageDatabase.swift in Sources */, + F7D68FD028CB9051009139F3 /* NCManageDatabase+DashboardWidget.swift in Sources */, F7245927289BB59300474787 /* ThreadSafeDictionary.swift in Sources */, 2C33C48223E2C475005F963B /* NotificationService.swift in Sources */, AF4BF617275629E20081CEEF /* NCManageDatabase+Account.swift in Sources */, @@ -2477,6 +2813,7 @@ F7B8CD96261AF401007C1359 /* NCNetworkingChunkedUpload.swift in Sources */, F7BAADC91ED5A87C00B7EAD4 /* NCDatabase.swift in Sources */, F7D57C8B26317BDE00DE301D /* NCAccountRequest.swift in Sources */, + F7D68FCE28CB9051009139F3 /* NCManageDatabase+DashboardWidget.swift in Sources */, AF22B217277D196700DAB0CC /* NCShareExtension+DataSource.swift in Sources */, F76D364728A4F8BF00214537 /* NCActivityIndicator.swift in Sources */, F780710A1EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m in Sources */, @@ -2488,6 +2825,52 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + F7346E0C28B0EF5B006CE2D2 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F78302FD28B4C42B00B84583 /* NCUserBaseUrl.swift in Sources */, + F793E5A128B76541005E4B02 /* NotificationCenter+MainThread.swift in Sources */, + F76DEE9928F808AF0041B1C9 /* LockscreenWidgetView.swift in Sources */, + F78302F928B4C3E600B84583 /* NCManageDatabase+Account.swift in Sources */, + F7E0710128B13BB00001B882 /* DashboardData.swift in Sources */, + F783030328B4C4DD00B84583 /* ThreadSafeDictionary.swift in Sources */, + F77ED59128C9CE9D00E24ED0 /* ToolbarData.swift in Sources */, + F78302F728B4C3C900B84583 /* NCManageDatabase.swift in Sources */, + F7346E1628B0EF5C006CE2D2 /* Widget.swift in Sources */, + F78302F828B4C3E100B84583 /* NCManageDatabase+Activity.swift in Sources */, + F783030228B4C4B800B84583 /* NCUtility.swift in Sources */, + F711D63128F44801003F43C8 /* IntentHandler.swift in Sources */, + F76DEE9728F808AF0041B1C9 /* LockscreenData.swift in Sources */, + F72EA95A28B7BD0D00C88F0C /* FilesWidgetView.swift in Sources */, + F78302FE28B4C44700B84583 /* NCBrand.swift in Sources */, + F793E5A028B7651B005E4B02 /* NCViewCertificateDetails.swift in Sources */, + F7FABE3728D1DAD00000A325 /* Dashboard.intentdefinition in Sources */, + F793E59F28B764F6005E4B02 /* NCContentPresenter.swift in Sources */, + F76DEE9828F808AF0041B1C9 /* LockscreenWidgetProvider.swift in Sources */, + F78302FA28B4C3EA00B84583 /* NCManageDatabase+Metadata.swift in Sources */, + F783030728B4C52800B84583 /* UIColor+Extensions.swift in Sources */, + F783030028B4C45800B84583 /* NCGlobal.swift in Sources */, + F793E59D28B761E7005E4B02 /* NCNetworking.swift in Sources */, + F78302FC28B4C3F300B84583 /* NCElementsJSON.swift in Sources */, + F783030628B4C51E00B84583 /* String+Extensions.swift in Sources */, + F77ED59328C9CEA000E24ED0 /* ToolbarWidgetProvider.swift in Sources */, + F72A17D828B221E300F3F159 /* DashboardWidgetView.swift in Sources */, + F77ED59528C9CEA400E24ED0 /* ToolbarWidgetView.swift in Sources */, + F78302FB28B4C3EE00B84583 /* NCManageDatabase+Video.swift in Sources */, + F72EA95228B7BA2A00C88F0C /* DashboardWidgetProvider.swift in Sources */, + F793E5A228B76580005E4B02 /* NCNetworkingChunkedUpload.swift in Sources */, + F783031228B4C8EC00B84583 /* CCUtility.m in Sources */, + F72EA95828B7BC4F00C88F0C /* FilesData.swift in Sources */, + F793E59E28B763C2005E4B02 /* NCAskAuthorization.swift in Sources */, + F78302FF28B4C45000B84583 /* NCUtilityFileSystem.swift in Sources */, + F78302F628B4C3C500B84583 /* NCDatabase.swift in Sources */, + F7D68FCD28CB9051009139F3 /* NCManageDatabase+DashboardWidget.swift in Sources */, + F783030128B4C49700B84583 /* UIImage+Extensions.swift in Sources */, + F72EA95428B7BABA00C88F0C /* FilesWidgetProvider.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; F771E3CC20E2392D00AFB62D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -2507,6 +2890,7 @@ AF4BF616275629E20081CEEF /* NCManageDatabase+Account.swift in Sources */, F7434B3620E23FE000417916 /* NCManageDatabase.swift in Sources */, F798F0E725880609000DAFFD /* UIColor+Extensions.swift in Sources */, + F7D68FCF28CB9051009139F3 /* NCManageDatabase+DashboardWidget.swift in Sources */, AF4BF61B27562A4B0081CEEF /* NCManageDatabase+Metadata.swift in Sources */, F70460542499095400BB98A7 /* NotificationCenter+MainThread.swift in Sources */, F7E98C1827E0D0FC001F9F19 /* NCManageDatabase+Video.swift in Sources */, @@ -2578,7 +2962,6 @@ F710D2022405826100A6033D /* NCViewer+Menu.swift in Sources */, F77A697D250A0FBC00FF1708 /* NCCollectionViewCommon+Menu.swift in Sources */, AF7E504E27A2D8FF00B5E4AF /* UIBarButton+Extension.swift in Sources */, - F72928A0253B0937009CA4FD /* NCMainNavigationController.swift in Sources */, F704B5E92430C0B800632F5F /* NCCreateFormUploadConflictCell.swift in Sources */, F72D404923D2082500A97FD0 /* NCViewerNextcloudText.swift in Sources */, AFCE353927E5DE0500FEA6C2 /* NCShare+Helper.swift in Sources */, @@ -2615,7 +2998,6 @@ F7F4F11227ECDC52008676F9 /* UIFont+Extension.swift in Sources */, AF93471A27E2361E002537EE /* NCShareAdvancePermissionHeader.swift in Sources */, F7F878AE1FB9E3B900599E4F /* NCEndToEndMetadata.swift in Sources */, - F7DBC37C23325E02001A85BA /* NCAppConfigView.swift in Sources */, 3781B9B023DB2B7E006B4B1D /* AppDelegate+Menu.swift in Sources */, F73D5E47246DE09200DF6467 /* NCElementsJSON.swift in Sources */, F710D1F52405770F00A6033D /* NCViewerPDF.swift in Sources */, @@ -2660,6 +3042,7 @@ F70CAE3A1F8CF31A008125FD /* NCEndToEndEncryption.m in Sources */, AF93471B27E2361E002537EE /* NCShareAdvancePermission.swift in Sources */, F70753EB2542A99800972D44 /* NCViewerMediaPage.swift in Sources */, + F7FAFD3A28BFA948000777FE /* NCNotification+Menu.swift in Sources */, F74C0436253F1CDC009762AB /* NCShares.swift in Sources */, F7AC1CB028AB94490032D99F /* Array+Extensions.swift in Sources */, F7AE00F5230D5F9E007ACF8A /* NCLoginWeb.swift in Sources */, @@ -2676,6 +3059,7 @@ F7725A60251F33BB00D125E0 /* NCFiles.swift in Sources */, F704B5E52430AA8000632F5F /* NCCreateFormUploadConflict.swift in Sources */, F765608F23BF813600765969 /* NCContentPresenter.swift in Sources */, + F7D68FCC28CB9051009139F3 /* NCManageDatabase+DashboardWidget.swift in Sources */, F70CEF5623E9C7E50007035B /* UIColor+Extensions.swift in Sources */, F77BB748289985270090FC19 /* UITabBarController+Extension.swift in Sources */, F75AC2431F1F62450073EC19 /* NCManageAutoUploadFileName.swift in Sources */, @@ -2685,6 +3069,7 @@ F7F4F11027ECDC4A008676F9 /* UIDevice+Extensions.swift in Sources */, F77B0ED11D118A16002130FE /* Acknowledgements.m in Sources */, F70D8D8124A4A9BF000A5756 /* NCNetworkingProcessUpload.swift in Sources */, + F7FABE3628D1DAD00000A325 /* Dashboard.intentdefinition in Sources */, F7D96FCC246ED7E200536D73 /* NCNetworkingCheckRemoteUser.swift in Sources */, F7E4D9C422ED929B003675FD /* NCShareCommentsCell.swift in Sources */, F717402E24F699A5000C87D5 /* NCFavorite.swift in Sources */, @@ -2696,6 +3081,33 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + F7C9738C28F17131002C43E2 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F7A8D73528F17E16008BBE1C /* NCManageDatabase.swift in Sources */, + F7A8D74428F1827B008BBE1C /* ThreadSafeDictionary.swift in Sources */, + F7C9739528F17131002C43E2 /* IntentHandler.swift in Sources */, + F7A8D73D28F181D3008BBE1C /* NCUtilityFileSystem.swift in Sources */, + F7A8D74528F1828E008BBE1C /* CCUtility.m in Sources */, + F7A8D73F28F181EF008BBE1C /* NCGlobal.swift in Sources */, + F7A8D74328F1826F008BBE1C /* String+Extensions.swift in Sources */, + F7A8D73728F17E1E008BBE1C /* NCManageDatabase+Account.swift in Sources */, + F7A8D73B28F17E2C008BBE1C /* NCElementsJSON.swift in Sources */, + F7A8D73C28F181BC008BBE1C /* NCBrand.swift in Sources */, + F7A8D74228F18261008BBE1C /* NCUtility.swift in Sources */, + F7A8D73A28F17E28008BBE1C /* NCManageDatabase+Video.swift in Sources */, + F7C9739D28F1733B002C43E2 /* Dashboard.intentdefinition in Sources */, + F7A8D73828F17E21008BBE1C /* NCManageDatabase+DashboardWidget.swift in Sources */, + F7A8D73928F17E25008BBE1C /* NCManageDatabase+Metadata.swift in Sources */, + F7A8D74128F18254008BBE1C /* UIColor+Extensions.swift in Sources */, + F7A8D73428F17E12008BBE1C /* NCDatabase.swift in Sources */, + F7A8D74028F18212008BBE1C /* UIImage+Extensions.swift in Sources */, + F7A8D73628F17E1A008BBE1C /* NCManageDatabase+Activity.swift in Sources */, + F7A8D73E28F181E2008BBE1C /* NCUserBaseUrl.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -2714,11 +3126,21 @@ target = F71459B41D12E3B700CAFEEC /* Share */; targetProxy = F7145A311D12E65F00CAFEEC /* PBXContainerItemProxy */; }; + F7346E1B28B0EF5E006CE2D2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = F7346E0F28B0EF5B006CE2D2 /* Widget */; + targetProxy = F7346E1A28B0EF5E006CE2D2 /* PBXContainerItemProxy */; + }; F771E3EA20E2392E00AFB62D /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = F771E3CF20E2392D00AFB62D /* File Provider Extension */; targetProxy = F771E3E920E2392E00AFB62D /* PBXContainerItemProxy */; }; + F7C9739828F17131002C43E2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = F7C9738F28F17131002C43E2 /* WidgetDashboardIntentHandler */; + targetProxy = F7C9739728F17131002C43E2 /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -2826,6 +3248,58 @@ path = "Supporting Files"; sourceTree = "<group>"; }; + F7FABE3928D1DAD00000A325 /* Dashboard.intentdefinition */ = { + isa = PBXVariantGroup; + children = ( + F7FABE3828D1DAD00000A325 /* Base */, + F711D63328F47A66003F43C8 /* en */, + F7CD836428F6B4DA00E93B11 /* eu */, + F7CD836628F6B4DA00E93B11 /* ca */, + F7CD836828F6B4DB00E93B11 /* zh-Hans */, + F7CD836A28F6B4DC00E93B11 /* zh-Hant-TW */, + F7CD836C28F6B4DC00E93B11 /* cs-CZ */, + F7CD836E28F6B4DD00E93B11 /* da */, + F7CD837028F6B4E100E93B11 /* nl */, + F7CD837228F6B4E300E93B11 /* en-GB */, + F7CD837428F6B4E700E93B11 /* fr */, + F7CD837628F6B4E800E93B11 /* gl */, + F7CD837828F6B4EA00E93B11 /* ka-GE */, + F7CD837A28F6B4EC00E93B11 /* de */, + F7CD837C28F6B4ED00E93B11 /* hu */, + F7CD837E28F6B4EE00E93B11 /* is */, + F7CD838028F6B4EF00E93B11 /* it */, + F7CD838228F6B4F000E93B11 /* ja-JP */, + F7CD838428F6B4F200E93B11 /* ko */, + F7CD838628F6B4F300E93B11 /* nb-NO */, + F7CD838828F6B4F400E93B11 /* pl */, + F7CD838A28F6B4F800E93B11 /* pt-BR */, + F7CD838C28F6B4F900E93B11 /* pt-PT */, + F7CD838E28F6B4F900E93B11 /* ru */, + F7CD839028F6B4FA00E93B11 /* sr */, + F7CD839228F6B4FB00E93B11 /* sk-SK */, + F7CD839428F6B4FC00E93B11 /* es */, + F7CD839628F6B4FC00E93B11 /* es-CL */, + F7CD839828F6B4FD00E93B11 /* es-CO */, + F7CD839A28F6B4FE00E93B11 /* es-CR */, + F7CD839C28F6B4FF00E93B11 /* es-DO */, + F7CD839E28F6B4FF00E93B11 /* es-EC */, + F7CD83A028F6B50000E93B11 /* es-SV */, + F7CD83A228F6B50100E93B11 /* es-GT */, + F7CD83A428F6B50100E93B11 /* es-HN */, + F7CD83A628F6B50200E93B11 /* es-419 */, + F7CD83A828F6B50300E93B11 /* es-MX */, + F7CD83AA28F6B50400E93B11 /* es-NI */, + F7CD83AC28F6B50400E93B11 /* es-PA */, + F7CD83AE28F6B50500E93B11 /* es-PY */, + F7CD83B028F6B50600E93B11 /* es-PE */, + F7CD83B228F6B50700E93B11 /* es-PR */, + F7CD83B428F6B50700E93B11 /* es-UY */, + F7CD83B628F6B50800E93B11 /* sv */, + F7CD83B828F6B50800E93B11 /* tr */, + ); + name = Dashboard.intentdefinition; + sourceTree = "<group>"; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -2923,6 +3397,61 @@ }; name = Release; }; + F7346E1D28B0EF5E006CE2D2 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; + CLANG_ANALYZER_NONNULL = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/iOSClient/Brand/Widget.entitlements"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + EXTENSION, + EXTENSION_WIDGET, + ); + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "$(SRCROOT)/iOSClient/Brand/Widget.plist"; + INFOPLIST_KEY_CFBundleDisplayName = Nextcloud; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = it.twsweb.Nextcloud.Widget; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) EXTENSION EXTENSION_WIDGET"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/Widget/Widget-Brinding-header.h"; + }; + name = Debug; + }; + F7346E1E28B0EF5E006CE2D2 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; + CLANG_ANALYZER_NONNULL = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/iOSClient/Brand/Widget.entitlements"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + EXTENSION, + EXTENSION_WIDGET, + ); + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "$(SRCROOT)/iOSClient/Brand/Widget.plist"; + INFOPLIST_KEY_CFBundleDisplayName = Nextcloud; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = it.twsweb.Nextcloud.Widget; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) EXTENSION EXTENSION_WIDGET"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/Widget/Widget-Brinding-header.h"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; F771E3F020E2392E00AFB62D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -2960,6 +3489,7 @@ F77B0F9B1D118A16002130FE /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = iOSClient/Brand/iOSClient.entitlements; INFOPLIST_FILE = "$(SRCROOT)/iOSClient/Brand/iOSClient.plist"; @@ -2971,6 +3501,7 @@ F77B0F9C1D118A16002130FE /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = iOSClient/Brand/iOSClient.entitlements; INFOPLIST_FILE = "$(SRCROOT)/iOSClient/Brand/iOSClient.plist"; @@ -2979,6 +3510,76 @@ }; name = Release; }; + F7C9739B28F17132002C43E2 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/iOSClient/Brand//WidgetDashboardIntentHandler.entitlements"; + DEBUG_INFORMATION_FORMAT = dwarf; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + EXTENSION, + EXTENSION_WIDGETDASHBOARDINTENTHANDLER, + ); + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "$(SRCROOT)/iOSClient/Brand/WidgetDashboardIntentHandler.plist"; + INFOPLIST_KEY_CFBundleDisplayName = WidgetDashboardIntentHandler; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2022 Nextcloud. All rights reserved."; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = it.twsweb.Nextcloud.WidgetDashboardIntentHandler; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) EXTENSION EXTENSION_WIDGETDASHBOARDINTENTHANDLER"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/WidgetDashboardIntentHandler/WidgetDashboardIntentHandler-Brinding-header.h"; + }; + name = Debug; + }; + F7C9739C28F17132002C43E2 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/iOSClient/Brand//WidgetDashboardIntentHandler.entitlements"; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + EXTENSION, + EXTENSION_WIDGETDASHBOARDINTENTHANDLER, + ); + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "$(SRCROOT)/iOSClient/Brand/WidgetDashboardIntentHandler.plist"; + INFOPLIST_KEY_CFBundleDisplayName = WidgetDashboardIntentHandler; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2022 Nextcloud. All rights reserved."; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = it.twsweb.Nextcloud.WidgetDashboardIntentHandler; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) EXTENSION EXTENSION_WIDGETDASHBOARDINTENTHANDLER"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/WidgetDashboardIntentHandler/WidgetDashboardIntentHandler-Brinding-header.h"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; F7F67BC91A24D27800EE80DA /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -3006,9 +3607,8 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 0; + CURRENT_PROJECT_VERSION = 17; DEVELOPMENT_TEAM = NKUJUXUJ3B; - ENABLE_BITCODE = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_NO_COMMON_BLOCKS = YES; @@ -3024,13 +3624,14 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.1; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2022 Nextcloud. All rights reserved."; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 4.4.4; + MARKETING_VERSION = 4.5.0; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ""; SDKROOT = iphoneos; @@ -3069,9 +3670,8 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 0; + CURRENT_PROJECT_VERSION = 17; DEVELOPMENT_TEAM = NKUJUXUJ3B; - ENABLE_BITCODE = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_NO_COMMON_BLOCKS = YES; @@ -3085,13 +3685,14 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.1; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2022 Nextcloud. All rights reserved."; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 4.4.4; + MARKETING_VERSION = 4.5.0; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ""; SDKROOT = iphoneos; @@ -3134,6 +3735,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + F7346E1F28B0EF5E006CE2D2 /* Build configuration list for PBXNativeTarget "Widget" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F7346E1D28B0EF5E006CE2D2 /* Debug */, + F7346E1E28B0EF5E006CE2D2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; F771E3EF20E2392E00AFB62D /* Build configuration list for PBXNativeTarget "File Provider Extension" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -3152,6 +3762,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + F7C9739A28F17132002C43E2 /* Build configuration list for PBXNativeTarget "WidgetDashboardIntentHandler" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F7C9739B28F17132002C43E2 /* Debug */, + F7C9739C28F17132002C43E2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; F7F67BA31A24D27800EE80DA /* Build configuration list for PBXProject "Nextcloud" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -3196,6 +3815,14 @@ minimumVersion = 3.7.2; }; }; + F734B06428E75C0100E180D5 /* XCRemoteSwiftPackageReference "TLPhotoPicker" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/marinofaggiana/TLPhotoPicker"; + requirement = { + branch = master; + kind = branch; + }; + }; F73ADD1A265546880069EA0D /* XCRemoteSwiftPackageReference "SwiftEntryKit" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/huri000/SwiftEntryKit"; @@ -3260,14 +3887,6 @@ kind = branch; }; }; - F76DA96D277B78AE0082465B /* XCRemoteSwiftPackageReference "TLPhotoPicker" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/tilltue/TLPhotoPicker"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 2.0.0; - }; - }; F770768C263A8C3400A1BA94 /* XCRemoteSwiftPackageReference "FloatingPanel" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/scenee/FloatingPanel"; @@ -3276,12 +3895,12 @@ minimumVersion = 2.0.0; }; }; - F786D58B253454BF00E3DD7B /* XCRemoteSwiftPackageReference "ios-communication-library" */ = { + F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */ = { isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/nextcloud/ios-communication-library/"; + repositoryURL = "https://github.com/nextcloud/NextcloudKit"; requirement = { kind = exactVersion; - version = 0.99.9; + version = 1.0.0; }; }; F788ECC5263AAAF900ADC67F /* XCRemoteSwiftPackageReference "MarkdownKit" */ = { @@ -3356,6 +3975,26 @@ package = F710FC78277B7CFF00AA9FBF /* XCRemoteSwiftPackageReference "realm-swift" */; productName = RealmSwift; }; + F72AD70C28C24B93006CB92D /* NextcloudKit */ = { + isa = XCSwiftPackageProductDependency; + package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; + productName = NextcloudKit; + }; + F72AD70E28C24BA1006CB92D /* NextcloudKit */ = { + isa = XCSwiftPackageProductDependency; + package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; + productName = NextcloudKit; + }; + F72AD71028C24BBB006CB92D /* NextcloudKit */ = { + isa = XCSwiftPackageProductDependency; + package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; + productName = NextcloudKit; + }; + F72AD71228C24BCC006CB92D /* NextcloudKit */ = { + isa = XCSwiftPackageProductDependency; + package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; + productName = NextcloudKit; + }; F72CD01127A7E92400E59476 /* JGProgressHUD */ = { isa = XCSwiftPackageProductDependency; package = F72CD01027A7E92400E59476 /* XCRemoteSwiftPackageReference "JGProgressHUD" */; @@ -3371,6 +4010,26 @@ package = F72DA9B225F53E4E00B87DB1 /* XCRemoteSwiftPackageReference "SwiftRichString" */; productName = SwiftRichString; }; + F7346E2428B0FEFA006CE2D2 /* UICKeyChainStore */ = { + isa = XCSwiftPackageProductDependency; + package = F76DA964277B76F10082465B /* XCRemoteSwiftPackageReference "UICKeyChainStore" */; + productName = UICKeyChainStore; + }; + F7346E2628B0FFF2006CE2D2 /* Realm */ = { + isa = XCSwiftPackageProductDependency; + package = F710FC78277B7CFF00AA9FBF /* XCRemoteSwiftPackageReference "realm-swift" */; + productName = Realm; + }; + F7346E2828B0FFF2006CE2D2 /* RealmSwift */ = { + isa = XCSwiftPackageProductDependency; + package = F710FC78277B7CFF00AA9FBF /* XCRemoteSwiftPackageReference "realm-swift" */; + productName = RealmSwift; + }; + F734B06528E75C0100E180D5 /* TLPhotoPicker */ = { + isa = XCSwiftPackageProductDependency; + package = F734B06428E75C0100E180D5 /* XCRemoteSwiftPackageReference "TLPhotoPicker" */; + productName = TLPhotoPicker; + }; F73ADD1B265546890069EA0D /* SwiftEntryKit */ = { isa = XCSwiftPackageProductDependency; package = F73ADD1A265546880069EA0D /* XCRemoteSwiftPackageReference "SwiftEntryKit" */; @@ -3441,41 +4100,61 @@ package = F76DA967277B77E90082465B /* XCRemoteSwiftPackageReference "DropDown" */; productName = DropDown; }; - F76DA96E277B78AE0082465B /* TLPhotoPicker */ = { - isa = XCSwiftPackageProductDependency; - package = F76DA96D277B78AE0082465B /* XCRemoteSwiftPackageReference "TLPhotoPicker" */; - productName = TLPhotoPicker; - }; F770768D263A8C3400A1BA94 /* FloatingPanel */ = { isa = XCSwiftPackageProductDependency; package = F770768C263A8C3400A1BA94 /* XCRemoteSwiftPackageReference "FloatingPanel" */; productName = FloatingPanel; }; - F786D58C253454BF00E3DD7B /* NCCommunication */ = { + F783030428B4C50600B84583 /* SVGKit */ = { isa = XCSwiftPackageProductDependency; - package = F786D58B253454BF00E3DD7B /* XCRemoteSwiftPackageReference "ios-communication-library" */; - productName = NCCommunication; - }; - F786D592253454CE00E3DD7B /* NCCommunication */ = { - isa = XCSwiftPackageProductDependency; - package = F786D58B253454BF00E3DD7B /* XCRemoteSwiftPackageReference "ios-communication-library" */; - productName = NCCommunication; + package = F75E57A725BF0D61002B72C2 /* XCRemoteSwiftPackageReference "SVGKit" */; + productName = SVGKit; }; - F786D594253454D300E3DD7B /* NCCommunication */ = { + F783030C28B4C59A00B84583 /* SwiftEntryKit */ = { isa = XCSwiftPackageProductDependency; - package = F786D58B253454BF00E3DD7B /* XCRemoteSwiftPackageReference "ios-communication-library" */; - productName = NCCommunication; + package = F73ADD1A265546880069EA0D /* XCRemoteSwiftPackageReference "SwiftEntryKit" */; + productName = SwiftEntryKit; }; - F786D596253454D800E3DD7B /* NCCommunication */ = { + F783034328B5142B00B84583 /* NextcloudKit */ = { isa = XCSwiftPackageProductDependency; - package = F786D58B253454BF00E3DD7B /* XCRemoteSwiftPackageReference "ios-communication-library" */; - productName = NCCommunication; + package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; + productName = NextcloudKit; }; F788ECC6263AAAFA00ADC67F /* MarkdownKit */ = { isa = XCSwiftPackageProductDependency; package = F788ECC5263AAAF900ADC67F /* XCRemoteSwiftPackageReference "MarkdownKit" */; productName = MarkdownKit; }; + F7A8D72328F1771B008BBE1C /* NextcloudKit */ = { + isa = XCSwiftPackageProductDependency; + package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */; + productName = NextcloudKit; + }; + F7A8D72528F17728008BBE1C /* Realm */ = { + isa = XCSwiftPackageProductDependency; + package = F710FC78277B7CFF00AA9FBF /* XCRemoteSwiftPackageReference "realm-swift" */; + productName = Realm; + }; + F7A8D72728F17728008BBE1C /* RealmSwift */ = { + isa = XCSwiftPackageProductDependency; + package = F710FC78277B7CFF00AA9FBF /* XCRemoteSwiftPackageReference "realm-swift" */; + productName = RealmSwift; + }; + F7A8D72928F17733008BBE1C /* SVGKit */ = { + isa = XCSwiftPackageProductDependency; + package = F75E57A725BF0D61002B72C2 /* XCRemoteSwiftPackageReference "SVGKit" */; + productName = SVGKit; + }; + F7A8D72B28F17742008BBE1C /* SwiftEntryKit */ = { + isa = XCSwiftPackageProductDependency; + package = F73ADD1A265546880069EA0D /* XCRemoteSwiftPackageReference "SwiftEntryKit" */; + productName = SwiftEntryKit; + }; + F7A8D72D28F17764008BBE1C /* UICKeyChainStore */ = { + isa = XCSwiftPackageProductDependency; + package = F76DA964277B76F10082465B /* XCRemoteSwiftPackageReference "UICKeyChainStore" */; + productName = UICKeyChainStore; + }; F7BB7E4627A18C56009B9F29 /* Parchment */ = { isa = XCSwiftPackageProductDependency; package = F7BB7E4527A18C56009B9F29 /* XCRemoteSwiftPackageReference "Parchment" */; @@ -3496,21 +4175,6 @@ package = F76DA964277B76F10082465B /* XCRemoteSwiftPackageReference "UICKeyChainStore" */; productName = UICKeyChainStore; }; - F7EBCDD4277B82DE00A4EF67 /* Queuer */ = { - isa = XCSwiftPackageProductDependency; - package = F76DA961277B760E0082465B /* XCRemoteSwiftPackageReference "Queuer" */; - productName = Queuer; - }; - F7EBCDD6277B834400A4EF67 /* Queuer */ = { - isa = XCSwiftPackageProductDependency; - package = F76DA961277B760E0082465B /* XCRemoteSwiftPackageReference "Queuer" */; - productName = Queuer; - }; - F7EBCDD8277B834F00A4EF67 /* Queuer */ = { - isa = XCSwiftPackageProductDependency; - package = F76DA961277B760E0082465B /* XCRemoteSwiftPackageReference "Queuer" */; - productName = Queuer; - }; F7ED547B25EEA65400956C55 /* QRCodeReader */ = { isa = XCSwiftPackageProductDependency; package = F7ED547A25EEA65400956C55 /* XCRemoteSwiftPackageReference "QRCodeReader" */; diff --git a/Nextcloud.xcodeproj/xcshareddata/xcschemes/File Provider Extension.xcscheme b/Nextcloud.xcodeproj/xcshareddata/xcschemes/File Provider Extension.xcscheme index 32b1efb9e..f43247426 100755 --- a/Nextcloud.xcodeproj/xcshareddata/xcschemes/File Provider Extension.xcscheme +++ b/Nextcloud.xcodeproj/xcshareddata/xcschemes/File Provider Extension.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "1330" + LastUpgradeVersion = "1400" wasCreatedForAppExtension = "YES" version = "2.0"> <BuildAction @@ -93,6 +93,7 @@ savedToolIdentifier = "" useCustomWorkingDirectory = "NO" debugDocumentVersioning = "YES" + askForAppToLaunch = "Yes" launchAutomaticallySubstyle = "2"> <BuildableProductRunnable runnableDebuggingMode = "0"> diff --git a/Nextcloud.xcodeproj/xcshareddata/xcschemes/Nextcloud.xcscheme b/Nextcloud.xcodeproj/xcshareddata/xcschemes/Nextcloud.xcscheme index 5e0b54e5b..59a7c6e95 100755 --- a/Nextcloud.xcodeproj/xcshareddata/xcschemes/Nextcloud.xcscheme +++ b/Nextcloud.xcodeproj/xcshareddata/xcschemes/Nextcloud.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "1330" + LastUpgradeVersion = "1400" version = "1.7"> <BuildAction parallelizeBuildables = "YES" diff --git a/Nextcloud.xcodeproj/xcshareddata/xcschemes/Notification Service Extension.xcscheme b/Nextcloud.xcodeproj/xcshareddata/xcschemes/Notification Service Extension.xcscheme new file mode 100644 index 000000000..451096171 --- /dev/null +++ b/Nextcloud.xcodeproj/xcshareddata/xcschemes/Notification Service Extension.xcscheme @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "1400" + wasCreatedForAppExtension = "YES" + version = "2.0"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + <BuildActionEntries> + <BuildActionEntry + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "2C33C47E23E2C475005F963B" + BuildableName = "Notification Service Extension.appex" + BlueprintName = "Notification Service Extension" + ReferencedContainer = "container:Nextcloud.xcodeproj"> + </BuildableReference> + </BuildActionEntry> + <BuildActionEntry + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "F77B0DEB1D118A16002130FE" + BuildableName = "Nextcloud.app" + BlueprintName = "Nextcloud" + ReferencedContainer = "container:Nextcloud.xcodeproj"> + </BuildableReference> + </BuildActionEntry> + </BuildActionEntries> + </BuildAction> + <TestAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + shouldUseLaunchSchemeArgsEnv = "YES"> + <Testables> + </Testables> + </TestAction> + <LaunchAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "" + selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn" + launchStyle = "0" + askForAppToLaunch = "Yes" + useCustomWorkingDirectory = "NO" + ignoresPersistentStateOnLaunch = "NO" + debugDocumentVersioning = "YES" + debugServiceExtension = "internal" + allowLocationSimulation = "YES" + launchAutomaticallySubstyle = "2"> + <BuildableProductRunnable + runnableDebuggingMode = "0"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "F77B0DEB1D118A16002130FE" + BuildableName = "Nextcloud.app" + BlueprintName = "Nextcloud" + ReferencedContainer = "container:Nextcloud.xcodeproj"> + </BuildableReference> + </BuildableProductRunnable> + </LaunchAction> + <ProfileAction + buildConfiguration = "Release" + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "NO" + debugDocumentVersioning = "YES" + askForAppToLaunch = "Yes" + launchAutomaticallySubstyle = "2"> + <BuildableProductRunnable + runnableDebuggingMode = "0"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "F77B0DEB1D118A16002130FE" + BuildableName = "Nextcloud.app" + BlueprintName = "Nextcloud" + ReferencedContainer = "container:Nextcloud.xcodeproj"> + </BuildableReference> + </BuildableProductRunnable> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme> diff --git a/Nextcloud.xcodeproj/xcshareddata/xcschemes/Share.xcscheme b/Nextcloud.xcodeproj/xcshareddata/xcschemes/Share.xcscheme index 13c5e2fe1..af89366ff 100755 --- a/Nextcloud.xcodeproj/xcshareddata/xcschemes/Share.xcscheme +++ b/Nextcloud.xcodeproj/xcshareddata/xcschemes/Share.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "1330" + LastUpgradeVersion = "1400" wasCreatedForAppExtension = "YES" version = "2.0"> <BuildAction @@ -97,6 +97,7 @@ savedToolIdentifier = "" useCustomWorkingDirectory = "NO" debugDocumentVersioning = "YES" + askForAppToLaunch = "Yes" launchAutomaticallySubstyle = "2"> <BuildableProductRunnable runnableDebuggingMode = "0"> diff --git a/Nextcloud.xcodeproj/xcshareddata/xcschemes/Widget.xcscheme b/Nextcloud.xcodeproj/xcshareddata/xcschemes/Widget.xcscheme new file mode 100644 index 000000000..af8214452 --- /dev/null +++ b/Nextcloud.xcodeproj/xcshareddata/xcschemes/Widget.xcscheme @@ -0,0 +1,124 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "1400" + wasCreatedForAppExtension = "YES" + version = "2.0"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + <BuildActionEntries> + <BuildActionEntry + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "F7346E0F28B0EF5B006CE2D2" + BuildableName = "Widget.appex" + BlueprintName = "Widget" + ReferencedContainer = "container:Nextcloud.xcodeproj"> + </BuildableReference> + </BuildActionEntry> + <BuildActionEntry + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "F77B0DEB1D118A16002130FE" + BuildableName = "Nextcloud.app" + BlueprintName = "Nextcloud" + ReferencedContainer = "container:Nextcloud.xcodeproj"> + </BuildableReference> + </BuildActionEntry> + </BuildActionEntries> + </BuildAction> + <TestAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + shouldUseLaunchSchemeArgsEnv = "YES"> + <Testables> + </Testables> + </TestAction> + <LaunchAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "" + selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn" + launchStyle = "0" + askForAppToLaunch = "Yes" + useCustomWorkingDirectory = "NO" + ignoresPersistentStateOnLaunch = "NO" + debugDocumentVersioning = "YES" + debugServiceExtension = "internal" + allowLocationSimulation = "YES" + launchAutomaticallySubstyle = "2"> + <RemoteRunnable + runnableDebuggingMode = "2" + BundleIdentifier = "com.apple.springboard"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "F7346E0F28B0EF5B006CE2D2" + BuildableName = "Widget.appex" + BlueprintName = "Widget" + ReferencedContainer = "container:Nextcloud.xcodeproj"> + </BuildableReference> + </RemoteRunnable> + <MacroExpansion> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "F77B0DEB1D118A16002130FE" + BuildableName = "Nextcloud.app" + BlueprintName = "Nextcloud" + ReferencedContainer = "container:Nextcloud.xcodeproj"> + </BuildableReference> + </MacroExpansion> + <EnvironmentVariables> + <EnvironmentVariable + key = "_XCWidgetKind" + value = "" + isEnabled = "YES"> + </EnvironmentVariable> + <EnvironmentVariable + key = "_XCWidgetDefaultView" + value = "timeline" + isEnabled = "YES"> + </EnvironmentVariable> + <EnvironmentVariable + key = "_XCWidgetFamily" + value = "medium" + isEnabled = "YES"> + </EnvironmentVariable> + </EnvironmentVariables> + </LaunchAction> + <ProfileAction + buildConfiguration = "Release" + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "NO" + debugDocumentVersioning = "YES" + askForAppToLaunch = "Yes" + launchAutomaticallySubstyle = "2"> + <BuildableProductRunnable + runnableDebuggingMode = "0"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "F77B0DEB1D118A16002130FE" + BuildableName = "Nextcloud.app" + BlueprintName = "Nextcloud" + ReferencedContainer = "container:Nextcloud.xcodeproj"> + </BuildableReference> + </BuildableProductRunnable> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme> diff --git a/NextcloudTests/SharePermissionTest.swift b/NextcloudTests/SharePermissionTest.swift index 919941eb4..16cc75e83 100644 --- a/NextcloudTests/SharePermissionTest.swift +++ b/NextcloudTests/SharePermissionTest.swift @@ -23,7 +23,7 @@ @testable import Nextcloud import XCTest -import NCCommunication +import NextcloudKit class SharePermissionTest: XCTestCase { override func setUp() { @@ -35,7 +35,7 @@ class SharePermissionTest: XCTestCase { } func testShareCellPermissionCell() throws { - let share = NCTableShareOptions(sharee: NCCommunicationSharee(), metadata: tableMetadata(), password: nil) + let share = NCTableShareOptions(sharee: NKSharee(), metadata: tableMetadata(), password: nil) let shareConfig = NCShareConfig(parentMetadata: tableMetadata(), share: share) for row in 0..<shareConfig.permissions.count { @@ -48,7 +48,7 @@ class SharePermissionTest: XCTestCase { let meta = tableMetadata() meta.sharePermissionsCollaborationServices = 31 - let fullShare = NCTableShareOptions(sharee: NCCommunicationSharee(), metadata: meta, password: nil) + let fullShare = NCTableShareOptions(sharee: NKSharee(), metadata: meta, password: nil) let shareFullConfig = NCShareConfig(parentMetadata: meta, share: fullShare) for row in 0..<shareFullConfig.permissions.count { @@ -102,7 +102,7 @@ class SharePermissionTest: XCTestCase { func testUserShare() throws { let meta = tableMetadata() meta.directory = false - let sharee = NCCommunicationSharee() + let sharee = NKSharee() let share = NCTableShareOptions(sharee: sharee, metadata: meta, password: nil) let fileConfig = NCShareConfig(parentMetadata: meta, share: share) XCTAssertEqual(fileConfig.advanced, NCShareDetails.forUser) @@ -126,7 +126,7 @@ class SharePermissionTest: XCTestCase { XCTAssertEqual(fileConfig.permissions as? [NCLinkPermission], NCLinkPermission.forFile) meta.directory = true - let sharee = NCCommunicationSharee() + let sharee = NKSharee() let folderShare = NCTableShareOptions(sharee: sharee, metadata: meta, password: nil) let folderConfig = NCShareConfig(parentMetadata: meta, share: folderShare) XCTAssertEqual(folderConfig.resharePermission, meta.sharePermissionsCollaborationServices) @@ -2,7 +2,7 @@ [![Releases](https://img.shields.io/github/release/nextcloud/ios.svg)](https://github.com/nextcloud/ios/releases/latest) [![Build](https://github.com/nextcloud/ios/actions/workflows/xcode.yml/badge.svg)](https://github.com/nextcloud/ios/actions/workflows/xcode.yml) [![SwiftLint](https://github.com/nextcloud/ios/actions/workflows/lint.yml/badge.svg)](https://github.com/nextcloud/ios/actions/workflows/lint.yml) [![irc](https://img.shields.io/badge/IRC-%23nextcloud--mobile%20on%20freenode-blue.svg)](https://webchat.freenode.net/?channels=nextcloud-mobile) -<img src="Animation.gif" alt="Demo of the Nextcloud iOS files app" width="277" height="600"> +<img src="Animation.gif" alt="Demo of the Nextcloud iOS files app" width="277" height="600"><img src="widget.png" alt="Widget of the Nextcloud iOS files app" width="277" height="600"> [<img src="https://developer.apple.com/assets/elements/badges/download-on-the-app-store.svg" alt="Demo of the Nextcloud iOS files app" @@ -38,7 +38,7 @@ branch. Maybe start working on [starter issues](https://github.com/nextcloud/ios Easy starting points are also reviewing [pull requests](https://github.com/nextcloud/ios/pulls) -### Xcode 13.4 Project Setup +### Xcode 14 Project Setup #### Dependencies diff --git a/Share/NCShareCell.swift b/Share/NCShareCell.swift index 15e1504ab..a17118946 100644 --- a/Share/NCShareCell.swift +++ b/Share/NCShareCell.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit protocol NCShareCellDelegate: AnyObject { var uploadStarted: Bool { get } @@ -40,9 +40,9 @@ class NCShareCell: UITableViewCell { func setup(fileName: String) { self.fileName = fileName - let resultInternalType = NCCommunicationCommon.shared.getInternalType(fileName: fileName, mimeType: "", directory: false) + let resultInternalType = NKCommon.shared.getInternalType(fileName: fileName, mimeType: "", directory: false) - backgroundColor = NCBrandColor.shared.systemBackground + backgroundColor = .systemBackground imageCell?.layer.cornerRadius = 6 imageCell?.layer.masksToBounds = true @@ -61,7 +61,7 @@ class NCShareCell: UITableViewCell { let fileSize = NCUtilityFileSystem.shared.getFileSize(filePath: (NSTemporaryDirectory() + fileName)) sizeCell?.text = CCUtility.transformedSize(fileSize) - moreButton?.setImage(NCUtility.shared.loadImage(named: "more").image(color: NCBrandColor.shared.label, size: 15), for: .normal) + moreButton?.setImage(NCUtility.shared.loadImage(named: "more").image(color: .label, size: 15), for: .normal) } @IBAction func buttonTapped(_ sender: Any) { diff --git a/Share/NCShareExtension+DataSource.swift b/Share/NCShareExtension+DataSource.swift index a3c07e69f..64ad5f8fc 100644 --- a/Share/NCShareExtension+DataSource.swift +++ b/Share/NCShareExtension+DataSource.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit // MARK: - Collection View (target folder) @@ -67,7 +67,7 @@ extension NCShareExtension: UICollectionViewDataSource { cell.fileObjectId = metadata.ocId cell.fileUser = metadata.ownerId cell.labelTitle.text = metadata.fileNameView - cell.labelTitle.textColor = NCBrandColor.shared.label + cell.labelTitle.textColor = .label cell.imageSelect.image = nil cell.imageStatus.image = nil diff --git a/Share/NCShareExtension+Files.swift b/Share/NCShareExtension+Files.swift index 495dff95a..efa034069 100644 --- a/Share/NCShareExtension+Files.swift +++ b/Share/NCShareExtension+Files.swift @@ -73,11 +73,11 @@ extension NCShareExtension { networkInProgress = true collectionView.reloadData() - NCNetworking.shared.readFolder(serverUrl: serverUrl, account: activeAccount.account) { _, metadataFolder, _, _, _, _, errorCode, errorDescription in + NCNetworking.shared.readFolder(serverUrl: serverUrl, account: activeAccount.account) { _, metadataFolder, _, _, _, _, error in DispatchQueue.main.async { - if errorCode != 0 { - self.showAlert(description: errorDescription) + if error != .success { + self.showAlert(description: error.errorDescription) } self.networkInProgress = false self.metadataFolder = metadataFolder diff --git a/Share/NCShareExtension+NCDelegate.swift b/Share/NCShareExtension+NCDelegate.swift index 50929180b..3fd9af725 100644 --- a/Share/NCShareExtension+NCDelegate.swift +++ b/Share/NCShareExtension+NCDelegate.swift @@ -21,7 +21,7 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. // -import NCCommunication +import NextcloudKit import UIKit extension NCShareExtension: NCEmptyDataSetDelegate, NCAccountRequestDelegate { @@ -81,14 +81,13 @@ extension NCShareExtension: NCEmptyDataSetDelegate, NCAccountRequestDelegate { NCBrandColor.shared.createUserColors() // NETWORKING - NCCommunicationCommon.shared.setup( + NKCommon.shared.setup( account: activeAccount.account, user: activeAccount.user, userId: activeAccount.userId, password: CCUtility.getPassword(activeAccount.account), urlBase: activeAccount.urlBase, userAgent: CCUtility.getUserAgent(), - webDav: NCUtilityFileSystem.shared.getWebDAV(account: activeAccount.account), nextcloudVersion: 0, delegate: NCNetworking.shared) @@ -122,7 +121,7 @@ extension NCShareExtension: NCShareCellDelegate, NCRenameFileDelegate, NCListCel func renameFile(named fileName: String) { guard let vcRename = UIStoryboard(name: "NCRenameFile", bundle: nil).instantiateInitialViewController() as? NCRenameFile else { return } - let resultInternalType = NCCommunicationCommon.shared.getInternalType(fileName: fileName, mimeType: "", directory: false) + let resultInternalType = NKCommon.shared.getInternalType(fileName: fileName, mimeType: "", directory: false) vcRename.delegate = self vcRename.fileName = fileName if let previewImage = UIImage.downsample(imageAt: URL(fileURLWithPath: NSTemporaryDirectory() + fileName), to: CGSize(width: 140, height: 140)) { diff --git a/Share/NCShareExtension.swift b/Share/NCShareExtension.swift index d22714e40..00abd8072 100644 --- a/Share/NCShareExtension.swift +++ b/Share/NCShareExtension.swift @@ -24,7 +24,7 @@ // import UIKit -import NCCommunication +import NextcloudKit import JGProgressHUD enum NCShareExtensionError: Error { @@ -85,27 +85,27 @@ class NCShareExtension: UIViewController { collectionView.addSubview(refreshControl) refreshControl.tintColor = NCBrandColor.shared.brandText - refreshControl.backgroundColor = NCBrandColor.shared.systemBackground + refreshControl.backgroundColor = .systemBackground refreshControl.addTarget(self, action: #selector(reloadDatasource), for: .valueChanged) - commandView.backgroundColor = NCBrandColor.shared.secondarySystemBackground - separatorView.backgroundColor = NCBrandColor.shared.separator + commandView.backgroundColor = .secondarySystemBackground + separatorView.backgroundColor = .separator separatorHeightConstraint.constant = 0.5 - tableView.separatorColor = NCBrandColor.shared.separator + tableView.separatorColor = .separator tableView.layer.cornerRadius = 10 tableView.tableFooterView = UIView(frame: CGRect(origin: .zero, size: CGSize(width: 0, height: 1))) commandViewHeightConstraint.constant = heightCommandView createFolderView.layer.cornerRadius = 10 - createFolderImage.image = NCUtility.shared.loadImage(named: "folder.badge.plus", color: NCBrandColor.shared.label) + createFolderImage.image = NCUtility.shared.loadImage(named: "folder.badge.plus", color: .label) createFolderLabel.text = NSLocalizedString("_create_folder_", comment: "") let createFolderGesture = UITapGestureRecognizer(target: self, action: #selector(actionCreateFolder)) createFolderView.addGestureRecognizer(createFolderGesture) uploadView.layer.cornerRadius = 10 - // uploadImage.image = NCUtility.shared.loadImage(named: "square.and.arrow.up", color: NCBrandColor.shared.label) + // uploadImage.image = NCUtility.shared.loadImage(named: "square.and.arrow.up", color: .label) uploadLabel.text = NSLocalizedString("_upload_", comment: "") uploadLabel.textColor = .systemBlue let uploadGesture = UITapGestureRecognizer(target: self, action: #selector(actionUpload)) @@ -116,14 +116,14 @@ class NCShareExtension: UIViewController { let isSimulatorOrTestFlight = NCUtility.shared.isSimulatorOrTestFlight() let versionNextcloudiOS = String(format: NCBrandOptions.shared.textCopyrightNextcloudiOS, NCUtility.shared.getVersionApp()) - NCCommunicationCommon.shared.levelLog = levelLog + NKCommon.shared.levelLog = levelLog if let pathDirectoryGroup = CCUtility.getDirectoryGroup()?.path { - NCCommunicationCommon.shared.pathLog = pathDirectoryGroup + NKCommon.shared.pathLog = pathDirectoryGroup } if isSimulatorOrTestFlight { - NCCommunicationCommon.shared.writeLog("Start Share session with level \(levelLog) " + versionNextcloudiOS + " (Simulator / TestFlight)") + NKCommon.shared.writeLog("[INFO] Start Share session with level \(levelLog) " + versionNextcloudiOS + " (Simulator / TestFlight)") } else { - NCCommunicationCommon.shared.writeLog("Start Share session with level \(levelLog) " + versionNextcloudiOS) + NKCommon.shared.writeLog("[INFO] Start Share session with level \(levelLog) " + versionNextcloudiOS) } // Colors @@ -283,9 +283,9 @@ class NCShareExtension: UIViewController { } @objc func actionCreateFolder() { - let alertController = UIAlertController.createFolder(serverUrl: serverUrl, urlBase: activeAccount) { errorCode, errorDescription in - guard errorCode != 0 else { return } - self.showAlert(title: "_error_createsubfolders_upload_", description: errorDescription) + let alertController = UIAlertController.createFolder(serverUrl: serverUrl, urlBase: activeAccount) { error in + guard error != .success else { return } + self.showAlert(title: "_error_createsubfolders_upload_", description: error.errorDescription) } self.present(alertController, animated: true) } @@ -312,7 +312,7 @@ extension NCShareExtension { ocId: ocId, serverUrl: serverUrl, urlBase: activeAccount.urlBase, url: "", contentType: "") - metadata.session = NCCommunicationCommon.shared.sessionIdentifierUpload + metadata.session = NKCommon.shared.sessionIdentifierUpload metadata.sessionSelector = NCGlobal.shared.selectorUploadFileShareExtension metadata.size = NCUtilityFileSystem.shared.getFileSize(filePath: toPath) metadata.status = NCGlobal.shared.metadataStatusWaitUpload @@ -339,7 +339,7 @@ extension NCShareExtension { guard uploadStarted else { return } guard uploadMetadata.count > counterUploaded else { return finishedUploading() } let metadata = uploadMetadata[counterUploaded] - let results = NCCommunicationCommon.shared.getInternalType(fileName: metadata.fileNameView, mimeType: metadata.contentType, directory: false) + let results = NKCommon.shared.getInternalType(fileName: metadata.fileNameView, mimeType: metadata.contentType, directory: false) metadata.contentType = results.mimeType metadata.iconName = results.iconName metadata.classFile = results.classFile @@ -352,8 +352,8 @@ extension NCShareExtension { hud.progress = 0 hud.show(in: self.view) - NCNetworking.shared.upload(metadata: metadata) { } completion: { errorCode, _ in - if errorCode != 0 { + NCNetworking.shared.upload(metadata: metadata) { } completion: { error in + if error != .success { let path = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId)! NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)) NCManageDatabase.shared.deleteChunks(account: metadata.account, ocId: metadata.ocId) diff --git a/Widget/Assets.xcassets/AccentColor.colorset/Contents.json b/Widget/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 000000000..eb8789700 --- /dev/null +++ b/Widget/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Widget/Assets.xcassets/AppIcon.imageset/Contents.json b/Widget/Assets.xcassets/AppIcon.imageset/Contents.json new file mode 100644 index 000000000..6fe332016 --- /dev/null +++ b/Widget/Assets.xcassets/AppIcon.imageset/Contents.json @@ -0,0 +1,11 @@ +{ + "images" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Widget/Assets.xcassets/Contents.json b/Widget/Assets.xcassets/Contents.json new file mode 100644 index 000000000..73c00596a --- /dev/null +++ b/Widget/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Widget/Assets.xcassets/WidgetBackground.colorset/Contents.json b/Widget/Assets.xcassets/WidgetBackground.colorset/Contents.json new file mode 100644 index 000000000..eb8789700 --- /dev/null +++ b/Widget/Assets.xcassets/WidgetBackground.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Widget/Assets.xcassets/activity.imageset/Contents.json b/Widget/Assets.xcassets/activity.imageset/Contents.json new file mode 100644 index 000000000..e507da5dc --- /dev/null +++ b/Widget/Assets.xcassets/activity.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "activity.png", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Widget/Assets.xcassets/activity.imageset/activity.png b/Widget/Assets.xcassets/activity.imageset/activity.png Binary files differnew file mode 100644 index 000000000..8c2efb615 --- /dev/null +++ b/Widget/Assets.xcassets/activity.imageset/activity.png diff --git a/Widget/Assets.xcassets/widget.imageset/Contents.json b/Widget/Assets.xcassets/widget.imageset/Contents.json new file mode 100644 index 000000000..7215b5e03 --- /dev/null +++ b/Widget/Assets.xcassets/widget.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "icons8-widgetsmith-250.png", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Widget/Assets.xcassets/widget.imageset/icons8-widgetsmith-250.png b/Widget/Assets.xcassets/widget.imageset/icons8-widgetsmith-250.png Binary files differnew file mode 100644 index 000000000..78516262d --- /dev/null +++ b/Widget/Assets.xcassets/widget.imageset/icons8-widgetsmith-250.png diff --git a/Widget/Dashboard/DashboardData.swift b/Widget/Dashboard/DashboardData.swift new file mode 100644 index 000000000..e733fb351 --- /dev/null +++ b/Widget/Dashboard/DashboardData.swift @@ -0,0 +1,223 @@ +// +// DashboardData.swift +// Widget +// +// Created by Marino Faggiana on 20/08/22. +// Copyright © 2022 Marino Faggiana. All rights reserved. +// +// Author Marino Faggiana <marino.faggiana@nextcloud.com> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// + +import WidgetKit +import NextcloudKit +import RealmSwift +import SVGKit + +struct DashboardDataEntry: TimelineEntry { + let date: Date + let datas: [DashboardData] + let dashboard: tableDashboardWidget? + let buttons: [tableDashboardWidgetButton]? + let isPlaceholder: Bool + let titleImage: UIImage + let title: String + let footerImage: String + let footerText: String +} + +struct DashboardData: Identifiable, Hashable { + let id: Int + let title: String + let subTitle: String + let link: URL + let icon: UIImage + let template: Bool + let avatar: Bool +} + +struct DashboardDataButton: Hashable { + let type: String + let Text: String + let link: String +} + +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) +] + +func getDashboardItems(displaySize: CGSize, withButton: Bool) -> Int { + + if withButton { + let height = Int((displaySize.height - 85) / 50) + return height + } else { + let height = Int((displaySize.height - 60) / 50) + return height + } +} + +func getDashboardDataEntry(intent: Applications?, isPreview: Bool, displaySize: CGSize, completion: @escaping (_ entry: DashboardDataEntry) -> Void) { + + let dashboardItems = getDashboardItems(displaySize: displaySize, withButton: false) + let datasPlaceholder = Array(dashboardDatasTest[0...dashboardItems - 1]) + + if isPreview { + return completion(DashboardDataEntry(date: Date(), datas: datasPlaceholder, dashboard: nil, buttons: nil, isPlaceholder: true, titleImage: UIImage(named: "widget")!, title: "Dashboard", footerImage: "checkmark.icloud", footerText: NCBrandOptions.shared.brand + " dashboard")) + } + + guard let account = NCManageDatabase.shared.getActiveAccount() else { + return completion(DashboardDataEntry(date: Date(), datas: datasPlaceholder, dashboard: nil, buttons: nil, isPlaceholder: true, titleImage: UIImage(named: "widget")!, title: "Dashboard", footerImage: "xmark.icloud", footerText: NSLocalizedString("_no_active_account_", comment: ""))) + } + + // Default widget + let result = NCManageDatabase.shared.getDashboardWidgetApplications(account: account.account).first + let id: String = intent?.identifier ?? (result?.id ?? "recommendations") + + let serverVersionMajor = NCManageDatabase.shared.getCapabilitiesServerInt(account: account.account, elements: NCElementsJSON.shared.capabilitiesVersionMajor) + guard serverVersionMajor >= NCGlobal.shared.nextcloudVersion25 else { + return completion(DashboardDataEntry(date: Date(), datas: datasPlaceholder, dashboard: nil, buttons: nil, isPlaceholder: true, titleImage: UIImage(named: "widget")!, title: "Dashboard", footerImage: "xmark.icloud", footerText: NSLocalizedString("_widget_available_nc25_", comment: ""))) + } + + // NETWORKING + let password = CCUtility.getPassword(account.account)! + NKCommon.shared.setup( + account: account.account, + user: account.user, + userId: account.userId, + password: password, + urlBase: account.urlBase, + userAgent: CCUtility.getUserAgent(), + nextcloudVersion: 0, + delegate: NCNetworking.shared) + + // LOG + let levelLog = CCUtility.getLogLevel() + let isSimulatorOrTestFlight = NCUtility.shared.isSimulatorOrTestFlight() + let versionNextcloudiOS = String(format: NCBrandOptions.shared.textCopyrightNextcloudiOS, NCUtility.shared.getVersionApp()) + + NKCommon.shared.levelLog = levelLog + if let pathDirectoryGroup = CCUtility.getDirectoryGroup()?.path { + NKCommon.shared.pathLog = pathDirectoryGroup + } + if isSimulatorOrTestFlight { + NKCommon.shared.writeLog("[INFO] Start \(NCBrandOptions.shared.brand) dashboard widget session with level \(levelLog) " + versionNextcloudiOS + " (Simulator / TestFlight)") + } else { + NKCommon.shared.writeLog("[INFO] Start \(NCBrandOptions.shared.brand) dashboard widget session with level \(levelLog) " + versionNextcloudiOS) + } + + let (tableDashboard, tableButton) = NCManageDatabase.shared.getDashboardWidget(account: account.account, id: id) + let existsButton = (tableButton?.isEmpty ?? true) ? false : true + let options = NKRequestOptions(timeout: 15, queue: NKCommon.shared.backgroundQueue) + let title = tableDashboard?.title ?? id + + var imagetmp = UIImage(named: "widget")! + if let fileName = tableDashboard?.iconClass { + let fileNamePath: String = CCUtility.getDirectoryUserData() + "/" + fileName + ".png" + if let image = UIImage(contentsOfFile: fileNamePath) { + imagetmp = image.withTintColor(.label, renderingMode: .alwaysOriginal) + } + } + let titleImage = imagetmp + + NextcloudKit.shared.getDashboardWidgetsApplication(id, options: options) { account, results, data, error in + + Task { + var datas = [DashboardData]() + var numberItems = 0 + + if let results = results { + for result in results { + if let items = result.items { + numberItems = result.items?.count ?? 0 + var counter: Int = 0 + let dashboardItems = getDashboardItems(displaySize: displaySize, withButton: existsButton) + for item in items { + counter += 1 + let title = item.title ?? "" + let subtitle = item.subtitle ?? "" + var link = URL(string: "https://")! + 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 + + if let iconUrl = item.iconUrl, let url = URL(string: iconUrl) { + if let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false) { + + let path = (urlComponents.path as NSString) + let pathComponents = path.components(separatedBy: "/") + let queryItems = urlComponents.queryItems + + if (pathComponents.last as? NSString)?.pathExtension.lowercased() == "svg" { + template = true + } + + if let item = CCUtility.value(forKey: "fileId", fromQueryItems: queryItems) { + iconFileName = item + } else if pathComponents.contains("avatar") { + iconFileName = pathComponents[pathComponents.count-2] + avatar = true + } else { + iconFileName = ((path.lastPathComponent) as NSString).deletingPathExtension + } + } + 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) + if let image = NCUtility.shared.convertDataToImage(data: data, size: CGSize(width: 256, height: 256), fileNameToWrite: fileName) { + icon = image + } + } + } + } + + let data = DashboardData(id: counter, title: title, subTitle: subtitle, link: link, icon: icon, template: template, avatar: avatar) + datas.append(data) + + if datas.count == dashboardItems { break } + } + } + } + } + + var buttons = tableButton + if numberItems == datas.count, let tableButton = tableButton, tableButton.contains(where: { $0.type == "more"}) { + buttons = tableButton.filter(({ $0.type != "more" })) + } + + if error != .success { + completion(DashboardDataEntry(date: Date(), datas: datasPlaceholder, dashboard: tableDashboard, buttons: buttons, isPlaceholder: true, titleImage: titleImage, title: title, footerImage: "xmark.icloud", footerText: error.errorDescription)) + } else if datas.isEmpty { + completion(DashboardDataEntry(date: Date(), datas: datasPlaceholder, dashboard: tableDashboard, buttons: buttons, isPlaceholder: true, titleImage: titleImage, title: title, footerImage: "checkmark.icloud", footerText: NSLocalizedString("_no_data_available_", comment: ""))) + } else { + completion(DashboardDataEntry(date: Date(), datas: datas, dashboard: tableDashboard, buttons: buttons, isPlaceholder: false, titleImage: titleImage, title: title, footerImage: "checkmark.icloud", footerText: NCBrandOptions.shared.brand + " dashboard")) + } + } + } +} diff --git a/Widget/Dashboard/DashboardWidgetProvider.swift b/Widget/Dashboard/DashboardWidgetProvider.swift new file mode 100644 index 000000000..d7ccf1d9d --- /dev/null +++ b/Widget/Dashboard/DashboardWidgetProvider.swift @@ -0,0 +1,53 @@ +// +// DashboardWidgetProvider.swift +// Widget +// +// Created by Marino Faggiana on 25/08/22. +// Copyright © 2022 Marino Faggiana. All rights reserved. +// +// Author Marino Faggiana <marino.faggiana@nextcloud.com> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// + +import WidgetKit +import SwiftUI +import Intents + +struct DashboardWidgetProvider: IntentTimelineProvider { + + typealias Intent = DashboardIntent + typealias Entry = DashboardDataEntry + + func placeholder(in context: Context) -> Entry { + let dashboardItems = getDashboardItems(displaySize: context.displaySize, withButton: false) + let datasPlaceholder = Array(dashboardDatasTest[0...dashboardItems]) + let title = "Dashboard" + let titleImage = UIImage(named: "widget")! + return Entry(date: Date(), datas: datasPlaceholder, dashboard: nil, buttons: nil, isPlaceholder: true, titleImage: titleImage, title: title, footerImage: "checkmark.icloud", footerText: NCBrandOptions.shared.brand + " widget") + } + + func getSnapshot(for configuration: DashboardIntent, in context: Context, completion: @escaping (DashboardDataEntry) -> Void) { + getDashboardDataEntry(intent: configuration.Applications, isPreview: false, displaySize: context.displaySize) { entry in + completion(entry) + } + } + + func getTimeline(for configuration: DashboardIntent, in context: Context, completion: @escaping (Timeline<DashboardDataEntry>) -> Void) { + getDashboardDataEntry(intent: configuration.Applications, isPreview: context.isPreview, displaySize: context.displaySize) { entry in + let timeLine = Timeline(entries: [entry], policy: .atEnd) + completion(timeLine) + } + } +} diff --git a/Widget/Dashboard/DashboardWidgetView.swift b/Widget/Dashboard/DashboardWidgetView.swift new file mode 100644 index 000000000..8ebbe1fc7 --- /dev/null +++ b/Widget/Dashboard/DashboardWidgetView.swift @@ -0,0 +1,182 @@ +// +// DashboardWidgetView.swift +// Widget +// +// Created by Marino Faggiana on 20/08/22. +// Copyright © 2022 Marino Faggiana. All rights reserved. +// +// Author Marino Faggiana <marino.faggiana@nextcloud.com> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// + +import SwiftUI +import WidgetKit + +struct DashboardWidgetView: View { + + var entry: DashboardDataEntry + + var body: some View { + + GeometryReader { geo in + + ZStack(alignment: .topLeading) { + + HStack() { + + Image(uiImage: entry.titleImage) + .renderingMode(.template) + .resizable() + .scaledToFill() + .frame(width: 20, height: 20) + + Text(entry.title) + .font(.system(size: 15)) + .fontWeight(.bold) + .multilineTextAlignment(.center) + .textCase(.uppercase) + .lineLimit(1) + } + .frame(width: geo.size.width - 20) + .padding([.top, .leading, .trailing], 10) + + VStack(alignment: .leading) { + + VStack(spacing: 0) { + + ForEach(entry.datas, id: \.id) { element in + + Link(destination: element.link) { + + HStack { + + let subTitleColor = Color(white: 0.5) + + if entry.isPlaceholder { + Circle() + .fill(Color(.systemGray4)) + .frame(width: 35, height: 35) + } else if element.template { + if entry.dashboard?.itemIconsRound ?? false { + Image(uiImage: element.icon) + .renderingMode(.template) + .resizable() + .scaledToFill() + .frame(width: 20, height: 20) + .foregroundColor(.white) + .padding(8 + ) + .background(Color(.systemGray4)) + .clipShape(Circle()) + } else { + Image(uiImage: element.icon) + .renderingMode(.template) + .resizable() + .scaledToFill() + .frame(width: 25, height: 25) + .clipped() + .cornerRadius(5) + } + } else { + if entry.dashboard?.itemIconsRound ?? false || element.avatar { + Image(uiImage: element.icon) + .resizable() + .scaledToFill() + .frame(width: 35, height: 35) + .clipShape(Circle()) + } else { + Image(uiImage: element.icon) + .resizable() + .scaledToFill() + .frame(width: 35, height: 35) + .clipped() + .cornerRadius(5) + } + } + + VStack(alignment: .leading, spacing: 2) { + + Text(element.title) + .font(.system(size: 12)) + .fontWeight(.regular) + + Text(element.subTitle) + .font(.system(size: CGFloat(10))) + .foregroundColor(subTitleColor) + } + Spacer() + } + .padding(.leading, 10) + .frame(height: 50) + } + Divider() + .padding(.leading, 54) + } + } + } + .padding(.top, 35) + .redacted(reason: entry.isPlaceholder ? .placeholder : []) + + if let buttons = entry.buttons, !buttons.isEmpty, !entry.isPlaceholder { + + HStack(spacing: 10) { + + let brandColor = Color(NCBrandColor.shared.brand) + let brandTextColor = Color(NCBrandColor.shared.brandText) + + ForEach(buttons, id: \.index) { element in + Link(destination: URL(string: element.link)! , label: { + + Text(element.text) + .font(.system(size: 15)) + .padding(7) + .background(brandColor) + .foregroundColor(brandTextColor) + .border(brandColor, width: 1) + .cornerRadius(16) + }) + } + } + .frame(width: geo.size.width - 10, height: geo.size.height - 25, alignment: .bottomTrailing) + } + + HStack { + + Image(systemName: entry.footerImage) + .resizable() + .scaledToFit() + .frame(width: 15, height: 15) + .foregroundColor(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.brand)) + + Text(entry.footerText) + .font(.caption2) + .padding(.trailing, 13.0) + .foregroundColor(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.brand)) + } + .frame(maxWidth: geo.size.width - 5, maxHeight: geo.size.height - 2, alignment: .bottomTrailing) + } + } + } +} + +struct DashboardWidget_Previews: PreviewProvider { + static var previews: some View { + let datas = Array(dashboardDatasTest[0...4]) + let title = "Dashboard" + let titleImage = UIImage(named: "widget")! + let entry = DashboardDataEntry(date: Date(), datas: datas, dashboard: nil, buttons: nil, isPlaceholder: false, titleImage: titleImage, title: title, footerImage: "checkmark.icloud", footerText: "Nextcloud widget") + DashboardWidgetView(entry: entry).previewContext(WidgetPreviewContext(family: .systemLarge)) + } +} diff --git a/Widget/Dashboard/Intent/Base.lproj/Dashboard.intentdefinition b/Widget/Dashboard/Intent/Base.lproj/Dashboard.intentdefinition new file mode 100644 index 000000000..cc728fd06 --- /dev/null +++ b/Widget/Dashboard/Intent/Base.lproj/Dashboard.intentdefinition @@ -0,0 +1,169 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>INEnums</key> + <array/> + <key>INIntentDefinitionModelVersion</key> + <string>1.2</string> + <key>INIntentDefinitionNamespace</key> + <string>88xZPY</string> + <key>INIntentDefinitionSystemVersion</key> + <string>21G115</string> + <key>INIntentDefinitionToolsBuildVersion</key> + <string>14A309</string> + <key>INIntentDefinitionToolsVersion</key> + <string>14.0</string> + <key>INIntents</key> + <array> + <dict> + <key>INIntentCategory</key> + <string>information</string> + <key>INIntentDescription</key> + <string>Dashboard Widget</string> + <key>INIntentDescriptionID</key> + <string>tVvJ9c</string> + <key>INIntentEligibleForWidgets</key> + <true/> + <key>INIntentIneligibleForSuggestions</key> + <true/> + <key>INIntentLastParameterTag</key> + <integer>7</integer> + <key>INIntentName</key> + <string>Dashboard</string> + <key>INIntentParameters</key> + <array> + <dict> + <key>INIntentParameterConfigurable</key> + <true/> + <key>INIntentParameterDisplayName</key> + <string>Widget</string> + <key>INIntentParameterDisplayNameID</key> + <string>TRaTZg</string> + <key>INIntentParameterDisplayPriority</key> + <integer>1</integer> + <key>INIntentParameterName</key> + <string>Applications</string> + <key>INIntentParameterObjectType</key> + <string>Applications</string> + <key>INIntentParameterObjectTypeNamespace</key> + <string>88xZPY</string> + <key>INIntentParameterPromptDialogs</key> + <array> + <dict> + <key>INIntentParameterPromptDialogCustom</key> + <true/> + <key>INIntentParameterPromptDialogType</key> + <string>Configuration</string> + </dict> + <dict> + <key>INIntentParameterPromptDialogCustom</key> + <true/> + <key>INIntentParameterPromptDialogType</key> + <string>Primary</string> + </dict> + </array> + <key>INIntentParameterSupportsDynamicEnumeration</key> + <true/> + <key>INIntentParameterTag</key> + <integer>7</integer> + <key>INIntentParameterType</key> + <string>Object</string> + </dict> + </array> + <key>INIntentResponse</key> + <dict> + <key>INIntentResponseCodes</key> + <array> + <dict> + <key>INIntentResponseCodeName</key> + <string>success</string> + <key>INIntentResponseCodeSuccess</key> + <true/> + </dict> + <dict> + <key>INIntentResponseCodeName</key> + <string>failure</string> + </dict> + </array> + <key>INIntentResponseLastParameterTag</key> + <integer>1</integer> + </dict> + <key>INIntentTitle</key> + <string>Dashboard</string> + <key>INIntentTitleID</key> + <string>gpCwrM</string> + <key>INIntentType</key> + <string>Custom</string> + <key>INIntentVerb</key> + <string>View</string> + </dict> + </array> + <key>INTypes</key> + <array> + <dict> + <key>INTypeDisplayName</key> + <string>Applications</string> + <key>INTypeDisplayNameID</key> + <string>l090JH</string> + <key>INTypeLastPropertyTag</key> + <integer>99</integer> + <key>INTypeName</key> + <string>Applications</string> + <key>INTypeProperties</key> + <array> + <dict> + <key>INTypePropertyDefault</key> + <true/> + <key>INTypePropertyDisplayPriority</key> + <integer>1</integer> + <key>INTypePropertyName</key> + <string>identifier</string> + <key>INTypePropertyTag</key> + <integer>1</integer> + <key>INTypePropertyType</key> + <string>String</string> + </dict> + <dict> + <key>INTypePropertyDefault</key> + <true/> + <key>INTypePropertyDisplayPriority</key> + <integer>2</integer> + <key>INTypePropertyName</key> + <string>displayString</string> + <key>INTypePropertyTag</key> + <integer>2</integer> + <key>INTypePropertyType</key> + <string>String</string> + </dict> + <dict> + <key>INTypePropertyDefault</key> + <true/> + <key>INTypePropertyDisplayPriority</key> + <integer>3</integer> + <key>INTypePropertyName</key> + <string>pronunciationHint</string> + <key>INTypePropertyTag</key> + <integer>3</integer> + <key>INTypePropertyType</key> + <string>String</string> + </dict> + <dict> + <key>INTypePropertyDefault</key> + <true/> + <key>INTypePropertyDisplayPriority</key> + <integer>4</integer> + <key>INTypePropertyName</key> + <string>alternativeSpeakableMatches</string> + <key>INTypePropertySupportsMultipleValues</key> + <true/> + <key>INTypePropertyTag</key> + <integer>4</integer> + <key>INTypePropertyType</key> + <string>SpeakableString</string> + </dict> + </array> + </dict> + </array> +</dict> +</plist> diff --git a/Widget/Dashboard/Intent/ca.lproj/Dashboard.strings b/Widget/Dashboard/Intent/ca.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/ca.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/cs-CZ.lproj/Dashboard.strings b/Widget/Dashboard/Intent/cs-CZ.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/cs-CZ.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/da.lproj/Dashboard.strings b/Widget/Dashboard/Intent/da.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/da.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/de.lproj/Dashboard.strings b/Widget/Dashboard/Intent/de.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/de.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/en-GB.lproj/Dashboard.strings b/Widget/Dashboard/Intent/en-GB.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/en-GB.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/en.lproj/Dashboard.strings b/Widget/Dashboard/Intent/en.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/en.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/es-419.lproj/Dashboard.strings b/Widget/Dashboard/Intent/es-419.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/es-419.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/es-CL.lproj/Dashboard.strings b/Widget/Dashboard/Intent/es-CL.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/es-CL.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/es-CO.lproj/Dashboard.strings b/Widget/Dashboard/Intent/es-CO.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/es-CO.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/es-CR.lproj/Dashboard.strings b/Widget/Dashboard/Intent/es-CR.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/es-CR.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/es-DO.lproj/Dashboard.strings b/Widget/Dashboard/Intent/es-DO.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/es-DO.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/es-EC.lproj/Dashboard.strings b/Widget/Dashboard/Intent/es-EC.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/es-EC.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/es-GT.lproj/Dashboard.strings b/Widget/Dashboard/Intent/es-GT.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/es-GT.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/es-HN.lproj/Dashboard.strings b/Widget/Dashboard/Intent/es-HN.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/es-HN.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/es-MX.lproj/Dashboard.strings b/Widget/Dashboard/Intent/es-MX.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/es-MX.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/es-NI.lproj/Dashboard.strings b/Widget/Dashboard/Intent/es-NI.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/es-NI.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/es-PA.lproj/Dashboard.strings b/Widget/Dashboard/Intent/es-PA.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/es-PA.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/es-PE.lproj/Dashboard.strings b/Widget/Dashboard/Intent/es-PE.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/es-PE.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/es-PR.lproj/Dashboard.strings b/Widget/Dashboard/Intent/es-PR.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/es-PR.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/es-PY.lproj/Dashboard.strings b/Widget/Dashboard/Intent/es-PY.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/es-PY.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/es-SV.lproj/Dashboard.strings b/Widget/Dashboard/Intent/es-SV.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/es-SV.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/es-UY.lproj/Dashboard.strings b/Widget/Dashboard/Intent/es-UY.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/es-UY.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/es.lproj/Dashboard.strings b/Widget/Dashboard/Intent/es.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/es.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/eu.lproj/Dashboard.strings b/Widget/Dashboard/Intent/eu.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/eu.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/fr.lproj/Dashboard.strings b/Widget/Dashboard/Intent/fr.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/fr.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/gl.lproj/Dashboard.strings b/Widget/Dashboard/Intent/gl.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/gl.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/hu.lproj/Dashboard.strings b/Widget/Dashboard/Intent/hu.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/hu.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/is.lproj/Dashboard.strings b/Widget/Dashboard/Intent/is.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/is.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/it.lproj/Dashboard.strings b/Widget/Dashboard/Intent/it.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/it.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/ja-JP.lproj/Dashboard.strings b/Widget/Dashboard/Intent/ja-JP.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/ja-JP.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/ka-GE.lproj/Dashboard.strings b/Widget/Dashboard/Intent/ka-GE.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/ka-GE.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/ko.lproj/Dashboard.strings b/Widget/Dashboard/Intent/ko.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/ko.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/nb-NO.lproj/Dashboard.strings b/Widget/Dashboard/Intent/nb-NO.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/nb-NO.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/nl.lproj/Dashboard.strings b/Widget/Dashboard/Intent/nl.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/nl.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/pl.lproj/Dashboard.strings b/Widget/Dashboard/Intent/pl.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/pl.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/pt-BR.lproj/Dashboard.strings b/Widget/Dashboard/Intent/pt-BR.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/pt-BR.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/pt-PT.lproj/Dashboard.strings b/Widget/Dashboard/Intent/pt-PT.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/pt-PT.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/ru.lproj/Dashboard.strings b/Widget/Dashboard/Intent/ru.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/ru.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/sk-SK.lproj/Dashboard.strings b/Widget/Dashboard/Intent/sk-SK.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/sk-SK.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/sr.lproj/Dashboard.strings b/Widget/Dashboard/Intent/sr.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/sr.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/sv.lproj/Dashboard.strings b/Widget/Dashboard/Intent/sv.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/sv.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/tr.lproj/Dashboard.strings b/Widget/Dashboard/Intent/tr.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/tr.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/zh-Hans.lproj/Dashboard.strings b/Widget/Dashboard/Intent/zh-Hans.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/zh-Hans.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Dashboard/Intent/zh-Hant-TW.lproj/Dashboard.strings b/Widget/Dashboard/Intent/zh-Hant-TW.lproj/Dashboard.strings new file mode 100644 index 000000000..a32d2733f --- /dev/null +++ b/Widget/Dashboard/Intent/zh-Hant-TW.lproj/Dashboard.strings @@ -0,0 +1,8 @@ +"TRaTZg" = "Widget"; + +"gpCwrM" = "Dashboard"; + +"l090JH" = "Applications"; + +"tVvJ9c" = "Dashboard Widget"; + diff --git a/Widget/Files/FilesData.swift b/Widget/Files/FilesData.swift new file mode 100644 index 000000000..73f59ad7b --- /dev/null +++ b/Widget/Files/FilesData.swift @@ -0,0 +1,272 @@ +// +// FilesData.swift +// Widget +// +// Created by Marino Faggiana on 25/08/22. +// Copyright © 2022 Marino Faggiana. All rights reserved. +// +// Author Marino Faggiana <marino.faggiana@nextcloud.com> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// + +import WidgetKit +import NextcloudKit + +struct FilesDataEntry: TimelineEntry { + let date: Date + let datas: [FilesData] + let isPlaceholder: Bool + let tile: String + let footerImage: String + let footerText: String +} + +struct FilesData: Identifiable, Hashable { + var id: String + var image: UIImage + var title: String + var subTitle: String + var url: URL +} + +let filesDatasTest: [FilesData] = [ + .init(id: "0", image: UIImage(named: "widget")!, title: "title1", subTitle: "subTitle-description1", url: URL(string: "https://nextcloud.com/")!), + .init(id: "1", image: UIImage(named: "widget")!, title: "title2", subTitle: "subTitle-description2", url: URL(string: "https://nextcloud.com/")!), + .init(id: "2", image: UIImage(named: "widget")!, title: "title3", subTitle: "subTitle-description3", url: URL(string: "https://nextcloud.com/")!), + .init(id: "3", image: UIImage(named: "widget")!, title: "title4", subTitle: "subTitle-description4", url: URL(string: "https://nextcloud.com/")!), + .init(id: "4", image: UIImage(named: "widget")!, title: "title4", subTitle: "subTitle-description4", url: URL(string: "https://nextcloud.com/")!), + .init(id: "5", image: UIImage(named: "widget")!, title: "title4", subTitle: "subTitle-description4", url: URL(string: "https://nextcloud.com/")!), + .init(id: "6", image: UIImage(named: "widget")!, title: "title4", subTitle: "subTitle-description4", url: URL(string: "https://nextcloud.com/")!), + .init(id: "7", image: UIImage(named: "widget")!, title: "title4", subTitle: "subTitle-description4", url: URL(string: "https://nextcloud.com/")!), + .init(id: "8", image: UIImage(named: "widget")!, title: "title4", subTitle: "subTitle-description4", url: URL(string: "https://nextcloud.com/")!), + .init(id: "9", image: UIImage(named: "widget")!, title: "title4", subTitle: "subTitle-description4", url: URL(string: "https://nextcloud.com/")!) +] + +func getTitleFilesWidget() -> String { + + let hour = Calendar.current.component(.hour, from: Date()) + var good = "" + + switch hour { + case 6..<12: good = NSLocalizedString("_good_morning_", value: "Good morning", comment: "") + case 12: good = NSLocalizedString("_good_day_", value: "Good day", comment: "") + case 13..<17: good = NSLocalizedString("_good_afternoon_", value: "Good afternoon", comment: "") + case 17..<22: good = NSLocalizedString("_good_evening_", value: "Good evening", comment: "") + default: good = NSLocalizedString("_good_night_", value: "Good night", comment: "") + } + + if let account = NCManageDatabase.shared.getActiveAccount() { + return good + ", " + account.displayName + } else { + return good + } +} + +func getFilesItems(displaySize: CGSize) -> Int { + + let height = Int((displaySize.height - 100) / 50) + return height +} + +func getFilesDataEntry(isPreview: Bool, displaySize: CGSize, completion: @escaping (_ entry: FilesDataEntry) -> Void) { + + let filesItems = getFilesItems(displaySize: displaySize) + let datasPlaceholder = Array(filesDatasTest[0...filesItems - 1]) + let title = getTitleFilesWidget() + + + if isPreview { + return completion(FilesDataEntry(date: Date(), datas: datasPlaceholder, isPlaceholder: true, tile: title, footerImage: "checkmark.icloud", footerText: NCBrandOptions.shared.brand + " files")) + } + + guard let account = NCManageDatabase.shared.getActiveAccount() else { + return completion(FilesDataEntry(date: Date(), datas: datasPlaceholder, isPlaceholder: true, tile: title, footerImage: "xmark.icloud", footerText: NSLocalizedString("_no_active_account_", value: "No account found", comment: ""))) + } + + @Sendable func isLive(file: NKFile, files: [NKFile]) -> Bool { + + if file.ext.lowercased() != "mov" { return false } + if files.filter({ ($0.fileNameWithoutExt == file.fileNameWithoutExt) && ($0.ext.lowercased() == "jpg") }).first != nil { + return true + } + return false + } + + // NETWORKING + let password = CCUtility.getPassword(account.account)! + NKCommon.shared.setup( + account: account.account, + user: account.user, + userId: account.userId, + password: password, + urlBase: account.urlBase, + userAgent: CCUtility.getUserAgent(), + nextcloudVersion: 0, + delegate: NCNetworking.shared) + + let requestBodyRecent = + """ + <?xml version=\"1.0\"?> + <d:searchrequest xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\"> + <d:basicsearch> + <d:select> + <d:prop> + <d:displayname/> + <d:getcontenttype/> + <d:resourcetype/> + <d:getcontentlength/> + <d:getlastmodified/> + <d:getetag/> + <d:quota-used-bytes/> + <d:quota-available-bytes/> + <permissions xmlns=\"http://owncloud.org/ns\"/> + <id xmlns=\"http://owncloud.org/ns\"/> + <fileid xmlns=\"http://owncloud.org/ns\"/> + <size xmlns=\"http://owncloud.org/ns\"/> + <favorite xmlns=\"http://owncloud.org/ns\"/> + <creation_time xmlns=\"http://nextcloud.org/ns\"/> + <upload_time xmlns=\"http://nextcloud.org/ns\"/> + <is-encrypted xmlns=\"http://nextcloud.org/ns\"/> + <mount-type xmlns=\"http://nextcloud.org/ns\"/> + <owner-id xmlns=\"http://owncloud.org/ns\"/> + <owner-display-name xmlns=\"http://owncloud.org/ns\"/> + <comments-unread xmlns=\"http://owncloud.org/ns\"/> + <has-preview xmlns=\"http://nextcloud.org/ns\"/> + <trashbin-filename xmlns=\"http://nextcloud.org/ns\"/> + <trashbin-original-location xmlns=\"http://nextcloud.org/ns\"/> + <trashbin-deletion-time xmlns=\"http://nextcloud.org/ns\"/> + </d:prop> + </d:select> + <d:from> + <d:scope> + <d:href>%@</d:href> + <d:depth>infinity</d:depth> + </d:scope> + </d:from> + <d:where> + <d:lt> + <d:prop> + <d:getlastmodified/> + </d:prop> + <d:literal>%@</d:literal> + </d:lt> + </d:where> + <d:orderby> + <d:order> + <d:prop> + <d:getlastmodified/> + </d:prop> + <d:descending/> + </d:order> + </d:orderby> + <d:limit> + <d:nresults>50</d:nresults> + </d:limit> + </d:basicsearch> + </d:searchrequest> + """ + + let dateFormatter = DateFormatter() + dateFormatter.locale = Locale(identifier: "en_US_POSIX") + dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZZZ" + let lessDateString = dateFormatter.string(from: Date()) + let requestBody = String(format: requestBodyRecent, "/files/" + account.userId, lessDateString) + + // LOG + let levelLog = CCUtility.getLogLevel() + let isSimulatorOrTestFlight = NCUtility.shared.isSimulatorOrTestFlight() + let versionNextcloudiOS = String(format: NCBrandOptions.shared.textCopyrightNextcloudiOS, NCUtility.shared.getVersionApp()) + + NKCommon.shared.levelLog = levelLog + if let pathDirectoryGroup = CCUtility.getDirectoryGroup()?.path { + NKCommon.shared.pathLog = pathDirectoryGroup + } + if isSimulatorOrTestFlight { + NKCommon.shared.writeLog("[INFO] Start \(NCBrandOptions.shared.brand) widget session with level \(levelLog) " + versionNextcloudiOS + " (Simulator / TestFlight)") + } else { + NKCommon.shared.writeLog("[INFO] Start \(NCBrandOptions.shared.brand) widget session with level \(levelLog) " + versionNextcloudiOS) + } + + let options = NKRequestOptions(timeout: 15) + NextcloudKit.shared.searchBodyRequest(serverUrl: account.urlBase, requestBody: requestBody, showHiddenFiles: CCUtility.getShowHiddenFiles(), options: options) { _, files, data, error in + Task { + var datas: [FilesData] = [] + var imageRecent = UIImage(named: "file")! + + for file in files { + guard !file.directory else { continue } + guard !isLive(file: file, files: files) else { continue } + + // SUBTITLE + let subTitle = CCUtility.dateDiff(file.date as Date) + " · " + CCUtility.transformedSize(file.size) + + // URL: nextcloud://open-file?path=Talk/IMG_0000123.jpg&user=marinofaggiana&link=https://cloud.nextcloud.com/f/123 + guard var path = NCUtilityFileSystem.shared.getPath(path: file.path, user: file.user, fileName: file.fileName).urlEncoded else { continue } + if path.first == "/" { path = String(path.dropFirst())} + guard let user = file.user.urlEncoded else { continue } + let link = file.urlBase + "/f/" + file.fileId + let urlString = "nextcloud://open-file?path=\(path)&user=\(user)&link=\(link)" + guard let url = URL(string: urlString) else { continue } + + // IMAGE + if !file.iconName.isEmpty { + imageRecent = UIImage(named: file.iconName)! + } + if let image = NCUtility.shared.createFilePreviewImage(ocId: file.ocId, etag: file.etag, fileNameView: file.fileName, classFile: file.classFile, status: 0, createPreviewMedia: false) { + imageRecent = image + } else if file.hasPreview { + 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) + 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 + let data = FilesData.init(id: file.ocId, image: imageRecent, title: file.fileName, subTitle: subTitle, url: url) + datas.append(data) + if datas.count == filesItems { break} + } + + if error != .success { + completion(FilesDataEntry(date: Date(), datas: datasPlaceholder, isPlaceholder: true, tile: title, footerImage: "xmark.icloud", footerText: error.errorDescription)) + } else if datas.isEmpty { + var footerText = NSLocalizedString("_no_data_available_", comment: "") + let serverVersionMajor = NCManageDatabase.shared.getCapabilitiesServerInt(account: account.account, elements: NCElementsJSON.shared.capabilitiesVersionMajor) + if serverVersionMajor < NCGlobal.shared.nextcloudVersion25 { + footerText = NSLocalizedString("_widget_available_nc25_", comment: "") + } + completion(FilesDataEntry(date: Date(), datas: datasPlaceholder, isPlaceholder: true, tile: title, footerImage: "checkmark.icloud", footerText: footerText)) + } else { + completion(FilesDataEntry(date: Date(), datas: datas, isPlaceholder: false, tile: title, footerImage: "checkmark.icloud", footerText: NCBrandOptions.shared.brand + " files")) + } + } + } +} diff --git a/Widget/Files/FilesWidgetProvider.swift b/Widget/Files/FilesWidgetProvider.swift new file mode 100644 index 000000000..02a693280 --- /dev/null +++ b/Widget/Files/FilesWidgetProvider.swift @@ -0,0 +1,50 @@ +// +// FilesWidgetProvider.swift +// Widget +// +// Created by Marino Faggiana on 25/08/22. +// Copyright © 2022 Marino Faggiana. All rights reserved. +// +// Author Marino Faggiana <marino.faggiana@nextcloud.com> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// + +import WidgetKit +import SwiftUI + +struct FilesWidgetProvider: TimelineProvider { + + typealias Entry = FilesDataEntry + + func placeholder(in context: Context) -> Entry { + let filesItems = getFilesItems(displaySize: context.displaySize) + let datasPlaceholder = Array(filesDatasTest[0...filesItems - 1]) + let title = getTitleFilesWidget() + return Entry(date: Date(), datas: datasPlaceholder, isPlaceholder: true, tile: title, footerImage: "checkmark.icloud", footerText: NCBrandOptions.shared.brand + " files") + } + + func getSnapshot(in context: Context, completion: @escaping (Entry) -> Void) { + getFilesDataEntry(isPreview: false, displaySize: context.displaySize) { entry in + completion(entry) + } + } + + func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> Void) { + getFilesDataEntry(isPreview: context.isPreview, displaySize: context.displaySize) { entry in + let timeLine = Timeline(entries: [entry], policy: .atEnd) + completion(timeLine) + } + } +} diff --git a/Widget/Files/FilesWidgetView.swift b/Widget/Files/FilesWidgetView.swift new file mode 100644 index 000000000..0cd1fb963 --- /dev/null +++ b/Widget/Files/FilesWidgetView.swift @@ -0,0 +1,169 @@ +// +// FilesWidgetView.swift +// Widget +// +// Created by Marino Faggiana on 25/08/22. +// Copyright © 2022 Marino Faggiana. All rights reserved. +// +// Author Marino Faggiana <marino.faggiana@nextcloud.com> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// + +import SwiftUI +import WidgetKit + +struct FilesWidgetView: View { + + var entry: FilesDataEntry + + var body: some View { + + GeometryReader { geo in + + ZStack(alignment: .topLeading) { + + HStack() { + + Text(entry.tile) + .font(.system(size: 12)) + .fontWeight(.bold) + .multilineTextAlignment(.center) + .textCase(.uppercase) + .lineLimit(1) + } + .frame(width: geo.size.width - 20) + .padding([.top, .leading, .trailing], 10) + + VStack(alignment: .leading) { + + VStack(spacing: 0) { + + ForEach(entry.datas, id: \.id) { element in + + Link(destination: element.url) { + + HStack { + + Image(uiImage: element.image) + .resizable() + .scaledToFill() + .frame(width: 35, height: 35) + .clipped() + .cornerRadius(5) + + VStack(alignment: .leading, spacing: 2) { + + Text(element.title) + .font(.system(size: 12)) + .fontWeight(.regular) + + Text(element.subTitle) + .font(.system(size: CGFloat(10))) + .foregroundColor(Color(.systemGray)) + } + Spacer() + } + .padding(.leading, 10) + .frame(height: 50) + } + Divider() + .padding(.leading, 54) + } + } + } + .padding(.top, 30) + .redacted(reason: entry.isPlaceholder ? .placeholder : []) + + HStack(spacing: 0) { + + let sizeButton: CGFloat = 40 + + Link(destination: entry.isPlaceholder ? NCGlobal.shared.widgetActionNoAction : NCGlobal.shared.widgetActionUploadAsset, label: { + Image("addImage") + .resizable() + .renderingMode(.template) + .foregroundColor(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.brandText)) + .padding(11) + .background(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.brand)) + .clipShape(Circle()) + .scaledToFit() + .frame(width: geo.size.width / 4, height: sizeButton) + }) + + Link(destination: entry.isPlaceholder ? NCGlobal.shared.widgetActionNoAction : NCGlobal.shared.widgetActionScanDocument, label: { + Image("scan") + .resizable() + .renderingMode(.template) + .foregroundColor(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.brandText)) + .padding(11) + .background(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.brand)) + .clipShape(Circle()) + .scaledToFit() + .frame(width: geo.size.width / 4, height: sizeButton) + }) + + Link(destination: entry.isPlaceholder ? NCGlobal.shared.widgetActionNoAction : NCGlobal.shared.widgetActionTextDocument, label: { + Image("note.text") + .resizable() + .renderingMode(.template) + .foregroundColor(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.brandText)) + .padding(11) + .background(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.brand)) + .clipShape(Circle()) + .scaledToFit() + .frame(width: geo.size.width / 4, height: sizeButton) + }) + + Link(destination: entry.isPlaceholder ? NCGlobal.shared.widgetActionNoAction : NCGlobal.shared.widgetActionVoiceMemo, label: { + Image("microphone") + .resizable() + .renderingMode(.template) + .foregroundColor(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.brandText)) + .padding(11) + .background(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.brand)) + .clipShape(Circle()) + .scaledToFit() + .frame(width: geo.size.width / 4, height: sizeButton) + }) + } + .frame(width: geo.size.width, height: geo.size.height - 25, alignment: .bottomTrailing) + .redacted(reason: entry.isPlaceholder ? .placeholder : []) + + HStack { + + Image(systemName: entry.footerImage) + .resizable() + .scaledToFit() + .frame(width: 15, height: 15) + .foregroundColor(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.brand)) + + Text(entry.footerText) + .font(.caption2) + .padding(.trailing, 13.0) + .foregroundColor(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.brand)) + } + .frame(maxWidth: geo.size.width - 5, maxHeight: geo.size.height - 2, alignment: .bottomTrailing) + } + } + } +} + +struct FilesWidget_Previews: PreviewProvider { + static var previews: some View { + let datas = Array(filesDatasTest[0...4]) + let entry = FilesDataEntry(date: Date(), datas: datas, isPlaceholder: false, tile: "Good afternoon, Marino Faggiana", footerImage: "checkmark.icloud", footerText: "Nextcloud files") + FilesWidgetView(entry: entry).previewContext(WidgetPreviewContext(family: .systemLarge)) + } +} diff --git a/Widget/Lockscreen/LockscreenData.swift b/Widget/Lockscreen/LockscreenData.swift new file mode 100644 index 000000000..03ff6e224 --- /dev/null +++ b/Widget/Lockscreen/LockscreenData.swift @@ -0,0 +1,95 @@ +// +// LockscreenData.swift +// Widget +// +// Created by Marino Faggiana on 13/10/22. +// Copyright © 2022 Marino Faggiana. All rights reserved. +// +// Author Marino Faggiana <marino.faggiana@nextcloud.com> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// + +import WidgetKit +import NextcloudKit + +struct LockscreenData: TimelineEntry { + let date: Date + let isPlaceholder: Bool + let activity: String + let link: URL + let quotaRelative: Float + let quotaUsed: String + let quotaTotal: String +} + +func getLockscreenDataEntry(isPreview: Bool, completion: @escaping (_ entry: LockscreenData) -> Void) { + + if isPreview { + return completion(LockscreenData(date: Date(), isPlaceholder: true, activity: "", link: URL(string: "https://")!, quotaRelative: 0, quotaUsed: "", quotaTotal: "")) + } + + guard let account = NCManageDatabase.shared.getActiveAccount() else { + return completion(LockscreenData(date: Date(), isPlaceholder: true, activity: "", link: URL(string: "https://")!, quotaRelative: 0, quotaUsed: "", quotaTotal: "")) + } + + var quotaRelative: Float = 0 + if account.quotaRelative > 0 { + quotaRelative = Float(account.quotaRelative) / 100 + } + let quotaUsed: String = CCUtility.transformedSize(account.quotaUsed) + var quotaTotal: String = "" + + switch account.quotaTotal { + case -1: + quotaTotal = "" + case -2: + quotaTotal = "" + case -3: + quotaTotal = "" + default: + quotaTotal = CCUtility.transformedSize(account.quotaTotal) + } + + let serverVersionMajor = NCManageDatabase.shared.getCapabilitiesServerInt(account: account.account, elements: NCElementsJSON.shared.capabilitiesVersionMajor) + if serverVersionMajor >= NCGlobal.shared.nextcloudVersion25 { + + // NETWORKING + let password = CCUtility.getPassword(account.account)! + NKCommon.shared.setup( + account: account.account, + user: account.user, + userId: account.userId, + password: password, + urlBase: account.urlBase, + userAgent: CCUtility.getUserAgent(), + nextcloudVersion: 0, + delegate: NCNetworking.shared) + + let options = NKRequestOptions(timeout: 15, queue: NKCommon.shared.backgroundQueue) + NextcloudKit.shared.getDashboardWidgetsApplication("activity", options: options) { _, results, _, error in + var activity: String = NSLocalizedString("_no_data_available_", comment: "") + var link = URL(string: "https://")! + if error == .success, let result = results?.first { + if let item = result.items?.first { + if let title = item.title { activity = title } + if let itemLink = item.link, let url = URL(string: itemLink) { link = url } + } + } + completion(LockscreenData(date: Date(), isPlaceholder: false, activity: activity, link: link, quotaRelative: quotaRelative, quotaUsed: quotaUsed, quotaTotal: quotaTotal)) + } + } else { + completion(LockscreenData(date: Date(), isPlaceholder: false, activity: NSLocalizedString("_widget_available_nc25_", comment: ""), link: URL(string: "https://")!, quotaRelative: quotaRelative, quotaUsed: quotaUsed, quotaTotal: quotaTotal)) + } +} diff --git a/Widget/Lockscreen/LockscreenWidgetProvider.swift b/Widget/Lockscreen/LockscreenWidgetProvider.swift new file mode 100644 index 000000000..963c8a0d5 --- /dev/null +++ b/Widget/Lockscreen/LockscreenWidgetProvider.swift @@ -0,0 +1,47 @@ +// +// LockscreenWidgetProvider.swift +// Widget +// +// Created by Marino Faggiana on 13/10/22. +// Copyright © 2022 Marino Faggiana. All rights reserved. +// +// Author Marino Faggiana <marino.faggiana@nextcloud.com> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// + +import WidgetKit +import SwiftUI + +struct LockscreenWidgetProvider: TimelineProvider { + + typealias Entry = LockscreenData + + func placeholder(in context: Context) -> Entry { + return Entry(date: Date(), isPlaceholder: true, activity: "", link: URL(string: "https://")!, quotaRelative: 0, quotaUsed: "", quotaTotal: "") + } + + func getSnapshot(in context: Context, completion: @escaping (Entry) -> Void) { + getLockscreenDataEntry(isPreview: false) { entry in + completion(entry) + } + } + + func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> Void) { + getLockscreenDataEntry(isPreview: context.isPreview) { entry in + let timeLine = Timeline(entries: [entry], policy: .atEnd) + completion(timeLine) + } + } +} diff --git a/Widget/Lockscreen/LockscreenWidgetView.swift b/Widget/Lockscreen/LockscreenWidgetView.swift new file mode 100644 index 000000000..de03865c0 --- /dev/null +++ b/Widget/Lockscreen/LockscreenWidgetView.swift @@ -0,0 +1,75 @@ +// +// LockscreenWidgetView.swift +// Widget +// +// Created by Marino Faggiana on 13/10/22. +// Copyright © 2022 Marino Faggiana. All rights reserved. +// +// Author Marino Faggiana <marino.faggiana@nextcloud.com> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// + +import SwiftUI +import WidgetKit + +@available(iOSApplicationExtension 16.0, *) +struct LockscreenWidgetView: View { + + let entry: LockscreenData + @Environment(\.widgetFamily) private var family + + var body: some View { + switch family { + case .accessoryCircular: + Gauge( + value: entry.quotaRelative, + label: { Text(" " + entry.quotaTotal + " ") }, + currentValueLabel: { Text(entry.quotaUsed) } + ) + .gaugeStyle(.accessoryCircular) + .redacted(reason: entry.isPlaceholder ? .placeholder : []) + case .accessoryRectangular: + VStack(alignment: .leading, spacing: 1) { + HStack(spacing: 1) { + Image("activity") + .renderingMode(.template) + .resizable() + .scaledToFill() + .foregroundColor(.gray) + .frame(width: 11, height: 11) + Text(NSLocalizedString("_recent_activity_", comment: "")) + .font(.system(size: 11)) + .fontWeight(.heavy) + .foregroundColor(.gray) + } + Text(entry.activity) + .font(.system(size: 12)).bold() + } + .widgetURL(entry.link) + .redacted(reason: entry.isPlaceholder ? .placeholder : []) + default: + Text("Not implemented") + } + } +} + +@available(iOSApplicationExtension 16.0, *) +struct LockscreenWidgetView_Previews: PreviewProvider { + static var previews: some View { + let entry = LockscreenData(date: Date(), isPlaceholder: false, activity: "Alba Mayoral changed Marketing / Regional Marketing / Agenda Meetings / Q4 2022 / OCTOBER / 13.11 Afrah Kahlid.md", link: URL(string: "https://")!, quotaRelative: 0.5, quotaUsed: "22 GB", quotaTotal: "50 GB") + LockscreenWidgetView(entry: entry).previewContext(WidgetPreviewContext(family: .accessoryRectangular)).previewDisplayName("Rectangular") + LockscreenWidgetView(entry: entry).previewContext(WidgetPreviewContext(family: .accessoryCircular)).previewDisplayName("Circular") + } +} diff --git a/Widget/Toolbar/ToolbarData.swift b/Widget/Toolbar/ToolbarData.swift new file mode 100644 index 000000000..00efdb9fd --- /dev/null +++ b/Widget/Toolbar/ToolbarData.swift @@ -0,0 +1,44 @@ +// +// ToolbarData.swift +// Widget +// +// Created by Marino Faggiana on 25/08/22. +// Copyright © 2022 Marino Faggiana. All rights reserved. +// +// Author Marino Faggiana <marino.faggiana@nextcloud.com> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// + +import WidgetKit + +struct ToolbarDataEntry: TimelineEntry { + let date: Date + let isPlaceholder: Bool + let footerImage: String + let footerText: String +} + +func getToolbarDataEntry(isPreview: Bool, completion: @escaping (_ entry: ToolbarDataEntry) -> Void) { + + if isPreview { + return completion(ToolbarDataEntry(date: Date(), isPlaceholder: true, footerImage: "checkmark.icloud", footerText: NCBrandOptions.shared.brand + " toolbar")) + } + + if NCManageDatabase.shared.getActiveAccount() == nil { + return completion(ToolbarDataEntry(date: Date(), isPlaceholder: true, footerImage: "xmark.icloud", footerText: NSLocalizedString("_no_active_account_", value: "No account found", comment: ""))) + } + + completion(ToolbarDataEntry(date: Date(), isPlaceholder: false, footerImage: "checkmark.icloud", footerText: NCBrandOptions.shared.brand + " toolbar")) +} diff --git a/Widget/Toolbar/ToolbarWidgetProvider.swift b/Widget/Toolbar/ToolbarWidgetProvider.swift new file mode 100644 index 000000000..d834a2fc0 --- /dev/null +++ b/Widget/Toolbar/ToolbarWidgetProvider.swift @@ -0,0 +1,47 @@ +// +// ToolbarWidgetProvider.swift +// Widget +// +// Created by Marino Faggiana on 25/08/22. +// Copyright © 2022 Marino Faggiana. All rights reserved. +// +// Author Marino Faggiana <marino.faggiana@nextcloud.com> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// + +import WidgetKit +import SwiftUI + +struct ToolbarWidgetProvider: TimelineProvider { + + typealias Entry = ToolbarDataEntry + + func placeholder(in context: Context) -> Entry { + return Entry(date: Date(), isPlaceholder: true, footerImage: "checkmark.icloud", footerText: NCBrandOptions.shared.brand + " toolbar") + } + + func getSnapshot(in context: Context, completion: @escaping (Entry) -> Void) { + getToolbarDataEntry(isPreview: false) { entry in + completion(entry) + } + } + + func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> Void) { + getToolbarDataEntry(isPreview: context.isPreview) { entry in + let timeLine = Timeline(entries: [entry], policy: .atEnd) + completion(timeLine) + } + } +} diff --git a/Widget/Toolbar/ToolbarWidgetView.swift b/Widget/Toolbar/ToolbarWidgetView.swift new file mode 100644 index 000000000..6841b4259 --- /dev/null +++ b/Widget/Toolbar/ToolbarWidgetView.swift @@ -0,0 +1,118 @@ +// +// ToolbarWidgetView.swift +// Widget +// +// Created by Marino Faggiana on 25/08/22. +// Copyright © 2022 Marino Faggiana. All rights reserved. +// +// Author Marino Faggiana <marino.faggiana@nextcloud.com> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// + +import SwiftUI +import WidgetKit + +struct ToolbarWidgetView: View { + + var entry: ToolbarDataEntry + + var body: some View { + + GeometryReader { geo in + + ZStack(alignment: .topLeading) { + + Color(.black).opacity(0.9) + .ignoresSafeArea() + + HStack(spacing: 0) { + + let sizeButton: CGFloat = 65 + + Link(destination: entry.isPlaceholder ? NCGlobal.shared.widgetActionNoAction : NCGlobal.shared.widgetActionUploadAsset, label: { + Image("addImage") + .resizable() + .renderingMode(.template) + .foregroundColor(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.brandText)) + .padding() + .background(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.brand)) + .clipShape(Circle()) + .scaledToFit() + .frame(width: geo.size.width / 4, height: sizeButton) + }) + + Link(destination: entry.isPlaceholder ? NCGlobal.shared.widgetActionNoAction : NCGlobal.shared.widgetActionScanDocument, label: { + Image("scan") + .resizable() + .renderingMode(.template) + .foregroundColor(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.brandText)) + .padding() + .background(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.brand)) + .clipShape(Circle()) + .scaledToFit() + .frame(width: geo.size.width / 4, height: sizeButton) + }) + + Link(destination: entry.isPlaceholder ? NCGlobal.shared.widgetActionNoAction : NCGlobal.shared.widgetActionTextDocument, label: { + Image("note.text") + .resizable() + .renderingMode(.template) + .foregroundColor(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.brandText)) + .padding() + .background(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.brand)) + .clipShape(Circle()) + .scaledToFit() + .frame(width: geo.size.width / 4, height: sizeButton) + }) + + Link(destination: entry.isPlaceholder ? NCGlobal.shared.widgetActionNoAction : NCGlobal.shared.widgetActionVoiceMemo, label: { + Image("microphone") + .resizable() + .foregroundColor(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.brandText)) + .padding() + .background(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.brand)) + .clipShape(Circle()) + .scaledToFit() + .frame(width: geo.size.width / 4, height: sizeButton) + }) + } + .frame(width: geo.size.width, height: geo.size.height, alignment: .center) + .redacted(reason: entry.isPlaceholder ? .placeholder : []) + + HStack { + + Image(systemName: entry.footerImage) + .resizable() + .scaledToFit() + .frame(width: 15, height: 15) + .foregroundColor(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.brand)) + + Text(entry.footerText) + .font(.caption2) + .padding(.trailing, 13.0) + .foregroundColor(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.brand)) + } + .frame(maxWidth: geo.size.width - 5, maxHeight: geo.size.height - 2, alignment: .bottomTrailing) + } + } + } +} + +struct ToolbarWidget_Previews: PreviewProvider { + static var previews: some View { + let entry = ToolbarDataEntry(date: Date(), isPlaceholder: false, footerImage: "checkmark.icloud", footerText: NCBrandOptions.shared.brand + " toolbar") + ToolbarWidgetView(entry: entry).previewContext(WidgetPreviewContext(family: .systemMedium)) + } +} diff --git a/Widget/Widget-Brinding-header.h b/Widget/Widget-Brinding-header.h new file mode 100644 index 000000000..b905120e1 --- /dev/null +++ b/Widget/Widget-Brinding-header.h @@ -0,0 +1,5 @@ +// +// Use this file to import your target's public headers that you would like to expose to Swift. +// + +#import "CCUtility.h" diff --git a/Widget/Widget.swift b/Widget/Widget.swift new file mode 100644 index 000000000..fe301a39b --- /dev/null +++ b/Widget/Widget.swift @@ -0,0 +1,93 @@ +// +// NextcloudWidget.swift +// NextcloudWidget +// +// Created by Marino Faggiana on 20/08/22. +// Copyright © 2022 Marino Faggiana. All rights reserved. +// +// Author Marino Faggiana <marino.faggiana@nextcloud.com> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// + +import WidgetKit +import SwiftUI + +@main +struct NextcloudWidgetBundle: WidgetBundle { + + @WidgetBundleBuilder + var body: some Widget { + DashboardWidget() + FilesWidget() + ToolbarWidget() + LockscreenWidget() + } +} + +struct DashboardWidget: Widget { + let kind: String = "DashboardWidget" + + var body: some WidgetConfiguration { + IntentConfiguration(kind: kind, intent: DashboardIntent.self, provider: DashboardWidgetProvider()) { entry in + DashboardWidgetView(entry: entry) + } + .supportedFamilies([.systemLarge]) + .configurationDisplayName("Dashboard") + .description(NSLocalizedString("_description_dashboardwidget_", comment: "")) + } +} + +struct FilesWidget: Widget { + let kind: String = "FilesWidget" + + var body: some WidgetConfiguration { + StaticConfiguration(kind: kind, provider: FilesWidgetProvider()) { entry in + FilesWidgetView(entry: entry) + } + .supportedFamilies([.systemLarge]) + .configurationDisplayName("Files") + .description(NSLocalizedString("_description_fileswidget_", comment: "")) + } +} + +struct ToolbarWidget: Widget { + let kind: String = "ToolbarWidget" + + var body: some WidgetConfiguration { + StaticConfiguration(kind: kind, provider: ToolbarWidgetProvider()) { entry in + ToolbarWidgetView(entry: entry) + } + .supportedFamilies([.systemMedium]) + .configurationDisplayName("Toolbar") + .description(NSLocalizedString("_description_toolbarwidget_", comment: "")) + } +} + +struct LockscreenWidget: Widget { + let kind: String = "LockscreenWidget" + + var body: some WidgetConfiguration { + if #available(iOSApplicationExtension 16.0, *) { + return StaticConfiguration(kind: kind, provider: LockscreenWidgetProvider()) { entry in + LockscreenWidgetView(entry: entry) + } + .supportedFamilies([.accessoryRectangular, .accessoryCircular]) + .configurationDisplayName(NSLocalizedString("_title_lockscreenwidget_", comment: "")) + .description(NSLocalizedString("_description_lockscreenwidget_", comment: "")) + } else { + return EmptyWidgetConfiguration() + } + } +} diff --git a/WidgetDashboardIntentHandler/IntentHandler.swift b/WidgetDashboardIntentHandler/IntentHandler.swift new file mode 100644 index 000000000..0be2ead90 --- /dev/null +++ b/WidgetDashboardIntentHandler/IntentHandler.swift @@ -0,0 +1,42 @@ +// +// IntentHandler.swift +// WidgetDashboardIntentHandler +// +// Created by Marino Faggiana on 08/10/22. +// Copyright © 2022 Marino Faggiana. All rights reserved. +// + +import Intents +import RealmSwift + +class IntentHandler: INExtension, DashboardIntentHandling { + + func provideApplicationsOptionsCollection(for intent: DashboardIntent, with completion: @escaping (INObjectCollection<Applications>?, Error?) -> Void) { + + var applications: [Applications] = [] + + guard let account = NCManageDatabase.shared.getActiveAccount() else { + completion(nil, nil) + return + } + + let results = NCManageDatabase.shared.getDashboardWidgetApplications(account: account.account) + for result in results { + let application = Applications(identifier: result.id, display: result.title) + applications.append(application) + } + + completion(INObjectCollection(items: applications), nil) + } + + func defaultApplications(for intent: DashboardIntent) -> Applications? { + + guard let account = NCManageDatabase.shared.getActiveAccount() else { + return nil + } + if let result = NCManageDatabase.shared.getDashboardWidgetApplications(account: account.account).first { + return Applications(identifier: result.id, display: result.title) + } + return nil + } +} diff --git a/WidgetDashboardIntentHandler/WidgetDashboardIntentHandler-Brinding-header.h b/WidgetDashboardIntentHandler/WidgetDashboardIntentHandler-Brinding-header.h new file mode 100644 index 000000000..b905120e1 --- /dev/null +++ b/WidgetDashboardIntentHandler/WidgetDashboardIntentHandler-Brinding-header.h @@ -0,0 +1,5 @@ +// +// Use this file to import your target's public headers that you would like to expose to Swift. +// + +#import "CCUtility.h" diff --git a/iOSClient/.tx/config b/iOSClient/.tx/config index 9706c6ea1..2216eb6d3 100755 --- a/iOSClient/.tx/config +++ b/iOSClient/.tx/config @@ -1,16 +1,17 @@ [main] host = https://www.transifex.com -[nextcloud.ios] +[o:nextcloud:p:nextcloud:r:ios] file_filter = Supporting Files/<lang>.lproj/Localizable.strings source_file = Supporting Files/en.lproj/Localizable.strings source_lang = en -type = STRINGS -lang_map = pt_BR:pt-BR,zh_CN:zh-Hans,fi_FI:fi-FI,es_MX:es-MX,nb_NO:nb-NO,cs_CZ:cs-CZ,en_GB:en-GB,es_AR:es-AR,sk_SK:sk-SK,hu_HU:hu,ka_GE:ka-GE,zh_TW:zh-Hant-TW,es_CL:es-CL,es_CO:es-CO,es_CR:es-CR,es_DO:es-DO,es_EC:es-EC,es_GT:es-GT,es_HN:es-HN,es_NI:es-NI,es_PA:es-PA,es_PE:es-PE,es_PR:es-PR,es_PY:es-PY,es_SV:es-SV,es_UY:es-UY,es_419:es-419,pt_PT:pt-PT,ja_JP:ja-JP +type = STRINGS +lang_map = hu_HU: hu, es_DO: es-DO, es_419: es-419, cs_CZ: cs-CZ, es_EC: es-EC, es_GT: es-GT, es_PY: es-PY, es_SV: es-SV, pt_BR: pt-BR, fi_FI: fi-FI, nb_NO: nb-NO, es_UY: es-UY, es_MX: es-MX, sk_SK: sk-SK, pt_PT: pt-PT, en_GB: en-GB, ka_GE: ka-GE, es_HN: es-HN, zh_CN: zh-Hans, es_AR: es-AR, es_NI: es-NI, es_PE: es-PE, ja_JP: ja-JP, es_CL: es-CL, es_PR: es-PR, zh_TW: zh-Hant-TW, es_CO: es-CO, es_CR: es-CR, es_PA: es-PA -[nextcloud.ios-info] +[o:nextcloud:p:nextcloud:r:ios-info] file_filter = Supporting Files/<lang>.lproj/InfoPlist.strings source_file = Supporting Files/en.lproj/InfoPlist.strings source_lang = en -type = STRINGS -lang_map = pt_BR:pt-BR,zh_CN:zh-Hans,fi_FI:fi-FI,es_MX:es-MX,nb_NO:nb-NO,cs_CZ:cs-CZ,en_GB:en-GB,es_AR:es-AR,sk_SK:sk-SK,hu_HU:hu,ka_GE:ka-GE,zh_TW:zh-Hant-TW,es_CL:es-CL,es_CO:es-CO,es_CR:es-CR,es_DO:es-DO,es_EC:es-EC,es_GT:es-GT,es_HN:es-HN,es_NI:es-NI,es_PA:es-PA,es_PE:es-PE,es_PR:es-PR,es_PY:es-PY,es_SV:es-SV,es_UY:es-UY,es_419:es-419,pt_PT:pt-PT,ja_JP:ja-JP +type = STRINGS +lang_map = es_NI: es-NI, es_PY: es-PY, fi_FI: fi-FI, nb_NO: nb-NO, es_PE: es-PE, es_UY: es-UY, pt_BR: pt-BR, cs_CZ: cs-CZ, en_GB: en-GB, es_CR: es-CR, es_GT: es-GT, es_419: es-419, zh_CN: zh-Hans, es_CO: es-CO, es_DO: es-DO, es_PA: es-PA, es_PR: es-PR, es_SV: es-SV, es_EC: es-EC, es_MX: es-MX, hu_HU: hu, ka_GE: ka-GE, zh_TW: zh-Hant-TW, es_AR: es-AR, sk_SK: sk-SK, es_CL: es-CL, es_HN: es-HN, pt_PT: pt-PT, ja_JP: ja-JP + diff --git a/iOSClient/Account Request/NCAccountRequest.swift b/iOSClient/Account Request/NCAccountRequest.swift index c5d8bfd0f..5e01a814d 100644 --- a/iOSClient/Account Request/NCAccountRequest.swift +++ b/iOSClient/Account Request/NCAccountRequest.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit public protocol NCAccountRequestDelegate: AnyObject { func accountRequestAddAccount() @@ -61,13 +61,13 @@ class NCAccountRequest: UIViewController { titleLabel.text = NSLocalizedString("_account_select_", comment: "") - closeButton.setImage(NCUtility.shared.loadImage(named: "xmark", color: NCBrandColor.shared.label), for: .normal) + closeButton.setImage(NCUtility.shared.loadImage(named: "xmark", color: .label), for: .normal) tableView.tableFooterView = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.size.width, height: 1)) tableView.separatorStyle = UITableViewCell.SeparatorStyle.none - view.backgroundColor = NCBrandColor.shared.secondarySystemBackground - tableView.backgroundColor = NCBrandColor.shared.secondarySystemBackground + view.backgroundColor = .secondarySystemBackground + tableView.backgroundColor = .secondarySystemBackground progressView.trackTintColor = .clear progressView.progress = 1 diff --git a/iOSClient/Activity/NCActivity.swift b/iOSClient/Activity/NCActivity.swift index 30ad4e552..6caa5c07c 100644 --- a/iOSClient/Activity/NCActivity.swift +++ b/iOSClient/Activity/NCActivity.swift @@ -24,7 +24,7 @@ import UIKit import SwiftRichString -import NCCommunication +import NextcloudKit class NCActivity: UIViewController, NCSharePagingContent { @@ -60,13 +60,13 @@ class NCActivity: UIViewController, NCSharePagingContent { super.viewDidLoad() self.navigationController?.navigationBar.prefersLargeTitles = true - view.backgroundColor = NCBrandColor.shared.systemBackground + view.backgroundColor = .systemBackground self.title = NSLocalizedString("_activity_", comment: "") tableView.allowsSelection = false tableView.separatorColor = UIColor.clear tableView.contentInset = insets - tableView.backgroundColor = NCBrandColor.shared.systemBackground + tableView.backgroundColor = .systemBackground if showComments { setupComments() @@ -83,12 +83,12 @@ class NCActivity: UIViewController, NCSharePagingContent { commentView = Bundle.main.loadNibNamed("NCActivityCommentView", owner: self, options: nil)?.first as? NCActivityCommentView commentView?.setup(urlBase: appDelegate, account: activeAccount) { newComment in guard let newComment = newComment, !newComment.isEmpty, let metadata = self.metadata else { return } - NCCommunication.shared.putComments(fileId: metadata.fileId, message: newComment) { _, errorCode, errorDescription in - if errorCode == 0 { + NextcloudKit.shared.putComments(fileId: metadata.fileId, message: newComment) { _, error in + if error == .success { self.commentView?.newCommentField.text?.removeAll() self.loadComments() } else { - NCContentPresenter.shared.messageNotification("_share_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCContentPresenter.shared.showError(error: error) } } } @@ -96,7 +96,11 @@ class NCActivity: UIViewController, NCSharePagingContent { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + appDelegate.activeViewController = self + + navigationController?.setFileAppreance() + NotificationCenter.default.addObserver(self, selector: #selector(initialize), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitialize), object: nil) initialize() } @@ -163,7 +167,7 @@ extension NCActivity: UITableViewDelegate { let label = UILabel() label.font = UIFont.boldSystemFont(ofSize: 13) - label.textColor = NCBrandColor.shared.label + label.textColor = .label label.text = CCUtility.getTitleSectionDate(sectionDates[section]) label.textAlignment = .center label.layer.cornerRadius = 11 @@ -218,13 +222,13 @@ extension NCActivity: UITableViewDataSource { NCOperationQueue.shared.downloadAvatar(user: comment.actorId, dispalyName: comment.actorDisplayName, fileName: fileName, cell: cell, view: tableView, cellImageView: cell.fileAvatarImageView) // Username cell.labelUser.text = comment.actorDisplayName - cell.labelUser.textColor = NCBrandColor.shared.label + cell.labelUser.textColor = .label // Date cell.labelDate.text = CCUtility.dateDiff(comment.creationDateTime as Date) - cell.labelDate.textColor = NCBrandColor.shared.systemGray4 + cell.labelDate.textColor = .systemGray4 // Message cell.labelMessage.text = comment.message - cell.labelMessage.textColor = NCBrandColor.shared.label + cell.labelMessage.textColor = .label // Button Menu if comment.actorId == appDelegate.userId { cell.buttonMenu.isHidden = false @@ -248,7 +252,7 @@ extension NCActivity: UITableViewDataSource { cell.avatar.isHidden = true cell.subjectTrailingConstraint.constant = 10 cell.didSelectItemEnable = self.didSelectItemEnable - cell.subject.textColor = NCBrandColor.shared.label + cell.subject.textColor = .label cell.viewController = self // icon @@ -262,8 +266,8 @@ extension NCActivity: UITableViewDataSource { cell.icon.image = image } } else { - NCCommunication.shared.downloadContent(serverUrl: activity.icon) { _, data, errorCode, _ in - if errorCode == 0 { + NextcloudKit.shared.downloadContent(serverUrl: activity.icon) { _, data, error in + if error == .success { do { try data!.write(to: NSURL(fileURLWithPath: fileNameLocalPath) as URL, options: .atomic) self.tableView.reloadData() @@ -356,7 +360,7 @@ extension NCActivity { if let mainTabBar = self.tabBarController?.tabBar as? NCMainTabBar { bottom = -mainTabBar.getHight() } - NCActivityIndicator.shared.start(backgroundView: self.view, bottom: bottom-5, style: .gray) + NCActivityIndicator.shared.start(backgroundView: self.view, bottom: bottom-5, style: .medium) let dispatchGroup = DispatchGroup() loadComments(disptachGroup: dispatchGroup) @@ -403,11 +407,11 @@ extension NCActivity { guard showComments, let metadata = metadata else { return } disptachGroup?.enter() - NCCommunication.shared.getComments(fileId: metadata.fileId) { account, comments, errorCode, errorDescription in - if errorCode == 0, let comments = comments { + NextcloudKit.shared.getComments(fileId: metadata.fileId) { account, comments, data, error in + if error == .success, let comments = comments { NCManageDatabase.shared.addComments(comments, account: metadata.account, objectId: metadata.fileId) - } else if errorCode != NCGlobal.shared.errorResourceNotFound { - NCContentPresenter.shared.messageNotification("_share_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + } else if error.errorCode != NCGlobal.shared.errorResourceNotFound { + NCContentPresenter.shared.showError(error: error) } if let disptachGroup = disptachGroup { @@ -427,20 +431,20 @@ extension NCActivity { disptachGroup.enter() - NCCommunication.shared.getActivity( + NextcloudKit.shared.getActivity( since: 0, limit: 1, objectId: nil, objectType: objectType, - previews: true) { account, _, activityFirstKnown, activityLastGiven, errorCode, _ in + previews: true) { account, _, activityFirstKnown, activityLastGiven, data, error in defer { disptachGroup.leave() } let largestActivityId = max(activityFirstKnown, activityLastGiven) - guard errorCode == 0, + guard error == .success, account == self.appDelegate.account, largestActivityId > resultActivityId else { - self.hasActivityToLoad = errorCode == 304 ? false : self.hasActivityToLoad + self.hasActivityToLoad = error.errorCode == NCGlobal.shared.errorNotModified ? false : self.hasActivityToLoad return } @@ -454,18 +458,18 @@ extension NCActivity { var resultActivityId = 0 disptachGroup.enter() - NCCommunication.shared.getActivity( + NextcloudKit.shared.getActivity( since: idActivity, limit: min(limit, 200), objectId: metadata?.fileId, objectType: objectType, - previews: true) { account, activities, activityFirstKnown, activityLastGiven, errorCode, _ in + previews: true) { account, activities, activityFirstKnown, activityLastGiven, data, error in defer { disptachGroup.leave() } - guard errorCode == 0, + guard error == .success, account == self.appDelegate.account, !activities.isEmpty else { - self.hasActivityToLoad = errorCode == 304 ? false : self.hasActivityToLoad + self.hasActivityToLoad = error.errorCode == NCGlobal.shared.errorNotModified ? false : self.hasActivityToLoad return } NCManageDatabase.shared.addActivity(activities, account: account) @@ -514,11 +518,11 @@ extension NCActivity: NCShareCommentsCellDelegate { alert.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default, handler: { _ in guard let message = alert.textFields?.first?.text, message != "" else { return } - NCCommunication.shared.updateComments(fileId: metadata.fileId, messageId: tableComments.messageId, message: message) { _, errorCode, errorDescription in - if errorCode == 0 { + NextcloudKit.shared.updateComments(fileId: metadata.fileId, messageId: tableComments.messageId, message: message) { _, error in + if error == .success { self.loadComments() } else { - NCContentPresenter.shared.messageNotification("_share_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCContentPresenter.shared.showError(error: error) } } })) @@ -535,11 +539,11 @@ extension NCActivity: NCShareCommentsCellDelegate { action: { _ in guard let metadata = self.metadata, let tableComments = tableComments else { return } - NCCommunication.shared.deleteComments(fileId: metadata.fileId, messageId: tableComments.messageId) { _, errorCode, errorDescription in - if errorCode == 0 { + NextcloudKit.shared.deleteComments(fileId: metadata.fileId, messageId: tableComments.messageId) { _, error in + if error == .success { self.loadComments() } else { - NCContentPresenter.shared.messageNotification("_share_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCContentPresenter.shared.showError(error: error) } } } diff --git a/iOSClient/Activity/NCActivityCommentView.swift b/iOSClient/Activity/NCActivityCommentView.swift index b3b0d9c4f..768006b13 100644 --- a/iOSClient/Activity/NCActivityCommentView.swift +++ b/iOSClient/Activity/NCActivityCommentView.swift @@ -48,7 +48,7 @@ class NCActivityCommentView: UIView, UITextFieldDelegate { } else { labelUser.text = account.displayName } - labelUser.textColor = NCBrandColor.shared.label + labelUser.textColor = .label } func textFieldShouldReturn(_ textField: UITextField) -> Bool { diff --git a/iOSClient/Activity/NCActivityTableViewCell.swift b/iOSClient/Activity/NCActivityTableViewCell.swift index 40b3307a5..d21491afd 100644 --- a/iOSClient/Activity/NCActivityTableViewCell.swift +++ b/iOSClient/Activity/NCActivityTableViewCell.swift @@ -22,8 +22,9 @@ // import Foundation -import NCCommunication +import NextcloudKit import FloatingPanel +import JGProgressHUD class NCActivityCollectionViewCell: UICollectionViewCell { @@ -108,7 +109,8 @@ extension NCActivityTableViewCell: UICollectionViewDelegate { viewController.trashPath = result.filePath (responder as? UIViewController)!.navigationController?.pushViewController(viewController, animated: true) } else { - NCContentPresenter.shared.messageNotification("_error_", description: "_trash_file_not_found_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorInternalError) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_trash_file_not_found_") + NCContentPresenter.shared.showError(error: error) } } } @@ -139,54 +141,39 @@ extension NCActivityTableViewCell: UICollectionViewDelegate { } } - var pathComponents = activityPreview.link.components(separatedBy: "?") - pathComponents = pathComponents[1].components(separatedBy: "&") - var serverUrlFileName = pathComponents[0].replacingOccurrences(of: "dir=", with: "").removingPercentEncoding! - serverUrlFileName = NCUtilityFileSystem.shared.getHomeServer(account: activityPreview.account) + serverUrlFileName + "/" + activitySubjectRich.name - let fileNameLocalPath = CCUtility.getDirectoryProviderStorageOcId(activitySubjectRich.id, fileNameView: activitySubjectRich.name)! - - if let backgroundView = appDelegate.window?.rootViewController?.view { - NCActivityIndicator.shared.start(backgroundView: backgroundView) + let hud = JGProgressHUD() + hud.indicatorView = JGProgressHUDRingIndicatorView() + if let indicatorView = hud.indicatorView as? JGProgressHUDRingIndicatorView { + indicatorView.ringWidth = 1.5 } - - NCCommunication.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, requestHandler: { _ in - - }, taskHandler: { _ in - - }, progressHandler: { _ in - - }) { account, _, _, _, _, _, errorCode, _ in - - if account == self.appDelegate.account && errorCode == 0 { - - let serverUrl = (serverUrlFileName as NSString).deletingLastPathComponent - let fileName = (serverUrlFileName as NSString).lastPathComponent - let serverUrlFileName = serverUrl + "/" + fileName - - NCNetworking.shared.readFile(serverUrlFileName: serverUrlFileName) { account, metadata, errorCode, _ in - - NCActivityIndicator.shared.stop() - - DispatchQueue.main.async { - if account == self.appDelegate.account, errorCode == 0, let metadata = metadata { - - // move from id to oc:id + instanceid (ocId) - let atPath = CCUtility.getDirectoryProviderStorage()! + "/" + activitySubjectRich.id - let toPath = CCUtility.getDirectoryProviderStorage()! + "/" + metadata.ocId - - CCUtility.moveFile(atPath: atPath, toPath: toPath) - - NCManageDatabase.shared.addMetadata(metadata) - if let viewController = self.viewController { - NCViewer.shared.view(viewController: viewController, metadata: metadata, metadatas: [metadata], imageIcon: cell?.imageView.image) - } + guard let view = appDelegate.window?.rootViewController?.view else { return } + hud.show(in: view) + + NextcloudKit.shared.getFileFromFileId(fileId: String(activityPreview.fileId)) { account, file, data, error in + if let file = file { + + let metadata = NCManageDatabase.shared.convertNCFileToMetadata(file, isEncrypted: file.e2eEncrypted, account: account) + NCManageDatabase.shared.addMetadata(metadata) + + let serverUrlFileName = metadata.serverUrl + "/" + metadata.fileName + let fileNameLocalPath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)! + + NextcloudKit.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, requestHandler: { _ in + }, taskHandler: { _ in + }, progressHandler: { progress in + hud.progress = Float(progress.fractionCompleted) + }) { account, _, _, _, _, _, error in + hud.dismiss() + if account == self.appDelegate.account && error == .success { + NCManageDatabase.shared.addLocalFile(metadata: metadata) + if let viewController = self.viewController { + NCViewer.shared.view(viewController: viewController, metadata: metadata, metadatas: [metadata], imageIcon: cell?.imageView.image) } } } - - } else { - - NCActivityIndicator.shared.stop() + } else if error != .success { + hud.dismiss() + NCContentPresenter.shared.showError(error: error) } } } diff --git a/iOSClient/AppDelegate.swift b/iOSClient/AppDelegate.swift index 38c653f45..56d04c76a 100644 --- a/iOSClient/AppDelegate.swift +++ b/iOSClient/AppDelegate.swift @@ -23,10 +23,11 @@ import UIKit import BackgroundTasks -import NCCommunication +import NextcloudKit import TOPasscodeViewController import LocalAuthentication import Firebase +import WidgetKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate, TOPasscodeViewControllerDelegate, NCAccountRequestDelegate, NCViewCertificateDetailsDelegate, NCUserBaseUrl { @@ -41,7 +42,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD @objc var password: String = "" var deletePasswordSession: Bool = false - var activeAppConfigView: NCAppConfigView? var activeLogin: NCLogin? var activeLoginWeb: NCLoginWeb? var activeServerUrl: String = "" @@ -60,16 +60,16 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD var shares: [tableShare] = [] var timerErrorNetworking: Timer? - var errorITMS90076: Bool = false - private var privacyProtectionWindow: UIWindow? - + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { let userAgent = CCUtility.getUserAgent() as String - let isSimulatorOrTestFlight = NCUtility.shared.isSimulatorOrTestFlight() let versionNextcloudiOS = String(format: NCBrandOptions.shared.textCopyrightNextcloudiOS, NCUtility.shared.getVersionApp()) + // Register initialize + NotificationCenter.default.addObserver(self, selector: #selector(initialize), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitialize), object: nil) + UserDefaults.standard.register(defaults: ["UserAgent": userAgent]) if !CCUtility.getDisableCrashservice() && !NCBrandOptions.shared.disable_crash_service { FirebaseApp.configure() @@ -78,47 +78,38 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD CCUtility.createDirectoryStandard() CCUtility.emptyTemporaryDirectory() - NCCommunicationCommon.shared.setup(delegate: NCNetworking.shared) - NCCommunicationCommon.shared.setup(userAgent: userAgent) + NKCommon.shared.setup(delegate: NCNetworking.shared) + NKCommon.shared.setup(userAgent: userAgent) startTimerErrorNetworking() // LOG var levelLog = 0 if let pathDirectoryGroup = CCUtility.getDirectoryGroup()?.path { - NCCommunicationCommon.shared.pathLog = pathDirectoryGroup + NKCommon.shared.pathLog = pathDirectoryGroup } if NCBrandOptions.shared.disable_log { - NCUtilityFileSystem.shared.deleteFile(filePath: NCCommunicationCommon.shared.filenamePathLog) - NCUtilityFileSystem.shared.deleteFile(filePath: NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first! + "/" + NCCommunicationCommon.shared.filenameLog) + NCUtilityFileSystem.shared.deleteFile(filePath: NKCommon.shared.filenamePathLog) + NCUtilityFileSystem.shared.deleteFile(filePath: NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first! + "/" + NKCommon.shared.filenameLog) } else { levelLog = CCUtility.getLogLevel() - NCCommunicationCommon.shared.levelLog = levelLog - NCCommunicationCommon.shared.copyLogToDocumentDirectory = true - if isSimulatorOrTestFlight { - NCCommunicationCommon.shared.writeLog("Start session with level \(levelLog) " + versionNextcloudiOS + " (Simulator / TestFlight)") - } else { - NCCommunicationCommon.shared.writeLog("Start session with level \(levelLog) " + versionNextcloudiOS) - } + NKCommon.shared.levelLog = levelLog + NKCommon.shared.copyLogToDocumentDirectory = true + NKCommon.shared.writeLog("[INFO] Start session with level \(levelLog) " + versionNextcloudiOS + " in state \(UIApplication.shared.applicationState.rawValue) where (0 active, 1 inactive, 2 background).") } // LOG Account if let account = NCManageDatabase.shared.getActiveAccount() { - NCCommunicationCommon.shared.writeLog("Account active \(account.account)") + NKCommon.shared.writeLog("Account active \(account.account)") if CCUtility.getPassword(account.account).isEmpty { - NCCommunicationCommon.shared.writeLog("PASSWORD NOT FOUND for \(account.account)") + NKCommon.shared.writeLog("[ERROR] PASSWORD NOT FOUND for \(account.account)") } } - // ITMS-90076: Potential Loss of Keychain Access - if let account = NCManageDatabase.shared.getActiveAccount(), CCUtility.getPassword(account.account).isEmpty, NCUtility.shared.getVersionApp(withBuild: false).starts(with: "4.4") { - errorITMS90076 = true - } - // Activate user account if let activeAccount = NCManageDatabase.shared.getActiveAccount() { @@ -147,13 +138,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD // Create user color NCBrandColor.shared.createUserColors() - // initialize - NotificationCenter.default.addObserver(self, selector: #selector(initialize), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitialize), object: nil) - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize, userInfo:["atStart":1]) - - // Process upload - networkingProcessUpload = NCNetworkingProcessUpload() - // Push Notification & display notification application.registerForRemoteNotifications() UNUserNotificationCenter.current().delegate = self @@ -167,15 +151,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD } // Background task: register - if #available(iOS 13.0, *) { - BGTaskScheduler.shared.register(forTaskWithIdentifier: NCGlobal.shared.refreshTask, using: nil) { task in - self.handleRefreshTask(task) - } - BGTaskScheduler.shared.register(forTaskWithIdentifier: NCGlobal.shared.processingTask, using: nil) { task in - self.handleProcessingTask(task) - } - } else { - application.setMinimumBackgroundFetchInterval(UIApplication.backgroundFetchIntervalMinimum) + BGTaskScheduler.shared.register(forTaskWithIdentifier: NCGlobal.shared.refreshTask, using: nil) { task in + self.handleRefreshTask(task) + } + BGTaskScheduler.shared.register(forTaskWithIdentifier: NCGlobal.shared.processingTask, using: nil) { task in + self.handleProcessingTask(task) } // Intro @@ -206,47 +186,43 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD // MARK: - Life Cycle - // L' applicazione entrerà in primo piano (attivo sempre) + // L' applicazione entrerà in attivo (sempre) func applicationDidBecomeActive(_ application: UIApplication) { + NKCommon.shared.writeLog("[INFO] Application did become active") + self.deletePasswordSession = false if !NCAskAuthorization.shared.isRequesting { - // Privacy hidePrivacyProtectionWindow() } NCSettingsBundleHelper.setVersionAndBuildNumber() - if account == "" { return } - - networkingProcessUpload?.verifyUploadZombie() + if !account.isEmpty { + networkingProcessUpload?.verifyUploadZombie() + } NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterApplicationDidBecomeActive) } - // L' applicazione entrerà in primo piano (attivo solo dopo il background) + // L' applicazione entrerà in primo piano (dopo il background) func applicationWillEnterForeground(_ application: UIApplication) { + guard !account.isEmpty, let activeAccount = NCManageDatabase.shared.getActiveAccount() else { return } - if account == "" { return } - guard let activeAccount = NCManageDatabase.shared.getActiveAccount() else { return } + NKCommon.shared.writeLog("[INFO] Application will enter in foreground") // Account changed ?? if activeAccount.account != account { settingAccount(activeAccount.account, urlBase: activeAccount.urlBase, user: activeAccount.user, userId: activeAccount.userId, password: CCUtility.getPassword(activeAccount.account)) - - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize) - } - - NCCommunicationCommon.shared.writeLog("Application will enter in foreground") - - // START TIMER UPLOAD PROCESS - if NCUtility.shared.isSimulator() { - networkingProcessUpload?.startTimer() + } 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() } + } } - - // Initialize Auto upload - NCAutoUpload.shared.initAutoUpload(viewController: nil) { _ in } // Required unsubscribing / subscribing NCPushNotification.shared().pushNotification() @@ -264,14 +240,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD // L' applicazione si dimetterà dallo stato di attivo func applicationWillResignActive(_ application: UIApplication) { + guard !account.isEmpty else { return } - if account == "" { return } + NKCommon.shared.writeLog("[INFO] Application will resign active") if CCUtility.getPrivacyScreenEnabled() { // Privacy showPrivacyProtectionWindow() } + // Reload Widget + WidgetCenter.shared.reloadAllTimelines() + // Clear operation queue NCOperationQueue.shared.cancelAllQueue() // Clear download @@ -288,18 +268,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD // L' applicazione è entrata nello sfondo func applicationDidEnterBackground(_ application: UIApplication) { + guard !account.isEmpty else { return } - if account == "" { return } + NKCommon.shared.writeLog("[INFO] Application did enter in background") - // STOP TIMER UPLOAD PROCESS - if NCUtility.shared.isSimulator() { - networkingProcessUpload?.stopTimer() - } + // STOP UPLOAD PROCESS + networkingProcessUpload?.stopTimer() - if #available(iOS 13.0, *) { - scheduleAppRefresh() - scheduleBackgroundProcessing() - } + scheduleAppRefresh() + scheduleAppProcessing() // Passcode presentPasscode { } @@ -311,7 +288,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD func applicationWillTerminate(_ application: UIApplication) { NCNetworking.shared.cancelAllDownloadTransfer() - NCCommunicationCommon.shared.writeLog("bye bye") + + let content = UNMutableNotificationContent() + content.title = NCBrandOptions.shared.brand + content.body = NSLocalizedString("_keep_running_", comment: "") + let req = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: nil) + let notificationCenter = UNUserNotificationCenter.current() + notificationCenter.add(req) + + NKCommon.shared.writeLog("bye bye") } // MARK: - @@ -319,13 +304,16 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD @objc private func initialize() { guard !account.isEmpty else { return } - NCCommunicationCommon.shared.writeLog("initialize Main") + NKCommon.shared.writeLog("[INFO] initialize Main") // Registeration push notification NCPushNotification.shared().pushNotification() // Start Auto Upload - NCAutoUpload.shared.initAutoUpload(viewController: nil) { _ in } + 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() @@ -333,6 +321,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD // close detail NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterMenuDetailClose) + // Reload Widget + WidgetCenter.shared.reloadAllTimelines() + // Registeration domain File Provider // FileProviderDomain *fileProviderDomain = [FileProviderDomain new]; // [fileProviderDomain removeAllDomains]; @@ -341,100 +332,80 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD // MARK: - Background Task - @available(iOS 13.0, *) + /* + @discussion Schedule a refresh task request to ask that the system launch your app briefly so that you can download data and keep your app's contents up-to-date. The system will fulfill this request intelligently based on system conditions and app usage. + < MAX 30 seconds > + */ func scheduleAppRefresh() { let request = BGAppRefreshTaskRequest(identifier: NCGlobal.shared.refreshTask) - request.earliestBeginDate = Date(timeIntervalSinceNow: 5 * 60) // Refresh after 5 minutes. + request.earliestBeginDate = Date(timeIntervalSinceNow: 60) // Refresh after 60 seconds. do { try BGTaskScheduler.shared.submit(request) - NCCommunicationCommon.shared.writeLog("Refresh task success submit request \(request)") + NKCommon.shared.writeLog("[SUCCESS] Refresh task success submit request 60 seconds \(request)") } catch { - NCCommunicationCommon.shared.writeLog("Refresh task failed to submit request: \(error)") + NKCommon.shared.writeLog("[ERROR] Refresh task failed to submit request: \(error)") } } - @available(iOS 13.0, *) - func scheduleBackgroundProcessing() { + /* + @discussion Schedule a processing task request to ask that the system launch your app when conditions are favorable for battery life to handle deferrable, longer-running processing, such as syncing, database maintenance, or similar tasks. The system will attempt to fulfill this request to the best of its ability within the next two days as long as the user has used your app within the past week. + < MAX over 1 minute > + */ + func scheduleAppProcessing() { let request = BGProcessingTaskRequest(identifier: NCGlobal.shared.processingTask) request.earliestBeginDate = Date(timeIntervalSinceNow: 5 * 60) // Refresh after 5 minutes. - request.requiresNetworkConnectivity = true + request.requiresNetworkConnectivity = false request.requiresExternalPower = false do { try BGTaskScheduler.shared.submit(request) - NCCommunicationCommon.shared.writeLog("Background Processing task success submit request \(request)") + NKCommon.shared.writeLog("[SUCCESS] Background Processing task success submit request 5 minutes \(request)") } catch { - NCCommunicationCommon.shared.writeLog("Background Processing task failed to submit request: \(error)") + NKCommon.shared.writeLog("[ERROR] Background Processing task failed to submit request: \(error)") } } - @available(iOS 13.0, *) func handleRefreshTask(_ task: BGTask) { - - if account == "" { + scheduleAppRefresh() + + guard !account.isEmpty else { task.setTaskCompleted(success: true) return } - NCCommunicationCommon.shared.writeLog("Start handler refresh task [Auto upload]") - - NCAutoUpload.shared.initAutoUpload(viewController: nil) { _ in - DispatchQueue.main.asyncAfter(deadline: .now() + 5) { - NCCommunicationCommon.shared.writeLog("Completition handler refresh task with [Auto upload]") - task.setTaskCompleted(success: true) - } + NKCommon.shared.setup(delegate: NCNetworking.shared) + NKCommon.shared.writeLog("[INFO] Start handler refresh task [Auto upload]") + + NCAutoUpload.shared.initAutoUpload(viewController: nil) { items in + NKCommon.shared.writeLog("[INFO] Completition handler refresh task [Auto upload] with \(items) uploads") + task.setTaskCompleted(success: true) } } - @available(iOS 13.0, *) func handleProcessingTask(_ task: BGTask) { - - if account == "" { + scheduleAppProcessing() + + guard !account.isEmpty else { task.setTaskCompleted(success: true) return } - NCCommunicationCommon.shared.writeLog("Start handler processing task [Synchronize Favorite & Offline]") - - NCNetworking.shared.listingFavoritescompletion(selector: NCGlobal.shared.selectorReadFile) { _, _, errorCode, _ in - NCCommunicationCommon.shared.writeLog("Completition listing favorite with error: \(errorCode)") - } + NKCommon.shared.setup(delegate: NCNetworking.shared) + NKCommon.shared.writeLog("[INFO] Start handler processing task [Reload widget]") - NCService.shared.synchronizeOffline(account: account) + WidgetCenter.shared.reloadAllTimelines() - DispatchQueue.main.asyncAfter(deadline: .now() + 25) { - NCCommunicationCommon.shared.writeLog("Completition handler processing task [Synchronize Favorite & Offline]") - task.setTaskCompleted(success: true) - } - } - - // MARK: - Fetch - - func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { - - if account == "" { - completionHandler(UIBackgroundFetchResult.noData) - return - } - - NCCommunicationCommon.shared.writeLog("Start perform Fetch [Auto upload]") - - NCAutoUpload.shared.initAutoUpload(viewController: nil) { items in - NCCommunicationCommon.shared.writeLog("Completition perform Fetch with \(items) uploads [Auto upload]") - if items == 0 { - completionHandler(UIBackgroundFetchResult.noData) - } else { - completionHandler(UIBackgroundFetchResult.newData) - } - } + task.setTaskCompleted(success: true) } // MARK: - Background Networking Session func application(_ application: UIApplication, handleEventsForBackgroundURLSession identifier: String, completionHandler: @escaping () -> Void) { - NCCommunicationCommon.shared.writeLog("Start handle Events For Background URLSession: \(identifier)") + NKCommon.shared.writeLog("[INFO] Start handle Events For Background URLSession: \(identifier)") + // Reload Widget + WidgetCenter.shared.reloadAllTimelines() backgroundSessionCompletionHandler = completionHandler } @@ -449,8 +420,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD } func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { - NCNetworking.shared.checkPushNotificationServerProxyCertificateUntrusted(viewController: self.window?.rootViewController) { errorCode in - if errorCode == 0 { + NCNetworking.shared.checkPushNotificationServerProxyCertificateUntrusted(viewController: self.window?.rootViewController) { error in + if error == .success { NCPushNotification.shared().registerForRemoteNotifications(withDeviceToken: deviceToken) } } @@ -466,18 +437,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD @objc func openLogin(viewController: UIViewController?, selector: Int, openLoginWeb: Bool) { - // use appConfig [MDM] - if NCBrandOptions.shared.use_configuration { - - if activeAppConfigView?.view.window == nil { - activeAppConfigView = UIStoryboard(name: "NCLogin", bundle: nil).instantiateViewController(withIdentifier: "NCAppConfigView") as? NCAppConfigView - showLoginViewController(activeAppConfigView, contextViewController: viewController) - } - return - } - - // only for personalized LoginWeb [customer] - if NCBrandOptions.shared.use_login_web_personalized { + // [WEBPersonalized] [AppConfig] + if NCBrandOptions.shared.use_login_web_personalized || NCBrandOptions.shared.use_AppConfig { if activeLoginWeb?.view.window == nil { activeLoginWeb = UIStoryboard(name: "NCLogin", bundle: nil).instantiateViewController(withIdentifier: "NCLoginWeb") as? NCLoginWeb @@ -576,19 +537,19 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD let certificateHostSavedPath = CCUtility.getDirectoryCerificates()! + "/" + host + ".der" var title = NSLocalizedString("_ssl_certificate_changed_", comment: "") - + if !FileManager.default.fileExists(atPath: certificateHostSavedPath) { title = NSLocalizedString("_connect_server_anyway_", comment: "") } - + let alertController = UIAlertController(title: title, message: NSLocalizedString("_server_is_trusted_", comment: ""), preferredStyle: .alert) - + alertController.addAction(UIAlertAction(title: NSLocalizedString("_yes_", comment: ""), style: .default, handler: { action in NCNetworking.shared.writeCertificate(host: host) })) - + alertController.addAction(UIAlertAction(title: NSLocalizedString("_no_", comment: ""), style: .default, handler: { action in })) - + alertController.addAction(UIAlertAction(title: NSLocalizedString("_certificate_details_", comment: ""), style: .default, handler: { action in if let navigationController = UIStoryboard(name: "NCViewCertificateDetails", bundle: nil).instantiateInitialViewController() as? UINavigationController { let viewController = navigationController.topViewController as! NCViewCertificateDetails @@ -597,7 +558,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD self.window?.rootViewController?.present(navigationController, animated: true) } })) - + window?.rootViewController?.present(alertController, animated: true) } @@ -609,6 +570,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD @objc func settingAccount(_ account: String, urlBase: String, user: String, userId: String, password: String) { + let accountBackup = self.account + let userIdBackup = self.userId + self.account = account self.urlBase = urlBase self.user = user @@ -617,12 +581,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD _ = NCFunctionCenter.shared - NCCommunicationCommon.shared.setup(account: account, user: user, userId: userId, password: password, urlBase: urlBase) + NKCommon.shared.setup(account: account, user: user, userId: userId, password: password, urlBase: urlBase) let serverVersionMajor = NCManageDatabase.shared.getCapabilitiesServerInt(account: account, elements: NCElementsJSON.shared.capabilitiesVersionMajor) if serverVersionMajor > 0 { - NCCommunicationCommon.shared.setup(nextcloudVersion: serverVersionMajor) + NKCommon.shared.setup(nextcloudVersion: serverVersionMajor) } NCKTVHTTPCache.shared.restartProxy(user: user, password: password) + + DispatchQueue.main.async { + if UIApplication.shared.applicationState != .background && (accountBackup != account || userIdBackup != userId) { + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize, second: 0.2) + } + } } @objc func deleteAccount(_ account: String, wipe: Bool) { @@ -663,8 +633,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD NCNetworking.shared.cancelAllTask() settingAccount(tableAccount.account, urlBase: tableAccount.urlBase, user: tableAccount.user, userId: tableAccount.userId, password: CCUtility.getPassword(tableAccount.account)) - - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize) } } @@ -699,7 +667,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD let popup = NCPopupViewController(contentController: vcAccountRequest, popupWidth: 300, popupHeight: height+20) popup.backgroundAlpha = 0.8 - UIApplication.shared.keyWindow?.rootViewController?.present(popup, animated: true) + window?.rootViewController?.present(popup, animated: true) vcAccountRequest.startTimer() } @@ -814,8 +782,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD // MARK: - Open URL func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { - - if account == "" { return false } + guard !account.isEmpty else { return false } let scheme = url.scheme let action = url.host @@ -823,7 +790,73 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD var serverUrl: String = "" var matchedAccount: tableAccount? - if scheme == "nextcloud" && action == "open-file" { + /* + Example: + nextcloud://open-action?action=create-voice-memo + */ + + if scheme == "nextcloud" && action == "open-action" { + + if let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false) { + let queryItems = urlComponents.queryItems + guard let actionScheme = CCUtility.value(forKey: "action", fromQueryItems: queryItems), let rootViewController = window?.rootViewController else { return false } + + switch actionScheme { + case NCGlobal.shared.actionUploadAsset: + + NCAskAuthorization.shared.askAuthorizationPhotoLibrary(viewController: rootViewController) { hasPermission in + if hasPermission { + NCPhotosPickerViewController.init(viewController: rootViewController, maxSelectedAssets: 0, singleSelectedMode: false) + } + } + + case NCGlobal.shared.actionScanDocument: + + NCCreateScanDocument.shared.openScannerDocument(viewController: rootViewController) + + case NCGlobal.shared.actionTextDocument: + + guard let navigationController = UIStoryboard(name: "NCCreateFormUploadDocuments", bundle: nil).instantiateInitialViewController(), let directEditingCreators = NCManageDatabase.shared.getDirectEditingCreators(account: account), let directEditingCreator = directEditingCreators.first(where: { $0.editor == NCGlobal.shared.editorText}) else { return false } + + navigationController.modalPresentationStyle = UIModalPresentationStyle.formSheet + + let viewController = (navigationController as! UINavigationController).topViewController as! NCCreateFormUploadDocuments + viewController.editorId = NCGlobal.shared.editorText + viewController.creatorId = directEditingCreator.identifier + viewController.typeTemplate = NCGlobal.shared.templateDocument + viewController.serverUrl = activeServerUrl + viewController.titleForm = NSLocalizedString("_create_nextcloudtext_document_", comment: "") + + rootViewController.present(navigationController, animated: true, completion: nil) + + case NCGlobal.shared.actionVoiceMemo: + + NCAskAuthorization.shared.askAuthorizationAudioRecord(viewController: rootViewController) { hasPermission in + if hasPermission { + let fileName = CCUtility.createFileNameDate(NSLocalizedString("_voice_memo_filename_", comment: ""), extension: "m4a")! + let viewController = UIStoryboard(name: "NCAudioRecorderViewController", bundle: nil).instantiateInitialViewController() as! NCAudioRecorderViewController + + viewController.delegate = self + viewController.createRecorder(fileName: fileName) + viewController.modalTransitionStyle = .crossDissolve + viewController.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext + + rootViewController.present(viewController, animated: true, completion: nil) + } + } + + default: + print("No action") + } + } + } + + /* + Example: + nextcloud://open-file?path=Talk/IMG_0000123.jpg&user=marinofaggiana&link=https://cloud.nextcloud.com/f/123 + */ + + else if scheme == "nextcloud" && action == "open-file" { if !isSearchingMode, let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false) { @@ -862,7 +895,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD } DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { - NCFunctionCenter.shared.openFileViewInFolder(serverUrl: serverUrl, fileNameBlink: fileName) + NCFunctionCenter.shared.openFileViewInFolder(serverUrl: serverUrl, fileNameBlink: nil, fileNameOpen: fileName) } } else { @@ -880,6 +913,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD } } } + } else { + app.open(url) } return true @@ -908,6 +943,6 @@ extension AppDelegate: NCAudioRecorderViewControllerDelegate { extension AppDelegate: NCCreateFormUploadConflictDelegate { func dismissCreateFormUploadConflict(metadatas: [tableMetadata]?) { guard let metadatas = metadatas, !metadatas.isEmpty else { return } - networkingProcessUpload?.createProcessUploads(metadatas: metadatas) + networkingProcessUpload?.createProcessUploads(metadatas: metadatas, completion: { _ in }) } } diff --git a/iOSClient/Brand/Intro/NCIntroViewController.swift b/iOSClient/Brand/Intro/NCIntroViewController.swift index 1002b888c..011ddba06 100644 --- a/iOSClient/Brand/Intro/NCIntroViewController.swift +++ b/iOSClient/Brand/Intro/NCIntroViewController.swift @@ -60,20 +60,12 @@ class NCIntroViewController: UIViewController, UICollectionViewDataSource, UICol textColorOpponent = .black } - if #available(iOS 13.0, *) { - let navBarAppearance = UINavigationBarAppearance() - navBarAppearance.configureWithTransparentBackground() - navBarAppearance.shadowColor = .clear - navBarAppearance.shadowImage = UIImage() - self.navigationController?.navigationBar.standardAppearance = navBarAppearance - self.navigationController?.view.backgroundColor = NCBrandColor.shared.customer - } else { - self.navigationController?.navigationBar.isTranslucent = true - self.navigationController?.navigationBar.shadowImage = UIImage() - self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) - self.navigationController?.navigationBar.backgroundColor = .clear - self.navigationController?.navigationBar.barTintColor = NCBrandColor.shared.customer - } + let navBarAppearance = UINavigationBarAppearance() + navBarAppearance.configureWithTransparentBackground() + navBarAppearance.shadowColor = .clear + navBarAppearance.shadowImage = UIImage() + self.navigationController?.navigationBar.standardAppearance = navBarAppearance + self.navigationController?.view.backgroundColor = NCBrandColor.shared.customer self.navigationController?.navigationBar.tintColor = textColor pageControl.currentPageIndicatorTintColor = textColor @@ -108,14 +100,10 @@ class NCIntroViewController: UIViewController, UICollectionViewDataSource, UICol } override var preferredStatusBarStyle: UIStatusBarStyle { - if #available(iOS 13.0, *) { - if traitCollection.userInterfaceStyle == .light { - return .lightContent - } else { - return .darkContent - } - } else { + if traitCollection.userInterfaceStyle == .light { return .lightContent + } else { + return .darkContent } } diff --git a/iOSClient/Brand/NCBrand.swift b/iOSClient/Brand/NCBrand.swift index eb44e85f6..56b4e21b0 100755 --- a/iOSClient/Brand/NCBrand.swift +++ b/iOSClient/Brand/NCBrand.swift @@ -23,20 +23,6 @@ import UIKit -// MARK: - Configuration - -@objc class NCBrandConfiguration: NSObject { - @objc static let shared: NCBrandConfiguration = { - let instance = NCBrandConfiguration() - return instance - }() - - @objc public let configuration_bundleId: String = "it.twsweb.Nextcloud" - @objc public let configuration_serverUrl: String = "serverUrl" - @objc public let configuration_username: String = "username" - @objc public let configuration_password: String = "password" -} - // MARK: - Options @objc class NCBrandOptions: NSObject { @@ -46,20 +32,19 @@ import UIKit }() @objc public var brand: String = "Nextcloud" - // @objc public var mailMe: String = "ios@nextcloud.com" // Deprecated @objc public var textCopyrightNextcloudiOS: String = "Nextcloud Liquid for iOS %@ © 2022" @objc public var textCopyrightNextcloudServer: String = "Nextcloud Server %@" @objc public var loginBaseUrl: String = "https://cloud.nextcloud.com" @objc public var pushNotificationServerProxy: String = "https://push-notifications.nextcloud.com" @objc public var linkLoginHost: String = "https://nextcloud.com/install" @objc public var linkloginPreferredProviders: String = "https://nextcloud.com/signup-ios" - @objc public var webLoginAutenticationProtocol: String = "nc://" // example "abc://" + @objc public var webLoginAutenticationProtocol: String = "nc://" // example "abc://" @objc public var privacy: String = "https://nextcloud.com/privacy" @objc public var sourceCode: String = "https://github.com/nextcloud/ios" // Personalized - @objc public var webCloseViewProtocolPersonalized: String = "" // example "abc://change/plan" Don't touch me !! - @objc public var folderBrandAutoUpload: String = "" // example "_auto_upload_folder_" Don't touch me !! + @objc public var webCloseViewProtocolPersonalized: String = "" // example "abc://change/plan" Don't touch me !! + @objc public var folderBrandAutoUpload: String = "" // example "_auto_upload_folder_" Don't touch me !! // Auto Upload default folder @objc public var folderDefaultAutoUpload: String = "Photos" @@ -68,16 +53,17 @@ import UIKit @objc public var capabilitiesGroups: String = "group.it.twsweb.Crypto-Cloud" // User Agent - @objc public var userAgent: String = "Nextcloud-iOS" // Don't touch me !! + @objc public var userAgent: String = "Nextcloud-iOS" // Don't touch me !! - // Options + // BRAND ONLY @objc public var use_login_web_personalized: Bool = false // Don't touch me !! + @objc public var use_AppConfig: Bool = false // Don't touch me !! + + // Options @objc public var use_default_auto_upload: Bool = false @objc public var use_themingColor: Bool = true - //@objc public var use_themingBackground: Bool = true // Deprecated @objc public var use_themingLogo: Bool = false @objc public var use_storeLocalAutoUploadAll: Bool = false - @objc public var use_configuration: Bool = false // Don't touch me !! @objc public var use_loginflowv2: Bool = false // Don't touch me !! @objc public var disable_intro: Bool = false @@ -87,7 +73,6 @@ import UIKit @objc public var disable_more_external_site: Bool = false @objc public var disable_openin_file: Bool = false // Don't touch me !! @objc public var disable_crash_service: Bool = false - @objc public var disable_request_account: Bool = false @objc public var disable_log: Bool = false override init() { @@ -95,6 +80,35 @@ import UIKit if folderBrandAutoUpload != "" { folderDefaultAutoUpload = folderBrandAutoUpload } + + // wrapper AppConfig + if let configurationManaged = UserDefaults.standard.dictionary(forKey: "com.apple.configuration.managed"), use_AppConfig { + + if let str = configurationManaged[NCGlobal.shared.configuration_brand] as? String { + brand = str + } + if let str = configurationManaged[NCGlobal.shared.configuration_disable_intro] as? String { + disable_intro = (str as NSString).boolValue + } + if let str = configurationManaged[NCGlobal.shared.configuration_disable_multiaccount] as? String { + disable_multiaccount = (str as NSString).boolValue + } + if let str = configurationManaged[NCGlobal.shared.configuration_disable_crash_service] as? String { + disable_crash_service = (str as NSString).boolValue + } + if let str = configurationManaged[NCGlobal.shared.configuration_disable_log] as? String { + disable_log = (str as NSString).boolValue + } + if let str = configurationManaged[NCGlobal.shared.configuration_disable_manage_account] as? String { + disable_manage_account = (str as NSString).boolValue + } + if let str = configurationManaged[NCGlobal.shared.configuration_disable_more_external_site] as? String { + disable_more_external_site = (str as NSString).boolValue + } + if let str = configurationManaged[NCGlobal.shared.configuration_disable_openin_file] as? String { + disable_openin_file = (str as NSString).boolValue + } + } } } @@ -146,11 +160,11 @@ class NCBrandColor: NSObject { } // Color - @objc public let customer: UIColor = UIColor(red: 0.0/255.0, green: 130.0/255.0, blue: 201.0/255.0, alpha: 1.0) // BLU NC : #0082c9 + @objc public let customer: UIColor = UIColor(red: 0.0/255.0, green: 130.0/255.0, blue: 201.0/255.0, alpha: 1.0) // BLU NC : #0082c9 @objc public var customerText: UIColor = .white - @objc public var brand: UIColor // don't touch me - @objc public var brandElement: UIColor // don't touch me + @objc public var brand: UIColor // don't touch me + @objc public var brandElement: UIColor // don't touch me @objc public var brandText: UIColor // don't touch me @objc public let nextcloud: UIColor = UIColor(red: 0.0/255.0, green: 130.0/255.0, blue: 201.0/255.0, alpha: 1.0) @@ -163,225 +177,15 @@ class NCBrandColor: NSObject { public var themingColorElement: String = "" public var themingColorText: String = "" - @objc public var annotationColor: UIColor { - get { - return .systemBlue - } - } - - @objc public var systemBlue: UIColor { - get { - if #available(iOS 13, *) { - return .systemBlue - } else { - return UIColor(red: 0.0, green: 122.0 / 255.0, blue: 1.0, alpha: 1.0) - } - } - } - - @objc public var systemIndigo: UIColor { - get { - if #available(iOS 13, *) { - return .systemIndigo - } else { - return UIColor(red: 88.0 / 255.0, green: 86.0 / 255.0, blue: 214.0 / 255.0, alpha: 1.0) - } - } - } - - @objc public var systemPink: UIColor { - get { - if #available(iOS 13, *) { - return .systemPink - } else { - return UIColor(red: 1.0, green: 45.0 / 255.0, blue: 85.0 / 255.0, alpha: 1.0) - } - } - } - - @objc public var systemTeal: UIColor { - get { - if #available(iOS 13, *) { - return .systemTeal - } else { - return UIColor(red: 90.0 / 255.0, green: 200.0 / 255.0, blue: 250.0 / 255.0, alpha: 1.0) - } - } - } - @objc public var systemMint: UIColor { get { return UIColor(red: 0.0 / 255.0, green: 199.0 / 255.0, blue: 190.0 / 255.0, alpha: 1.0) } } - @objc public var systemBackground: UIColor { - get { - if #available(iOS 13, *) { - return .systemBackground - } else { - return .white - } - } - } - - @objc public var secondarySystemBackground: UIColor { - get { - if #available(iOS 13, *) { - return .secondarySystemBackground - } else { - return UIColor(red: 0.95, green: 0.95, blue: 0.97, alpha: 1.0) - } - } - } - - @objc public var tertiarySystemBackground: UIColor { - get { - if #available(iOS 13, *) { - return .tertiarySystemBackground - } else { - return UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0) - } - } - } - - @objc public var systemGroupedBackground: UIColor { - get { - if #available(iOS 13, *) { - return .systemGroupedBackground - } else { - return UIColor(red: 0.95, green: 0.95, blue: 0.97, alpha: 1.0) - } - } - } - - @objc public var secondarySystemGroupedBackground: UIColor { - get { - if #available(iOS 13, *) { - return .secondarySystemGroupedBackground - } else { - return .white - } - } - } - - @objc public var label: UIColor { - get { - if #available(iOS 13, *) { - return .label - } else { - return .black - } - } - } - - @objc public var secondaryLabel: UIColor { - get { - if #available(iOS 13, *) { - return .secondaryLabel - } else { - return UIColor(red: 0.24, green: 0.24, blue: 0.26, alpha: 0.6) - } - } - } - - @objc public var separator: UIColor { - get { - if #available(iOS 13, *) { - return .separator - } else { - return UIColor(red: 0.89, green: 0.89, blue: 0.89, alpha: 1.0) - } - } - } - - @objc public var opaqueSeparator: UIColor { - get { - if #available(iOS 13, *) { - return .opaqueSeparator - } else { - return UIColor(red: 0.78, green: 0.78, blue: 0.78, alpha: 1.0) - } - } - } - - @objc public var systemGray: UIColor { - get { - if #available(iOS 13, *) { - return .systemGray - } else { - return UIColor(red: 0.56, green: 0.56, blue: 0.58, alpha: 1.0) - } - } - } - @objc public var systemGray1: UIColor { get { - if #available(iOS 13, *) { - return UIColor(red: 0.60, green: 0.60, blue: 0.60, alpha: 1.0) - } else { - return UIColor(red: 0.60, green: 0.60, blue: 0.60, alpha: 1.0) - } - } - } - - @objc public var systemGray2: UIColor { - get { - if #available(iOS 13, *) { - return .systemGray2 - } else { - return UIColor(red: 0.68, green: 0.68, blue: 0.7, alpha: 1.0) - } - } - } - - @objc public var systemGray3: UIColor { - get { - if #available(iOS 13, *) { - return .systemGray3 - } else { - return UIColor(red: 0.78, green: 0.78, blue: 0.8, alpha: 1.0) - } - } - } - - @objc public var systemGray4: UIColor { - get { - if #available(iOS 13, *) { - return .systemGray4 - } else { - return UIColor(red: 0.82, green: 0.82, blue: 0.84, alpha: 1.0) - } - } - } - - @objc public var systemGray5: UIColor { - get { - if #available(iOS 13, *) { - return .systemGray5 - } else { - return UIColor(red: 0.9, green: 0.9, blue: 0.92, alpha: 1.0) - } - } - } - - @objc public var systemGray6: UIColor { - get { - if #available(iOS 13, *) { - return .systemGray6 - } else { - return UIColor(red: 0.95, green: 0.95, blue: 0.97, alpha: 1.0) - } - } - } - - @objc public var systemFill: UIColor { - get { - if #available(iOS 13, *) { - return .systemFill - } else { - return UIColor(red: 120/255, green: 120/255, blue: 120/255, alpha: 1.0) - } + return UIColor(red: 0.60, green: 0.60, blue: 0.60, alpha: 1.0) } } @@ -407,7 +211,7 @@ class NCBrandColor: NSObject { cacheImages.favorite = NCUtility.shared.loadImage(named: "star.fill", color: yellowFavorite) cacheImages.comment = UIImage(named: "comment")!.image(color: gray, size: 50) - cacheImages.livePhoto = NCUtility.shared.loadImage(named: "livephoto", color: label) + cacheImages.livePhoto = NCUtility.shared.loadImage(named: "livephoto", color: .label) cacheImages.offlineFlag = UIImage(named: "offlineFlag")! cacheImages.local = UIImage(named: "local")! diff --git a/iOSClient/Brand/NCBridgeSwift.h b/iOSClient/Brand/NCBridgeSwift.h index a2dbd2b1d..ec18d0323 100755 --- a/iOSClient/Brand/NCBridgeSwift.h +++ b/iOSClient/Brand/NCBridgeSwift.h @@ -21,28 +21,26 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. // -// -// App bridge swift -// -// change -// from : Nextcloud-Swift.h -// to : brand-Swift.h -// #if !defined(EXTENSION) #import "Nextcloud-Swift.h" #endif -// Nextcloud Share #if defined(EXTENSION_SHARE) #import "Share-Swift.h" #endif -// Nextcloud File Provider Extension #if defined(EXTENSION_FILE_PROVIDER_EXTENSION) #import "File_Provider_Extension-Swift.h" #endif -// Nextcloud Notification Service Extension #if defined(EXTENSION_NOTIFICATION_SERVICE) #import "Notification_Service_Extension-Swift.h" #endif + +#if defined(EXTENSION_WIDGET) +#import "Widget-Swift.h" +#endif + +#if defined(EXTENSION_WIDGETDASHBOARDINTENTHANDLER) +#import "WidgetDashboardIntentHandler-Swift.h" +#endif diff --git a/iOSClient/Brand/Widget.entitlements b/iOSClient/Brand/Widget.entitlements new file mode 100644 index 000000000..cb8bcc366 --- /dev/null +++ b/iOSClient/Brand/Widget.entitlements @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>com.apple.security.application-groups</key> + <array> + <string>group.it.twsweb.Crypto-Cloud</string> + </array> + <key>keychain-access-groups</key> + <array> + <string>$(AppIdentifierPrefix)it.twsweb.Crypto-Cloud</string> + </array> +</dict> +</plist> diff --git a/iOSClient/Brand/Widget.plist b/iOSClient/Brand/Widget.plist new file mode 100644 index 000000000..32ce55cfb --- /dev/null +++ b/iOSClient/Brand/Widget.plist @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>NSExtension</key> + <dict> + <key>NSExtensionPointIdentifier</key> + <string>com.apple.widgetkit-extension</string> + </dict> + <key>NSAppTransportSecurity</key> + <dict> + <key>NSAllowsArbitraryLoads</key> + <true/> + </dict> +</dict> +</plist> diff --git a/iOSClient/Brand/WidgetDashboardIntentHandler.entitlements b/iOSClient/Brand/WidgetDashboardIntentHandler.entitlements new file mode 100644 index 000000000..4ecc3f0d1 --- /dev/null +++ b/iOSClient/Brand/WidgetDashboardIntentHandler.entitlements @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>com.apple.security.application-groups</key> + <array> + <string>group.it.twsweb.Crypto-Cloud</string> + </array> + <key>keychain-access-groups</key> + <array> + <string>$(AppIdentifierPrefix)it.twsweb.Crypto-Cloud</string> + </array> +</dict> +</plist> diff --git a/iOSClient/Brand/WidgetDashboardIntentHandler.plist b/iOSClient/Brand/WidgetDashboardIntentHandler.plist new file mode 100644 index 000000000..bd92093ac --- /dev/null +++ b/iOSClient/Brand/WidgetDashboardIntentHandler.plist @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>NSAppTransportSecurity</key> + <dict> + <key>NSAllowsArbitraryLoads</key> + <true/> + </dict> + <key>NSExtension</key> + <dict> + <key>NSExtensionAttributes</key> + <dict> + <key>IntentsRestrictedWhileLocked</key> + <array/> + <key>IntentsRestrictedWhileProtectedDataUnavailable</key> + <array/> + <key>IntentsSupported</key> + <array> + <string>DashboardIntent</string> + </array> + </dict> + <key>NSExtensionPointIdentifier</key> + <string>com.apple.intents-service</string> + <key>NSExtensionPrincipalClass</key> + <string>$(PRODUCT_MODULE_NAME).IntentHandler</string> + </dict> +</dict> +</plist> diff --git a/iOSClient/Brand/iOSClient.plist b/iOSClient/Brand/iOSClient.plist index a1a376ecf..121991ec4 100755 --- a/iOSClient/Brand/iOSClient.plist +++ b/iOSClient/Brand/iOSClient.plist @@ -75,6 +75,10 @@ <string>Photo library access is required to upload your photos and videos to your cloud.</string> <key>NSPhotoLibraryUsageDescription</key> <string>Photo library access is required to upload your photos and videos to your cloud.</string> + <key>NSUserActivityTypes</key> + <array> + <string>DashboardIntent</string> + </array> <key>PHPhotoLibraryPreventAutomaticLimitedAccessAlert</key> <true/> <key>UIAppFonts</key> diff --git a/iOSClient/BrowserWeb/NCBrowserWeb.swift b/iOSClient/BrowserWeb/NCBrowserWeb.swift index a18b00b08..ae1b4d714 100644 --- a/iOSClient/BrowserWeb/NCBrowserWeb.swift +++ b/iOSClient/BrowserWeb/NCBrowserWeb.swift @@ -69,7 +69,7 @@ class NCBrowserWeb: UIViewController { loadWebPage(webView: webView!, url: url) } - // navigationItem.rightBarButtonItem = UIBarButtonItem.init(image: UIImage(named: "more")!.image(color: NCBrandColor.shared.label, size: 25), style: .plain, target: self, action: #selector(self.openMenuMore)) + // navigationItem.rightBarButtonItem = UIBarButtonItem.init(image: UIImage(named: "more")!.image(color: .label, size: 25), style: .plain, target: self, action: #selector(self.openMenuMore)) } override func viewWillAppear(_ animated: Bool) { diff --git a/iOSClient/Color/NCColorPicker.swift b/iOSClient/Color/NCColorPicker.swift index 2bfba58b5..ace49d09a 100644 --- a/iOSClient/Color/NCColorPicker.swift +++ b/iOSClient/Color/NCColorPicker.swift @@ -41,7 +41,7 @@ class NCColorPicker: UIViewController { override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = NCBrandColor.shared.secondarySystemBackground + view.backgroundColor = .secondarySystemBackground if let metadata = metadata { let serverUrl = metadata.serverUrl + "/" + metadata.fileName @@ -50,7 +50,7 @@ class NCColorPicker: UIViewController { } } - closeButton.setImage(NCUtility.shared.loadImage(named: "xmark", color: NCBrandColor.shared.label), for: .normal) + closeButton.setImage(NCUtility.shared.loadImage(named: "xmark", color: .label), for: .normal) titleLabel.text = NSLocalizedString("_select_color_", comment: "") orangeButton.backgroundColor = .orange @@ -89,7 +89,7 @@ class NCColorPicker: UIViewController { yellowButton.layer.cornerRadius = 5 yellowButton.layer.masksToBounds = true - systemBlueButton.backgroundColor = NCBrandColor.shared.systemBlue + systemBlueButton.backgroundColor = .systemBlue systemBlueButton.layer.cornerRadius = 5 systemBlueButton.layer.masksToBounds = true @@ -97,24 +97,20 @@ class NCColorPicker: UIViewController { systemMintButton.layer.cornerRadius = 5 systemMintButton.layer.masksToBounds = true - systemPinkButton.backgroundColor = NCBrandColor.shared.systemPink + systemPinkButton.backgroundColor = .systemPink systemPinkButton.layer.cornerRadius = 5 systemPinkButton.layer.masksToBounds = true - if #available(iOS 14.0, *) { - customButton.setImage(UIImage(named: "rgb"), for: .normal) - if let selectedColor = selectedColor { - customButton.backgroundColor = selectedColor - } else { - customButton.backgroundColor = NCBrandColor.shared.secondarySystemBackground - } + customButton.setImage(UIImage(named: "rgb"), for: .normal) + if let selectedColor = selectedColor { + customButton.backgroundColor = selectedColor } else { - customButton.backgroundColor = NCBrandColor.shared.systemTeal + customButton.backgroundColor = .secondarySystemBackground } customButton.layer.cornerRadius = 5 customButton.layer.masksToBounds = true - systemIndigoButton.backgroundColor = NCBrandColor.shared.systemIndigo + systemIndigoButton.backgroundColor = .systemIndigo systemIndigoButton.layer.cornerRadius = 5 systemIndigoButton.layer.masksToBounds = true @@ -166,11 +162,11 @@ class NCColorPicker: UIViewController { } @IBAction func systemBlueButtonAction(_ sender: AnyObject) { - updateColor(hexColor: NCBrandColor.shared.systemBlue.hexString) + updateColor(hexColor: UIColor.systemBlue.hexString) } @IBAction func systemIndigoButtonAction(_ sender: AnyObject) { - updateColor(hexColor: NCBrandColor.shared.systemIndigo.hexString) + updateColor(hexColor: UIColor.systemIndigo.hexString) } @IBAction func systemMintButtonAction(_ sender: AnyObject) { @@ -178,7 +174,7 @@ class NCColorPicker: UIViewController { } @IBAction func systemPinkButtonAction(_ sender: AnyObject) { - updateColor(hexColor: NCBrandColor.shared.systemPink.hexString) + updateColor(hexColor: UIColor.systemPink.hexString) } @IBAction func defaultButtonAction(_ sender: AnyObject) { @@ -187,17 +183,13 @@ class NCColorPicker: UIViewController { @IBAction func customButtonAction(_ sender: AnyObject) { - if #available(iOS 14.0, *) { - let picker = UIColorPickerViewController() - picker.delegate = self - picker.supportsAlpha = false - if let selectedColor = selectedColor { - picker.selectedColor = selectedColor - } - self.present(picker, animated: true, completion: nil) - } else { - updateColor(hexColor: NCBrandColor.shared.systemTeal.hexString) + let picker = UIColorPickerViewController() + picker.delegate = self + picker.supportsAlpha = false + if let selectedColor = selectedColor { + picker.selectedColor = selectedColor } + self.present(picker, animated: true, completion: nil) } // MARK: - @@ -214,7 +206,6 @@ class NCColorPicker: UIViewController { } } -@available(iOS 14.0, *) extension NCColorPicker: UIColorPickerViewControllerDelegate { func colorPickerViewControllerDidFinish(_ viewController: UIColorPickerViewController) { diff --git a/iOSClient/Data/NCDataSource.swift b/iOSClient/Data/NCDataSource.swift index df9660aa2..6e708e15c 100644 --- a/iOSClient/Data/NCDataSource.swift +++ b/iOSClient/Data/NCDataSource.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit class NCDataSource: NSObject { @@ -33,8 +33,8 @@ class NCDataSource: NSObject { var groupByField: String = "" private var sectionsValue: [String] = [] - private var providers: [NCCSearchProvider]? - private var searchResults: [NCCSearchResult]? + private var providers: [NKSearchProvider]? + private var searchResults: [NKSearchResult]? private var shares: [tableShare] = [] private var localFiles: [tableLocalFile] = [] @@ -48,7 +48,7 @@ class NCDataSource: NSObject { super.init() } - init(metadatas: [tableMetadata], account: String, directory: tableDirectory? = nil, sort: String? = "none", ascending: Bool? = false, directoryOnTop: Bool? = true, favoriteOnTop: Bool? = true, filterLivePhoto: Bool? = true, groupByField: String = "name", providers: [NCCSearchProvider]? = nil, searchResults: [NCCSearchResult]? = nil) { + init(metadatas: [tableMetadata], account: String, directory: tableDirectory? = nil, sort: String? = "none", ascending: Bool? = false, directoryOnTop: Bool? = true, favoriteOnTop: Bool? = true, filterLivePhoto: Bool? = true, groupByField: String = "name", providers: [NKSearchProvider]? = nil, searchResults: [NKSearchResult]? = nil) { super.init() self.metadatas = metadatas @@ -98,7 +98,7 @@ class NCDataSource: NSObject { createSections() } - func addSection(metadatas: [tableMetadata], searchResult: NCCSearchResult?) { + func addSection(metadatas: [tableMetadata], searchResult: NKSearchResult?) { self.metadatas.append(contentsOf: metadatas) @@ -169,7 +169,7 @@ class NCDataSource: NSObject { internal func createMetadataForSection(sectionValue: String) { - var searchResult: NCCSearchResult? + var searchResult: NKSearchResult? if let providers = self.providers, !providers.isEmpty, let searchResults = self.searchResults { searchResult = searchResults.filter({ $0.id == sectionValue}).first } @@ -201,7 +201,7 @@ class NCDataSource: NSObject { // MARK: - @discardableResult - func appendMetadatasToSection(_ metadatas: [tableMetadata], metadataForSection: NCMetadataForSection, lastSearchResult: NCCSearchResult) -> [IndexPath] { + func appendMetadatasToSection(_ metadatas: [tableMetadata], metadataForSection: NCMetadataForSection, lastSearchResult: NKSearchResult) -> [IndexPath] { guard let sectionIndex = getSectionIndex(metadataForSection.sectionValue) else { return [] } var indexPaths: [IndexPath] = [] @@ -423,7 +423,7 @@ class NCMetadataForSection: NSObject { var metadatas: [tableMetadata] var shares: [tableShare] var localFiles: [tableLocalFile] - var lastSearchResult: NCCSearchResult? + var lastSearchResult: NKSearchResult? var unifiedSearchInProgress: Bool = false private var sort : String @@ -445,7 +445,7 @@ class NCMetadataForSection: NSObject { public var metadataOffLine: [String] = [] public var directories: [tableDirectory]? - init(sectionValue: String, metadatas: [tableMetadata], shares: [tableShare], localFiles: [tableLocalFile], lastSearchResult: NCCSearchResult?, sort: String, ascending: Bool, directoryOnTop: Bool, favoriteOnTop: Bool, filterLivePhoto: Bool) { + init(sectionValue: String, metadatas: [tableMetadata], shares: [tableShare], localFiles: [tableLocalFile], lastSearchResult: NKSearchResult?, sort: String, ascending: Bool, directoryOnTop: Bool, favoriteOnTop: Bool, filterLivePhoto: Bool) { self.sectionValue = sectionValue self.metadatas = metadatas diff --git a/iOSClient/Data/NCDatabase.swift b/iOSClient/Data/NCDatabase.swift index be6105309..191280f30 100644 --- a/iOSClient/Data/NCDatabase.swift +++ b/iOSClient/Data/NCDatabase.swift @@ -24,7 +24,7 @@ import UIKit import RealmSwift -import NCCommunication +import NextcloudKit protocol DateCompareable { var dateKey: Date { get } @@ -244,6 +244,29 @@ class tableDirectEditingCreators: Object { @objc dynamic var templates: Int = 0 } +class tableDashboardWidget: Object { + + @Persisted(primaryKey: true) var index = "" + @Persisted var account = "" + @Persisted var id = "" + @Persisted var title = "" + @Persisted var order: Int = 0 + @Persisted var iconClass: String? + @Persisted var iconUrl: String? + @Persisted var widgetUrl: String? + @Persisted var itemIconsRound: Bool = false +} + +class tableDashboardWidgetButton: Object { + + @Persisted(primaryKey: true) var index = "" + @Persisted var account = "" + @Persisted var id = "" + @Persisted var type = "" + @Persisted var text = "" + @Persisted var link = "" +} + class tableDirectEditingEditors: Object { @objc dynamic var account = "" @@ -433,7 +456,7 @@ extension tableMetadata { var fileExtension: String { (fileNameView as NSString).pathExtension } var isPrintable: Bool { - classFile == NCCommunicationCommon.typeClassFile.image.rawValue || ["application/pdf", "com.adobe.pdf"].contains(contentType) || contentType.hasPrefix("text/") + classFile == NKCommon.typeClassFile.image.rawValue || ["application/pdf", "com.adobe.pdf"].contains(contentType) || contentType.hasPrefix("text/") } /// Returns false if the user is lokced out of the file. I.e. The file is locked but by somone else diff --git a/iOSClient/Data/NCManageDatabase+Account.swift b/iOSClient/Data/NCManageDatabase+Account.swift index c18fc3e68..3f6956ca5 100644 --- a/iOSClient/Data/NCManageDatabase+Account.swift +++ b/iOSClient/Data/NCManageDatabase+Account.swift @@ -23,7 +23,7 @@ import Foundation import RealmSwift -import NCCommunication +import NextcloudKit extension NCManageDatabase { @@ -59,7 +59,7 @@ extension NCManageDatabase { realm.add(addObject, update: .all) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -72,7 +72,7 @@ extension NCManageDatabase { realm.add(account, update: .all) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -87,7 +87,7 @@ extension NCManageDatabase { realm.delete(result) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -211,7 +211,7 @@ extension NCManageDatabase { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") return nil } @@ -230,7 +230,7 @@ extension NCManageDatabase { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -247,7 +247,7 @@ extension NCManageDatabase { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -266,7 +266,7 @@ extension NCManageDatabase { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -285,11 +285,11 @@ extension NCManageDatabase { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } - @objc func setAccountUserProfile(_ userProfile: NCCommunicationUserProfile) -> tableAccount? { + @objc func setAccountUserProfile(_ userProfile: NKUserProfile) -> tableAccount? { let realm = try! Realm() @@ -333,7 +333,7 @@ extension NCManageDatabase { returnAccount = result } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } return tableAccount.init(value: returnAccount) @@ -367,7 +367,7 @@ extension NCManageDatabase { returnAccount = result } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } return tableAccount.init(value: returnAccount) @@ -383,7 +383,7 @@ extension NCManageDatabase { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -403,7 +403,7 @@ extension NCManageDatabase { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -423,7 +423,7 @@ extension NCManageDatabase { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } } diff --git a/iOSClient/Data/NCManageDatabase+Activity.swift b/iOSClient/Data/NCManageDatabase+Activity.swift index 354b953f2..401258164 100644 --- a/iOSClient/Data/NCManageDatabase+Activity.swift +++ b/iOSClient/Data/NCManageDatabase+Activity.swift @@ -23,12 +23,12 @@ import Foundation import RealmSwift -import NCCommunication +import NextcloudKit import SwiftyJSON extension NCManageDatabase { - @objc func addActivity(_ activities: [NCCommunicationActivity], account: String) { + @objc func addActivity(_ activities: [NKActivity], account: String) { let realm = try! Realm() @@ -114,7 +114,7 @@ extension NCManageDatabase { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -186,7 +186,7 @@ extension NCManageDatabase { realm.add(newRecentActivity, update: .all) } } catch { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -199,7 +199,7 @@ extension NCManageDatabase { // MARK: - // MARK: Table Comments - @objc func addComments(_ comments: [NCCommunicationComments], account: String, objectId: String) { + @objc func addComments(_ comments: [NKComments], account: String, objectId: String) { let realm = try! Realm() @@ -230,7 +230,7 @@ extension NCManageDatabase { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } diff --git a/iOSClient/Data/NCManageDatabase+DashboardWidget.swift b/iOSClient/Data/NCManageDatabase+DashboardWidget.swift new file mode 100644 index 000000000..ebd58d4bf --- /dev/null +++ b/iOSClient/Data/NCManageDatabase+DashboardWidget.swift @@ -0,0 +1,100 @@ +// +// NCManageDatabase+DashboardWidget.swift +// Nextcloud +// +// Created by Marino Faggiana on 09/09/22. +// Copyright © 2022 Marino Faggiana. All rights reserved. +// +// Author Marino Faggiana <marino.faggiana@nextcloud.com> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// + +import Foundation +import RealmSwift +import NextcloudKit + +extension NCManageDatabase { + + func getDashboardWidget(account: String, id: String) -> (tableDashboardWidget?, [tableDashboardWidgetButton]?) { + + let realm = try! Realm() + guard let resultDashboard = realm.objects(tableDashboardWidget.self).filter("account == %@ AND id == %@", account, id).first else { + return (nil, nil) + } + let resultsButton = realm.objects(tableDashboardWidgetButton.self).filter("account == %@ AND id == %@", account, id).sorted(byKeyPath: "type", ascending: true) + + return (tableDashboardWidget.init(value: resultDashboard), Array(resultsButton.map { tableDashboardWidgetButton.init(value: $0) })) + } + + func getDashboardWidgetApplications(account: String) -> [tableDashboardWidget] { + + let realm = try! Realm() + let sortProperties = [SortDescriptor(keyPath: "order", ascending: true), SortDescriptor(keyPath: "title", ascending: true)] + let results = realm.objects(tableDashboardWidget.self).filter("account == %@", account).sorted(by: sortProperties) + + return Array(results.map { tableDashboardWidget.init(value: $0) }) + } + + func addDashboardWidget(account: String, dashboardWidgets: [NCCDashboardWidget]) { + + let realm = try! Realm() + + do { + try realm.safeWrite { + + let resultDashboard = realm.objects(tableDashboardWidget.self).filter("account == %@", account) + realm.delete(resultDashboard) + + let resultDashboardButton = realm.objects(tableDashboardWidgetButton.self).filter("account == %@", account) + realm.delete(resultDashboardButton) + + for widget in dashboardWidgets { + + let addObject = tableDashboardWidget() + + addObject.index = account + " " + widget.id + addObject.account = account + addObject.id = widget.id + addObject.title = widget.title + addObject.order = widget.order + addObject.iconClass = widget.iconClass + addObject.iconUrl = widget.iconUrl + addObject.widgetUrl = widget.widgetUrl + addObject.itemIconsRound = widget.itemIconsRound + + if let buttons = widget.button { + for button in buttons { + + let addObject = tableDashboardWidgetButton() + + addObject.account = account + addObject.id = widget.id + addObject.type = button.type + addObject.text = button.text + addObject.link = button.link + addObject.index = account + " " + widget.id + " " + button.type + + realm.add(addObject, update: .all) + } + } + + realm.add(addObject, update: .all) + } + } + } catch let error { + NKCommon.shared.writeLog("Could not write to database: \(error)") + } + } +} diff --git a/iOSClient/Data/NCManageDatabase+Metadata.swift b/iOSClient/Data/NCManageDatabase+Metadata.swift index c98b0aa17..972812ebe 100644 --- a/iOSClient/Data/NCManageDatabase+Metadata.swift +++ b/iOSClient/Data/NCManageDatabase+Metadata.swift @@ -23,7 +23,7 @@ import Foundation import RealmSwift -import NCCommunication +import NextcloudKit extension NCManageDatabase { @@ -31,7 +31,7 @@ extension NCManageDatabase { return tableMetadata.init(value: metadata) } - @objc func convertNCFileToMetadata(_ file: NCCommunicationFile, isEncrypted: Bool, account: String) -> tableMetadata { + @objc func convertNCFileToMetadata(_ file: NKFile, isEncrypted: Bool, account: String) -> tableMetadata { let metadata = tableMetadata() @@ -89,8 +89,8 @@ extension NCManageDatabase { metadata.size = file.size metadata.classFile = file.classFile //FIXME: iOS 12.0,* don't detect UTI text/markdown, text/x-markdown - if (metadata.contentType == "text/markdown" || metadata.contentType == "text/x-markdown") && metadata.classFile == NCCommunicationCommon.typeClassFile.unknow.rawValue { - metadata.classFile = NCCommunicationCommon.typeClassFile.document.rawValue + if (metadata.contentType == "text/markdown" || metadata.contentType == "text/x-markdown") && metadata.classFile == NKCommon.typeClassFile.unknow.rawValue { + metadata.classFile = NKCommon.typeClassFile.document.rawValue } if let date = file.uploadDate { metadata.uploadDate = date @@ -105,7 +105,7 @@ extension NCManageDatabase { if isEncrypted || metadata.e2eEncrypted { if let tableE2eEncryption = NCManageDatabase.shared.getE2eEncryption(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameIdentifier == %@", account, file.serverUrl, file.fileName)) { metadata.fileNameView = tableE2eEncryption.fileName - let results = NCCommunicationCommon.shared.getInternalType(fileName: metadata.fileNameView, mimeType: file.contentType, directory: file.directory) + let results = NKCommon.shared.getInternalType(fileName: metadata.fileNameView, mimeType: file.contentType, directory: file.directory) metadata.contentType = results.mimeType metadata.iconName = results.iconName metadata.classFile = results.classFile @@ -113,12 +113,12 @@ extension NCManageDatabase { } // Live Photo "DETECT" - if !metadata.directory && !metadata.livePhoto && (metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue) { + if !metadata.directory && !metadata.livePhoto && (metadata.classFile == NKCommon.typeClassFile.video.rawValue || metadata.classFile == NKCommon.typeClassFile.image.rawValue) { var classFile = metadata.classFile - if classFile == NCCommunicationCommon.typeClassFile.image.rawValue { - classFile = NCCommunicationCommon.typeClassFile.video.rawValue + if classFile == NKCommon.typeClassFile.image.rawValue { + classFile = NKCommon.typeClassFile.video.rawValue } else { - classFile = NCCommunicationCommon.typeClassFile.image.rawValue + classFile = NKCommon.typeClassFile.image.rawValue } if getMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameWithoutExt == %@ AND ocId != %@ AND classFile == %@", metadata.account, metadata.serverUrl, metadata.fileNameWithoutExt, metadata.ocId, classFile)) != nil { metadata.livePhoto = true @@ -128,7 +128,7 @@ extension NCManageDatabase { return metadata } - @objc func convertNCCommunicationFilesToMetadatas(_ files: [NCCommunicationFile], useMetadataFolder: Bool, account: String, completion: @escaping (_ metadataFolder: tableMetadata, _ metadatasFolder: [tableMetadata], _ metadatas: [tableMetadata]) -> Void) { + @objc func convertNKFilesToMetadatas(_ files: [NKFile], useMetadataFolder: Bool, account: String, completion: @escaping (_ metadataFolder: tableMetadata, _ metadatasFolder: [tableMetadata], _ metadatas: [tableMetadata]) -> Void) { var counter: Int = 0 var isEncrypted: Bool = false @@ -172,18 +172,18 @@ extension NCManageDatabase { if let iconName = iconName { metadata.iconName = iconName } else { - metadata.iconName = NCCommunicationCommon.typeIconFile.url.rawValue + metadata.iconName = NKCommon.typeIconFile.url.rawValue } - metadata.classFile = NCCommunicationCommon.typeClassFile.url.rawValue + metadata.classFile = NKCommon.typeClassFile.url.rawValue } else { - let (mimeType, classFile, iconName, _, _, _) = NCCommunicationCommon.shared.getInternalType(fileName: fileName, mimeType: contentType, directory: false) + let (mimeType, classFile, iconName, _, _, _) = NKCommon.shared.getInternalType(fileName: fileName, mimeType: contentType, directory: false) metadata.contentType = mimeType metadata.iconName = iconName metadata.classFile = classFile //FIXME: iOS 12.0,* don't detect UTI text/markdown, text/x-markdown - if classFile == NCCommunicationCommon.typeClassFile.unknow.rawValue && (mimeType == "text/x-markdown" || mimeType == "text/markdown") { - metadata.iconName = NCCommunicationCommon.typeIconFile.txt.rawValue - metadata.classFile = NCCommunicationCommon.typeClassFile.document.rawValue + if classFile == NKCommon.typeClassFile.unknow.rawValue && (mimeType == "text/x-markdown" || mimeType == "text/markdown") { + metadata.iconName = NKCommon.typeIconFile.txt.rawValue + metadata.classFile = NKCommon.typeClassFile.document.rawValue } } if let iconUrl = iconUrl { @@ -232,7 +232,7 @@ extension NCManageDatabase { realm.add(metadata, update: .all) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") return nil } return returnMetadata @@ -249,7 +249,7 @@ extension NCManageDatabase { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -263,7 +263,7 @@ extension NCManageDatabase { realm.delete(results) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -278,7 +278,7 @@ extension NCManageDatabase { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -294,7 +294,7 @@ extension NCManageDatabase { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -305,7 +305,7 @@ extension NCManageDatabase { do { try realm.safeWrite { if let result = realm.objects(tableMetadata.self).filter("ocId == %@", ocId).first { - let resultsType = NCCommunicationCommon.shared.getInternalType(fileName: fileNameTo, mimeType: "", directory: result.directory) + let resultsType = NKCommon.shared.getInternalType(fileName: fileNameTo, mimeType: "", directory: result.directory) result.fileName = fileNameTo result.fileNameView = fileNameTo if result.directory { @@ -321,7 +321,7 @@ extension NCManageDatabase { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -390,7 +390,7 @@ extension NCManageDatabase { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } for ocId in ocIdsUdate { @@ -436,7 +436,7 @@ extension NCManageDatabase { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -452,7 +452,7 @@ extension NCManageDatabase { result?.status = status } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } if let result = result { @@ -474,7 +474,7 @@ extension NCManageDatabase { result?.etagResource = etagResource } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -488,7 +488,7 @@ extension NCManageDatabase { result?.favorite = favorite } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -507,7 +507,7 @@ extension NCManageDatabase { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -521,7 +521,7 @@ extension NCManageDatabase { result?.e2eEncrypted = encrypted } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -535,7 +535,7 @@ extension NCManageDatabase { result?.fileNameView = newFileNameView } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -579,7 +579,7 @@ extension NCManageDatabase { // For Live Photo var fileNameImages: [String] = [] - let filtered = results.filter { $0.classFile.contains(NCCommunicationCommon.typeClassFile.image.rawValue) } + let filtered = results.filter { $0.classFile.contains(NKCommon.typeClassFile.image.rawValue) } filtered.forEach { print($0) let fileName = ($0.fileNameView as NSString).deletingPathExtension fileNameImages.append(fileName) @@ -713,7 +713,7 @@ extension NCManageDatabase { realm.delete(results) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -729,7 +729,7 @@ extension NCManageDatabase { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -761,7 +761,7 @@ extension NCManageDatabase { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -776,10 +776,10 @@ extension NCManageDatabase { return nil } - if classFile == NCCommunicationCommon.typeClassFile.image.rawValue { - classFile = NCCommunicationCommon.typeClassFile.video.rawValue + if classFile == NKCommon.typeClassFile.image.rawValue { + classFile = NKCommon.typeClassFile.video.rawValue } else { - classFile = NCCommunicationCommon.typeClassFile.image.rawValue + classFile = NKCommon.typeClassFile.image.rawValue } guard let result = realm.objects(tableMetadata.self).filter(NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameWithoutExt == %@ AND ocId != %@ AND classFile == %@", metadata.account, metadata.serverUrl, metadata.fileNameWithoutExt, metadata.ocId, classFile)).first else { @@ -860,4 +860,13 @@ extension NCManageDatabase { } return(Array(results.map { tableMetadata.init(value: $0) }), Array(metadatas.map { tableMetadata.init(value: $0) })) } + + func getNumMetadatasInUpload() -> Int { + + let realm = try! Realm() + + let num = realm.objects(tableMetadata.self).filter(NSPredicate(format: "status == %i || status == %i", NCGlobal.shared.metadataStatusInUpload, NCGlobal.shared.metadataStatusUploading)).count + + return num + } } diff --git a/iOSClient/Data/NCManageDatabase+Video.swift b/iOSClient/Data/NCManageDatabase+Video.swift index 34723d9ec..2ea740cb4 100644 --- a/iOSClient/Data/NCManageDatabase+Video.swift +++ b/iOSClient/Data/NCManageDatabase+Video.swift @@ -23,7 +23,7 @@ import Foundation import RealmSwift -import NCCommunication +import NextcloudKit extension NCManageDatabase { @@ -60,7 +60,7 @@ extension NCManageDatabase { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -92,7 +92,7 @@ extension NCManageDatabase { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -146,7 +146,7 @@ extension NCManageDatabase { realm.delete(result) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } } diff --git a/iOSClient/Data/NCManageDatabase.swift b/iOSClient/Data/NCManageDatabase.swift index 10459c812..68833bb56 100644 --- a/iOSClient/Data/NCManageDatabase.swift +++ b/iOSClient/Data/NCManageDatabase.swift @@ -24,7 +24,7 @@ import UIKit import RealmSwift -import NCCommunication +import NextcloudKit import SwiftyJSON import CoreMedia import Photos @@ -46,9 +46,9 @@ class NCManageDatabase: NSObject { if let databaseFilePath = databaseFileUrlPath?.path { if FileManager.default.fileExists(atPath: databaseFilePath) { - NCCommunicationCommon.shared.writeLog("DATABASE FOUND in " + databaseFilePath) + NKCommon.shared.writeLog("DATABASE FOUND in " + databaseFilePath) } else { - NCCommunicationCommon.shared.writeLog("DATABASE NOT FOUND in " + databaseFilePath) + NKCommon.shared.writeLog("DATABASE NOT FOUND in " + databaseFilePath) } } @@ -70,7 +70,7 @@ class NCManageDatabase: NSObject { let config = Realm.Configuration( fileURL: dirGroup?.appendingPathComponent(NCGlobal.shared.appDatabaseNextcloud + "/" + NCGlobal.shared.databaseDefault), schemaVersion: NCGlobal.shared.databaseSchemaVersion, - objectTypes: [tableMetadata.self, tableLocalFile.self, tableDirectory.self, tableTag.self, tableAccount.self, tableCapabilities.self, tableE2eEncryption.self, tableE2eEncryptionLock.self, tableShare.self, tableChunk.self, tableAvatar.self] + objectTypes: [tableMetadata.self, tableLocalFile.self, tableDirectory.self, tableTag.self, tableAccount.self, tableCapabilities.self, tablePhotoLibrary.self, tableE2eEncryption.self, tableE2eEncryptionLock.self, tableShare.self, tableChunk.self, tableAvatar.self, tableDashboardWidget.self, tableDashboardWidgetButton.self] ) Realm.Configuration.defaultConfiguration = config @@ -188,9 +188,10 @@ class NCManageDatabase: NSObject { if let databaseFileUrlPath = databaseFileUrlPath { do { #if !EXTENSION - NCContentPresenter.shared.messageNotification("_error_", description: "_database_corrupt_", delay: NCGlobal.shared.dismissAfterSecondLong, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorInternalError, priority: .max) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_database_corrupt_") + NCContentPresenter.shared.showError(error: error, priority: .max) #endif - NCCommunicationCommon.shared.writeLog("DATABASE CORRUPT: removed") + NKCommon.shared.writeLog("DATABASE CORRUPT: removed") try FileManager.default.removeItem(at: databaseFileUrlPath) } catch {} } @@ -211,9 +212,10 @@ class NCManageDatabase: NSObject { if let databaseFileUrlPath = databaseFileUrlPath { do { #if !EXTENSION - NCContentPresenter.shared.messageNotification("_error_", description: "_database_corrupt_", delay: NCGlobal.shared.dismissAfterSecondLong, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorInternalError, priority: .max) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_database_corrupt_") + NCContentPresenter.shared.showError(error: error, priority: .max) #endif - NCCommunicationCommon.shared.writeLog("DATABASE CORRUPT: removed") + NKCommon.shared.writeLog("DATABASE CORRUPT: removed") try FileManager.default.removeItem(at: databaseFileUrlPath) } catch {} } @@ -243,7 +245,7 @@ class NCManageDatabase: NSObject { realm.delete(results) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -257,6 +259,8 @@ class NCManageDatabase: NSObject { self.clearTable(tableCapabilities.self, account: account) self.clearTable(tableChunk.self, account: account) self.clearTable(tableComments.self, account: account) + self.clearTable(tableDashboardWidget.self, account: account) + self.clearTable(tableDashboardWidgetButton.self, account: account) self.clearTable(tableDirectEditingCreators.self, account: account) self.clearTable(tableDirectEditingEditors.self, account: account) self.clearTable(tableDirectory.self, account: account) @@ -292,7 +296,7 @@ class NCManageDatabase: NSObject { do { try FileManager.default.removeItem(at: URL) } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } } @@ -337,7 +341,7 @@ class NCManageDatabase: NSObject { realm.add(addObject, update: .all) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -366,7 +370,7 @@ class NCManageDatabase: NSObject { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -389,7 +393,7 @@ class NCManageDatabase: NSObject { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } return image @@ -428,7 +432,7 @@ class NCManageDatabase: NSObject { realm.add(addObject, update: .all) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -570,7 +574,7 @@ class NCManageDatabase: NSObject { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -596,7 +600,7 @@ class NCManageDatabase: NSObject { realm.delete(result) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -611,14 +615,14 @@ class NCManageDatabase: NSObject { realm.delete(result) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } // MARK: - // MARK: Table Direct Editing - @objc func addDirectEditing(account: String, editors: [NCCommunicationEditorDetailsEditors], creators: [NCCommunicationEditorDetailsCreators]) { + @objc func addDirectEditing(account: String, editors: [NKEditorDetailsEditors], creators: [NKEditorDetailsCreators]) { let realm = try! Realm() @@ -669,7 +673,7 @@ class NCManageDatabase: NSObject { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -747,7 +751,7 @@ class NCManageDatabase: NSObject { realm.add(addObject, update: .all) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -770,7 +774,7 @@ class NCManageDatabase: NSObject { realm.delete(results) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -809,7 +813,7 @@ class NCManageDatabase: NSObject { realm.add(directory, update: .all) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -847,7 +851,7 @@ class NCManageDatabase: NSObject { result?.serverUrl = serverUrl } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -861,7 +865,7 @@ class NCManageDatabase: NSObject { result?.offline = offline } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -877,7 +881,7 @@ class NCManageDatabase: NSObject { result?.richWorkspace = richWorkspace } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } if let result = result { @@ -899,7 +903,7 @@ class NCManageDatabase: NSObject { result?.colorFolder = colorFolder } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } if let result = result { @@ -921,7 +925,7 @@ class NCManageDatabase: NSObject { realm.add(e2e, update: .all) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -936,7 +940,7 @@ class NCManageDatabase: NSObject { realm.delete(results) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -997,7 +1001,7 @@ class NCManageDatabase: NSObject { do { try realm.commitWrite() } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -1031,7 +1035,7 @@ class NCManageDatabase: NSObject { realm.add(addObject, update: .all) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -1046,14 +1050,14 @@ class NCManageDatabase: NSObject { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } // MARK: - // MARK: Table External Sites - @objc func addExternalSites(_ externalSite: NCCommunicationExternalSite, account: String) { + @objc func addExternalSites(_ externalSite: NKExternalSite, account: String) { let realm = try! Realm() @@ -1072,7 +1076,7 @@ class NCManageDatabase: NSObject { realm.add(addObject) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -1086,7 +1090,7 @@ class NCManageDatabase: NSObject { realm.delete(results) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -1135,7 +1139,7 @@ class NCManageDatabase: NSObject { do { try realm.commitWrite() } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -1174,7 +1178,7 @@ class NCManageDatabase: NSObject { realm.add(addObject, update: .all) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -1198,7 +1202,7 @@ class NCManageDatabase: NSObject { realm.add(addObject, update: .all) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -1212,7 +1216,7 @@ class NCManageDatabase: NSObject { realm.delete(results) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -1231,7 +1235,7 @@ class NCManageDatabase: NSObject { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -1251,7 +1255,7 @@ class NCManageDatabase: NSObject { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -1292,7 +1296,7 @@ class NCManageDatabase: NSObject { result?.offline = offline } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -1334,7 +1338,7 @@ class NCManageDatabase: NSObject { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") return false } @@ -1369,7 +1373,7 @@ class NCManageDatabase: NSObject { // MARK: - // MARK: Table Share - @objc func addShare(urlBase: String, account: String, shares: [NCCommunicationShare]) { + @objc func addShare(urlBase: String, account: String, shares: [NKShare]) { let realm = try! Realm() realm.beginWrite() @@ -1427,7 +1431,7 @@ class NCManageDatabase: NSObject { do { try realm.commitWrite() } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -1446,17 +1450,13 @@ class NCManageDatabase: NSObject { let realm = try! Realm() let sortProperties = [SortDescriptor(keyPath: "shareType", ascending: false), SortDescriptor(keyPath: "idShare", ascending: false)] - let firstShareLink = realm.objects(tableShare.self).filter("account == %@ AND serverUrl == %@ AND fileName == %@ AND shareType == 3", metadata.account, metadata.serverUrl, metadata.fileName).first - if firstShareLink == nil { - - let results = realm.objects(tableShare.self).filter("account == %@ AND serverUrl == %@ AND fileName == %@", metadata.account, metadata.serverUrl, metadata.fileName).sorted(by: sortProperties) - return(firstShareLink: firstShareLink, share: Array(results.map { tableShare.init(value: $0) })) - + if let firstShareLink = firstShareLink { + let results = realm.objects(tableShare.self).filter("account == %@ AND serverUrl == %@ AND fileName == %@ AND idShare != %d", metadata.account, metadata.serverUrl, metadata.fileName, firstShareLink.idShare).sorted(by: sortProperties) + return(firstShareLink: tableShare.init(value: firstShareLink), share: Array(results.map { tableShare.init(value: $0) })) } else { - - let results = realm.objects(tableShare.self).filter("account == %@ AND serverUrl == %@ AND fileName == %@ AND idShare != %d", metadata.account, metadata.serverUrl, metadata.fileName, firstShareLink!.idShare).sorted(by: sortProperties) + let results = realm.objects(tableShare.self).filter("account == %@ AND serverUrl == %@ AND fileName == %@", metadata.account, metadata.serverUrl, metadata.fileName).sorted(by: sortProperties) return(firstShareLink: firstShareLink, share: Array(results.map { tableShare.init(value: $0) })) } } @@ -1504,7 +1504,7 @@ class NCManageDatabase: NSObject { do { try realm.commitWrite() } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -1520,7 +1520,7 @@ class NCManageDatabase: NSObject { do { try realm.commitWrite() } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -1544,7 +1544,7 @@ class NCManageDatabase: NSObject { realm.add(addObject, update: .all) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -1560,7 +1560,7 @@ class NCManageDatabase: NSObject { do { try realm.commitWrite() } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -1611,14 +1611,14 @@ class NCManageDatabase: NSObject { realm.add(addObject, update: .all) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } // MARK: - // MARK: Table Trash - @objc func addTrash(account: String, items: [NCCommunicationTrash]) { + @objc func addTrash(account: String, items: [NKTrash]) { let realm = try! Realm() @@ -1646,7 +1646,7 @@ class NCManageDatabase: NSObject { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -1668,7 +1668,7 @@ class NCManageDatabase: NSObject { realm.delete(result) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -1690,7 +1690,7 @@ class NCManageDatabase: NSObject { realm.delete(result) } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } @@ -1719,7 +1719,7 @@ class NCManageDatabase: NSObject { // MARK: - // MARK: Table UserStatus - @objc func addUserStatus(_ userStatuses: [NCCommunicationUserStatus], account: String, predefined: Bool) { + @objc func addUserStatus(_ userStatuses: [NKUserStatus], account: String, predefined: Bool) { let realm = try! Realm() @@ -1748,7 +1748,7 @@ class NCManageDatabase: NSObject { } } } catch let error { - NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)") + NKCommon.shared.writeLog("Could not write to database: \(error)") } } } diff --git a/iOSClient/Diagnostics/NCCapabilitiesViewController.swift b/iOSClient/Diagnostics/NCCapabilitiesViewController.swift index 7451affac..3e5bde1bd 100644 --- a/iOSClient/Diagnostics/NCCapabilitiesViewController.swift +++ b/iOSClient/Diagnostics/NCCapabilitiesViewController.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit class NCCapabilitiesViewController: UIViewController, UIDocumentInteractionControllerDelegate { @@ -86,79 +86,79 @@ class NCCapabilitiesViewController: UIViewController, UIDocumentInteractionContr textView.layer.cornerRadius = 15 textView.layer.masksToBounds = true - textView.backgroundColor = NCBrandColor.shared.secondarySystemBackground + textView.backgroundColor = .secondarySystemBackground statusFileSharing.layer.cornerRadius = 12.5 statusFileSharing.layer.borderWidth = 0.5 - statusFileSharing.layer.borderColor = NCBrandColor.shared.systemGray.cgColor + statusFileSharing.layer.borderColor = UIColor.systemGray.cgColor statusFileSharing.layer.masksToBounds = true - statusFileSharing.backgroundColor = NCBrandColor.shared.secondarySystemBackground + statusFileSharing.backgroundColor = .secondarySystemBackground statusExternalSite.layer.cornerRadius = 12.5 statusExternalSite.layer.borderWidth = 0.5 - statusExternalSite.layer.borderColor = NCBrandColor.shared.systemGray.cgColor + statusExternalSite.layer.borderColor = UIColor.systemGray.cgColor statusExternalSite.layer.masksToBounds = true - statusExternalSite.backgroundColor = NCBrandColor.shared.secondarySystemBackground + statusExternalSite.backgroundColor = .secondarySystemBackground statusEndToEndEncryption.layer.cornerRadius = 12.5 statusEndToEndEncryption.layer.borderWidth = 0.5 - statusEndToEndEncryption.layer.borderColor = NCBrandColor.shared.systemGray.cgColor + statusEndToEndEncryption.layer.borderColor = UIColor.systemGray.cgColor statusEndToEndEncryption.layer.masksToBounds = true - statusEndToEndEncryption.backgroundColor = NCBrandColor.shared.secondarySystemBackground + statusEndToEndEncryption.backgroundColor = .secondarySystemBackground statusActivity.layer.cornerRadius = 12.5 statusActivity.layer.borderWidth = 0.5 - statusActivity.layer.borderColor = NCBrandColor.shared.systemGray.cgColor + statusActivity.layer.borderColor = UIColor.systemGray.cgColor statusActivity.layer.masksToBounds = true - statusActivity.backgroundColor = NCBrandColor.shared.secondarySystemBackground + statusActivity.backgroundColor = .secondarySystemBackground statusNotification.layer.cornerRadius = 12.5 statusNotification.layer.borderWidth = 0.5 - statusNotification.layer.borderColor = NCBrandColor.shared.systemGray.cgColor + statusNotification.layer.borderColor = UIColor.systemGray.cgColor statusNotification.layer.masksToBounds = true - statusNotification.backgroundColor = NCBrandColor.shared.secondarySystemBackground + statusNotification.backgroundColor = .secondarySystemBackground statusDeletedFiles.layer.cornerRadius = 12.5 statusDeletedFiles.layer.borderWidth = 0.5 - statusDeletedFiles.layer.borderColor = NCBrandColor.shared.systemGray.cgColor + statusDeletedFiles.layer.borderColor = UIColor.systemGray.cgColor statusDeletedFiles.layer.masksToBounds = true - statusDeletedFiles.backgroundColor = NCBrandColor.shared.secondarySystemBackground + statusDeletedFiles.backgroundColor = .secondarySystemBackground statusText.layer.cornerRadius = 12.5 statusText.layer.borderWidth = 0.5 - statusText.layer.borderColor = NCBrandColor.shared.systemGray.cgColor + statusText.layer.borderColor = UIColor.systemGray.cgColor statusText.layer.masksToBounds = true - statusText.backgroundColor = NCBrandColor.shared.secondarySystemBackground + statusText.backgroundColor = .secondarySystemBackground statusCollabora.layer.cornerRadius = 12.5 statusCollabora.layer.borderWidth = 0.5 - statusCollabora.layer.borderColor = NCBrandColor.shared.systemGray.cgColor + statusCollabora.layer.borderColor = UIColor.systemGray.cgColor statusCollabora.layer.masksToBounds = true - statusCollabora.backgroundColor = NCBrandColor.shared.secondarySystemBackground + statusCollabora.backgroundColor = .secondarySystemBackground statusOnlyOffice.layer.cornerRadius = 12.5 statusOnlyOffice.layer.borderWidth = 0.5 - statusOnlyOffice.layer.borderColor = NCBrandColor.shared.systemGray.cgColor + statusOnlyOffice.layer.borderColor = UIColor.systemGray.cgColor statusOnlyOffice.layer.masksToBounds = true - statusOnlyOffice.backgroundColor = NCBrandColor.shared.secondarySystemBackground + statusOnlyOffice.backgroundColor = .secondarySystemBackground statusUserStatus.layer.cornerRadius = 12.5 statusUserStatus.layer.borderWidth = 0.5 - statusUserStatus.layer.borderColor = NCBrandColor.shared.systemGray.cgColor + statusUserStatus.layer.borderColor = UIColor.systemGray.cgColor statusUserStatus.layer.masksToBounds = true - statusUserStatus.backgroundColor = NCBrandColor.shared.secondarySystemBackground + statusUserStatus.backgroundColor = .secondarySystemBackground statusComments.layer.cornerRadius = 12.5 statusComments.layer.borderWidth = 0.5 - statusComments.layer.borderColor = NCBrandColor.shared.systemGray.cgColor + statusComments.layer.borderColor = UIColor.systemGray.cgColor statusComments.layer.masksToBounds = true - statusComments.backgroundColor = NCBrandColor.shared.secondarySystemBackground + statusComments.backgroundColor = .secondarySystemBackground statusLockFile.layer.cornerRadius = 12.5 statusLockFile.layer.borderWidth = 0.5 - statusLockFile.layer.borderColor = NCBrandColor.shared.systemGray.cgColor + statusLockFile.layer.borderColor = UIColor.systemGray.cgColor statusLockFile.layer.masksToBounds = true - statusLockFile.backgroundColor = NCBrandColor.shared.secondarySystemBackground + statusLockFile.backgroundColor = .secondarySystemBackground imageFileSharing.image = UIImage(named: "share")!.image(color: NCBrandColor.shared.gray, size: 50) imageExternalSite.image = NCUtility.shared.loadImage(named: "network", color: NCBrandColor.shared.gray) @@ -180,7 +180,8 @@ class NCCapabilitiesViewController: UIViewController, UIDocumentInteractionContr capabilitiesText = text updateCapabilities() } else { - NCContentPresenter.shared.messageNotification("_error_", description: "_no_capabilities_found_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorInternalError, priority: .max) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_no_capabilities_found_") + NCContentPresenter.shared.showError(error: error, priority: .max) DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { self.dismiss(animated: true, completion: nil) @@ -193,15 +194,15 @@ class NCCapabilitiesViewController: UIViewController, UIDocumentInteractionContr @objc func updateCapabilities() { - NCCommunication.shared.getCapabilities { account, data, errorCode, _ in - if errorCode == 0 && data != nil { + NextcloudKit.shared.getCapabilities { account, data, error in + if error == .success && data != nil { NCManageDatabase.shared.addCapabilitiesJSon(data!, account: account) // EDITORS let serverVersionMajor = NCManageDatabase.shared.getCapabilitiesServerInt(account: account, elements: NCElementsJSON.shared.capabilitiesVersionMajor) if serverVersionMajor >= NCGlobal.shared.nextcloudVersion18 { - NCCommunication.shared.NCTextObtainEditorDetails { account, editors, creators, errorCode, _ in - if errorCode == 0 && account == self.appDelegate.account { + NextcloudKit.shared.NCTextObtainEditorDetails { account, editors, creators, data, error in + if error == .success && account == self.appDelegate.account { NCManageDatabase.shared.addDirectEditing(account: account, editors: editors, creators: creators) self.readCapabilities() } diff --git a/iOSClient/EmptyView/NCEmptyDataSet.swift b/iOSClient/EmptyView/NCEmptyDataSet.swift index 684be71d5..59e9c3700 100644 --- a/iOSClient/EmptyView/NCEmptyDataSet.swift +++ b/iOSClient/EmptyView/NCEmptyDataSet.swift @@ -127,6 +127,6 @@ public class NCEmptyView: UIView { public override func awakeFromNib() { super.awakeFromNib() - emptyTitle.textColor = NCBrandColor.shared.label + emptyTitle.textColor = .label } } diff --git a/iOSClient/Extensions/NotificationCenter+MainThread.swift b/iOSClient/Extensions/NotificationCenter+MainThread.swift index 94214d48f..bbc33ba52 100644 --- a/iOSClient/Extensions/NotificationCenter+MainThread.swift +++ b/iOSClient/Extensions/NotificationCenter+MainThread.swift @@ -27,9 +27,6 @@ import UIKit extension NotificationCenter { func postOnMainThread(name: String, object anObject: Any? = nil, userInfo aUserInfo: [AnyHashable: Any]? = nil, second: Double = 0) { -// if UIApplication.shared.applicationState == .background { -// return -// } DispatchQueue.main.asyncAfter(deadline: .now() + second) { NotificationCenter.default.post(name: Notification.Name(rawValue: name), object: anObject, userInfo: aUserInfo) } diff --git a/iOSClient/Extensions/String+Extensions.swift b/iOSClient/Extensions/String+Extensions.swift index 4e0fa5131..27aefad99 100644 --- a/iOSClient/Extensions/String+Extensions.swift +++ b/iOSClient/Extensions/String+Extensions.swift @@ -69,6 +69,13 @@ extension String { return digestData.map { String(format: "%02hhx", $0) }.joined() } + + var urlEncoded: String? { + // + for historical reason, most web servers treat + as a replacement of whitespace + // ?, & mark query pararmeter which should not be part of a url string, but added seperately + let urlAllowedCharSet = CharacterSet.urlQueryAllowed.subtracting(["+", "?", "&"]) + return addingPercentEncoding(withAllowedCharacters: urlAllowedCharSet) + } } extension StringProtocol { diff --git a/iOSClient/Extensions/UIAlertController+Extension.swift b/iOSClient/Extensions/UIAlertController+Extension.swift index 90a55c09d..5c7dc93a8 100644 --- a/iOSClient/Extensions/UIAlertController+Extension.swift +++ b/iOSClient/Extensions/UIAlertController+Extension.swift @@ -22,6 +22,7 @@ // import UIKit +import NextcloudKit extension UIAlertController { /// Creates a alert controller with a textfield, asking to create a new folder @@ -30,16 +31,16 @@ extension UIAlertController { /// - urlBase: UrlBase object /// - completion: If not` nil` it overrides the default behavior which shows an error using `NCContentPresenter` /// - Returns: The presentable alert controller - static func createFolder(serverUrl: String, urlBase: NCUserBaseUrl, completion: ((_ errorCode: Int, _ errorDescription: String) -> Void)? = nil) -> UIAlertController { + static func createFolder(serverUrl: String, urlBase: NCUserBaseUrl, completion: ((_ error: NKError) -> Void)? = nil) -> UIAlertController { let alertController = UIAlertController(title: NSLocalizedString("_create_folder_", comment: ""), message: nil, preferredStyle: .alert) let okAction = UIAlertAction(title: NSLocalizedString("_save_", comment: ""), style: .default, handler: { _ in guard let fileNameFolder = alertController.textFields?.first?.text else { return } - NCNetworking.shared.createFolder(fileName: fileNameFolder, serverUrl: serverUrl, account: urlBase.account, urlBase: urlBase.urlBase, overwrite: false) { errorCode, errorDescription in + NCNetworking.shared.createFolder(fileName: fileNameFolder, serverUrl: serverUrl, account: urlBase.account, urlBase: urlBase.urlBase, overwrite: false) { error in if let completion = completion { - completion(errorCode, errorDescription) - } else if errorCode != 0 { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + completion(error) + } else if error != .success { + NCContentPresenter.shared.showError(error: error) } // else: successful, no action } }) diff --git a/iOSClient/Extensions/UIApplication+Orientation.swift b/iOSClient/Extensions/UIApplication+Orientation.swift index aa3f1528b..432b2ed08 100644 --- a/iOSClient/Extensions/UIApplication+Orientation.swift +++ b/iOSClient/Extensions/UIApplication+Orientation.swift @@ -27,10 +27,8 @@ extension UIApplication { var isLandscape: Bool { if UIDevice.current.orientation.isValidInterfaceOrientation { return UIDevice.current.orientation.isLandscape - } else if #available(iOS 13.0, *) { + } else { return windows.first?.windowScene?.interfaceOrientation.isLandscape ?? false - } else { - return statusBarOrientation.isLandscape } } } diff --git a/iOSClient/Extensions/UIControl+Extensions.swift b/iOSClient/Extensions/UIControl+Extensions.swift index 390734d65..ad9556abb 100644 --- a/iOSClient/Extensions/UIControl+Extensions.swift +++ b/iOSClient/Extensions/UIControl+Extensions.swift @@ -27,7 +27,7 @@ import Foundation public class ActionClosure { public let selector: Selector - private let closure : (_ sendersender: Any?) -> Void + private let closure: (_ sendersender: Any?) -> Void init(_ attachObj: AnyObject, closure: @escaping (_ sender: Any?) -> Void) { self.closure = closure @@ -41,7 +41,7 @@ public class ActionClosure { } public extension UIControl { - func action(for event: UIControl.Event, _ closure : @escaping (_ object: Any?) -> Void) { + func action(for event: UIControl.Event, _ closure: @escaping (_ object: Any?) -> Void) { let actionClosure = ActionClosure(self, closure: closure) self.addTarget(actionClosure, action: actionClosure.selector, for: event) } diff --git a/iOSClient/Extensions/UIImage+Extensions.swift b/iOSClient/Extensions/UIImage+Extensions.swift index fda843b38..04a13de4f 100644 --- a/iOSClient/Extensions/UIImage+Extensions.swift +++ b/iOSClient/Extensions/UIImage+Extensions.swift @@ -27,7 +27,7 @@ import Accelerate extension UIImage { - @objc func resizeImage(size: CGSize, isAspectRation: Bool) -> UIImage? { + @objc func resizeImage(size: CGSize, isAspectRation: Bool = true) -> UIImage? { let originRatio = self.size.width / self.size.height let newRatio = size.width / size.height @@ -138,18 +138,6 @@ extension UIImage { return newImage } - func imageColor(_ color: UIColor) -> UIImage { - - if #available(iOS 13.0, *) { - return self.withTintColor(color, renderingMode: .alwaysOriginal) - } else { - return UIGraphicsImageRenderer(size: size, format: imageRendererFormat).image { _ in - color.set() - withRenderingMode(.alwaysTemplate).draw(at: .zero) - } - } - } - func isEqualToImage(image: UIImage?) -> Bool { if image == nil { return false } let data1: NSData = self.pngData()! as NSData @@ -233,10 +221,10 @@ extension UIImage { var image = self if let tableDirectory = tableDirectory { if let hex = tableDirectory.colorFolder, let color = UIColor(hex: hex) { - image = self.imageColor(color) + image = self.withTintColor(color, renderingMode: .alwaysOriginal) } } else if let tableDirectory = NCManageDatabase.shared.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", metadata.account, serverUrl)), let hex = tableDirectory.colorFolder, let color = UIColor(hex: hex) { - image = self.imageColor(color) + image = self.withTintColor(color, renderingMode: .alwaysOriginal) } return image } diff --git a/iOSClient/Extensions/UINavigationController+Extension.swift b/iOSClient/Extensions/UINavigationController+Extension.swift index e0e987df6..5d0fd79ca 100644 --- a/iOSClient/Extensions/UINavigationController+Extension.swift +++ b/iOSClient/Extensions/UINavigationController+Extension.swift @@ -29,4 +29,51 @@ extension UINavigationController { override func topMostViewController() -> UIViewController { return self.visibleViewController!.topMostViewController() } + + func setFileAppreance() { + + navigationBar.tintColor = .systemBlue + + let standardAppearance = UINavigationBarAppearance() + standardAppearance.configureWithDefaultBackground() + + standardAppearance.largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.label] + standardAppearance.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.label] + standardAppearance.backgroundColor = .systemGray6 + navigationBar.standardAppearance = standardAppearance + + let scrollEdgeAppearance = UINavigationBarAppearance() + scrollEdgeAppearance.configureWithDefaultBackground() + + scrollEdgeAppearance.backgroundColor = .systemBackground + scrollEdgeAppearance.shadowColor = .clear + scrollEdgeAppearance.shadowImage = UIImage() + navigationBar.scrollEdgeAppearance = scrollEdgeAppearance + } + + func setGroupeAppreance() { + + navigationBar.tintColor = .systemBlue + + let standardAppearance = UINavigationBarAppearance() + standardAppearance.configureWithDefaultBackground() + + standardAppearance.largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.label] + standardAppearance.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.label] + standardAppearance.backgroundColor = .systemGray6 + navigationBar.standardAppearance = standardAppearance + + let scrollEdgeAppearance = UINavigationBarAppearance() + scrollEdgeAppearance.configureWithDefaultBackground() + + scrollEdgeAppearance.backgroundColor = .systemGroupedBackground + scrollEdgeAppearance.shadowColor = .clear + scrollEdgeAppearance.shadowImage = UIImage() + navigationBar.scrollEdgeAppearance = scrollEdgeAppearance + } + + func setMediaAppreance() { + + setNavigationBarHidden(true, animated: false) + } } diff --git a/iOSClient/Favorites/NCFavorite.swift b/iOSClient/Favorites/NCFavorite.swift index 448caf426..d6f2d3894 100644 --- a/iOSClient/Favorites/NCFavorite.swift +++ b/iOSClient/Favorites/NCFavorite.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit class NCFavorite: NCCollectionViewCommon { @@ -42,6 +42,12 @@ class NCFavorite: NCCollectionViewCommon { emptyDescription = "_tutorial_favorite_view_" } + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + + navigationController?.setFileAppreance() + } + // MARK: - DataSource + NC Endpoint override func reloadDataSource(forced: Bool = true) { @@ -82,9 +88,9 @@ class NCFavorite: NCCollectionViewCommon { if serverUrl.isEmpty { - NCNetworking.shared.listingFavoritescompletion(selector: NCGlobal.shared.selectorListingFavorite) { _, _, errorCode, errorDescription in - if errorCode != 0 { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCNetworking.shared.listingFavoritescompletion(selector: NCGlobal.shared.selectorListingFavorite) { _, _, error in + if error != .success { + NCContentPresenter.shared.showError(error: error) } DispatchQueue.main.async { @@ -96,8 +102,8 @@ class NCFavorite: NCCollectionViewCommon { } else { - networkReadFolder(forced: forced) { tableDirectory, metadatas, metadatasUpdate, metadatasDelete, errorCode, _ in - if errorCode == 0 { + networkReadFolder(forced: forced) { tableDirectory, metadatas, metadatasUpdate, metadatasDelete, error in + if error == .success { for metadata in metadatas ?? [] { if !metadata.directory { if NCManageDatabase.shared.isDownloadMetadata(metadata, download: false) { diff --git a/iOSClient/Files/NCFiles.swift b/iOSClient/Files/NCFiles.swift index 296ef3a87..dd7d413fe 100644 --- a/iOSClient/Files/NCFiles.swift +++ b/iOSClient/Files/NCFiles.swift @@ -22,12 +22,13 @@ // import UIKit -import NCCommunication +import NextcloudKit class NCFiles: NCCollectionViewCommon { internal var isRoot: Bool = true internal var fileNameBlink: String? + internal var fileNameOpen: String? // MARK: - View Life Cycle @@ -52,27 +53,32 @@ class NCFiles: NCCollectionViewCommon { titleCurrentFolder = getNavigationTitle() } super.viewWillAppear(animated) + + navigationController?.setFileAppreance() } override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) fileNameBlink = nil + fileNameOpen = nil } // MARK: - NotificationCenter - override func initialize(_ notification: NSNotification) { + override func initialize() { if isRoot { serverUrl = NCUtilityFileSystem.shared.getHomeServer(account: appDelegate.account) titleCurrentFolder = getNavigationTitle() } - super.initialize(notification) + super.initialize() + /* if let userInfo = notification.userInfo as NSDictionary?, userInfo["atStart"] as? Int == 1 { return } + */ reloadDataSource(forced: false) reloadDataSourceNetwork() @@ -99,7 +105,7 @@ class NCFiles: NCCollectionViewCommon { self.richWorkspaceText = directory?.richWorkspace // FORCED false: test the directory.etag - if !forced, let directory = directory, directory.etag == self.dataSource.directory?.etag, metadataTransfer == nil, self.fileNameBlink == nil { + if !forced, let directory = directory, directory.etag == self.dataSource.directory?.etag, metadataTransfer == nil, self.fileNameBlink == nil, self.fileNameOpen == nil { return } @@ -120,7 +126,9 @@ class NCFiles: NCCollectionViewCommon { self.collectionView.reloadData() if !self.dataSource.metadatas.isEmpty { self.blinkCell(fileName: self.fileNameBlink) + self.openFile(fileName: self.fileNameOpen) self.fileNameBlink = nil + self.fileNameOpen = nil } } } @@ -135,12 +143,10 @@ class NCFiles: NCCollectionViewCommon { isReloadDataSourceNetworkInProgress = true collectionView?.reloadData() - networkReadFolder(forced: forced) { tableDirectory, metadatas, metadatasUpdate, metadatasDelete, errorCode, _ in - if errorCode == 0 { - for metadata in metadatas ?? [] { - if !metadata.directory, NCManageDatabase.shared.isDownloadMetadata(metadata, download: false) { - NCOperationQueue.shared.download(metadata: metadata, selector: NCGlobal.shared.selectorDownloadFile) - } + networkReadFolder(forced: forced) { tableDirectory, metadatas, metadatasUpdate, metadatasDelete, error in + if error == .success { + for metadata in metadatas ?? [] where !metadata.directory && NCManageDatabase.shared.isDownloadMetadata(metadata, download: false) { + NCOperationQueue.shared.download(metadata: metadata, selector: NCGlobal.shared.selectorDownloadFile) } } @@ -162,7 +168,7 @@ class NCFiles: NCCollectionViewCommon { if let fileName = fileName, let metadata = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileName == %@", self.appDelegate.account, self.serverUrl, fileName)) { let (indexPath, _) = self.dataSource.getIndexPathMetadata(ocId: metadata.ocId) if let indexPath = indexPath { - DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { UIView.animate(withDuration: 0.3) { self.collectionView.scrollToItem(at: indexPath, at: .centeredVertically, animated: false) } completion: { _ in @@ -177,4 +183,16 @@ class NCFiles: NCCollectionViewCommon { } } } + + func openFile(fileName: String?) { + + if let fileName = fileName, let metadata = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileName == %@", self.appDelegate.account, self.serverUrl, fileName)) { + let (indexPath, _) = self.dataSource.getIndexPathMetadata(ocId: metadata.ocId) + if let indexPath = indexPath { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { + self.collectionView(self.collectionView, didSelectItemAt: indexPath) + } + } + } + } } diff --git a/iOSClient/Images.xcassets/MenuGroupByAlphabetic.imageset/Contents.json b/iOSClient/Images.xcassets/MenuGroupByAlphabetic.imageset/Contents.json index 8a0e3c8db..f2f2fc305 100644 --- a/iOSClient/Images.xcassets/MenuGroupByAlphabetic.imageset/Contents.json +++ b/iOSClient/Images.xcassets/MenuGroupByAlphabetic.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "MenuGroupByAlphabetic.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "MenuGroupByAlphabetic@3x-1.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "MenuGroupByAlphabetic@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/MenuGroupByDate.imageset/Contents.json b/iOSClient/Images.xcassets/MenuGroupByDate.imageset/Contents.json index df3f40411..a3852fbd0 100644 --- a/iOSClient/Images.xcassets/MenuGroupByDate.imageset/Contents.json +++ b/iOSClient/Images.xcassets/MenuGroupByDate.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "MenuGroupByDate.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "MenuGroupByDate@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "MenuGroupByDate@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/MenuGroupByFile.imageset/Contents.json b/iOSClient/Images.xcassets/MenuGroupByFile.imageset/Contents.json index 0f2174768..0b82de579 100644 --- a/iOSClient/Images.xcassets/MenuGroupByFile.imageset/Contents.json +++ b/iOSClient/Images.xcassets/MenuGroupByFile.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "MenuGroupByFile.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "MenuGroupByFile@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "MenuGroupByFile@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/MenuOrderByFileName.imageset/Contents.json b/iOSClient/Images.xcassets/MenuOrderByFileName.imageset/Contents.json index 12b4f589d..808b6665c 100644 --- a/iOSClient/Images.xcassets/MenuOrderByFileName.imageset/Contents.json +++ b/iOSClient/Images.xcassets/MenuOrderByFileName.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "MenuOrderByFileName.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "MenuOrderByFileName@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "MenuOrderByFileName@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/MenuOrdeyByDate.imageset/Contents.json b/iOSClient/Images.xcassets/MenuOrdeyByDate.imageset/Contents.json index 3591298d9..585e3e21f 100644 --- a/iOSClient/Images.xcassets/MenuOrdeyByDate.imageset/Contents.json +++ b/iOSClient/Images.xcassets/MenuOrdeyByDate.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "MenuOrdeyByDate.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "MenuOrdeyByDate@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "MenuOrdeyByDate@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/MenuOrdinamentoAscendente.imageset/Contents.json b/iOSClient/Images.xcassets/MenuOrdinamentoAscendente.imageset/Contents.json index bdfe3752f..58efb2282 100644 --- a/iOSClient/Images.xcassets/MenuOrdinamentoAscendente.imageset/Contents.json +++ b/iOSClient/Images.xcassets/MenuOrdinamentoAscendente.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "MenuOrdinamentoAscendente.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "MenuOrdinamentoAscendente@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "MenuOrdinamentoAscendente@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/MenuOrdinamentoDiscendente.imageset/Contents.json b/iOSClient/Images.xcassets/MenuOrdinamentoDiscendente.imageset/Contents.json index edebaa105..393a10016 100644 --- a/iOSClient/Images.xcassets/MenuOrdinamentoDiscendente.imageset/Contents.json +++ b/iOSClient/Images.xcassets/MenuOrdinamentoDiscendente.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "MenuOrdinamentoDiscendente.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "MenuOrdinamentoDiscendente@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "MenuOrdinamentoDiscendente@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/WiFiSmall.imageset/Contents.json b/iOSClient/Images.xcassets/WiFiSmall.imageset/Contents.json index 3888d7137..0d044c1a4 100644 --- a/iOSClient/Images.xcassets/WiFiSmall.imageset/Contents.json +++ b/iOSClient/Images.xcassets/WiFiSmall.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { + "filename" : "WiFiSmall.png", "idiom" : "universal", - "scale" : "1x", - "filename" : "WiFiSmall.png" + "scale" : "1x" }, { - "idiom" : "universal", "filename" : "WiFiSmall@2x.png", + "idiom" : "universal", "scale" : "2x" }, { + "filename" : "WiFiSmall@3x.png", "idiom" : "universal", - "scale" : "3x", - "filename" : "WiFiSmall@3x.png" + "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/acknowledgements.imageset/Contents.json b/iOSClient/Images.xcassets/acknowledgements.imageset/Contents.json index 91c16cb02..1a717a665 100644 --- a/iOSClient/Images.xcassets/acknowledgements.imageset/Contents.json +++ b/iOSClient/Images.xcassets/acknowledgements.imageset/Contents.json @@ -1,12 +1,15 @@ { "images" : [ { - "idiom" : "universal", - "filename" : "acknowledgements.pdf" + "filename" : "acknowledgements.pdf", + "idiom" : "universal" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/actionSheetModify.imageset/Contents.json b/iOSClient/Images.xcassets/actionSheetModify.imageset/Contents.json index e88d736e6..da6627652 100644 --- a/iOSClient/Images.xcassets/actionSheetModify.imageset/Contents.json +++ b/iOSClient/Images.xcassets/actionSheetModify.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "actionSheetModify.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "actionSheetModify@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "actionSheetModify@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/activityTypeFailure.imageset/Contents.json b/iOSClient/Images.xcassets/activityTypeFailure.imageset/Contents.json index b32b9ad99..85b232117 100644 --- a/iOSClient/Images.xcassets/activityTypeFailure.imageset/Contents.json +++ b/iOSClient/Images.xcassets/activityTypeFailure.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "activityTypeFailure.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "activityTypeFailure@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "activityTypeFailure@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/activityTypeInfo.imageset/Contents.json b/iOSClient/Images.xcassets/activityTypeInfo.imageset/Contents.json index e239f33e9..273f51bf4 100644 --- a/iOSClient/Images.xcassets/activityTypeInfo.imageset/Contents.json +++ b/iOSClient/Images.xcassets/activityTypeInfo.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "activityTypeInfo.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "activityTypeInfo@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "activityTypeInfo@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/activityTypeInfoServer.imageset/Contents.json b/iOSClient/Images.xcassets/activityTypeInfoServer.imageset/Contents.json index 0d522e18a..5c7837e19 100644 --- a/iOSClient/Images.xcassets/activityTypeInfoServer.imageset/Contents.json +++ b/iOSClient/Images.xcassets/activityTypeInfoServer.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "activityTypeInfoServer.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "activityTypeInfoServer@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "activityTypeInfoServer@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/activityTypeSuccess.imageset/Contents.json b/iOSClient/Images.xcassets/activityTypeSuccess.imageset/Contents.json index 02432344a..d3c47f981 100644 --- a/iOSClient/Images.xcassets/activityTypeSuccess.imageset/Contents.json +++ b/iOSClient/Images.xcassets/activityTypeSuccess.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "activityTypeSuccess.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "activityTypeSucces@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "activityTypeSuccess@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/addImage.imageset/Contents.json b/iOSClient/Images.xcassets/addImage.imageset/Contents.json new file mode 100644 index 000000000..1fcb8593e --- /dev/null +++ b/iOSClient/Images.xcassets/addImage.imageset/Contents.json @@ -0,0 +1,15 @@ +{ + "images" : [ + { + "filename" : "icons8-aggiungi-immagine.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true + } +} diff --git a/iOSClient/Images.xcassets/addImage.imageset/icons8-aggiungi-immagine.svg b/iOSClient/Images.xcassets/addImage.imageset/icons8-aggiungi-immagine.svg new file mode 100644 index 000000000..ae3014bc6 --- /dev/null +++ b/iOSClient/Images.xcassets/addImage.imageset/icons8-aggiungi-immagine.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<svg fill="#000000" viewBox="0 0 64 64" width="96px" height="96px" xmlns="http://www.w3.org/2000/svg"> + <path d="M 6.444 4.778 C 3.989 4.778 2 6.767 2 9.222 L 2 44.779 C 2 47.234 3.989 49.223 6.444 49.223 L 36.501 49.223 C 36.473 48.856 36.444 48.485 36.444 48.111 C 36.444 46.962 36.595 45.852 36.848 44.779 C 38.188 39.133 42.846 34.771 48.644 33.861 L 43.36 29.002 C 41.231 27.043 37.957 27.047 35.833 29.01 L 26.54 37.591 L 21.451 33.237 C 19.364 31.456 16.292 31.462 14.215 33.254 L 6.444 39.945 L 6.444 10.335 C 6.444 9.719 6.941 9.222 7.557 9.222 L 51.999 9.222 C 52.615 9.222 53.112 9.719 53.112 10.335 L 53.112 33.857 C 54.691 34.102 56.187 34.594 57.556 35.31 L 57.556 9.222 C 57.556 6.767 55.566 4.778 53.112 4.778 L 6.444 4.778 Z M 19.777 13.666 C 17.322 13.666 15.333 15.656 15.333 18.111 C 15.333 20.565 17.322 22.555 19.777 22.555 C 22.232 22.555 24.221 20.565 24.221 18.111 C 24.221 15.656 22.232 13.666 19.777 13.666 Z M 50.889 37 C 44.754 37 39.779 41.975 39.779 48.111 C 39.779 54.25 44.754 59.221 50.889 59.221 C 57.025 59.221 62 54.25 62 48.111 C 62 41.975 57.025 37 50.889 37 Z M 50.889 41.444 C 51.503 41.444 51.999 41.941 51.999 42.557 L 51.999 47.001 L 56.443 47.001 C 57.06 47.001 57.556 47.498 57.556 48.111 C 57.556 48.723 57.06 49.223 56.443 49.223 L 51.999 49.223 L 51.999 53.667 C 51.999 54.28 51.503 54.777 50.889 54.777 C 50.276 54.777 49.777 54.28 49.777 53.667 L 49.777 49.223 L 45.333 49.223 C 44.719 49.223 44.223 48.723 44.223 48.111 C 44.223 47.498 44.719 47.001 45.333 47.001 L 49.777 47.001 L 49.777 42.557 C 49.777 41.941 50.276 41.444 50.889 41.444 Z"/> +</svg>
\ No newline at end of file diff --git a/iOSClient/Images.xcassets/arrow.right.imageset/Contents.json b/iOSClient/Images.xcassets/arrow.right.imageset/Contents.json index e7f727ee6..a8661a624 100644 --- a/iOSClient/Images.xcassets/arrow.right.imageset/Contents.json +++ b/iOSClient/Images.xcassets/arrow.right.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/arrow.up.right.square.imageset/Contents.json b/iOSClient/Images.xcassets/arrow.up.right.square.imageset/Contents.json index de0266f2a..ba9ee6e43 100644 --- a/iOSClient/Images.xcassets/arrow.up.right.square.imageset/Contents.json +++ b/iOSClient/Images.xcassets/arrow.up.right.square.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/bell.imageset/Contents.json b/iOSClient/Images.xcassets/bell.imageset/Contents.json index cb9f9fd15..a61395b22 100644 --- a/iOSClient/Images.xcassets/bell.imageset/Contents.json +++ b/iOSClient/Images.xcassets/bell.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/buttonAddFolder.imageset/Contents.json b/iOSClient/Images.xcassets/buttonAddFolder.imageset/Contents.json deleted file mode 100644 index a039207ac..000000000 --- a/iOSClient/Images.xcassets/buttonAddFolder.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "icons8-add-folder-24(@1x).png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "icons8-add-folder-48(@2x)-1.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "icons8-add-folder-72(@3x).png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/iOSClient/Images.xcassets/buttonAddFolder.imageset/icons8-add-folder-24(@1x).png b/iOSClient/Images.xcassets/buttonAddFolder.imageset/icons8-add-folder-24(@1x).png Binary files differdeleted file mode 100644 index 0328885ac..000000000 --- a/iOSClient/Images.xcassets/buttonAddFolder.imageset/icons8-add-folder-24(@1x).png +++ /dev/null diff --git a/iOSClient/Images.xcassets/buttonAddFolder.imageset/icons8-add-folder-48(@2x)-1.png b/iOSClient/Images.xcassets/buttonAddFolder.imageset/icons8-add-folder-48(@2x)-1.png Binary files differdeleted file mode 100644 index 2f05bfd73..000000000 --- a/iOSClient/Images.xcassets/buttonAddFolder.imageset/icons8-add-folder-48(@2x)-1.png +++ /dev/null diff --git a/iOSClient/Images.xcassets/buttonAddFolder.imageset/icons8-add-folder-72(@3x).png b/iOSClient/Images.xcassets/buttonAddFolder.imageset/icons8-add-folder-72(@3x).png Binary files differdeleted file mode 100644 index 74ffa2d03..000000000 --- a/iOSClient/Images.xcassets/buttonAddFolder.imageset/icons8-add-folder-72(@3x).png +++ /dev/null diff --git a/iOSClient/Images.xcassets/buttonAddImage.imageset/Contents.json b/iOSClient/Images.xcassets/buttonAddImage.imageset/Contents.json deleted file mode 100644 index cc66bc8da..000000000 --- a/iOSClient/Images.xcassets/buttonAddImage.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "icons8-image-upload-24(@1x).png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "icons8-image-upload-48(@2x).png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "icons8-image-upload-72(@3x).png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/iOSClient/Images.xcassets/buttonAddImage.imageset/icons8-image-upload-24(@1x).png b/iOSClient/Images.xcassets/buttonAddImage.imageset/icons8-image-upload-24(@1x).png Binary files differdeleted file mode 100644 index 0250e8868..000000000 --- a/iOSClient/Images.xcassets/buttonAddImage.imageset/icons8-image-upload-24(@1x).png +++ /dev/null diff --git a/iOSClient/Images.xcassets/buttonAddImage.imageset/icons8-image-upload-48(@2x).png b/iOSClient/Images.xcassets/buttonAddImage.imageset/icons8-image-upload-48(@2x).png Binary files differdeleted file mode 100644 index bafea055b..000000000 --- a/iOSClient/Images.xcassets/buttonAddImage.imageset/icons8-image-upload-48(@2x).png +++ /dev/null diff --git a/iOSClient/Images.xcassets/buttonAddImage.imageset/icons8-image-upload-72(@3x).png b/iOSClient/Images.xcassets/buttonAddImage.imageset/icons8-image-upload-72(@3x).png Binary files differdeleted file mode 100644 index 4a60a404a..000000000 --- a/iOSClient/Images.xcassets/buttonAddImage.imageset/icons8-image-upload-72(@3x).png +++ /dev/null diff --git a/iOSClient/Images.xcassets/buttonAddScan.imageset/Contents.json b/iOSClient/Images.xcassets/buttonAddScan.imageset/Contents.json deleted file mode 100644 index 899bf6cbe..000000000 --- a/iOSClient/Images.xcassets/buttonAddScan.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "icons8-scan-24(@1x).png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "icons8-scan-48(@2x).png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "icons8-scan-72(@3x).png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/iOSClient/Images.xcassets/buttonAddScan.imageset/icons8-scan-24(@1x).png b/iOSClient/Images.xcassets/buttonAddScan.imageset/icons8-scan-24(@1x).png Binary files differdeleted file mode 100644 index eb6211df7..000000000 --- a/iOSClient/Images.xcassets/buttonAddScan.imageset/icons8-scan-24(@1x).png +++ /dev/null diff --git a/iOSClient/Images.xcassets/buttonAddScan.imageset/icons8-scan-48(@2x).png b/iOSClient/Images.xcassets/buttonAddScan.imageset/icons8-scan-48(@2x).png Binary files differdeleted file mode 100644 index 866cc7d77..000000000 --- a/iOSClient/Images.xcassets/buttonAddScan.imageset/icons8-scan-48(@2x).png +++ /dev/null diff --git a/iOSClient/Images.xcassets/buttonAddScan.imageset/icons8-scan-72(@3x).png b/iOSClient/Images.xcassets/buttonAddScan.imageset/icons8-scan-72(@3x).png Binary files differdeleted file mode 100644 index 16d88895c..000000000 --- a/iOSClient/Images.xcassets/buttonAddScan.imageset/icons8-scan-72(@3x).png +++ /dev/null diff --git a/iOSClient/Images.xcassets/captions.bubble.imageset/Contents.json b/iOSClient/Images.xcassets/captions.bubble.imageset/Contents.json index f17a1e2e0..dd2f90e0b 100644 --- a/iOSClient/Images.xcassets/captions.bubble.imageset/Contents.json +++ b/iOSClient/Images.xcassets/captions.bubble.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/create_file_document.imageset/Contents.json b/iOSClient/Images.xcassets/create_file_document.imageset/Contents.json index 3e515556f..6126b598e 100644 --- a/iOSClient/Images.xcassets/create_file_document.imageset/Contents.json +++ b/iOSClient/Images.xcassets/create_file_document.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "document_menu.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "create_file_document@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "document_menu@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/create_file_ppt.imageset/Contents.json b/iOSClient/Images.xcassets/create_file_ppt.imageset/Contents.json index b4124b6d8..72118b742 100644 --- a/iOSClient/Images.xcassets/create_file_ppt.imageset/Contents.json +++ b/iOSClient/Images.xcassets/create_file_ppt.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "file_ppt_menu.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "create_file_ppt@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "file_ppt_menu@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/create_file_xls.imageset/Contents.json b/iOSClient/Images.xcassets/create_file_xls.imageset/Contents.json index 24e2b9f8f..32339f608 100644 --- a/iOSClient/Images.xcassets/create_file_xls.imageset/Contents.json +++ b/iOSClient/Images.xcassets/create_file_xls.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "file_xls_menu.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "create_file_xls@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "file_xls_menu@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/deleteScan.imageset/Contents.json b/iOSClient/Images.xcassets/deleteScan.imageset/Contents.json index 3489861f8..a339b95ca 100644 --- a/iOSClient/Images.xcassets/deleteScan.imageset/Contents.json +++ b/iOSClient/Images.xcassets/deleteScan.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "deleteScan.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "deleteScan@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "deleteScan@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/disclosureIndicator.imageset/Contents.json b/iOSClient/Images.xcassets/disclosureIndicator.imageset/Contents.json index 78f6d8725..da15f8951 100644 --- a/iOSClient/Images.xcassets/disclosureIndicator.imageset/Contents.json +++ b/iOSClient/Images.xcassets/disclosureIndicator.imageset/Contents.json @@ -1,12 +1,15 @@ { "images" : [ { - "idiom" : "universal", - "filename" : "disclosureIndicator@2x.png" + "filename" : "disclosureIndicator@2x.png", + "idiom" : "universal" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/doc.on.clipboard.imageset/Contents.json b/iOSClient/Images.xcassets/doc.on.clipboard.imageset/Contents.json index 3bbc60af9..bd560aff3 100644 --- a/iOSClient/Images.xcassets/doc.on.clipboard.imageset/Contents.json +++ b/iOSClient/Images.xcassets/doc.on.clipboard.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/encrypted.imageset/Contents.json b/iOSClient/Images.xcassets/encrypted.imageset/Contents.json index c0e4360eb..ae738eff4 100644 --- a/iOSClient/Images.xcassets/encrypted.imageset/Contents.json +++ b/iOSClient/Images.xcassets/encrypted.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "encrypted.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "encrypted@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "encrypted@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/folderStarred.imageset/Contents.json b/iOSClient/Images.xcassets/folderStarred.imageset/Contents.json index 130b885f8..6b9892fdd 100644 --- a/iOSClient/Images.xcassets/folderStarred.imageset/Contents.json +++ b/iOSClient/Images.xcassets/folderStarred.imageset/Contents.json @@ -1,15 +1,15 @@ { "images" : [ { - "idiom" : "universal", - "filename" : "folderStarred.pdf" + "filename" : "folderStarred.pdf", + "idiom" : "universal" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 }, "properties" : { "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/foldersOnTop.imageset/Contents.json b/iOSClient/Images.xcassets/foldersOnTop.imageset/Contents.json index e7899584d..2f2e54e8c 100644 --- a/iOSClient/Images.xcassets/foldersOnTop.imageset/Contents.json +++ b/iOSClient/Images.xcassets/foldersOnTop.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "foldersOnTop.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "foldersOnTop@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "foldersOnTop@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/form-textbox.imageset/Contents.json b/iOSClient/Images.xcassets/form-textbox.imageset/Contents.json index 3184feb38..60638382a 100644 --- a/iOSClient/Images.xcassets/form-textbox.imageset/Contents.json +++ b/iOSClient/Images.xcassets/form-textbox.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/gitHub.imageset/Contents.json b/iOSClient/Images.xcassets/gitHub.imageset/Contents.json index 6a3ff780c..fa786f329 100644 --- a/iOSClient/Images.xcassets/gitHub.imageset/Contents.json +++ b/iOSClient/Images.xcassets/gitHub.imageset/Contents.json @@ -19,5 +19,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/gobackward.10.imageset/Contents.json b/iOSClient/Images.xcassets/gobackward.10.imageset/Contents.json index 53137b64f..41bf7eb30 100644 --- a/iOSClient/Images.xcassets/gobackward.10.imageset/Contents.json +++ b/iOSClient/Images.xcassets/gobackward.10.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/goforward.10.imageset/Contents.json b/iOSClient/Images.xcassets/goforward.10.imageset/Contents.json index 701e0b03f..ac3151060 100644 --- a/iOSClient/Images.xcassets/goforward.10.imageset/Contents.json +++ b/iOSClient/Images.xcassets/goforward.10.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/icon-calendar.imageset/Contents.json b/iOSClient/Images.xcassets/icon-calendar.imageset/Contents.json index 08e460fdf..830a3079b 100644 --- a/iOSClient/Images.xcassets/icon-calendar.imageset/Contents.json +++ b/iOSClient/Images.xcassets/icon-calendar.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/icon-confirm.imageset/Contents.json b/iOSClient/Images.xcassets/icon-confirm.imageset/Contents.json index 45660b0ea..f208a73f8 100644 --- a/iOSClient/Images.xcassets/icon-confirm.imageset/Contents.json +++ b/iOSClient/Images.xcassets/icon-confirm.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/icon-contacts.imageset/Contents.json b/iOSClient/Images.xcassets/icon-contacts.imageset/Contents.json index 39392d2d1..ca321128d 100644 --- a/iOSClient/Images.xcassets/icon-contacts.imageset/Contents.json +++ b/iOSClient/Images.xcassets/icon-contacts.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/icon-deck.imageset/Contents.json b/iOSClient/Images.xcassets/icon-deck.imageset/Contents.json index 3137099e6..90df8ba40 100644 --- a/iOSClient/Images.xcassets/icon-deck.imageset/Contents.json +++ b/iOSClient/Images.xcassets/icon-deck.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/icon-mail.imageset/Contents.json b/iOSClient/Images.xcassets/icon-mail.imageset/Contents.json index 53b2cb365..f08f7eaae 100644 --- a/iOSClient/Images.xcassets/icon-mail.imageset/Contents.json +++ b/iOSClient/Images.xcassets/icon-mail.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/icon-pages.imageset/Contents.json b/iOSClient/Images.xcassets/icon-pages.imageset/Contents.json index 04a211550..fe86cc0dc 100644 --- a/iOSClient/Images.xcassets/icon-pages.imageset/Contents.json +++ b/iOSClient/Images.xcassets/icon-pages.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/icon-talk.imageset/Contents.json b/iOSClient/Images.xcassets/icon-talk.imageset/Contents.json index e1961fe89..f0dc62157 100644 --- a/iOSClient/Images.xcassets/icon-talk.imageset/Contents.json +++ b/iOSClient/Images.xcassets/icon-talk.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/iconError.imageset/Contents.json b/iOSClient/Images.xcassets/iconError.imageset/Contents.json index d37508f03..6e53abd5b 100644 --- a/iOSClient/Images.xcassets/iconError.imageset/Contents.json +++ b/iOSClient/Images.xcassets/iconError.imageset/Contents.json @@ -5,8 +5,8 @@ "scale" : "1x" }, { - "idiom" : "universal", "filename" : "iconError@2x.png", + "idiom" : "universal", "scale" : "2x" }, { @@ -15,7 +15,10 @@ } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/iconInfo.imageset/Contents.json b/iOSClient/Images.xcassets/iconInfo.imageset/Contents.json index 1f9672eb5..dbc8ea0ff 100644 --- a/iOSClient/Images.xcassets/iconInfo.imageset/Contents.json +++ b/iOSClient/Images.xcassets/iconInfo.imageset/Contents.json @@ -5,8 +5,8 @@ "scale" : "1x" }, { - "idiom" : "universal", "filename" : "iconInfo@2x.png", + "idiom" : "universal", "scale" : "2x" }, { @@ -15,7 +15,10 @@ } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/iconSuccess.imageset/Contents.json b/iOSClient/Images.xcassets/iconSuccess.imageset/Contents.json index 6416831fc..f705d5252 100644 --- a/iOSClient/Images.xcassets/iconSuccess.imageset/Contents.json +++ b/iOSClient/Images.xcassets/iconSuccess.imageset/Contents.json @@ -5,8 +5,8 @@ "scale" : "1x" }, { - "idiom" : "universal", "filename" : "iconSuccess@2x.png", + "idiom" : "universal", "scale" : "2x" }, { @@ -15,7 +15,10 @@ } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/livePhoto.imageset/Contents.json b/iOSClient/Images.xcassets/livePhoto.imageset/Contents.json index 16f3a5b4e..334fcc3ef 100644 --- a/iOSClient/Images.xcassets/livePhoto.imageset/Contents.json +++ b/iOSClient/Images.xcassets/livePhoto.imageset/Contents.json @@ -1,12 +1,15 @@ { "images" : [ { - "idiom" : "universal", - "filename" : "live_photo.png" + "filename" : "live_photo.png", + "idiom" : "universal" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/local.imageset/Contents.json b/iOSClient/Images.xcassets/local.imageset/Contents.json index 80b03aaaa..5ffe3a6ee 100644 --- a/iOSClient/Images.xcassets/local.imageset/Contents.json +++ b/iOSClient/Images.xcassets/local.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "local.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "local@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "local@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/loginPassword.imageset/Contents.json b/iOSClient/Images.xcassets/loginPassword.imageset/Contents.json index 568841b4f..a41709109 100644 --- a/iOSClient/Images.xcassets/loginPassword.imageset/Contents.json +++ b/iOSClient/Images.xcassets/loginPassword.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { + "filename" : "passwordNextcloud.png", "idiom" : "universal", - "scale" : "1x", - "filename" : "passwordNextcloud.png" + "scale" : "1x" }, { - "idiom" : "universal", "filename" : "passwordNextcloud@2x.png", + "idiom" : "universal", "scale" : "2x" }, { + "filename" : "passwordNextcloud@3x.png", "idiom" : "universal", - "scale" : "3x", - "filename" : "passwordNextcloud@3x.png" + "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/loginURL.imageset/Contents.json b/iOSClient/Images.xcassets/loginURL.imageset/Contents.json index e87eaa121..6de00731b 100644 --- a/iOSClient/Images.xcassets/loginURL.imageset/Contents.json +++ b/iOSClient/Images.xcassets/loginURL.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { + "filename" : "baseurlNextcloud.png", "idiom" : "universal", - "scale" : "1x", - "filename" : "baseurlNextcloud.png" + "scale" : "1x" }, { - "idiom" : "universal", "filename" : "baseurlNextcloud@2x.png", + "idiom" : "universal", "scale" : "2x" }, { + "filename" : "baseurlNextcloud@3x.png", "idiom" : "universal", - "scale" : "3x", - "filename" : "baseurlNextcloud@3x.png" + "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/loginUser.imageset/Contents.json b/iOSClient/Images.xcassets/loginUser.imageset/Contents.json index 399c26689..9f0cdbcee 100644 --- a/iOSClient/Images.xcassets/loginUser.imageset/Contents.json +++ b/iOSClient/Images.xcassets/loginUser.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { + "filename" : "userNextcloud.png", "idiom" : "universal", - "scale" : "1x", - "filename" : "userNextcloud.png" + "scale" : "1x" }, { - "idiom" : "universal", "filename" : "userNextcloud@2x.png", + "idiom" : "universal", "scale" : "2x" }, { + "filename" : "userNextcloud@3x.png", "idiom" : "universal", - "scale" : "3x", - "filename" : "userNextcloud@3x.png" + "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/mac.imageset/Contents.json b/iOSClient/Images.xcassets/mac.imageset/Contents.json index cae4de536..f051e98fa 100644 --- a/iOSClient/Images.xcassets/mac.imageset/Contents.json +++ b/iOSClient/Images.xcassets/mac.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/mediaPlay.imageset/Contents.json b/iOSClient/Images.xcassets/mediaPlay.imageset/Contents.json index e4967a1fd..db15d7376 100644 --- a/iOSClient/Images.xcassets/mediaPlay.imageset/Contents.json +++ b/iOSClient/Images.xcassets/mediaPlay.imageset/Contents.json @@ -1,12 +1,15 @@ { "images" : [ { - "idiom" : "universal", - "filename" : "play.png" + "filename" : "play.png", + "idiom" : "universal" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/menuLogoUser.imageset/Contents.json b/iOSClient/Images.xcassets/menuLogoUser.imageset/Contents.json index 355bcc3f2..02f557bf4 100644 --- a/iOSClient/Images.xcassets/menuLogoUser.imageset/Contents.json +++ b/iOSClient/Images.xcassets/menuLogoUser.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "menuLogoUser.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "menuLogoUser@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "menuLogoUser@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/microphone.imageset/Contents.json b/iOSClient/Images.xcassets/microphone.imageset/Contents.json index e17ad3b4e..3bd88e65d 100644 --- a/iOSClient/Images.xcassets/microphone.imageset/Contents.json +++ b/iOSClient/Images.xcassets/microphone.imageset/Contents.json @@ -1,15 +1,15 @@ { "images" : [ { - "idiom" : "universal", - "filename" : "Microphone.png" + "filename" : "icons8-microfono-400.svg", + "idiom" : "universal" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 }, "properties" : { "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/microphone.imageset/Microphone.png b/iOSClient/Images.xcassets/microphone.imageset/Microphone.png Binary files differdeleted file mode 100644 index 128657638..000000000 --- a/iOSClient/Images.xcassets/microphone.imageset/Microphone.png +++ /dev/null diff --git a/iOSClient/Images.xcassets/microphone.imageset/icons8-microfono-400.svg b/iOSClient/Images.xcassets/microphone.imageset/icons8-microfono-400.svg new file mode 100644 index 000000000..112bfb771 --- /dev/null +++ b/iOSClient/Images.xcassets/microphone.imageset/icons8-microfono-400.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<svg fill="#000000" viewBox="0 0 48 48" width="400px" height="400px" xmlns="http://www.w3.org/2000/svg"> + <path d="M 24 2 C 19.047281 2 15 6.0472805 15 11 L 15 26 C 15 30.952719 19.047281 35 24 35 C 28.952719 35 33 30.952719 33 26 L 33 11 C 33 6.0472805 28.952719 2 24 2 z M 10.476562 20.978516 A 1.50015 1.50015 0 0 0 9 22.5 L 9 26 C 9 33.760508 14.934038 40.16812 22.5 40.923828 L 22.5 45.5 A 1.50015 1.50015 0 1 0 25.5 45.5 L 25.5 40.923828 C 33.065962 40.16812 39 33.760508 39 26 L 39 22.5 A 1.50015 1.50015 0 1 0 36 22.5 L 36 26 C 36 32.585372 30.739679 37.894735 24.177734 37.990234 A 1.50015 1.50015 0 0 0 23.976562 37.978516 A 1.50015 1.50015 0 0 0 23.8125 37.990234 C 17.255134 37.889572 12 32.582085 12 26 L 12 22.5 A 1.50015 1.50015 0 0 0 10.476562 20.978516 z" style="fill: rgb(255, 255, 255);"/> +</svg>
\ No newline at end of file diff --git a/iOSClient/Images.xcassets/microphone_off.imageset/Contents.json b/iOSClient/Images.xcassets/microphone_off.imageset/Contents.json deleted file mode 100644 index 4104d254e..000000000 --- a/iOSClient/Images.xcassets/microphone_off.imageset/Contents.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "microphone_off.pdf" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - }, - "properties" : { - "preserves-vector-representation" : true - } -}
\ No newline at end of file diff --git a/iOSClient/Images.xcassets/microphone_off.imageset/microphone_off.pdf b/iOSClient/Images.xcassets/microphone_off.imageset/microphone_off.pdf Binary files differdeleted file mode 100644 index 0ec6d736c..000000000 --- a/iOSClient/Images.xcassets/microphone_off.imageset/microphone_off.pdf +++ /dev/null diff --git a/iOSClient/Images.xcassets/modifyPhoto.imageset/modifyPhoto.pdf b/iOSClient/Images.xcassets/modifyPhoto.imageset/modifyPhoto.pdf Binary files differdeleted file mode 100644 index 7e5f91b5a..000000000 --- a/iOSClient/Images.xcassets/modifyPhoto.imageset/modifyPhoto.pdf +++ /dev/null diff --git a/iOSClient/Images.xcassets/moon.circle.imageset/Contents.json b/iOSClient/Images.xcassets/moon.circle.imageset/Contents.json deleted file mode 100644 index 6d9f59c0e..000000000 --- a/iOSClient/Images.xcassets/moon.circle.imageset/Contents.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "darkModeDetect.pdf" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - }, - "properties" : { - "preserves-vector-representation" : true - } -}
\ No newline at end of file diff --git a/iOSClient/Images.xcassets/moon.circle.imageset/darkModeDetect.pdf b/iOSClient/Images.xcassets/moon.circle.imageset/darkModeDetect.pdf Binary files differdeleted file mode 100644 index 3121d5c75..000000000 --- a/iOSClient/Images.xcassets/moon.circle.imageset/darkModeDetect.pdf +++ /dev/null diff --git a/iOSClient/Images.xcassets/moreBig.imageset/Contents.json b/iOSClient/Images.xcassets/moreBig.imageset/Contents.json index 380e9e88e..2bd4f9dce 100644 --- a/iOSClient/Images.xcassets/moreBig.imageset/Contents.json +++ b/iOSClient/Images.xcassets/moreBig.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "moreBig.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "moreBig@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "moreBig@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/moreEmpty.imageset/Contents.json b/iOSClient/Images.xcassets/moreEmpty.imageset/Contents.json index 1f48ffadc..608e3161e 100644 --- a/iOSClient/Images.xcassets/moreEmpty.imageset/Contents.json +++ b/iOSClient/Images.xcassets/moreEmpty.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "moreEmpty.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "moreEmpty@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "moreEmpty@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/moreLock.imageset/Contents.json b/iOSClient/Images.xcassets/moreLock.imageset/Contents.json index 194258945..c2ad9fa11 100644 --- a/iOSClient/Images.xcassets/moreLock.imageset/Contents.json +++ b/iOSClient/Images.xcassets/moreLock.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/navigationControllerMenu.imageset/Contents.json b/iOSClient/Images.xcassets/navigationControllerMenu.imageset/Contents.json deleted file mode 100644 index ff9fb6d82..000000000 --- a/iOSClient/Images.xcassets/navigationControllerMenu.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "navigationControllerMenu.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "navigationControllerMenu@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "navigationControllerMenu@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -}
\ No newline at end of file diff --git a/iOSClient/Images.xcassets/navigationControllerMenu.imageset/navigationControllerMenu.png b/iOSClient/Images.xcassets/navigationControllerMenu.imageset/navigationControllerMenu.png Binary files differdeleted file mode 100644 index 3e9460995..000000000 --- a/iOSClient/Images.xcassets/navigationControllerMenu.imageset/navigationControllerMenu.png +++ /dev/null diff --git a/iOSClient/Images.xcassets/navigationControllerMenu.imageset/navigationControllerMenu@2x.png b/iOSClient/Images.xcassets/navigationControllerMenu.imageset/navigationControllerMenu@2x.png Binary files differdeleted file mode 100644 index 4e646132d..000000000 --- a/iOSClient/Images.xcassets/navigationControllerMenu.imageset/navigationControllerMenu@2x.png +++ /dev/null diff --git a/iOSClient/Images.xcassets/navigationControllerMenu.imageset/navigationControllerMenu@3x.png b/iOSClient/Images.xcassets/navigationControllerMenu.imageset/navigationControllerMenu@3x.png Binary files differdeleted file mode 100644 index da1a1be96..000000000 --- a/iOSClient/Images.xcassets/navigationControllerMenu.imageset/navigationControllerMenu@3x.png +++ /dev/null diff --git a/iOSClient/Images.xcassets/navigationMore.imageset/Contents.json b/iOSClient/Images.xcassets/navigationMore.imageset/Contents.json index 30efa1b71..fa2d81caa 100644 --- a/iOSClient/Images.xcassets/navigationMore.imageset/Contents.json +++ b/iOSClient/Images.xcassets/navigationMore.imageset/Contents.json @@ -5,8 +5,8 @@ "scale" : "1x" }, { - "idiom" : "universal", "filename" : "more-round.png", + "idiom" : "universal", "scale" : "2x" }, { @@ -15,10 +15,11 @@ } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 }, "properties" : { + "preserves-vector-representation" : true, "template-rendering-intent" : "template" } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/navigationSort.imageset/Contents.json b/iOSClient/Images.xcassets/navigationSort.imageset/Contents.json index f16f5db52..30a6d892c 100644 --- a/iOSClient/Images.xcassets/navigationSort.imageset/Contents.json +++ b/iOSClient/Images.xcassets/navigationSort.imageset/Contents.json @@ -1,15 +1,16 @@ { "images" : [ { - "idiom" : "universal", - "filename" : "Untitled.pdf" + "filename" : "Untitled.pdf", + "idiom" : "universal" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 }, "properties" : { + "preserves-vector-representation" : true, "template-rendering-intent" : "template" } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/network.imageset/Contents.json b/iOSClient/Images.xcassets/network.imageset/Contents.json index bb250773d..0c20d6ba9 100644 --- a/iOSClient/Images.xcassets/network.imageset/Contents.json +++ b/iOSClient/Images.xcassets/network.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/networkInProgress.imageset/Contents.json b/iOSClient/Images.xcassets/networkInProgress.imageset/Contents.json index f951658a5..5cd67041c 100644 --- a/iOSClient/Images.xcassets/networkInProgress.imageset/Contents.json +++ b/iOSClient/Images.xcassets/networkInProgress.imageset/Contents.json @@ -1,12 +1,15 @@ { "images" : [ { - "idiom" : "universal", - "filename" : "networkInProgress.pdf" + "filename" : "networkInProgress.pdf", + "idiom" : "universal" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/nonetwork.imageset/Contents.json b/iOSClient/Images.xcassets/nonetwork.imageset/Contents.json index 12a037088..34ae16431 100644 --- a/iOSClient/Images.xcassets/nonetwork.imageset/Contents.json +++ b/iOSClient/Images.xcassets/nonetwork.imageset/Contents.json @@ -1,15 +1,15 @@ { "images" : [ { - "idiom" : "universal", - "filename" : "nonetwork.pdf" + "filename" : "nonetwork.pdf", + "idiom" : "universal" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 }, "properties" : { "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/notaMusic.imageset/Contents.json b/iOSClient/Images.xcassets/notaMusic.imageset/Contents.json index 8020bc9d8..857154c7d 100644 --- a/iOSClient/Images.xcassets/notaMusic.imageset/Contents.json +++ b/iOSClient/Images.xcassets/notaMusic.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "notaMusic.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "notaMusic@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "notaMusic@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/offlineFlag.imageset/Contents.json b/iOSClient/Images.xcassets/offlineFlag.imageset/Contents.json index 846979865..1db27463e 100644 --- a/iOSClient/Images.xcassets/offlineFlag.imageset/Contents.json +++ b/iOSClient/Images.xcassets/offlineFlag.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "offlineFlag.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "offlineFlag@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "offlineFlag@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/palette.imageset/Contents.json b/iOSClient/Images.xcassets/palette.imageset/Contents.json index a4bc71f0b..6601935c6 100644 --- a/iOSClient/Images.xcassets/palette.imageset/Contents.json +++ b/iOSClient/Images.xcassets/palette.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/passcode.imageset/Contents.json b/iOSClient/Images.xcassets/passcode.imageset/Contents.json index 370f27247..63ca80e76 100644 --- a/iOSClient/Images.xcassets/passcode.imageset/Contents.json +++ b/iOSClient/Images.xcassets/passcode.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { + "filename" : "passcode.png", "idiom" : "universal", - "scale" : "1x", - "filename" : "passcode.png" + "scale" : "1x" }, { + "filename" : "passcode@2x.png", "idiom" : "universal", - "scale" : "2x", - "filename" : "passcode@2x.png" + "scale" : "2x" }, { + "filename" : "passcode@3x.png", "idiom" : "universal", - "scale" : "3x", - "filename" : "passcode@3x.png" + "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/pencil.imageset/Contents.json b/iOSClient/Images.xcassets/pencil.imageset/Contents.json index de0266f2a..ba9ee6e43 100644 --- a/iOSClient/Images.xcassets/pencil.imageset/Contents.json +++ b/iOSClient/Images.xcassets/pencil.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/person.crop.circle.imageset/Contents.json b/iOSClient/Images.xcassets/person.crop.circle.imageset/Contents.json index 46f29206a..34850a048 100644 --- a/iOSClient/Images.xcassets/person.crop.circle.imageset/Contents.json +++ b/iOSClient/Images.xcassets/person.crop.circle.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/pip.enter.imageset/Contents.json b/iOSClient/Images.xcassets/pip.enter.imageset/Contents.json index b9f68df99..d737f573c 100644 --- a/iOSClient/Images.xcassets/pip.enter.imageset/Contents.json +++ b/iOSClient/Images.xcassets/pip.enter.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/plus.imageset/Contents.json b/iOSClient/Images.xcassets/plus.imageset/Contents.json index 1ab419199..aac31f933 100644 --- a/iOSClient/Images.xcassets/plus.imageset/Contents.json +++ b/iOSClient/Images.xcassets/plus.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "add.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "add@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "add@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/plus100.imageset/Contents.json b/iOSClient/Images.xcassets/plus100.imageset/Contents.json index 6358e3218..4588e2636 100644 --- a/iOSClient/Images.xcassets/plus100.imageset/Contents.json +++ b/iOSClient/Images.xcassets/plus100.imageset/Contents.json @@ -1,12 +1,15 @@ { "images" : [ { - "idiom" : "universal", - "filename" : "plus100@2x.png" + "filename" : "plus100@2x.png", + "idiom" : "universal" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/qrcode.imageset/Contents.json b/iOSClient/Images.xcassets/qrcode.imageset/Contents.json index 0069f596d..3d370c566 100644 --- a/iOSClient/Images.xcassets/qrcode.imageset/Contents.json +++ b/iOSClient/Images.xcassets/qrcode.imageset/Contents.json @@ -1,12 +1,15 @@ { "images" : [ { - "idiom" : "universal", - "filename" : "qrcode.pdf" + "filename" : "qrcode.pdf", + "idiom" : "universal" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/repeat.imageset/Contents.json b/iOSClient/Images.xcassets/repeat.imageset/Contents.json index 8821ac833..bcba57b3e 100644 --- a/iOSClient/Images.xcassets/repeat.imageset/Contents.json +++ b/iOSClient/Images.xcassets/repeat.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/restore.imageset/Contents.json b/iOSClient/Images.xcassets/restore.imageset/Contents.json index 6eee552c5..74570520e 100644 --- a/iOSClient/Images.xcassets/restore.imageset/Contents.json +++ b/iOSClient/Images.xcassets/restore.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "restore.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "restore@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "restore@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/rgb.imageset/Contents.json b/iOSClient/Images.xcassets/rgb.imageset/Contents.json index 587109c2c..0756c3e4e 100644 --- a/iOSClient/Images.xcassets/rgb.imageset/Contents.json +++ b/iOSClient/Images.xcassets/rgb.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/rotate.imageset/Contents.json b/iOSClient/Images.xcassets/rotate.imageset/Contents.json index e580427db..6ef84edb1 100644 --- a/iOSClient/Images.xcassets/rotate.imageset/Contents.json +++ b/iOSClient/Images.xcassets/rotate.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "rotate.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "rotate@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "rotate@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/modifyPhoto.imageset/Contents.json b/iOSClient/Images.xcassets/scan.imageset/Contents.json index ad9dbb39f..5a72dee25 100644 --- a/iOSClient/Images.xcassets/modifyPhoto.imageset/Contents.json +++ b/iOSClient/Images.xcassets/scan.imageset/Contents.json @@ -1,15 +1,15 @@ { "images" : [ { - "idiom" : "universal", - "filename" : "modifyPhoto.pdf" + "filename" : "icons8-scan.svg", + "idiom" : "universal" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 }, "properties" : { "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/scan.imageset/icons8-scan.svg b/iOSClient/Images.xcassets/scan.imageset/icons8-scan.svg new file mode 100644 index 000000000..7ab3280ff --- /dev/null +++ b/iOSClient/Images.xcassets/scan.imageset/icons8-scan.svg @@ -0,0 +1 @@ +<svg fill="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24px" height="24px"><path d="M 2,5 C 2,3.34 3.34,2 5,2 H 7.5 V 4 H 5 C 4.44,4 4,4.44 4,5 V 7.5 H 2 Z M 19,4 H 16.5 V 2 H 19 c 1.65,0 3,1.34 3,3 V 7.5 H 20 V 5 C 20,4.44 19.55,4 19,4 Z M 4,16.5 V 19 c 0,0.55 0.44,1 1,1 h 2.5 v 2 H 5 C 3.34,22 2,20.65 2,19 V 16.5 Z M 20,19 v -2.5 h 2 V 19 c 0,1.65 -1.35,3 -3,3 H 16.5 V 20 H 19 c 0.55,0 1,-0.45 1,-1 z M 17,13 H 7 v -2 h 10 z"/></svg>
\ No newline at end of file diff --git a/iOSClient/Images.xcassets/sharePhotoBrowser.imageset/Contents.json b/iOSClient/Images.xcassets/sharePhotoBrowser.imageset/Contents.json index c13a5e7ec..1d44c683b 100644 --- a/iOSClient/Images.xcassets/sharePhotoBrowser.imageset/Contents.json +++ b/iOSClient/Images.xcassets/sharePhotoBrowser.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "share.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "sharePhotoBrowser@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "share@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/sortDateLessRecent.imageset/Contents.json b/iOSClient/Images.xcassets/sortDateLessRecent.imageset/Contents.json index 6d5c1d6ea..f7f765b8e 100644 --- a/iOSClient/Images.xcassets/sortDateLessRecent.imageset/Contents.json +++ b/iOSClient/Images.xcassets/sortDateLessRecent.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "sortDateLessRecent.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "sortDateLessRecent@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "sortDateLessRecent@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/sortDateMoreRecent.imageset/Contents.json b/iOSClient/Images.xcassets/sortDateMoreRecent.imageset/Contents.json index acdab4e94..16f652eaa 100644 --- a/iOSClient/Images.xcassets/sortDateMoreRecent.imageset/Contents.json +++ b/iOSClient/Images.xcassets/sortDateMoreRecent.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "sortDateLess.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "sortDateLess@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "sortDateLess@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/sortFileNameAZ.imageset/Contents.json b/iOSClient/Images.xcassets/sortFileNameAZ.imageset/Contents.json index 8e8163f19..ab8789256 100644 --- a/iOSClient/Images.xcassets/sortFileNameAZ.imageset/Contents.json +++ b/iOSClient/Images.xcassets/sortFileNameAZ.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "sortFileNameAZ.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "sortFileNameAZ@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "sortFileNameAZ@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/sortFileNameZA.imageset/Contents.json b/iOSClient/Images.xcassets/sortFileNameZA.imageset/Contents.json index 66e46e666..bd7d648b0 100644 --- a/iOSClient/Images.xcassets/sortFileNameZA.imageset/Contents.json +++ b/iOSClient/Images.xcassets/sortFileNameZA.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "sortFileNameZA.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "sortFileNameZA@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "sortFileNameZA@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/sortLargest.imageset/Contents.json b/iOSClient/Images.xcassets/sortLargest.imageset/Contents.json index d420da270..e92b17d4d 100644 --- a/iOSClient/Images.xcassets/sortLargest.imageset/Contents.json +++ b/iOSClient/Images.xcassets/sortLargest.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "sortLargest.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "sortLargest@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "sortLargest@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/sortSmallest.imageset/Contents.json b/iOSClient/Images.xcassets/sortSmallest.imageset/Contents.json index 199226cb9..91698080a 100644 --- a/iOSClient/Images.xcassets/sortSmallest.imageset/Contents.json +++ b/iOSClient/Images.xcassets/sortSmallest.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "sortSmallest.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "sortSmallest@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "sortSmallest@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/square.and.arrow.up.imageset/Contents.json b/iOSClient/Images.xcassets/square.and.arrow.up.imageset/Contents.json index 547621500..78451c57b 100644 --- a/iOSClient/Images.xcassets/square.and.arrow.up.imageset/Contents.json +++ b/iOSClient/Images.xcassets/square.and.arrow.up.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } } diff --git a/iOSClient/Images.xcassets/statusdownload.imageset/Contents.json b/iOSClient/Images.xcassets/statusdownload.imageset/Contents.json index 585cb8766..be3c311a0 100644 --- a/iOSClient/Images.xcassets/statusdownload.imageset/Contents.json +++ b/iOSClient/Images.xcassets/statusdownload.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { + "filename" : "statusdownload.png", "idiom" : "universal", - "scale" : "1x", - "filename" : "statusdownload.png" + "scale" : "1x" }, { + "filename" : "statusdownload@2x.png", "idiom" : "universal", - "scale" : "2x", - "filename" : "statusdownload@2x.png" + "scale" : "2x" }, { + "filename" : "statusdownload@3x.png", "idiom" : "universal", - "scale" : "3x", - "filename" : "statusdownload@3x.png" + "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/statuserror.imageset/Contents.json b/iOSClient/Images.xcassets/statuserror.imageset/Contents.json index 4e309f925..90c24b9a7 100644 --- a/iOSClient/Images.xcassets/statuserror.imageset/Contents.json +++ b/iOSClient/Images.xcassets/statuserror.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "statuserror.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "statuserror@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "statuserror@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/statusupload.imageset/Contents.json b/iOSClient/Images.xcassets/statusupload.imageset/Contents.json index a4cec8646..07cd780b3 100644 --- a/iOSClient/Images.xcassets/statusupload.imageset/Contents.json +++ b/iOSClient/Images.xcassets/statusupload.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { + "filename" : "statusupload.png", "idiom" : "universal", - "scale" : "1x", - "filename" : "statusupload.png" + "scale" : "1x" }, { + "filename" : "statusupload@2x.png", "idiom" : "universal", - "scale" : "2x", - "filename" : "statusupload@2x.png" + "scale" : "2x" }, { + "filename" : "statusupload@3x.png", "idiom" : "universal", - "scale" : "3x", - "filename" : "statusupload@3x.png" + "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/switchGrid.imageset/Contents.json b/iOSClient/Images.xcassets/switchGrid.imageset/Contents.json index d90cb82dc..b1304ea08 100644 --- a/iOSClient/Images.xcassets/switchGrid.imageset/Contents.json +++ b/iOSClient/Images.xcassets/switchGrid.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "switchGrid.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "switchGrid@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "switchGrid@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/switchList.imageset/Contents.json b/iOSClient/Images.xcassets/switchList.imageset/Contents.json index 0d7afc4e1..d0a70e20e 100644 --- a/iOSClient/Images.xcassets/switchList.imageset/Contents.json +++ b/iOSClient/Images.xcassets/switchList.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { - "idiom" : "universal", "filename" : "switchList.png", + "idiom" : "universal", "scale" : "1x" }, { - "idiom" : "universal", "filename" : "switchList@2x.png", + "idiom" : "universal", "scale" : "2x" }, { - "idiom" : "universal", "filename" : "switchList@3x.png", + "idiom" : "universal", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/taskCancelDownload.imageset/Contents.json b/iOSClient/Images.xcassets/taskCancelDownload.imageset/Contents.json index 64b7693a8..740de0b53 100644 --- a/iOSClient/Images.xcassets/taskCancelDownload.imageset/Contents.json +++ b/iOSClient/Images.xcassets/taskCancelDownload.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { + "filename" : "stoptask.png", "idiom" : "universal", - "scale" : "1x", - "filename" : "stoptask.png" + "scale" : "1x" }, { - "idiom" : "universal", "filename" : "stoptask@2x.png", + "idiom" : "universal", "scale" : "2x" }, { + "filename" : "stoptask@3x.png", "idiom" : "universal", - "scale" : "3x", - "filename" : "stoptask@3x.png" + "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/taskCancelUpload.imageset/Contents.json b/iOSClient/Images.xcassets/taskCancelUpload.imageset/Contents.json index 4713dbf4b..08d1ba722 100644 --- a/iOSClient/Images.xcassets/taskCancelUpload.imageset/Contents.json +++ b/iOSClient/Images.xcassets/taskCancelUpload.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { + "filename" : "removetask.png", "idiom" : "universal", - "scale" : "1x", - "filename" : "removetask.png" + "scale" : "1x" }, { - "idiom" : "universal", "filename" : "removetask@2x.png", + "idiom" : "universal", "scale" : "2x" }, { + "filename" : "removetask@3x.png", "idiom" : "universal", - "scale" : "3x", - "filename" : "removetask@3x.png" + "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/textRecognition.imageset/Contents.json b/iOSClient/Images.xcassets/textRecognition.imageset/Contents.json index c96175d0e..4fbfad753 100644 --- a/iOSClient/Images.xcassets/textRecognition.imageset/Contents.json +++ b/iOSClient/Images.xcassets/textRecognition.imageset/Contents.json @@ -1,12 +1,15 @@ { "images" : [ { - "idiom" : "universal", - "filename" : "textRecognition.png" + "filename" : "textRecognition.png", + "idiom" : "universal" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Images.xcassets/utorrent.imageset/Contents.json b/iOSClient/Images.xcassets/utorrent.imageset/Contents.json index 6f0c0cdf0..40f8f69ec 100644 --- a/iOSClient/Images.xcassets/utorrent.imageset/Contents.json +++ b/iOSClient/Images.xcassets/utorrent.imageset/Contents.json @@ -1,23 +1,26 @@ { "images" : [ { + "filename" : "utorrent.png", "idiom" : "universal", - "scale" : "1x", - "filename" : "utorrent.png" + "scale" : "1x" }, { - "idiom" : "universal", "filename" : "utorrent@2x.png", + "idiom" : "universal", "scale" : "2x" }, { + "filename" : "utorrent@3x.png", "idiom" : "universal", - "scale" : "3x", - "filename" : "utorrent@3x.png" + "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true } -}
\ No newline at end of file +} diff --git a/iOSClient/Login/NCAppConfigView.swift b/iOSClient/Login/NCAppConfigView.swift deleted file mode 100644 index 6eb28bab1..000000000 --- a/iOSClient/Login/NCAppConfigView.swift +++ /dev/null @@ -1,113 +0,0 @@ -// -// NCAppConfigView.swift -// Nextcloud -// -// Created by Marino Faggiana on 18/09/2019. -// Copyright © 2019 Marino Faggiana. All rights reserved. -// -// Author Marino Faggiana <marino.faggiana@nextcloud.com> -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see <http://www.gnu.org/licenses/>. -// - -import UIKit -import NCCommunication - -class NCAppConfigView: UIViewController { - - let appDelegate = UIApplication.shared.delegate as! AppDelegate - - private var serverUrl: String? - private var username: String? - private var password: String? - - @IBOutlet weak var logoImage: UIImageView! - @IBOutlet weak var titleLabel: UILabel! - - // MARK: - View Life Cycle - - override func viewDidLoad() { - super.viewDidLoad() - - self.view.backgroundColor = NCBrandColor.shared.brandElement - titleLabel.textColor = NCBrandColor.shared.brandText - - titleLabel.text = NSLocalizedString("_appconfig_view_title_", comment: "") - - if let serverConfig = UserDefaults.standard.dictionary(forKey: NCBrandConfiguration.shared.configuration_bundleId) { - serverUrl = serverConfig[NCBrandConfiguration.shared.configuration_serverUrl] as? String - username = serverConfig[NCBrandConfiguration.shared.configuration_username] as? String - password = serverConfig[NCBrandConfiguration.shared.configuration_password] as? String - } else { - serverUrl = UserDefaults.standard.string(forKey: NCBrandConfiguration.shared.configuration_serverUrl) - username = UserDefaults.standard.string(forKey: NCBrandConfiguration.shared.configuration_username) - password = UserDefaults.standard.string(forKey: NCBrandConfiguration.shared.configuration_password) - } - } - - override func viewDidAppear(_ animated: Bool) { - super.viewDidAppear(animated) - - // Stop timer error network - appDelegate.timerErrorNetworking?.invalidate() - - guard let serverUrl = self.serverUrl else { - NCContentPresenter.shared.messageNotification("_error_", description: "User Default, serverUrl not found", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError) - return - } - guard let username = self.username else { - NCContentPresenter.shared.messageNotification("_error_", description: "User Default, username not found", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError) - return - } - guard let password = self.password else { - NCContentPresenter.shared.messageNotification("_error_", description: "User Default, password not found", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError) - return - } - - NCCommunication.shared.getAppPassword(serverUrl: serverUrl, username: username, password: password, userAgent: nil) { token, errorCode, errorDescription in - DispatchQueue.main.async { - if errorCode == 0 && token != nil { - let account: String = "\(username) \(serverUrl)" - - // NO account found, clear - if NCManageDatabase.shared.getAccounts() == nil { NCUtility.shared.removeAllSettings() } - - // Add new account - NCManageDatabase.shared.deleteAccount(account) - NCManageDatabase.shared.addAccount(account, urlBase: serverUrl, user: username, password: token!) - - guard let tableAccount = NCManageDatabase.shared.setAccountActive(account) else { - NCContentPresenter.shared.messageNotification("_error_", description: "setAccountActive error", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError) - self.dismiss(animated: true, completion: nil) - return - } - - self.appDelegate.settingAccount(account, urlBase: serverUrl, user: username, userId: tableAccount.userId, password: token!) - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize) - - self.dismiss(animated: true) {} - } else { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) - } - } - } - } - - override func viewDidDisappear(_ animated: Bool) { - super.viewDidDisappear(animated) - - // Start timer error network - appDelegate.startTimerErrorNetworking() - } -} diff --git a/iOSClient/Login/NCLogin.storyboard b/iOSClient/Login/NCLogin.storyboard index ba9d28660..2ee73cae9 100644 --- a/iOSClient/Login/NCLogin.storyboard +++ b/iOSClient/Login/NCLogin.storyboard @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19162" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21225" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <device id="retina6_1" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19144"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21207"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> @@ -133,45 +133,5 @@ </objects> <point key="canvasLocation" x="5421.739130434783" y="-1210.0446428571429"/> </scene> - <!--App Config View--> - <scene sceneID="BeF-ke-GzC"> - <objects> - <viewController storyboardIdentifier="NCAppConfigView" id="Ak5-da-5qm" customClass="NCAppConfigView" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController"> - <view key="view" contentMode="scaleToFill" id="lrn-aT-NFz"> - <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <subviews> - <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="logo" translatesAutoresizingMaskIntoConstraints="NO" id="uEr-qx-rv2"> - <rect key="frame" x="79" y="389" width="256" height="128"/> - </imageView> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="898-PT-7ao"> - <rect key="frame" x="10" y="94" width="394" height="20.5"/> - <fontDescription key="fontDescription" type="system" pointSize="17"/> - <nil key="textColor"/> - <nil key="highlightedColor"/> - </label> - </subviews> - <viewLayoutGuide key="safeArea" id="x9O-1Y-Id9"/> - <color key="backgroundColor" red="0.0" green="0.50935935970000001" blue="0.78929150100000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> - <constraints> - <constraint firstItem="x9O-1Y-Id9" firstAttribute="trailing" secondItem="898-PT-7ao" secondAttribute="trailing" constant="10" id="6MT-gN-3XS"/> - <constraint firstItem="898-PT-7ao" firstAttribute="top" secondItem="x9O-1Y-Id9" secondAttribute="top" constant="50" id="Iks-eT-vBH"/> - <constraint firstItem="898-PT-7ao" firstAttribute="leading" secondItem="x9O-1Y-Id9" secondAttribute="leading" constant="10" id="S9I-wm-Vx0"/> - <constraint firstItem="uEr-qx-rv2" firstAttribute="centerX" secondItem="x9O-1Y-Id9" secondAttribute="centerX" id="aL5-QX-ULn"/> - <constraint firstItem="uEr-qx-rv2" firstAttribute="centerY" secondItem="x9O-1Y-Id9" secondAttribute="centerY" id="rrc-Gc-BmU"/> - </constraints> - </view> - <connections> - <outlet property="logoImage" destination="uEr-qx-rv2" id="g4x-Pf-mpw"/> - <outlet property="titleLabel" destination="898-PT-7ao" id="DjP-TA-Zqd"/> - </connections> - </viewController> - <placeholder placeholderIdentifier="IBFirstResponder" id="JhO-p5-bOq" userLabel="First Responder" sceneMemberID="firstResponder"/> - </objects> - <point key="canvasLocation" x="6386.9565217391309" y="-1214.0625"/> - </scene> </scenes> - <resources> - <image name="logo" width="256" height="128"/> - </resources> </document> diff --git a/iOSClient/Login/NCLogin.swift b/iOSClient/Login/NCLogin.swift index f648198e8..9354d4e1f 100644 --- a/iOSClient/Login/NCLogin.swift +++ b/iOSClient/Login/NCLogin.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate { @@ -96,22 +96,14 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate { certificate.isEnabled = false // navigation - if #available(iOS 13.0, *) { - let navBarAppearance = UINavigationBarAppearance() - navBarAppearance.configureWithTransparentBackground() - navBarAppearance.shadowColor = .clear - navBarAppearance.shadowImage = UIImage() - navBarAppearance.titleTextAttributes = [.foregroundColor: textColor] - navBarAppearance.largeTitleTextAttributes = [.foregroundColor: textColor] - self.navigationController?.navigationBar.standardAppearance = navBarAppearance - self.navigationController?.view.backgroundColor = NCBrandColor.shared.customer - } else { - self.navigationController?.navigationBar.isTranslucent = true - self.navigationController?.navigationBar.shadowImage = UIImage() - self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) - self.navigationController?.navigationBar.backgroundColor = .clear - self.navigationController?.navigationBar.barTintColor = NCBrandColor.shared.customer - } + let navBarAppearance = UINavigationBarAppearance() + navBarAppearance.configureWithTransparentBackground() + navBarAppearance.shadowColor = .clear + navBarAppearance.shadowImage = UIImage() + navBarAppearance.titleTextAttributes = [.foregroundColor: textColor] + navBarAppearance.largeTitleTextAttributes = [.foregroundColor: textColor] + self.navigationController?.navigationBar.standardAppearance = navBarAppearance + self.navigationController?.view.backgroundColor = NCBrandColor.shared.customer self.navigationController?.navigationBar.tintColor = textColor if NCManageDatabase.shared.getAccounts()?.count ?? 0 == 0 { @@ -215,20 +207,20 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate { loginButton.isEnabled = false - NCCommunication.shared.getServerStatus(serverUrl: url) { _, _, versionMajor, _, _, _, errorCode, errorDescription in + NextcloudKit.shared.getServerStatus(serverUrl: url) { _, _, versionMajor, _, _, _, _, error in - if errorCode == 0 { + if error == .success { if let host = URL(string: url)?.host { NCNetworking.shared.writeCertificate(host: host) } - NCCommunication.shared.getLoginFlowV2(serverUrl: url) { token, endpoint, login, errorCode, _ in + NextcloudKit.shared.getLoginFlowV2(serverUrl: url) { token, endpoint, login, data, error in self.loginButton.isEnabled = true // Login Flow V2 - if errorCode == 0 && NCBrandOptions.shared.use_loginflowv2 && token != nil && endpoint != nil && login != nil { + if error == .success && NCBrandOptions.shared.use_loginflowv2 && token != nil && endpoint != nil && login != nil { if let loginWeb = UIStoryboard(name: "NCLogin", bundle: nil).instantiateViewController(withIdentifier: "NCLoginWeb") as? NCLoginWeb { @@ -266,7 +258,7 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate { self.loginButton.isEnabled = true - if errorCode == NSURLErrorServerCertificateUntrusted { + if error.errorCode == NSURLErrorServerCertificateUntrusted { let alertController = UIAlertController(title: NSLocalizedString("_ssl_certificate_untrusted_", comment: ""), message: NSLocalizedString("_connect_server_anyway_", comment: ""), preferredStyle: .alert) @@ -292,7 +284,7 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate { } else { - let alertController = UIAlertController(title: NSLocalizedString("_connection_error_", comment: ""), message: errorDescription, preferredStyle: .alert) + let alertController = UIAlertController(title: NSLocalizedString("_connection_error_", comment: ""), message: error.errorDescription, preferredStyle: .alert) alertController.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default, handler: { _ in })) @@ -324,18 +316,18 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate { loginButton.isEnabled = false - NCCommunication.shared.checkServer(serverUrl: serverUrl) { errorCode, errorDescription in + NextcloudKit.shared.checkServer(serverUrl: serverUrl) { error in self.loginButton.isEnabled = true - self.standardLogin(url: urlBase, user: user, password: password, errorCode: errorCode, errorDescription: errorDescription) + self.standardLogin(url: urlBase, user: user, password: password, error: error) } } } } - func standardLogin(url: String, user: String, password: String, errorCode: Int, errorDescription: String) { + func standardLogin(url: String, user: String, password: String, error: NKError) { - if errorCode == 0 { + if error == .success { if let host = URL(string: url)?.host { NCNetworking.shared.writeCertificate(host: host) @@ -355,30 +347,20 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate { } if CCUtility.getIntro() { - - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize) self.dismiss(animated: true) - } else { - CCUtility.setIntro(true) - if self.presentingViewController == nil { - let viewController = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController() viewController?.modalPresentationStyle = .fullScreen - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize) self.appDelegate.window?.rootViewController = viewController self.appDelegate.window?.makeKey() - } else { - - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize) self.dismiss(animated: true) } } - } else if errorCode == NSURLErrorServerCertificateUntrusted { + } else if error.errorCode == NSURLErrorServerCertificateUntrusted { let alertController = UIAlertController(title: NSLocalizedString("_ssl_certificate_untrusted_", comment: ""), message: NSLocalizedString("_connect_server_anyway_", comment: ""), preferredStyle: .alert) @@ -400,7 +382,7 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate { } else { - let message = NSLocalizedString("_not_possible_connect_to_server_", comment: "") + ".\n" + errorDescription + let message = NSLocalizedString("_not_possible_connect_to_server_", comment: "") + ".\n" + error.errorDescription let alertController = UIAlertController(title: NSLocalizedString("_error_", comment: ""), message: message, preferredStyle: .alert) alertController.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default, handler: { _ in })) diff --git a/iOSClient/Login/NCLoginWeb.swift b/iOSClient/Login/NCLoginWeb.swift index 448b5de99..ce5565806 100644 --- a/iOSClient/Login/NCLoginWeb.swift +++ b/iOSClient/Login/NCLoginWeb.swift @@ -23,7 +23,7 @@ import UIKit import WebKit -import NCCommunication +import NextcloudKit import FloatingPanel class NCLoginWeb: UIViewController { @@ -33,12 +33,17 @@ class NCLoginWeb: UIViewController { let appDelegate = UIApplication.shared.delegate as! AppDelegate var titleView: String = "" - @objc var urlBase = "" + var urlBase = "" + + var configServerUrl: String? + var configUsername: String? + var configPassword: String? + var configAppPassword: String? - @objc var loginFlowV2Available = false - @objc var loginFlowV2Token = "" - @objc var loginFlowV2Endpoint = "" - @objc var loginFlowV2Login = "" + var loginFlowV2Available = false + var loginFlowV2Token = "" + var loginFlowV2Endpoint = "" + var loginFlowV2Login = "" // MARK: - View Life Cycle @@ -46,21 +51,32 @@ class NCLoginWeb: UIViewController { super.viewDidLoad() let accountCount = NCManageDatabase.shared.getAccounts()?.count ?? 0 - // TITLE - titleView = urlBase - if let host = URL(string: urlBase)?.host { - if let account = NCManageDatabase.shared.getActiveAccount(), CCUtility.getPassword(account.account).isEmpty { - titleView = NSLocalizedString("_user_", comment: "") + " " + account.userId + " " + NSLocalizedString("_in_", comment: "") + " " + host + + // load AppConfig + if (NCBrandOptions.shared.disable_multiaccount == false) || (NCBrandOptions.shared.disable_multiaccount == true && accountCount == 0) { + if let configurationManaged = UserDefaults.standard.dictionary(forKey: "com.apple.configuration.managed"), NCBrandOptions.shared.use_AppConfig { + + if let serverUrl = configurationManaged[NCGlobal.shared.configuration_serverUrl] as? String { + self.configServerUrl = serverUrl + } + if let username = configurationManaged[NCGlobal.shared.configuration_username] as? String, !username.isEmpty, username.lowercased() != "username" { + self.configUsername = username + } + if let password = configurationManaged[NCGlobal.shared.configuration_password] as? String, !password.isEmpty, password.lowercased() != "password" { + self.configPassword = password + } + if let apppassword = configurationManaged[NCGlobal.shared.configuration_apppassword] as? String, !apppassword.isEmpty, apppassword.lowercased() != "apppassword" { + self.configAppPassword = apppassword + } } } - self.title = titleView - if NCBrandOptions.shared.use_login_web_personalized && accountCount > 0 { + if (NCBrandOptions.shared.use_login_web_personalized || NCBrandOptions.shared.use_AppConfig) && accountCount > 0 { navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .stop, target: self, action: #selector(self.closeView(sender:))) } if accountCount > 0 { - navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "users")!.image(color: NCBrandColor.shared.label, size: 35), style: .plain, target: self, action: #selector(self.changeUser(sender:))) + navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "users")!.image(color: .label, size: 35), style: .plain, target: self, action: #selector(self.changeUser(sender:))) } let config = WKWebViewConfiguration() @@ -76,6 +92,26 @@ class NCLoginWeb: UIViewController { webView!.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = true webView!.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0).isActive = true + activityIndicator = UIActivityIndicatorView(style: .medium) + activityIndicator.center = self.view.center + activityIndicator.startAnimating() + + self.view.addSubview(activityIndicator) + + // AppConfig + if let serverUrl = configServerUrl { + if let username = self.configUsername, let password = configAppPassword { + activityIndicator.stopAnimating() + createAccount(server: serverUrl, username: username, password: password) + return + } else if let username = self.configUsername, let password = configPassword { + getAppPassword(serverUrl: serverUrl, username: username, password: password) + return + } else { + urlBase = serverUrl + } + } + // ADD end point for Web Flow if urlBase != NCBrandOptions.shared.linkloginPreferredProviders { if loginFlowV2Available { @@ -85,16 +121,21 @@ class NCLoginWeb: UIViewController { } } - activityIndicator = UIActivityIndicatorView(style: .gray) - activityIndicator.center = self.view.center - activityIndicator.startAnimating() - self.view.addSubview(activityIndicator) - if let url = URL(string: urlBase) { loadWebPage(webView: webView!, url: url) } else { - NCContentPresenter.shared.messageNotification("_error_", description: "_login_url_error_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError, priority: .max) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_login_url_error_") + NCContentPresenter.shared.showError(error: error, priority: .max) + } + + // TITLE + if let host = URL(string: urlBase)?.host { + titleView = host + if let account = NCManageDatabase.shared.getActiveAccount(), CCUtility.getPassword(account.account).isEmpty { + titleView = NSLocalizedString("_user_", comment: "") + " " + account.userId + " " + NSLocalizedString("_in_", comment: "") + " " + host + } } + self.title = titleView } override func viewDidAppear(_ animated: Bool) { @@ -103,16 +144,7 @@ class NCLoginWeb: UIViewController { // Stop timer error network appDelegate.timerErrorNetworking?.invalidate() - // ITMS-90076: Potential Loss of Keychain Access - if appDelegate.errorITMS90076, !CCUtility.getPresentErrorITMS90076() { - - let message = "\n" + NSLocalizedString("_ITMS-90076_", comment: "") - let alertController = UIAlertController(title: titleView, message: message, preferredStyle: .alert) - alertController.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default, handler: { _ in })) - present(alertController, animated: true, completion: { - CCUtility.setPresentErrorITMS90076(true) - }) - } else if let account = NCManageDatabase.shared.getActiveAccount(), CCUtility.getPassword(account.account).isEmpty { + if let account = NCManageDatabase.shared.getActiveAccount(), CCUtility.getPassword(account.account).isEmpty { let message = "\n" + NSLocalizedString("_password_not_present_", comment: "") let alertController = UIAlertController(title: titleView, message: message, preferredStyle: .alert) @@ -145,6 +177,19 @@ class NCLoginWeb: UIViewController { webView.load(request) } + + func getAppPassword(serverUrl: String, username: String, password: String) { + + NextcloudKit.shared.getAppPassword(serverUrl: serverUrl, username: username, password: password) { token, data, error in + self.activityIndicator.stopAnimating() + if error == .success, let password = token { + self.createAccount(server: serverUrl, username: username, password: password) + } else { + NCContentPresenter.shared.showError(error: error) + self.dismiss(animated: true, completion: nil) + } + } + } @objc func closeView(sender: UIBarButtonItem) { self.dismiss(animated: true, completion: nil) @@ -197,10 +242,6 @@ extension NCLoginWeb: WKNavigationDelegate { } } - func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) { - - } - func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) { var errorMessage = error.localizedDescription @@ -226,40 +267,7 @@ extension NCLoginWeb: WKNavigationDelegate { } func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { - decisionHandler(.allow) - - /* TEST NOT GOOD DON'T WORKS - - if let data = navigationAction.request.httpBody { - let str = String(decoding: data, as: UTF8.self) - print(str) - } - - guard let url = navigationAction.request.url else { - decisionHandler(.allow) - return - } - - if String(describing: url).hasPrefix(NCBrandOptions.shared.webLoginAutenticationProtocol) { - decisionHandler(.allow) - return - } else if navigationAction.request.httpMethod != "GET" || navigationAction.request.value(forHTTPHeaderField: "OCS-APIRequest") != nil { - decisionHandler(.allow) - return - } - - decisionHandler(.cancel) - - let language = NSLocale.preferredLanguages[0] as String - var request = URLRequest(url: url) - - request.setValue(CCUtility.getUserAgent(), forHTTPHeaderField: "User-Agent") - request.addValue("true", forHTTPHeaderField: "OCS-APIRequest") - request.addValue(language, forHTTPHeaderField: "Accept-Language") - - webView.load(request) - */ } func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) { @@ -272,8 +280,8 @@ extension NCLoginWeb: WKNavigationDelegate { if loginFlowV2Available { DispatchQueue.main.asyncAfter(deadline: .now() + 1) { - NCCommunication.shared.getLoginFlowV2Poll(token: self.loginFlowV2Token, endpoint: self.loginFlowV2Endpoint) { server, loginName, appPassword, errorCode, _ in - if errorCode == 0 && server != nil && loginName != nil && appPassword != nil { + NextcloudKit.shared.getLoginFlowV2Poll(token: self.loginFlowV2Token, endpoint: self.loginFlowV2Endpoint) { server, loginName, appPassword, data, error in + if error == .success && server != nil && loginName != nil && appPassword != nil { self.createAccount(server: server!, username: loginName!, password: appPassword!) } } @@ -312,17 +320,12 @@ extension NCLoginWeb: WKNavigationDelegate { appDelegate.settingAccount(account, urlBase: urlBase, user: username, userId: tableAccount.userId, password: password) if CCUtility.getIntro() { - - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize) self.dismiss(animated: true) - } else { - CCUtility.setIntro(true) if self.presentingViewController == nil { if let viewController = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController() { viewController.modalPresentationStyle = .fullScreen - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize) viewController.view.alpha = 0 appDelegate.window?.rootViewController = viewController appDelegate.window?.makeKeyAndVisible() @@ -331,7 +334,6 @@ extension NCLoginWeb: WKNavigationDelegate { } } } else { - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize) self.dismiss(animated: true) } } diff --git a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift index d4e593689..5cf32ca81 100644 --- a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift +++ b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift @@ -23,7 +23,7 @@ import UIKit import Realm -import NCCommunication +import NextcloudKit import EasyTipView class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UISearchResultsUpdating, UISearchControllerDelegate, UISearchBarDelegate, NCListCellDelegate, NCGridCellDelegate, NCSectionHeaderMenuDelegate, NCSectionFooterDelegate, UIAdaptivePresentationControllerDelegate, NCEmptyDataSetDelegate, UIContextMenuInteractionDelegate, NCAccountRequestDelegate, NCSelectableNavigationView { @@ -52,8 +52,8 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS private var autoUploadDirectory = "" internal var groupByField = "name" - internal var providers: [NCCSearchProvider]? - internal var searchResults: [NCCSearchResult]? + internal var providers: [NKSearchProvider]? + internal var searchResults: [NKSearchResult]? internal var listLayout: NCListLayout! internal var gridLayout: NCGridLayout! @@ -91,8 +91,8 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS collectionView.alwaysBounceVertical = true // Color - view.backgroundColor = NCBrandColor.shared.systemBackground - collectionView.backgroundColor = NCBrandColor.shared.systemBackground + view.backgroundColor = .systemBackground + collectionView.backgroundColor = .systemBackground refreshControl.tintColor = .gray if enableSearchBar { @@ -103,7 +103,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS searchController?.searchBar.delegate = self searchController?.searchBar.autocapitalizationType = .none navigationItem.searchController = searchController - navigationItem.hidesSearchBarWhenScrolling = false + navigationItem.hidesSearchBarWhenScrolling = true } // Cell @@ -155,7 +155,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS tipView = EasyTipView(text: NSLocalizedString("_tip_accountrequest_", comment: ""), preferences: preferences, delegate: self) // Notification - NotificationCenter.default.addObserver(self, selector: #selector(initialize(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitialize), object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(initialize), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitialize), object: nil) NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterChangeTheming), object: nil) } @@ -212,17 +212,17 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS if !appDelegate.isSearchingMode { reloadDataSourceNetwork() } + + //FIXME: iPAD PDF landscape mode iOS 16 + DispatchQueue.main.async { + self.collectionView?.collectionViewLayout.invalidateLayout() + } } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) - // TIP - if self is NCFiles, !NCBrandOptions.shared.disable_multiaccount, !NCBrandOptions.shared.disable_manage_account, self.serverUrl == NCUtilityFileSystem.shared.getHomeServer(account: appDelegate.account), let view = self.navigationItem.leftBarButtonItem?.customView { - if !NCManageDatabase.shared.tipExists(NCGlobal.shared.tipNCCollectionViewCommonAccountRequest), NCManageDatabase.shared.getAllAccountOrderAlias().count > 0 { - self.tipView?.show(forView: view) - } - } + showTip() } override func viewWillDisappear(_ animated: Bool) { @@ -267,6 +267,11 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS self.collectionView?.collectionViewLayout.invalidateLayout() self.collectionView?.reloadData() + self.tipView?.dismiss() + + coordinator.animate(alongsideTransition: nil) { _ in + self.showTip() + } } override var canBecomeFirstResponder: Bool { @@ -275,7 +280,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS // MARK: - NotificationCenter - @objc func initialize(_ notification: NSNotification) { + @objc func initialize() { guard !appDelegate.account.isEmpty else { return } // Search @@ -546,7 +551,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS else { return } guard let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) else { return } - if metadata.livePhoto && metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue { 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 { if sameSections && (indexPath.section < collectionView.numberOfSections && indexPath.row < collectionView.numberOfItems(inSection: indexPath.section)) { @@ -629,6 +634,17 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS } } + // MARK: - Tip + + func showTip() { + + if self is NCFiles, self.view.window != nil, !NCBrandOptions.shared.disable_multiaccount, !NCBrandOptions.shared.disable_manage_account, self.serverUrl == NCUtilityFileSystem.shared.getHomeServer(account: appDelegate.account), let view = self.navigationItem.leftBarButtonItem?.customView { + if !NCManageDatabase.shared.tipExists(NCGlobal.shared.tipNCCollectionViewCommonAccountRequest), NCManageDatabase.shared.getAllAccountOrderAlias().count > 0 { + self.tipView?.show(forView: view) + } + } + } + // MARK: - Layout @objc func setNavigationItem() { @@ -783,8 +799,6 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS NCNetworking.shared.cancelAllTask() appDelegate.settingAccount(activeAccount.account, urlBase: activeAccount.urlBase, user: activeAccount.user, userId: activeAccount.userId, password: CCUtility.getPassword(activeAccount.account)) - - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize) } } @@ -854,10 +868,8 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS func tapButton3(_ sender: Any) { - if #available(iOS 13.0, *) { - if let viewController = appDelegate.window?.rootViewController { - NCCreateScanDocument.shared.openScannerDocument(viewController: viewController) - } + if let viewController = appDelegate.window?.rootViewController { + NCCreateScanDocument.shared.openScannerDocument(viewController: viewController) } } @@ -921,7 +933,6 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS openMenuItems(with: nil, gestureRecognizer: gestureRecognizer) } - @available(iOS 13.0, *) func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? { return UIContextMenuConfiguration(identifier: nil, previewProvider: { @@ -1012,8 +1023,8 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS let serverVersionMajor = NCManageDatabase.shared.getCapabilitiesServerInt(account: appDelegate.account, elements: NCElementsJSON.shared.capabilitiesVersionMajor) if serverVersionMajor >= NCGlobal.shared.nextcloudVersion20 { - NCNetworking.shared.unifiedSearchFiles(urlBase: appDelegate, literal: literalSearch) { allProviders in - self.providers = allProviders + NCNetworking.shared.unifiedSearchFiles(userBaseUrl: appDelegate, literal: literalSearch) { account, searchProviders in + self.providers = searchProviders self.searchResults = [] self.dataSource = NCDataSource( metadatas: [] , @@ -1025,21 +1036,21 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS filterLivePhoto: true, providers: self.providers, searchResults: self.searchResults) - } update: { id, searchResult, metadatas in + } update: { account, id, searchResult, metadatas in guard let metadatas = metadatas, metadatas.count > 0, self.appDelegate.isSearchingMode , let searchResult = searchResult else { return } NCOperationQueue.shared.unifiedSearchAddSection(collectionViewCommon: self, metadatas: metadatas, searchResult: searchResult) - } completion: {errorCode, errorDescription in + } completion: { account, error in self.refreshControl.endRefreshing() self.isReloadDataSourceNetworkInProgress = false self.collectionView.reloadData() } } else { - NCNetworking.shared.searchFiles(urlBase: appDelegate, literal: literalSearch) { metadatas, errorCode, errorDescription in + NCNetworking.shared.searchFiles(urlBase: appDelegate, literal: literalSearch) { metadatas, error in DispatchQueue.main.async { self.refreshControl.endRefreshing() self.collectionView.reloadData() } - guard let metadatas = metadatas, errorCode == 0, self.appDelegate.isSearchingMode else { return } + guard let metadatas = metadatas, error == .success, self.appDelegate.isSearchingMode else { return } self.dataSource = NCDataSource( metadatas: metadatas, account: self.appDelegate.account, @@ -1063,10 +1074,10 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS metadataForSection.unifiedSearchInProgress = true self.collectionView?.reloadData() - NCNetworking.shared.unifiedSearchFilesProvider(urlBase: appDelegate, id: searchResult.id, term: term, limit: 5, cursor: cursor) { searchResult, metadatas, errorCode, errorDescription in + NCNetworking.shared.unifiedSearchFilesProvider(userBaseUrl: appDelegate, id: searchResult.id, term: term, limit: 5, cursor: cursor) { account, searchResult, metadatas, error in - if errorCode != 0 { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + if error != .success { + NCContentPresenter.shared.showError(error: error) } metadataForSection.unifiedSearchInProgress = false @@ -1079,13 +1090,13 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS } } - @objc func networkReadFolder(forced: Bool, completion: @escaping(_ tableDirectory: tableDirectory?, _ metadatas: [tableMetadata]?, _ metadatasUpdate: [tableMetadata]?, _ metadatasDelete: [tableMetadata]?, _ errorCode: Int, _ errorDescription: String) -> Void) { + @objc func networkReadFolder(forced: Bool, completion: @escaping(_ tableDirectory: tableDirectory?, _ metadatas: [tableMetadata]?, _ metadatasUpdate: [tableMetadata]?, _ metadatasDelete: [tableMetadata]?, _ error: NKError) -> Void) { var tableDirectory: tableDirectory? - NCNetworking.shared.readFile(serverUrlFileName: serverUrl) { (account, metadataFolder, errorCode, errorDescription) in - guard errorCode == 0 else { - completion(nil, nil, nil, nil, errorCode, errorDescription) + NCNetworking.shared.readFile(serverUrlFileName: serverUrl) { (account, metadataFolder, error) in + guard error == .success else { + completion(nil, nil, nil, nil, error) return } @@ -1093,32 +1104,34 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS tableDirectory = NCManageDatabase.shared.setDirectory(serverUrl: self.serverUrl, richWorkspace: metadataFolder.richWorkspace, account: account) } if forced || tableDirectory?.etag != metadataFolder?.etag || metadataFolder?.e2eEncrypted ?? false { - NCNetworking.shared.readFolder(serverUrl: self.serverUrl, account: self.appDelegate.account) { account, metadataFolder, metadatas, metadatasUpdate, _, metadatasDelete, errorCode, errorDescription in - guard errorCode == 0 else { - completion(tableDirectory, nil, nil, nil, errorCode, errorDescription) + NCNetworking.shared.readFolder(serverUrl: self.serverUrl, account: self.appDelegate.account) { account, metadataFolder, metadatas, metadatasUpdate, _, metadatasDelete, error in + guard error == .success else { + completion(tableDirectory, nil, nil, nil, error) return } self.metadataFolder = metadataFolder // E2EE if let metadataFolder = metadataFolder, metadataFolder.e2eEncrypted, CCUtility.isEnd(toEndEnabled: self.appDelegate.account) { - NCCommunication.shared.getE2EEMetadata(fileId: metadataFolder.ocId, e2eToken: nil) { account, e2eMetadata, errorCode, errorDescription in - if errorCode == 0, let e2eMetadata = e2eMetadata { + NextcloudKit.shared.getE2EEMetadata(fileId: metadataFolder.ocId, e2eToken: nil) { account, e2eMetadata, data, error in + if error == .success, let e2eMetadata = e2eMetadata { if NCEndToEndMetadata.shared.decoderMetadata(e2eMetadata, privateKey: CCUtility.getEndToEndPrivateKey(account), serverUrl: self.serverUrl, account: account, urlBase: self.appDelegate.urlBase) { self.reloadDataSource() } else { - NCContentPresenter.shared.messageNotification("_error_e2ee_", description: "_e2e_error_decode_metadata_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorDecodeMetadata) + let error = NKError(errorCode: NCGlobal.shared.errorDecodeMetadata, errorDescription: "_e2e_error_decode_metadata_") + NCContentPresenter.shared.messageNotification("_error_e2ee_", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error) } - } else if errorCode != NCGlobal.shared.errorResourceNotFound { - NCContentPresenter.shared.messageNotification("_error_e2ee_", description: "_e2e_error_decode_metadata_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorDecodeMetadata) + } else if error.errorCode != NCGlobal.shared.errorResourceNotFound { + let error = NKError(errorCode: NCGlobal.shared.errorDecodeMetadata, errorDescription: "_e2e_error_decode_metadata_") + NCContentPresenter.shared.messageNotification("_error_e2ee_", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error) } - completion(tableDirectory, metadatas, metadatasUpdate, metadatasDelete, errorCode, errorDescription) + completion(tableDirectory, metadatas, metadatasUpdate, metadatasDelete, error) } } else { - completion(tableDirectory, metadatas, metadatasUpdate, metadatasDelete, errorCode, errorDescription) + completion(tableDirectory, metadatas, metadatasUpdate, metadatasDelete, error) } } } else { - completion(tableDirectory, nil, nil, nil, 0, "") + completion(tableDirectory, nil, nil, nil, NKError()) } } } @@ -1272,7 +1285,8 @@ extension NCCollectionViewCommon: UICollectionViewDelegate { } if metadata.e2eEncrypted && !CCUtility.isEnd(toEndEnabled: appDelegate.account) { - NCContentPresenter.shared.messageNotification("_info_", description: "_e2e_goto_settings_for_enable_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorE2EENotEnabled) + let error = NKError(errorCode: NCGlobal.shared.errorE2EENotEnabled, errorDescription: "_e2e_goto_settings_for_enable_") + NCContentPresenter.shared.showInfo(error: error) return } @@ -1284,10 +1298,10 @@ extension NCCollectionViewCommon: UICollectionViewDelegate { let imageIcon = UIImage(contentsOfFile: CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag)) - if metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue { + if metadata.classFile == NKCommon.typeClassFile.image.rawValue || metadata.classFile == NKCommon.typeClassFile.video.rawValue || metadata.classFile == NKCommon.typeClassFile.audio.rawValue { var metadatas: [tableMetadata] = [] for metadata in metadataSourceForAllSections { - if metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue { + if metadata.classFile == NKCommon.typeClassFile.image.rawValue || metadata.classFile == NKCommon.typeClassFile.video.rawValue || metadata.classFile == NKCommon.typeClassFile.audio.rawValue { metadatas.append(metadata) } } @@ -1297,10 +1311,11 @@ extension NCCollectionViewCommon: UICollectionViewDelegate { if CCUtility.fileProviderStorageExists(metadata) { NCViewer.shared.view(viewController: self, metadata: metadata, metadatas: [metadata], imageIcon: imageIcon) - } else if NCCommunication.shared.isNetworkReachable() { - NCNetworking.shared.download(metadata: metadata, selector: NCGlobal.shared.selectorLoadFileView) { _ in } + } else if NextcloudKit.shared.isNetworkReachable() { + NCNetworking.shared.download(metadata: metadata, selector: NCGlobal.shared.selectorLoadFileView) { _, _ in } } else { - NCContentPresenter.shared.messageNotification("_info_", description: "_go_online_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorOffline) + let error = NKError(errorCode: NCGlobal.shared.errorOffline, errorDescription: "_go_online_") + NCContentPresenter.shared.showInfo(error: error) } } } @@ -1312,11 +1327,10 @@ extension NCCollectionViewCommon: UICollectionViewDelegate { navigationController?.pushViewController(viewController, animated: true) } - @available(iOS 13.0, *) func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? { guard let metadata = dataSource.cellForItemAt(indexPath: indexPath) else { return nil } - if isEditMode || metadata.classFile == NCCommunicationCommon.typeClassFile.url.rawValue { return nil } + if isEditMode || metadata.classFile == NKCommon.typeClassFile.url.rawValue { return nil } let identifier = indexPath as NSCopying var image: UIImage? @@ -1337,7 +1351,6 @@ extension NCCollectionViewCommon: UICollectionViewDelegate { }) } - @available(iOS 13.0, *) func collectionView(_ collectionView: UICollectionView, willPerformPreviewActionForMenuWith configuration: UIContextMenuConfiguration, animator: UIContextMenuInteractionCommitAnimating) { animator.addCompletion { @@ -1356,26 +1369,8 @@ extension NCCollectionViewCommon: UICollectionViewDataSource { // Thumbnail if !metadata.directory { if metadata.name == NCGlobal.shared.appName { - - let filePath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)! - let iconImagePath = CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag)! - - if FileManager().fileExists(atPath: iconImagePath) { - (cell as! NCCellProtocol).filePreviewImageView?.image = UIImage(contentsOfFile: CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag)) - } else if metadata.status > NCGlobal.shared.metadataStatusNormal && metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue && FileManager().fileExists(atPath: filePath) { - if let image = UIImage(contentsOfFile: filePath), let image = image.resizeImage(size: CGSize(width: NCGlobal.shared.sizeIcon, height: NCGlobal.shared.sizeIcon), isAspectRation: true), let data = image.jpegData(compressionQuality: 0.5) { - do { - try data.write(to: URL.init(fileURLWithPath: iconImagePath), options: .atomic) - (cell as! NCCellProtocol).filePreviewImageView?.image = image - } catch { } - } - } else if metadata.status > NCGlobal.shared.metadataStatusNormal && metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue && FileManager().fileExists(atPath: filePath) { - if let image = NCUtility.shared.imageFromVideo(url: URL(fileURLWithPath: filePath), at: 0), let image = image.resizeImage(size: CGSize(width: NCGlobal.shared.sizeIcon, height: NCGlobal.shared.sizeIcon), isAspectRation: true), let data = image.jpegData(compressionQuality: 0.5) { - do { - try data.write(to: URL.init(fileURLWithPath: iconImagePath), options: .atomic) - (cell as! NCCellProtocol).filePreviewImageView?.image = image - } catch { } - } + if let image = NCUtility.shared.createFilePreviewImage(ocId: metadata.ocId, etag: metadata.etag, fileNameView: metadata.fileNameView, classFile: metadata.classFile, status: metadata.status, createPreviewMedia: !metadata.hasPreview) { + (cell as! NCCellProtocol).filePreviewImageView?.image = image } else { NCOperationQueue.shared.downloadThumbnail(metadata: metadata, placeholder: true, cell: cell, view: collectionView) } @@ -1491,7 +1486,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource { cell.fileTitleLabel?.text = metadata.fileName cell.fileTitleLabel?.lineBreakMode = .byTruncatingTail if metadata.name == NCGlobal.shared.appName { - cell.fileInfoLabel?.text = NSLocalizedString("_in_", comment: "") + " " + NCUtilityFileSystem.shared.getPath(metadata: metadata, withFileName: false) + cell.fileInfoLabel?.text = NSLocalizedString("_in_", comment: "") + " " + NCUtilityFileSystem.shared.getPath(path: metadata.path, user: metadata.user) } else { cell.fileInfoLabel?.text = metadata.subline cell.titleInfoTrailingFull() @@ -1626,7 +1621,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource { } // URL - if metadata.classFile == NCCommunicationCommon.typeClassFile.url.rawValue { + if metadata.classFile == NKCommon.typeClassFile.url.rawValue { cell.fileLocalImage?.image = nil cell.hideButtonShare(true) cell.hideButtonMore(true) @@ -1667,7 +1662,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource { if appDelegate.isSearchingMode, let literalSearch = self.literalSearch, let title = cell.fileTitleLabel?.text { let longestWordRange = (title.lowercased() as NSString).range(of: literalSearch) let attributedString = NSMutableAttributedString(string: title, attributes: [NSAttributedString.Key.font : UIFont.systemFont(ofSize: 15)]) - attributedString.setAttributes([NSAttributedString.Key.font : UIFont.boldSystemFont(ofSize: 15), NSAttributedString.Key.foregroundColor : NCBrandColor.shared.annotationColor], range: longestWordRange) + attributedString.setAttributes([NSAttributedString.Key.font : UIFont.boldSystemFont(ofSize: 15), NSAttributedString.Key.foregroundColor : UIColor.systemBlue], range: longestWordRange) cell.fileTitleLabel?.attributedText = attributedString } return cell @@ -1694,7 +1689,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource { header.delegate = self if headerMenuButtonsCommand && !appDelegate.isSearchingMode { - header.setButtonsCommand(heigt: NCGlobal.shared.heightButtonsCommand, imageButton1: UIImage(named: "buttonAddImage"), titleButton1: NSLocalizedString("_upload_", comment: ""), imageButton2: UIImage(named: "buttonAddFolder"), titleButton2: NSLocalizedString("_folder_", comment: ""), imageButton3: UIImage(named: "buttonAddScan"), titleButton3: NSLocalizedString("_scan_", comment: "")) + header.setButtonsCommand(heigt: NCGlobal.shared.heightButtonsCommand, imageButton1: UIImage(named: "addImage"), titleButton1: NSLocalizedString("_upload_", comment: ""), imageButton2: UIImage(named: "folder"), titleButton2: NSLocalizedString("_create_folder_", comment: ""), imageButton3: UIImage(named: "scan"), titleButton3: NSLocalizedString("_scan_", comment: "")) } else { header.setButtonsCommand(heigt: 0) } @@ -1715,7 +1710,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource { } else { header.labelSection.text = self.dataSource.getSectionValueLocalization(indexPath: indexPath) } - header.labelSection.textColor = NCBrandColor.shared.label + header.labelSection.textColor = .label return header @@ -1724,7 +1719,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource { let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionHeader", for: indexPath) as! NCSectionHeader header.labelSection.text = self.dataSource.getSectionValueLocalization(indexPath: indexPath) - header.labelSection.textColor = NCBrandColor.shared.label + header.labelSection.textColor = .label return header } diff --git a/iOSClient/Main/Collection Common/NCGridCell.swift b/iOSClient/Main/Collection Common/NCGridCell.swift index 5c5522882..a0aa440e3 100644 --- a/iOSClient/Main/Collection Common/NCGridCell.swift +++ b/iOSClient/Main/Collection Common/NCGridCell.swift @@ -117,8 +117,8 @@ class NCGridCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto labelTitle.text = "" labelInfo.text = "" - labelTitle.textColor = NCBrandColor.shared.label - labelInfo.textColor = NCBrandColor.shared.systemGray + labelTitle.textColor = .label + labelInfo.textColor = .systemGray } override func prepareForReuse() { diff --git a/iOSClient/Main/Collection Common/NCListCell.swift b/iOSClient/Main/Collection Common/NCListCell.swift index 2e2a3aec7..f87710c97 100755 --- a/iOSClient/Main/Collection Common/NCListCell.swift +++ b/iOSClient/Main/Collection Common/NCListCell.swift @@ -134,13 +134,13 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto longPressedGestureMore.delaysTouchesBegan = true buttonMore.addGestureRecognizer(longPressedGestureMore) - separator.backgroundColor = NCBrandColor.shared.separator + separator.backgroundColor = .separator separatorHeightConstraint.constant = 0.5 labelTitle.text = "" labelInfo.text = "" - labelTitle.textColor = NCBrandColor.shared.label - labelInfo.textColor = NCBrandColor.shared.systemGray + labelTitle.textColor = .label + labelInfo.textColor = .systemGray } override func prepareForReuse() { diff --git a/iOSClient/Main/Collection Common/NCSelectableNavigationView.swift b/iOSClient/Main/Collection Common/NCSelectableNavigationView.swift index 77648ec13..b3d2291f5 100644 --- a/iOSClient/Main/Collection Common/NCSelectableNavigationView.swift +++ b/iOSClient/Main/Collection Common/NCSelectableNavigationView.swift @@ -22,7 +22,7 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. // -import NCCommunication +import NextcloudKit import Realm import UIKit @@ -106,7 +106,7 @@ extension NCSelectableNavigationView where Self: UIViewController { for ocId in selectOcId { guard let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) else { continue } selectedMetadatas.append(metadata) - if [NCCommunicationCommon.typeClassFile.image.rawValue, NCCommunicationCommon.typeClassFile.video.rawValue].contains(metadata.classFile) { + if [NKCommon.typeClassFile.image.rawValue, NKCommon.typeClassFile.video.rawValue].contains(metadata.classFile) { selectedMediaMetadatas.append(metadata) } if metadata.directory { isAnyFolder = true } diff --git a/iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift b/iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift index 3a32d1cf0..4bcf4ed7b 100644 --- a/iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift +++ b/iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift @@ -23,7 +23,7 @@ import UIKit import Queuer -import NCCommunication +import NextcloudKit import XLForm import Photos @@ -44,7 +44,7 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate { let targetSizeImagePreview = CGSize(width: 100, height: 100) let appDelegate = UIApplication.shared.delegate as! AppDelegate - var cellBackgoundColor = NCBrandColor.shared.secondarySystemGroupedBackground + var cellBackgoundColor = UIColor.secondarySystemGroupedBackground // MARK: - View Life Cycle @@ -79,9 +79,9 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate { self.title = NSLocalizedString("_upload_photos_videos_", comment: "") - view.backgroundColor = NCBrandColor.shared.systemGroupedBackground - tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground - cellBackgoundColor = NCBrandColor.shared.secondarySystemGroupedBackground + view.backgroundColor = .systemGroupedBackground + tableView.backgroundColor = .systemGroupedBackground + cellBackgoundColor = .secondarySystemGroupedBackground self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_cancel_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(cancel)) self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(save)) @@ -126,7 +126,7 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate { row.cellConfig["imageView.image"] = UIImage(named: "folder")!.image(color: NCBrandColor.shared.brandElement, size: 25) row.cellConfig["textLabel.textAlignment"] = NSTextAlignment.right.rawValue row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label + row.cellConfig["textLabel.textColor"] = UIColor.label section.addFormRow(row) @@ -136,7 +136,7 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate { row.cellConfig["backgroundColor"] = cellBackgoundColor row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label + row.cellConfig["textLabel.textColor"] = UIColor.label section.addFormRow(row) @@ -151,7 +151,7 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate { row.hidden = "$\("useFolderAutoUpload") == 0" row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label + row.cellConfig["textLabel.textColor"] = UIColor.label section.addFormRow(row) @@ -167,7 +167,7 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate { row.cellConfig["backgroundColor"] = cellBackgoundColor row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label + row.cellConfig["textLabel.textColor"] = UIColor.label section.addFormRow(row) @@ -179,7 +179,7 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate { row.cellConfig["backgroundColor"] = cellBackgoundColor row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label + row.cellConfig["textLabel.textColor"] = UIColor.label section.addFormRow(row) @@ -197,11 +197,11 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate { row.cellConfig["backgroundColor"] = cellBackgoundColor row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label + row.cellConfig["textLabel.textColor"] = UIColor.label row.cellConfig["textField.textAlignment"] = NSTextAlignment.right.rawValue row.cellConfig["textField.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textField.textColor"] = NCBrandColor.shared.label + row.cellConfig["textField.textColor"] = UIColor.label section.addFormRow(row) @@ -214,7 +214,7 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate { row.cellConfig["textView.backgroundColor"] = cellBackgoundColor row.cellConfig["textView.font"] = UIFont.systemFont(ofSize: 14.0) - row.cellConfig["textView.textColor"] = NCBrandColor.shared.label + row.cellConfig["textView.textColor"] = UIColor.label section.addFormRow(row) @@ -272,7 +272,8 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate { self.reloadFormRow(formRow) - NCContentPresenter.shared.messageNotification("_info_", description: "_forbidden_characters_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorCharactersForbidden) + let error = NKError(errorCode: NCGlobal.shared.errorCharactersForbidden, errorDescription: "_forbidden_characters_") + NCContentPresenter.shared.showInfo(error: error) } } @@ -338,7 +339,9 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate { if autoUploadPath == self.serverUrl { if !NCNetworking.shared.createFolder(assets: self.assets, selector: NCGlobal.shared.selectorUploadFile, useSubFolder: useSubFolder, account: self.appDelegate.account, urlBase: self.appDelegate.urlBase) { - NCContentPresenter.shared.messageNotification("_error_", description: "_error_createsubfolders_upload_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError) + + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_error_createsubfolders_upload_") + NCContentPresenter.shared.showError(error: error) return } } @@ -398,7 +401,7 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate { } else { - self.appDelegate.networkingProcessUpload?.createProcessUploads(metadatas: metadatasNOConflict) + self.appDelegate.networkingProcessUpload?.createProcessUploads(metadatas: metadatasNOConflict, completion: { _ in }) } DispatchQueue.main.async {self.dismiss(animated: true, completion: nil) } diff --git a/iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift b/iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift index 67d42110f..f114b90a8 100644 --- a/iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift +++ b/iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit import Photos @objc protocol NCCreateFormUploadConflictDelegate { @@ -79,10 +79,10 @@ extension NCCreateFormUploadConflictDelegate { tableView.allowsSelection = false tableView.tableFooterView = UIView() - view.backgroundColor = NCBrandColor.shared.systemGroupedBackground - tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground - viewSwitch.backgroundColor = NCBrandColor.shared.systemGroupedBackground - viewButton.backgroundColor = NCBrandColor.shared.systemGroupedBackground + view.backgroundColor = .systemGroupedBackground + tableView.backgroundColor = .systemGroupedBackground + viewSwitch.backgroundColor = .systemGroupedBackground + viewButton.backgroundColor = .systemGroupedBackground tableView.register(UINib(nibName: "NCCreateFormUploadConflictCell", bundle: nil), forCellReuseIdentifier: "Cell") @@ -105,9 +105,9 @@ extension NCCreateFormUploadConflictDelegate { buttonCancel.layer.masksToBounds = true buttonCancel.layer.borderWidth = 0.5 buttonCancel.layer.borderColor = UIColor.darkGray.cgColor - buttonCancel.backgroundColor = NCBrandColor.shared.systemGray5 + buttonCancel.backgroundColor = .systemGray5 buttonCancel.setTitle(NSLocalizedString("_cancel_", comment: ""), for: .normal) - buttonCancel.setTitleColor(NCBrandColor.shared.label, for: .normal) + buttonCancel.setTitleColor(.label, for: .normal) buttonContinue.layer.cornerRadius = 20 buttonContinue.layer.masksToBounds = true @@ -221,7 +221,8 @@ extension NCCreateFormUploadConflictDelegate { } switchAlreadyExistingFiles.isOn = true - NCContentPresenter.shared.messageNotification("_info_", description: "_file_not_rewite_doc_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorInternalError) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_file_not_rewite_doc_") + NCContentPresenter.shared.showInfo(error: error) } tableView.reloadData() @@ -409,7 +410,7 @@ extension NCCreateFormUploadConflict: UITableViewDataSource { } else if FileManager().fileExists(atPath: filePathNewFile) { do { - if metadataNewFile.classFile == NCCommunicationCommon.typeClassFile.image.rawValue { + if metadataNewFile.classFile == NKCommon.typeClassFile.image.rawValue { // preserver memory especially for very large files in Share extension if let image = UIImage.downsample(imageAt: URL(fileURLWithPath: filePathNewFile), to: cell.imageNewFile.frame.size) { cell.imageNewFile.image = image @@ -499,7 +500,7 @@ extension NCCreateFormUploadConflict: NCCreateFormUploadConflictCellDelegate { if result { buttonContinue.isEnabled = true - buttonContinue.setTitleColor(NCBrandColor.shared.label, for: .normal) + buttonContinue.setTitleColor(.label, for: .normal) } else { buttonContinue.isEnabled = false buttonContinue.setTitleColor(NCBrandColor.shared.gray, for: .normal) diff --git a/iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift b/iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift index 55f17283e..c42127c0d 100644 --- a/iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift +++ b/iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit import XLForm // MARK: - @@ -44,8 +44,8 @@ import XLForm var fileName = "" var fileNameExtension = "" var titleForm = "" - var listOfTemplate: [NCCommunicationEditorTemplates] = [] - var selectTemplate: NCCommunicationEditorTemplates? + var listOfTemplate: [NKEditorTemplates] = [] + var selectTemplate: NKEditorTemplates? // Layout let numItems = 2 @@ -65,9 +65,9 @@ import XLForm self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none - view.backgroundColor = NCBrandColor.shared.systemGroupedBackground - collectionView.backgroundColor = NCBrandColor.shared.systemGroupedBackground - tableView.backgroundColor = NCBrandColor.shared.secondarySystemGroupedBackground + view.backgroundColor = .systemGroupedBackground + collectionView.backgroundColor = .systemGroupedBackground + tableView.backgroundColor = .secondarySystemGroupedBackground let cancelButton: UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_cancel_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(cancel)) let saveButton: UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(save)) @@ -109,7 +109,7 @@ import XLForm row.cellConfig["textLabel.textAlignment"] = NSTextAlignment.right.rawValue row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label + row.cellConfig["textLabel.textColor"] = UIColor.label section.addFormRow(row) @@ -124,11 +124,11 @@ import XLForm row.cellConfig["textField.textAlignment"] = NSTextAlignment.right.rawValue row.cellConfig["textField.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textField.textColor"] = NCBrandColor.shared.label + row.cellConfig["textField.textColor"] = UIColor.label row.cellConfig["textLabel.textAlignment"] = NSTextAlignment.right.rawValue row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label + row.cellConfig["textLabel.textColor"] = UIColor.label section.addFormRow(row) @@ -183,16 +183,16 @@ import XLForm // name let name = cell.viewWithTag(200) as! UILabel name.text = template.name - name.textColor = NCBrandColor.shared.secondarySystemGroupedBackground + name.textColor = .secondarySystemGroupedBackground // select let imageSelect = cell.viewWithTag(300) as! UIImageView if selectTemplate != nil && selectTemplate?.name == template.name { - cell.backgroundColor = NCBrandColor.shared.label + cell.backgroundColor = .label imageSelect.image = UIImage(named: "plus100") imageSelect.isHidden = false } else { - cell.backgroundColor = NCBrandColor.shared.secondarySystemGroupedBackground + cell.backgroundColor = .secondarySystemGroupedBackground imageSelect.isHidden = true } @@ -263,7 +263,7 @@ import XLForm //Trim whitespaces after checks above fileNameForm = (fileNameForm as! String).trimmingCharacters(in: .whitespacesAndNewlines) - let result = NCCommunicationCommon.shared.getInternalType(fileName: fileNameForm as! String, mimeType: "", directory: false) + let result = NKCommon.shared.getInternalType(fileName: fileNameForm as! String, mimeType: "", directory: false) if NCUtility.shared.isDirectEditing(account: appDelegate.account, contentType: result.mimeType).count == 0 { fileNameForm = (fileNameForm as! NSString).deletingPathExtension + "." + fileNameExtension } @@ -311,23 +311,22 @@ import XLForm self.navigationItem.rightBarButtonItem?.isEnabled = false if self.editorId == NCGlobal.shared.editorText || self.editorId == NCGlobal.shared.editorOnlyoffice { - - var customUserAgent: String? - + + var options = NKRequestOptions() if self.editorId == NCGlobal.shared.editorOnlyoffice { - customUserAgent = NCUtility.shared.getCustomUserAgentOnlyOffice() + options = NKRequestOptions(customUserAgent: NCUtility.shared.getCustomUserAgentOnlyOffice()) } else if editorId == NCGlobal.shared.editorText { - customUserAgent = NCUtility.shared.getCustomUserAgentNCText() - } // else: use default - - NCCommunication.shared.NCTextCreateFile(fileNamePath: fileNamePath, editorId: editorId, creatorId: creatorId, templateId: templateIdentifier, customUserAgent: customUserAgent) { account, url, errorCode, errorMessage in - guard errorCode == 0, account == self.appDelegate.account, let url = url else { + options = NKRequestOptions(customUserAgent: NCUtility.shared.getCustomUserAgentNCText()) + } + + NextcloudKit.shared.NCTextCreateFile(fileNamePath: fileNamePath, editorId: editorId, creatorId: creatorId, templateId: templateIdentifier, options: options) { account, url, data, error in + guard error == .success, account == self.appDelegate.account, let url = url else { self.navigationItem.rightBarButtonItem?.isEnabled = true - NCContentPresenter.shared.messageNotification("_error_", description: errorMessage, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCContentPresenter.shared.showError(error: error) return } - var results = NCCommunicationCommon.shared.getInternalType(fileName: fileName, mimeType: "", directory: false) + var results = NKCommon.shared.getInternalType(fileName: fileName, mimeType: "", directory: false) //FIXME: iOS 12.0,* don't detect UTI text/markdown, text/x-markdown if results.mimeType.isEmpty { results.mimeType = "text/x-markdown" @@ -344,10 +343,10 @@ import XLForm if self.editorId == NCGlobal.shared.editorCollabora { - NCCommunication.shared.createRichdocuments(path: fileNamePath, templateId: templateIdentifier) { account, url, errorCode, errorDescription in - guard errorCode == 0, account == self.appDelegate.account, let url = url else { + NextcloudKit.shared.createRichdocuments(path: fileNamePath, templateId: templateIdentifier) { account, url, data, error in + guard error == .success, account == self.appDelegate.account, let url = url else { self.navigationItem.rightBarButtonItem?.isEnabled = true - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCContentPresenter.shared.showError(error: error) return } @@ -376,22 +375,22 @@ import XLForm if self.editorId == NCGlobal.shared.editorText || self.editorId == NCGlobal.shared.editorOnlyoffice { - var customUserAgent: String? + var options = NKRequestOptions() if self.editorId == NCGlobal.shared.editorOnlyoffice { - customUserAgent = NCUtility.shared.getCustomUserAgentOnlyOffice() + options = NKRequestOptions(customUserAgent: NCUtility.shared.getCustomUserAgentOnlyOffice()) } else if editorId == NCGlobal.shared.editorText { - customUserAgent = NCUtility.shared.getCustomUserAgentNCText() - } // else: use default + options = NKRequestOptions(customUserAgent: NCUtility.shared.getCustomUserAgentNCText()) + } - NCCommunication.shared.NCTextGetListOfTemplates(customUserAgent: customUserAgent) { account, templates, errorCode, _ in + NextcloudKit.shared.NCTextGetListOfTemplates(options: options) { account, templates, data, error in self.indicator.stopAnimating() - if errorCode == 0 && account == self.appDelegate.account { + if error == .success && account == self.appDelegate.account { for template in templates { - let temp = NCCommunicationEditorTemplates() + let temp = NKEditorTemplates() temp.identifier = template.identifier temp.ext = template.ext @@ -411,7 +410,7 @@ import XLForm if self.listOfTemplate.count == 0 { - let temp = NCCommunicationEditorTemplates() + let temp = NKEditorTemplates() temp.identifier = "" if self.editorId == NCGlobal.shared.editorText { @@ -440,15 +439,15 @@ import XLForm if self.editorId == NCGlobal.shared.editorCollabora { - NCCommunication.shared.getTemplatesRichdocuments(typeTemplate: typeTemplate) { account, templates, errorCode, _ in + NextcloudKit.shared.getTemplatesRichdocuments(typeTemplate: typeTemplate) { account, templates, data, error in self.indicator.stopAnimating() - if errorCode == 0 && account == self.appDelegate.account { + if error == .success && account == self.appDelegate.account { for template in templates! { - let temp = NCCommunicationEditorTemplates() + let temp = NKEditorTemplates() temp.identifier = "\(template.templateId)" temp.delete = template.delete @@ -470,7 +469,7 @@ import XLForm if self.listOfTemplate.count == 0 { - let temp = NCCommunicationEditorTemplates() + let temp = NKEditorTemplates() temp.identifier = "" if self.typeTemplate == NCGlobal.shared.templateDocument { @@ -499,18 +498,18 @@ import XLForm let fileNameLocalPath = String(CCUtility.getDirectoryUserData()) + "/" + name + ".png" - NCCommunication.shared.download(serverUrlFileName: preview, fileNameLocalPath: fileNameLocalPath, requestHandler: { _ in + NextcloudKit.shared.download(serverUrlFileName: preview, fileNameLocalPath: fileNameLocalPath, requestHandler: { _ in }, taskHandler: { _ in }, progressHandler: { _ in - }) { account, _, _, _, _, _, errorCode, _ in + }) { account, _, _, _, _, _, error in - if errorCode == 0 && account == self.appDelegate.account { + if error == .success && account == self.appDelegate.account { self.collectionView.reloadItems(at: [indexPath]) - } else if errorCode != 0 { - print("\(errorCode)") + } else if error != .success { + print("\(error.errorCode)") } else { print("[LOG] It has been changed user during networking process, error.") } diff --git a/iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift b/iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift index 08b7fdfe1..901361826 100644 --- a/iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift +++ b/iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift @@ -22,13 +22,12 @@ // import UIKit -import NCCommunication +import NextcloudKit import Vision import VisionKit import Photos import XLForm -@available(iOS 13.0, *) class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NCCreateFormUploadConflictDelegate { let appDelegate = UIApplication.shared.delegate as! AppDelegate @@ -47,7 +46,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC var password: String = "" var fileType = "PDF" - var cellBackgoundColor = NCBrandColor.shared.secondarySystemGroupedBackground + var cellBackgoundColor = UIColor.secondarySystemGroupedBackground // MARK: - View Life Cycle @@ -71,14 +70,14 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC self.title = NSLocalizedString("_save_settings_", comment: "") - view.backgroundColor = NCBrandColor.shared.systemGroupedBackground - tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground - cellBackgoundColor = NCBrandColor.shared.secondarySystemGroupedBackground + view.backgroundColor = .systemGroupedBackground + tableView.backgroundColor = .systemGroupedBackground + cellBackgoundColor = .secondarySystemGroupedBackground let saveButton: UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(save)) self.navigationItem.rightBarButtonItem = saveButton - NCUtility.shared.colorNavigationController(navigationController, backgroundColor: NCBrandColor.shared.systemBackground, titleColor: NCBrandColor.shared.label, tintColor: nil, withoutShadow: false) + NCUtility.shared.colorNavigationController(navigationController, backgroundColor: .systemBackground, titleColor: .label, tintColor: nil, withoutShadow: false) tableView.separatorStyle = UITableViewCell.SeparatorStyle.none @@ -118,7 +117,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC row.cellConfig["textLabel.textAlignment"] = NSTextAlignment.right.rawValue row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label + row.cellConfig["textLabel.textColor"] = UIColor.label section.addFormRow(row) @@ -140,7 +139,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC row.cellConfig["textLabel.textAlignment"] = NSTextAlignment.center.rawValue row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label + row.cellConfig["textLabel.textColor"] = UIColor.label section.addFormRow(row) @@ -153,11 +152,11 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC row.cellConfig["backgroundColor"] = cellBackgoundColor row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label + row.cellConfig["textLabel.textColor"] = UIColor.label row.cellConfig["textField.textAlignment"] = NSTextAlignment.right.rawValue row.cellConfig["textField.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textField.textColor"] = NCBrandColor.shared.label + row.cellConfig["textField.textColor"] = UIColor.label section.addFormRow(row) @@ -173,7 +172,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC row.cellConfig["imageView.image"] = UIImage(named: "textRecognition")!.image(color: NCBrandColor.shared.brandElement, size: 25) row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label + row.cellConfig["textLabel.textColor"] = UIColor.label section.addFormRow(row) @@ -193,7 +192,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC row.cellConfig["tintColor"] = NCBrandColor.shared.brandElement row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label + row.cellConfig["textLabel.textColor"] = UIColor.label section.addFormRow(row) @@ -202,11 +201,11 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC row.cellConfig["backgroundColor"] = cellBackgoundColor row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label + row.cellConfig["textLabel.textColor"] = UIColor.label row.cellConfig["textField.textAlignment"] = NSTextAlignment.right.rawValue row.cellConfig["textField.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textField.textColor"] = NCBrandColor.shared.label + row.cellConfig["textField.textColor"] = UIColor.label section.addFormRow(row) @@ -441,7 +440,9 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC guard let fileNameGenerateExport = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView) else { NCActivityIndicator.shared.stop() - NCContentPresenter.shared.messageNotification("_error_", description: "_error_creation_file_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorCreationFile) + + let error = NKError(errorCode: NCGlobal.shared.errorCreationFile, errorDescription: "_error_creation_file_") + NCContentPresenter.shared.showError(error: error) return } let fileUrl = URL(fileURLWithPath: fileNameGenerateExport) @@ -478,7 +479,8 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC try textFile.write(to: fileUrl, atomically: true, encoding: .utf8) } catch { NCActivityIndicator.shared.stop() - NCContentPresenter.shared.messageNotification("_error_", description: "_error_creation_file_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorCreationFile) + let error = NKError(errorCode: NCGlobal.shared.errorCreationFile, errorDescription: "_error_creation_file_") + NCContentPresenter.shared.showError(error: error) return } } @@ -560,7 +562,8 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC guard let data = image.jpegData(compressionQuality: CGFloat(0.5)) else { NCActivityIndicator.shared.stop() - NCContentPresenter.shared.messageNotification("_error_", description: "_error_creation_file_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorCreationFile) + let error = NKError(errorCode: NCGlobal.shared.errorCreationFile, errorDescription: "_error_creation_file_") + NCContentPresenter.shared.showError(error: error) return } @@ -568,7 +571,8 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC try data.write(to: fileUrl, options: .atomic) } catch { NCActivityIndicator.shared.stop() - NCContentPresenter.shared.messageNotification("_error_", description: "_error_creation_file_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorCreationFile) + let error = NKError(errorCode: NCGlobal.shared.errorCreationFile, errorDescription: "_error_creation_file_") + NCContentPresenter.shared.showError(error: error) return } } @@ -576,7 +580,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC NCActivityIndicator.shared.stop() - appDelegate.networkingProcessUpload?.createProcessUploads(metadatas: [metadata]) + appDelegate.networkingProcessUpload?.createProcessUploads(metadatas: [metadata], completion: { _ in }) // Request delete all image scanned let alertController = UIAlertController(title: "", message: NSLocalizedString("_delete_all_scanned_images_", comment: ""), preferredStyle: .alert) @@ -716,7 +720,6 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC } -@available(iOS 13.0, *) class NCCreateScanDocument: NSObject, VNDocumentCameraViewControllerDelegate { @objc static let shared: NCCreateScanDocument = { let instance = NCCreateScanDocument() diff --git a/iOSClient/Main/Create cloud/NCCreateFormUploadVoiceNote.swift b/iOSClient/Main/Create cloud/NCCreateFormUploadVoiceNote.swift index 874873027..36876db4e 100644 --- a/iOSClient/Main/Create cloud/NCCreateFormUploadVoiceNote.swift +++ b/iOSClient/Main/Create cloud/NCCreateFormUploadVoiceNote.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAudioPlayerDelegate, NCCreateFormUploadConflictDelegate { @@ -43,7 +43,7 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud private var audioPlayer: AVAudioPlayer! private var timer = Timer() - var cellBackgoundColor = NCBrandColor.shared.secondarySystemGroupedBackground + var cellBackgoundColor = UIColor.secondarySystemGroupedBackground // MARK: - View Life Cycle @@ -55,9 +55,9 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none - view.backgroundColor = NCBrandColor.shared.systemGroupedBackground - tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground - cellBackgoundColor = NCBrandColor.shared.secondarySystemGroupedBackground + view.backgroundColor = .systemGroupedBackground + tableView.backgroundColor = .systemGroupedBackground + cellBackgoundColor = .secondarySystemGroupedBackground self.title = NSLocalizedString("_voice_memo_title_", comment: "") @@ -69,8 +69,8 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud progressView.progressTintColor = .green progressView.trackTintColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) - labelTimer.textColor = NCBrandColor.shared.label - labelDuration.textColor = NCBrandColor.shared.label + labelTimer.textColor = .label + labelDuration.textColor = .label initializeForm() } @@ -135,7 +135,7 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud row.cellConfig["textLabel.textAlignment"] = NSTextAlignment.right.rawValue row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label + row.cellConfig["textLabel.textColor"] = UIColor.label section.addFormRow(row) @@ -149,11 +149,11 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud row.cellConfig["backgroundColor"] = cellBackgoundColor row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label + row.cellConfig["textLabel.textColor"] = UIColor.label row.cellConfig["textField.textAlignment"] = NSTextAlignment.right.rawValue row.cellConfig["textField.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textField.textColor"] = NCBrandColor.shared.label + row.cellConfig["textField.textColor"] = UIColor.label section.addFormRow(row) @@ -261,7 +261,7 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud CCUtility.copyFile(atPath: self.fileNamePath, toPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)) - appDelegate.networkingProcessUpload?.createProcessUploads(metadatas: [metadata]) + appDelegate.networkingProcessUpload?.createProcessUploads(metadatas: [metadata], completion: { _ in }) self.dismiss(animated: true, completion: nil) } diff --git a/iOSClient/Main/Main.storyboard b/iOSClient/Main/Main.storyboard index 5ba228a39..198b9154f 100644 --- a/iOSClient/Main/Main.storyboard +++ b/iOSClient/Main/Main.storyboard @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="FkP-Lh-8zt"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21225" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="FkP-Lh-8zt"> <device id="retina6_1" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17126"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21207"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <scenes> @@ -45,11 +45,11 @@ <!--File--> <scene sceneID="dMv-43-hWy"> <objects> - <navigationController extendedLayoutIncludesOpaqueBars="YES" automaticallyAdjustsScrollViewInsets="NO" id="bSZ-tE-FEj" customClass="NCMainNavigationController" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController"> + <navigationController extendedLayoutIncludesOpaqueBars="YES" automaticallyAdjustsScrollViewInsets="NO" id="bSZ-tE-FEj" sceneMemberID="viewController"> <tabBarItem key="tabBarItem" title="File" id="Zxv-aS-HGF"/> <toolbarItems/> <navigationBar key="navigationBar" contentMode="scaleToFill" largeTitles="YES" id="cj6-rT-wnB"> - <rect key="frame" x="0.0" y="44" width="414" height="96"/> + <rect key="frame" x="0.0" y="48" width="414" height="96"/> <autoresizingMask key="autoresizingMask"/> </navigationBar> <nil name="viewControllers"/> @@ -64,11 +64,11 @@ <!--Favorites--> <scene sceneID="YSr-JF-a0V"> <objects> - <navigationController extendedLayoutIncludesOpaqueBars="YES" automaticallyAdjustsScrollViewInsets="NO" id="hwM-4d-Afb" customClass="NCMainNavigationController" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController"> + <navigationController extendedLayoutIncludesOpaqueBars="YES" automaticallyAdjustsScrollViewInsets="NO" id="hwM-4d-Afb" sceneMemberID="viewController"> <tabBarItem key="tabBarItem" title="Favorites" id="o09-67-hwf"/> <toolbarItems/> <navigationBar key="navigationBar" contentMode="scaleToFill" largeTitles="YES" id="MJw-Bn-5le"> - <rect key="frame" x="0.0" y="44" width="414" height="96"/> + <rect key="frame" x="0.0" y="48" width="414" height="96"/> <autoresizingMask key="autoresizingMask"/> </navigationBar> <nil name="viewControllers"/> @@ -83,11 +83,11 @@ <!--Media--> <scene sceneID="IuY-Iu-oAm"> <objects> - <navigationController extendedLayoutIncludesOpaqueBars="YES" automaticallyAdjustsScrollViewInsets="NO" id="Npr-vu-PSD" customClass="NCMainNavigationController" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController"> + <navigationController extendedLayoutIncludesOpaqueBars="YES" automaticallyAdjustsScrollViewInsets="NO" id="Npr-vu-PSD" sceneMemberID="viewController"> <tabBarItem key="tabBarItem" title="Media" id="5cw-bP-7It"/> <toolbarItems/> <navigationBar key="navigationBar" contentMode="scaleToFill" largeTitles="YES" id="ixg-Pw-TNO"> - <rect key="frame" x="0.0" y="44" width="414" height="96"/> + <rect key="frame" x="0.0" y="48" width="414" height="96"/> <autoresizingMask key="autoresizingMask"/> </navigationBar> <nil name="viewControllers"/> @@ -99,14 +99,14 @@ </objects> <point key="canvasLocation" x="7771" y="327"/> </scene> - <!--Main Navigation Controller--> + <!--Navigation Controller--> <scene sceneID="cip-AF-Ks2"> <objects> - <navigationController extendedLayoutIncludesOpaqueBars="YES" automaticallyAdjustsScrollViewInsets="NO" id="Cc7-4O-z6Q" customClass="NCMainNavigationController" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController"> + <navigationController extendedLayoutIncludesOpaqueBars="YES" automaticallyAdjustsScrollViewInsets="NO" id="Cc7-4O-z6Q" sceneMemberID="viewController"> <tabBarItem key="tabBarItem" enabled="NO" title="" image="tabBarPlus" id="vIy-cM-ojV"/> <toolbarItems/> <navigationBar key="navigationBar" contentMode="scaleToFill" largeTitles="YES" id="jCU-so-Np6"> - <rect key="frame" x="0.0" y="44" width="414" height="96"/> + <rect key="frame" x="0.0" y="48" width="414" height="96"/> <autoresizingMask key="autoresizingMask"/> </navigationBar> <nil name="viewControllers"/> @@ -118,11 +118,11 @@ <!--More--> <scene sceneID="4RE-f1-SKU"> <objects> - <navigationController extendedLayoutIncludesOpaqueBars="YES" automaticallyAdjustsScrollViewInsets="NO" id="1Z8-Bx-Dqo" customClass="NCMainNavigationController" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController"> + <navigationController extendedLayoutIncludesOpaqueBars="YES" automaticallyAdjustsScrollViewInsets="NO" id="1Z8-Bx-Dqo" sceneMemberID="viewController"> <tabBarItem key="tabBarItem" title="More" id="U4f-qS-cgh"/> <toolbarItems/> <navigationBar key="navigationBar" contentMode="scaleToFill" largeTitles="YES" id="yVo-p8-ApS"> - <rect key="frame" x="0.0" y="44" width="414" height="96"/> + <rect key="frame" x="0.0" y="48" width="414" height="96"/> <autoresizingMask key="autoresizingMask"/> </navigationBar> <nil name="viewControllers"/> diff --git a/iOSClient/Main/NCFunctionCenter.swift b/iOSClient/Main/NCFunctionCenter.swift index f9ed5fa79..ce18d786b 100644 --- a/iOSClient/Main/NCFunctionCenter.swift +++ b/iOSClient/Main/NCFunctionCenter.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit import Queuer import JGProgressHUD import SVGKit @@ -47,15 +47,14 @@ import Photos guard let userInfo = notification.userInfo as NSDictionary?, let ocId = userInfo["ocId"] as? String, let selector = userInfo["selector"] as? String, - let errorCode = userInfo["errorCode"] as? Int, - let errorDescription = userInfo["errorDescription"] as? String, + let error = userInfo["error"] as? NKError, let account = userInfo["account"] as? String, account == appDelegate.account else { return } - guard errorCode == 0 else { + guard error == .success else { // File do not exists on server, remove in local - if errorCode == NCGlobal.shared.errorResourceNotFound || errorCode == NCGlobal.shared.errorBadServerResponse { + if error.errorCode == NCGlobal.shared.errorResourceNotFound || error.errorCode == NCGlobal.shared.errorBadServerResponse { do { try FileManager.default.removeItem(atPath: CCUtility.getDirectoryProviderStorageOcId(ocId)) } catch { } @@ -63,7 +62,7 @@ import Photos NCManageDatabase.shared.deleteLocalFile(predicate: NSPredicate(format: "ocId == %@", ocId)) } else { - NCContentPresenter.shared.messageNotification("_download_file_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + NCContentPresenter.shared.messageNotification("_download_file_", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) } return } @@ -73,21 +72,15 @@ import Photos case NCGlobal.shared.selectorLoadFileQuickLook: let fileNamePath = NSTemporaryDirectory() + metadata.fileNameView CCUtility.copyFile(atPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView), toPath: fileNamePath) - - var editingMode = false - if #available(iOS 13.0, *) { - editingMode = true - } - - let viewerQuickLook = NCViewerQuickLook(with: URL(fileURLWithPath: fileNamePath), isEditingEnabled: editingMode, metadata: metadata) + let viewerQuickLook = NCViewerQuickLook(with: URL(fileURLWithPath: fileNamePath), isEditingEnabled: true, metadata: metadata) self.appDelegate.window?.rootViewController?.present(viewerQuickLook, animated: true) case NCGlobal.shared.selectorLoadFileView: - guard UIApplication.shared.applicationState == UIApplication.State.active else { break } + guard UIApplication.shared.applicationState == .active else { break } if metadata.contentType.contains("opendocument") && !NCUtility.shared.isRichDocument(metadata) { self.openDocumentController(metadata: metadata) - } else if metadata.classFile == NCCommunicationCommon.typeClassFile.compress.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.unknow.rawValue { + } else if metadata.classFile == NKCommon.typeClassFile.compress.rawValue || metadata.classFile == NKCommon.typeClassFile.unknow.rawValue { self.openDocumentController(metadata: metadata) } else { if let viewController = self.appDelegate.activeViewController { @@ -97,7 +90,7 @@ import Photos } case NCGlobal.shared.selectorOpenIn: - if UIApplication.shared.applicationState == UIApplication.State.active { + if UIApplication.shared.applicationState == .active { self.openDocumentController(metadata: metadata) } @@ -151,9 +144,9 @@ import Photos NCManageDatabase.shared.setDirectory(serverUrl: serverUrl, offline: true, account: self.appDelegate.account) NCOperationQueue.shared.synchronizationMetadata(metadata, selector: NCGlobal.shared.selectorDownloadAllFile) } else { - NCNetworking.shared.download(metadata: metadata, selector: NCGlobal.shared.selectorLoadOffline) { _ in } + NCNetworking.shared.download(metadata: metadata, selector: NCGlobal.shared.selectorLoadOffline) { _, _ in } if let metadataLivePhoto = NCManageDatabase.shared.getMetadataLivePhoto(metadata: metadata) { - NCNetworking.shared.download(metadata: metadataLivePhoto, selector: NCGlobal.shared.selectorLoadOffline) { _ in } + NCNetworking.shared.download(metadata: metadataLivePhoto, selector: NCGlobal.shared.selectorLoadOffline) { _, _ in } } } } @@ -163,14 +156,13 @@ import Photos @objc func uploadedFile(_ notification: NSNotification) { guard let userInfo = notification.userInfo as NSDictionary?, - let errorCode = userInfo["errorCode"] as? Int, - let errorDescription = userInfo["errorDescription"] as? String, + let error = userInfo["error"] as? NKError, let account = userInfo["account"] as? String, account == appDelegate.account else { return } - if errorCode != 0, errorCode != -999, errorDescription != "" { - NCContentPresenter.shared.messageNotification("_upload_file_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + if error != .success, error.errorCode != NSURLErrorCancelled, error.errorCode != NCGlobal.shared.errorRequestExplicityCancelled { + NCContentPresenter.shared.messageNotification("_upload_file_", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) } } @@ -180,9 +172,9 @@ import Photos let serverUrlFileName = metadata.serverUrl + "/" + metadata.fileName NCActivityIndicator.shared.start(backgroundView: viewController.view) - NCNetworking.shared.readFile(serverUrlFileName: serverUrlFileName, queue: .main) { account, metadata, errorCode, errorDescription in + NCNetworking.shared.readFile(serverUrlFileName: serverUrlFileName, queue: .main) { account, metadata, error in NCActivityIndicator.shared.stop() - if let metadata = metadata, errorCode == 0 { + if let metadata = metadata, error == .success { let shareNavigationController = UIStoryboard(name: "NCShare", bundle: nil).instantiateInitialViewController() as! UINavigationController let shareViewController = shareNavigationController.topViewController as! NCSharePaging @@ -201,11 +193,11 @@ import Photos if CCUtility.fileProviderStorageExists(metadata) { - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDownloadedFile, userInfo: ["ocId": metadata.ocId, "selector": selector, "errorCode": 0, "errorDescription": "", "account": metadata.account]) + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDownloadedFile, userInfo: ["ocId": metadata.ocId, "selector": selector, "error": NKError(), "account": metadata.account]) } else { - NCNetworking.shared.download(metadata: metadata, selector: selector) { _ in } + NCNetworking.shared.download(metadata: metadata, selector: selector) { _, _ in } } } @@ -234,7 +226,7 @@ import Photos let processor = ParallelWorker(n: 5, titleKey: "_downloading_", totalTasks: downloadMetadata.count, hudView: self.appDelegate.window?.rootViewController?.view) for (metadata, url) in downloadMetadata { processor.execute { completion in - NCNetworking.shared.download(metadata: metadata, selector: "", completion: { _ in + NCNetworking.shared.download(metadata: metadata, selector: "", completion: { _, _ in if CCUtility.fileProviderStorageExists(metadata) { items.append(url) } completion() }) @@ -276,7 +268,7 @@ import Photos let printController = UIPrintInteractionController.shared let printInfo = UIPrintInfo(dictionary: nil) printInfo.jobName = fileNameURL.lastPathComponent - printInfo.outputType = metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue ? .photo : .general + printInfo.outputType = metadata.classFile == NKCommon.typeClassFile.image.rawValue ? .photo : .general printController.printInfo = printInfo printController.showsNumberOfCopies = true @@ -313,14 +305,16 @@ import Photos NCAskAuthorization.shared.askAuthorizationPhotoLibrary(viewController: appDelegate.mainTabBar?.window?.rootViewController) { hasPermission in guard hasPermission else { - return NCContentPresenter.shared.messageNotification("_access_photo_not_enabled_", description: "_access_photo_not_enabled_msg_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorFileNotSaved) + let error = NKError(errorCode: NCGlobal.shared.errorFileNotSaved, errorDescription: "_access_photo_not_enabled_msg_") + return NCContentPresenter.shared.messageNotification("_access_photo_not_enabled_", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error) } - if metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue, let image = UIImage(contentsOfFile: fileNamePath) { + if metadata.classFile == NKCommon.typeClassFile.image.rawValue, let image = UIImage(contentsOfFile: fileNamePath) { UIImageWriteToSavedPhotosAlbum(image, self, #selector(self.saveAlbum(_:didFinishSavingWithError:contextInfo:)), nil) - } else if metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue, UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(fileNamePath) { + } else if metadata.classFile == NKCommon.typeClassFile.video.rawValue, UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(fileNamePath) { UISaveVideoAtPathToSavedPhotosAlbum(fileNamePath, self, #selector(self.saveAlbum(_:didFinishSavingWithError:contextInfo:)), nil) } else { - NCContentPresenter.shared.messageNotification("_save_selected_files_", description: "_file_not_saved_cameraroll_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorFileNotSaved) + let error = NKError(errorCode: NCGlobal.shared.errorFileNotSaved, errorDescription: "_file_not_saved_cameraroll_") + NCContentPresenter.shared.messageNotification("_save_selected_files_", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error) } } } @@ -328,7 +322,8 @@ import Photos @objc private func saveAlbum(_ image: UIImage, didFinishSavingWithError error: Error?, contextInfo: UnsafeRawPointer) { if error != nil { - NCContentPresenter.shared.messageNotification("_save_selected_files_", description: "_file_not_saved_cameraroll_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorFileNotSaved) + let error = NKError(errorCode: NCGlobal.shared.errorFileNotSaved, errorDescription: "_file_not_saved_cameraroll_") + NCContentPresenter.shared.messageNotification("_save_selected_files_", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error) } } @@ -411,7 +406,7 @@ import Photos for metadata in downloadMetadatas { parallelizer.execute { completion in - NCNetworking.shared.download(metadata: metadata, selector: "") { _ in completion() } + NCNetworking.shared.download(metadata: metadata, selector: "") { _, _ in completion() } } } parallelizer.completeWork { @@ -421,28 +416,32 @@ import Photos } } - func upload(fileName: String, serverUrlFileName: String, fileNameLocalPath: String, serverUrl: String, completion: @escaping () -> Void) { - NCCommunication.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath) { _ in - } progressHandler: { progress in - } completionHandler: { account, ocId, etag, _, _, _, errorCode, errorDescription in - if errorCode == 0 && etag != nil && ocId != nil { - let toPath = CCUtility.getDirectoryProviderStorageOcId(ocId!, fileNameView: fileName)! - NCUtilityFileSystem.shared.moveFile(atPath: fileNameLocalPath, toPath: toPath) - NCManageDatabase.shared.addLocalFile(account: account, etag: etag!, ocId: ocId!, fileName: fileName) - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSourceNetworkForced, userInfo: ["serverUrl": serverUrl]) - } else { - NCContentPresenter.shared.showError(description: errorDescription, errorCode: errorCode) - } - completion() - } - } - func pastePasteboard(serverUrl: String) { let parallelizer = ParallelWorker(n: 5, titleKey: "_uploading_", totalTasks: nil, hudView: appDelegate.window?.rootViewController?.view) + func uploadPastePasteboard(fileName: String, serverUrlFileName: String, fileNameLocalPath: String, serverUrl: String, completion: @escaping () -> Void) { + NextcloudKit.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath) { request in + NCNetworking.shared.uploadRequest[fileNameLocalPath] = request + } progressHandler: { progress in + } completionHandler: { account, ocId, etag, _, _, _, afError, error in + NCNetworking.shared.uploadRequest.removeValue(forKey: fileNameLocalPath) + if error == .success && etag != nil && ocId != nil { + let toPath = CCUtility.getDirectoryProviderStorageOcId(ocId!, fileNameView: fileName)! + NCUtilityFileSystem.shared.moveFile(atPath: fileNameLocalPath, toPath: toPath) + NCManageDatabase.shared.addLocalFile(account: account, etag: etag!, ocId: ocId!, fileName: fileName) + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSourceNetworkForced, userInfo: ["serverUrl": serverUrl]) + } else if afError?.isExplicitlyCancelledError ?? false { + print("cancel") + } else { + NCContentPresenter.shared.showError(error: error) + } + completion() + } + } + for (index, items) in UIPasteboard.general.items.enumerated() { for item in items { - let results = NCCommunicationCommon.shared.getFileProperties(inUTI: item.key as CFString) + let results = NKCommon.shared.getFileProperties(inUTI: item.key as CFString) guard !results.ext.isEmpty, let data = UIPasteboard.general.data(forPasteboardType: item.key, inItemSet: IndexSet([index]))?.first else { continue } @@ -452,7 +451,7 @@ import Photos let fileNameLocalPath = CCUtility.getDirectoryProviderStorageOcId(ocIdUpload, fileNameView: fileName)! do { try data.write(to: URL(fileURLWithPath: fileNameLocalPath)) } catch { continue } parallelizer.execute { completion in - self.upload(fileName: fileName, serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, serverUrl: serverUrl, completion: completion) + uploadPastePasteboard(fileName: fileName, serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, serverUrl: serverUrl, completion: completion) } } } @@ -461,16 +460,20 @@ import Photos // MARK: - - func openFileViewInFolder(serverUrl: String, fileNameBlink: String?) { + func openFileViewInFolder(serverUrl: String, fileNameBlink: String?, fileNameOpen: String?) { + appDelegate.isSearchingMode = false + DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { var topNavigationController: UINavigationController? var pushServerUrl = NCUtilityFileSystem.shared.getHomeServer(account: self.appDelegate.account) - var mostViewController = UIApplication.shared.keyWindow!.rootViewController!.topMostViewController() + guard var mostViewController = self.appDelegate.window?.rootViewController?.topMostViewController() else { return } if mostViewController.isModal { mostViewController.dismiss(animated: false) - mostViewController = UIApplication.shared.keyWindow!.rootViewController!.topMostViewController() + if let viewController = self.appDelegate.window?.rootViewController?.topMostViewController() { + mostViewController = viewController + } } mostViewController.navigationController?.popToRootViewController(animated: false) @@ -484,6 +487,7 @@ import Photos if pushServerUrl == serverUrl { let viewController = topNavigationController?.topViewController as? NCFiles viewController?.blinkCell(fileName: fileNameBlink) + viewController?.openFile(fileName: fileNameOpen) return } guard let topNavigationController = topNavigationController else { return } @@ -501,6 +505,7 @@ import Photos viewController.titleCurrentFolder = String(dir) if pushServerUrl == serverUrl { viewController.fileNameBlink = fileNameBlink + viewController.fileNameOpen = fileNameOpen } self.appDelegate.listFilesVC[serverUrl] = viewController @@ -582,7 +587,6 @@ import Photos // MARK: - Context Menu Configuration - @available(iOS 13.0, *) func contextMenuConfiguration(ocId: String, viewController: UIViewController, enableDeleteLocal: Bool, enableViewInFolder: Bool, image: UIImage?) -> UIMenu { guard let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) else { @@ -618,8 +622,9 @@ import Photos let copyPath = UIAction(title: NSLocalizedString("_copy_path_", comment: ""), image: UIImage(systemName: "doc.on.clipboard")) { _ in let board = UIPasteboard.general - board.string = NCUtilityFileSystem.shared.getPath(metadata: metadata, withFileName: true) - NCContentPresenter.shared.messageNotification("", description: "_copied_path_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorNoError) + board.string = NCUtilityFileSystem.shared.getPath(path: metadata.path, user: metadata.user, fileName: metadata.fileName) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_copied_path_") + NCContentPresenter.shared.showInfo(error: error) } let detail = UIAction(title: NSLocalizedString("_details_", comment: ""), image: UIImage(systemName: "info")) { _ in @@ -649,7 +654,7 @@ import Photos } let viewInFolder = UIAction(title: NSLocalizedString("_view_in_folder_", comment: ""), image: UIImage(systemName: "arrow.forward.square")) { _ in - self.openFileViewInFolder(serverUrl: metadata.serverUrl, fileNameBlink: metadata.fileName) + self.openFileViewInFolder(serverUrl: metadata.serverUrl, fileNameBlink: metadata.fileName, fileNameOpen: nil) } let openIn = UIAction(title: NSLocalizedString("_open_in_", comment: ""), image: UIImage(systemName: "square.and.arrow.up") ) { _ in @@ -689,23 +694,23 @@ import Photos let favorite = UIAction(title: titleFavorite, image: NCUtility.shared.loadImage(named: "star.fill", color: NCBrandColor.shared.yellowFavorite)) { _ in - NCNetworking.shared.favoriteMetadata(metadata) { errorCode, errorDescription in - if errorCode != 0 { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCNetworking.shared.favoriteMetadata(metadata) { error in + if error != .success { + NCContentPresenter.shared.showError(error: error) } } } let deleteConfirmFile = UIAction(title: titleDeleteConfirmFile, image: UIImage(systemName: "trash"), attributes: .destructive) { _ in - NCNetworking.shared.deleteMetadata(metadata, onlyLocalCache: false) { errorCode, errorDescription in - if errorCode != 0 { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCNetworking.shared.deleteMetadata(metadata, onlyLocalCache: false) { error in + if error != .success { + NCContentPresenter.shared.showError(error: error) } } } let deleteConfirmLocal = UIAction(title: NSLocalizedString("_remove_local_file_", comment: ""), image: UIImage(systemName: "trash"), attributes: .destructive) { _ in - NCNetworking.shared.deleteMetadata(metadata, onlyLocalCache: true) { _, _ in + NCNetworking.shared.deleteMetadata(metadata, onlyLocalCache: true) { _ in } } @@ -747,15 +752,15 @@ import Photos children.insert(lockUnlock, at: metadata.lock ? 0 : 1) } - if (metadata.contentType != "image/svg+xml") && (metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue) { + if (metadata.contentType != "image/svg+xml") && (metadata.classFile == NKCommon.typeClassFile.image.rawValue || metadata.classFile == NKCommon.typeClassFile.video.rawValue) { children.insert(save, at: 2) } - if (metadata.contentType != "image/svg+xml") && (metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue) { + if (metadata.contentType != "image/svg+xml") && (metadata.classFile == NKCommon.typeClassFile.image.rawValue) { children.insert(saveAsScan, at: 2) } - if (metadata.contentType != "image/svg+xml") && (metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue || metadata.contentType == "application/pdf" || metadata.contentType == "com.adobe.pdf") { + if (metadata.contentType != "image/svg+xml") && (metadata.classFile == NKCommon.typeClassFile.image.rawValue || metadata.contentType == "application/pdf" || metadata.contentType == "com.adobe.pdf") { children.insert(print, at: 2) } @@ -763,7 +768,7 @@ import Photos children.insert(viewInFolder, at: children.count - 1) } - if (!isFolderEncrypted && metadata.contentType != "image/gif" && metadata.contentType != "image/svg+xml") && (metadata.contentType == "com.adobe.pdf" || metadata.contentType == "application/pdf" || metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue) { + if (!isFolderEncrypted && metadata.contentType != "image/gif" && metadata.contentType != "image/svg+xml") && (metadata.contentType == "com.adobe.pdf" || metadata.contentType == "application/pdf" || metadata.classFile == NKCommon.typeClassFile.image.rawValue) { children.insert(modify, at: children.count - 1) } diff --git a/iOSClient/Main/NCMainNavigationController.swift b/iOSClient/Main/NCMainNavigationController.swift deleted file mode 100644 index f95d9b7ac..000000000 --- a/iOSClient/Main/NCMainNavigationController.swift +++ /dev/null @@ -1,57 +0,0 @@ -// -// NCMainNavigationController.swift -// Nextcloud -// -// Created by Marino Faggiana on 17/10/2020. -// Copyright © 2020 Marino Faggiana. All rights reserved. -// -// Author Marino Faggiana <marino.faggiana@nextcloud.com> -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see <http://www.gnu.org/licenses/>. -// - -import UIKit - -class NCMainNavigationController: UINavigationController { - - // MARK: - View Life Cycle - - required init?(coder: NSCoder) { - super.init(coder: coder) - - if #available(iOS 13.0, *) { - - let appearance = UINavigationBarAppearance() - - appearance.configureWithOpaqueBackground() - appearance.largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor: NCBrandColor.shared.label] - appearance.backgroundColor = NCBrandColor.shared.systemBackground - appearance.configureWithOpaqueBackground() - appearance.titleTextAttributes = [NSAttributedString.Key.foregroundColor: NCBrandColor.shared.label] - appearance.backgroundColor = NCBrandColor.shared.systemBackground - - navigationBar.scrollEdgeAppearance = appearance - navigationBar.standardAppearance = appearance - - } else { - - navigationBar.barStyle = .default - navigationBar.barTintColor = NCBrandColor.shared.systemBackground - navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: NCBrandColor.shared.label] - navigationBar.largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor: NCBrandColor.shared.label] - } - - navigationBar.tintColor = .systemBlue - } -} diff --git a/iOSClient/Main/NCMainTabBar.swift b/iOSClient/Main/NCMainTabBar.swift index 7342efd54..93d9602d9 100644 --- a/iOSClient/Main/NCMainTabBar.swift +++ b/iOSClient/Main/NCMainTabBar.swift @@ -22,6 +22,7 @@ // import UIKit +import NextcloudKit class NCMainTabBar: UITabBar { @@ -50,8 +51,8 @@ class NCMainTabBar: UITabBar { NotificationCenter.default.addObserver(self, selector: #selector(updateBadgeNumber(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterUpdateBadgeNumber), object: nil) - barTintColor = NCBrandColor.shared.secondarySystemBackground - backgroundColor = NCBrandColor.shared.secondarySystemBackground + barTintColor = .secondarySystemBackground + backgroundColor = .secondarySystemBackground changeTheming() } @@ -194,7 +195,8 @@ class NCMainTabBar: UITabBar { if let directory = NCManageDatabase.shared.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", self.appDelegate.account, self.appDelegate.activeServerUrl)) { if !directory.permissions.contains("CK") { - NCContentPresenter.shared.messageNotification("_warning_", description: "_no_permission_add_file_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorInternalError) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_no_permission_add_file_") + NCContentPresenter.shared.showWarning(error: error) return } } diff --git a/iOSClient/Main/NCPickerViewController.swift b/iOSClient/Main/NCPickerViewController.swift index 83631cb69..075a39f83 100644 --- a/iOSClient/Main/NCPickerViewController.swift +++ b/iOSClient/Main/NCPickerViewController.swift @@ -25,6 +25,7 @@ import UIKit import TLPhotoPicker import MobileCoreServices import Photos +import NextcloudKit // MARK: - Photo Picker @@ -87,15 +88,18 @@ class NCPhotosPickerViewController: NSObject { }, didCancel: nil) viewController.didExceedMaximumNumberOfSelection = { _ in - NCContentPresenter.shared.messageNotification("_info_", description: "_limited_dimension_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_limited_dimension_") + NCContentPresenter.shared.showError(error: error) } viewController.handleNoAlbumPermissions = { _ in - NCContentPresenter.shared.messageNotification("_info_", description: "_denied_album_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_denied_album_") + NCContentPresenter.shared.showError(error: error) } viewController.handleNoCameraPermissions = { _ in - NCContentPresenter.shared.messageNotification("_info_", description: "_denied_camera_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_denied_camera_") + NCContentPresenter.shared.showError(error: error) } viewController.configure = configure @@ -169,11 +173,12 @@ class NCDocumentPickerViewController: NSObject, UIDocumentPickerDelegate { } } else { - appDelegate.networkingProcessUpload?.createProcessUploads(metadatas: [metadataForUpload]) + appDelegate.networkingProcessUpload?.createProcessUploads(metadatas: [metadataForUpload], completion: { _ in }) } } else { - NCContentPresenter.shared.messageNotification("_error_", description: "_read_file_error_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_read_file_error_") + NCContentPresenter.shared.showError(error: error) } } } diff --git a/iOSClient/Main/Section Header Footer/NCSectionHeaderFooter.swift b/iOSClient/Main/Section Header Footer/NCSectionHeaderFooter.swift index 4c7d592af..7b94233a8 100644 --- a/iOSClient/Main/Section Header Footer/NCSectionHeaderFooter.swift +++ b/iOSClient/Main/Section Header Footer/NCSectionHeaderFooter.swift @@ -101,14 +101,14 @@ class NCSectionHeaderMenu: UICollectionReusableView, UIGestureRecognizerDelegate viewRichWorkspace?.addGestureRecognizer(tap) viewSeparatorHeightConstraint.constant = 0.5 - viewSeparator.backgroundColor = NCBrandColor.shared.separator + viewSeparator.backgroundColor = .separator - markdownParser = MarkdownParser(font: UIFont.systemFont(ofSize: 15), color: NCBrandColor.shared.label) + markdownParser = MarkdownParser(font: UIFont.systemFont(ofSize: 15), color: .label) markdownParser.header.font = UIFont.systemFont(ofSize: 25) if let richWorkspaceText = richWorkspaceText { textViewRichWorkspace.attributedText = markdownParser.parse(richWorkspaceText) } - textViewColor = NCBrandColor.shared.label + textViewColor = .label labelSection.text = "" viewSectionHeightConstraint.constant = 0 @@ -334,12 +334,12 @@ class NCSectionFooter: UICollectionReusableView, NCSectionFooterDelegate { labelSection.textColor = NCBrandColor.shared.gray labelSection.text = "" - separator.backgroundColor = NCBrandColor.shared.separator + separator.backgroundColor = .separator separatorHeightConstraint.constant = 0.5 buttonIsHidden(true) activityIndicatorSection.isHidden = true - activityIndicatorSection.color = NCBrandColor.shared.label + activityIndicatorSection.color = .label } func setTitleLabel(directories: Int, files: Int, size: Int64) { diff --git a/iOSClient/Media/Cell/NCGridMediaCell.swift b/iOSClient/Media/Cell/NCGridMediaCell.swift index 0dc99c439..d60858081 100644 --- a/iOSClient/Media/Cell/NCGridMediaCell.swift +++ b/iOSClient/Media/Cell/NCGridMediaCell.swift @@ -59,13 +59,9 @@ class NCGridMediaCell: UICollectionViewCell, NCCellProtocol { } func initCell() { - imageItem.backgroundColor = UIColor.lightGray + imageItem.backgroundColor = .secondarySystemBackground imageStatus.image = nil imageItem.image = nil - imageItem.layer.masksToBounds = true - imageItem.layer.cornerRadius = 6 - imageVisualEffect.layer.cornerRadius = 6 - imageVisualEffect.clipsToBounds = true } func selectMode(_ status: Bool) { diff --git a/iOSClient/Media/Cell/NCGridMediaCell.xib b/iOSClient/Media/Cell/NCGridMediaCell.xib index a3f35e4ba..755720f0a 100644 --- a/iOSClient/Media/Cell/NCGridMediaCell.xib +++ b/iOSClient/Media/Cell/NCGridMediaCell.xib @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21225" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <device id="retina4_7" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21207"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> @@ -18,7 +18,7 @@ <autoresizingMask key="autoresizingMask"/> <subviews> <imageView autoresizesSubviews="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="5Ci-V1-hf5" userLabel="imageItem"> - <rect key="frame" x="0.0" y="0.0" width="220" height="220"/> + <rect key="frame" x="-1" y="-1" width="222" height="222"/> </imageView> <imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="a0p-rj-jnV" userLabel="imageStatus"> <rect key="frame" x="5" y="192" width="23" height="23"/> @@ -33,7 +33,7 @@ <blurEffect style="extraLight"/> </visualEffectView> <imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="DHy-Up-3Bh" userLabel="imageSelect"> - <rect key="frame" x="5" y="5" width="44" height="44"/> + <rect key="frame" x="5" y="5" width="44.5" height="44.5"/> </imageView> </subviews> </view> @@ -48,13 +48,13 @@ <constraint firstItem="a0p-rj-jnV" firstAttribute="leading" secondItem="VXh-sQ-LeX" secondAttribute="leading" constant="5" id="DYA-5M-RZ8"/> <constraint firstItem="a0p-rj-jnV" firstAttribute="width" secondItem="5Ci-V1-hf5" secondAttribute="width" multiplier="0.1" constant="1" id="DvH-0a-ncn"/> <constraint firstItem="DHy-Up-3Bh" firstAttribute="top" secondItem="VXh-sQ-LeX" secondAttribute="top" constant="5" id="ESV-qE-tbO"/> - <constraint firstItem="5Ci-V1-hf5" firstAttribute="top" secondItem="VXh-sQ-LeX" secondAttribute="top" id="Ouj-ZD-UFm"/> + <constraint firstItem="5Ci-V1-hf5" firstAttribute="top" secondItem="VXh-sQ-LeX" secondAttribute="top" constant="-1" id="Ouj-ZD-UFm"/> <constraint firstItem="VXh-sQ-LeX" firstAttribute="bottom" secondItem="r1K-4X-gNd" secondAttribute="bottom" id="QAj-Am-H9V"/> <constraint firstItem="r1K-4X-gNd" firstAttribute="top" secondItem="VXh-sQ-LeX" secondAttribute="top" id="Rou-vT-GPt"/> - <constraint firstItem="VXh-sQ-LeX" firstAttribute="trailing" secondItem="5Ci-V1-hf5" secondAttribute="trailing" id="cHT-cP-NN6"/> - <constraint firstItem="VXh-sQ-LeX" firstAttribute="bottom" secondItem="5Ci-V1-hf5" secondAttribute="bottom" id="eEC-eB-alE"/> + <constraint firstItem="VXh-sQ-LeX" firstAttribute="trailing" secondItem="5Ci-V1-hf5" secondAttribute="trailing" constant="-1" id="cHT-cP-NN6"/> + <constraint firstItem="VXh-sQ-LeX" firstAttribute="bottom" secondItem="5Ci-V1-hf5" secondAttribute="bottom" constant="-1" id="eEC-eB-alE"/> <constraint firstItem="DHy-Up-3Bh" firstAttribute="width" secondItem="5Ci-V1-hf5" secondAttribute="width" multiplier="0.2" id="ojv-2d-Xmj"/> - <constraint firstItem="5Ci-V1-hf5" firstAttribute="leading" secondItem="VXh-sQ-LeX" secondAttribute="leading" id="qT3-WD-iTV"/> + <constraint firstItem="5Ci-V1-hf5" firstAttribute="leading" secondItem="VXh-sQ-LeX" secondAttribute="leading" constant="-1" id="qT3-WD-iTV"/> </constraints> <size key="customSize" width="220" height="260"/> <connections> diff --git a/iOSClient/Media/NCMedia.swift b/iOSClient/Media/NCMedia.swift index 509d9ddc5..660c42f65 100644 --- a/iOSClient/Media/NCMedia.swift +++ b/iOSClient/Media/NCMedia.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit class NCMedia: UIViewController, NCEmptyDataSetDelegate, NCSelectDelegate { @@ -71,13 +71,13 @@ class NCMedia: UIViewController, NCEmptyDataSetDelegate, NCSelectDelegate { override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = NCBrandColor.shared.systemBackground + view.backgroundColor = .systemBackground collectionView.register(UINib(nibName: "NCGridMediaCell", bundle: nil), forCellWithReuseIdentifier: "gridCell") collectionView.alwaysBounceVertical = true collectionView.contentInset = UIEdgeInsets(top: insetsTop, left: 0, bottom: 50, right: 0) - collectionView.backgroundColor = NCBrandColor.shared.systemBackground + collectionView.backgroundColor = .systemBackground gridLayout = NCGridMediaLayout() gridLayout.itemForLine = CGFloat(min(CCUtility.getMediaWidthImage(), 5)) @@ -115,16 +115,13 @@ class NCMedia: UIViewController, NCEmptyDataSetDelegate, NCSelectDelegate { appDelegate.activeViewController = self - // + navigationController?.setMediaAppreance() + NotificationCenter.default.addObserver(self, selector: #selector(deleteFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterDeleteFile), object: nil) NotificationCenter.default.addObserver(self, selector: #selector(moveFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterMoveFile), object: nil) NotificationCenter.default.addObserver(self, selector: #selector(renameFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterRenameFile), object: nil) NotificationCenter.default.addObserver(self, selector: #selector(uploadedFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterUploadedFile), object: nil) - // hide nagigation controller - navigationController?.navigationBar.prefersLargeTitles = true - navigationController?.setNavigationBarHidden(true, animated: false) - self.reloadDataSourceWithCompletion { _ in self.timerSearchNewMedia?.invalidate() self.timerSearchNewMedia = Timer.scheduledTimer(timeInterval: self.timeIntervalSearchNewMedia, target: self, selector: #selector(self.searchNewMediaTimer), userInfo: nil, repeats: false) @@ -149,9 +146,7 @@ class NCMedia: UIViewController, NCEmptyDataSetDelegate, NCSelectDelegate { override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { super.viewWillTransition(to: size, with: coordinator) - coordinator.animate(alongsideTransition: nil) { _ in - self.reloadDataThenPerform { } - } + self.collectionView?.collectionViewLayout.invalidateLayout() } override var preferredStatusBarStyle: UIStatusBarStyle { @@ -214,7 +209,8 @@ class NCMedia: UIViewController, NCEmptyDataSetDelegate, NCSelectDelegate { @objc func uploadedFile(_ notification: NSNotification) { guard let userInfo = notification.userInfo as NSDictionary?, - let errorCode = userInfo["errorCode"] as? Int, errorCode == 0 , + let error = userInfo["error"] as? NKError, + error == .success, let account = userInfo["account"] as? String, account == appDelegate.account else { return } @@ -323,7 +319,6 @@ extension NCMedia: UICollectionViewDelegate { } } - @available(iOS 13.0, *) func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? { guard let cell = collectionView.cellForItem(at: indexPath) as? NCGridMediaCell else { return nil } @@ -338,7 +333,6 @@ extension NCMedia: UICollectionViewDelegate { }) } - @available(iOS 13.0, *) func collectionView(_ collectionView: UICollectionView, willPerformPreviewActionForMenuWith configuration: UIContextMenuConfiguration, animator: UIContextMenuInteractionCommitAnimating) { animator.addCompletion { if let indexPath = configuration.identifier as? IndexPath { @@ -399,7 +393,7 @@ extension NCMedia: UICollectionViewDataSource { cell.fileObjectId = metadata.ocId cell.fileUser = metadata.ownerId - if metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue { + if metadata.classFile == NKCommon.typeClassFile.video.rawValue || metadata.classFile == NKCommon.typeClassFile.audio.rawValue { cell.imageStatus.image = cacheImages.cellPlayImage } else if metadata.livePhoto && livePhoto { cell.imageStatus.image = cacheImages.cellLivePhotoImage @@ -457,12 +451,12 @@ extension NCMedia { } let startServerUrl = NCUtilityFileSystem.shared.getHomeServer(account: appDelegate.account) + mediaPath - predicateDefault = NSPredicate(format: "account == %@ AND serverUrl BEGINSWITH %@ AND (classFile == %@ OR classFile == %@) AND NOT (session CONTAINS[c] 'upload')", appDelegate.account, startServerUrl, NCCommunicationCommon.typeClassFile.image.rawValue, NCCommunicationCommon.typeClassFile.video.rawValue) + predicateDefault = NSPredicate(format: "account == %@ AND serverUrl BEGINSWITH %@ AND (classFile == %@ OR classFile == %@) AND NOT (session CONTAINS[c] 'upload')", appDelegate.account, startServerUrl, NKCommon.typeClassFile.image.rawValue, NKCommon.typeClassFile.video.rawValue) if filterClassTypeImage { - predicate = NSPredicate(format: "account == %@ AND serverUrl BEGINSWITH %@ AND classFile == %@ AND NOT (session CONTAINS[c] 'upload')", appDelegate.account, startServerUrl, NCCommunicationCommon.typeClassFile.video.rawValue) + predicate = NSPredicate(format: "account == %@ AND serverUrl BEGINSWITH %@ AND classFile == %@ AND NOT (session CONTAINS[c] 'upload')", appDelegate.account, startServerUrl, NKCommon.typeClassFile.video.rawValue) } else if filterClassTypeVideo { - predicate = NSPredicate(format: "account == %@ AND serverUrl BEGINSWITH %@ AND classFile == %@ AND NOT (session CONTAINS[c] 'upload')", appDelegate.account, startServerUrl, NCCommunicationCommon.typeClassFile.image.rawValue) + predicate = NSPredicate(format: "account == %@ AND serverUrl BEGINSWITH %@ AND classFile == %@ AND NOT (session CONTAINS[c] 'upload')", appDelegate.account, startServerUrl, NKCommon.typeClassFile.image.rawValue) } else { predicate = predicateDefault } @@ -529,15 +523,17 @@ extension NCMedia { } NCActivityIndicator.shared.start(backgroundView: self.view, bottom: bottom-5, style: .gray) - NCCommunication.shared.searchMedia(path: mediaPath, lessDate: lessDate, greaterDate: greaterDate, elementDate: "d:getlastmodified/", limit: limit, showHiddenFiles: CCUtility.getShowHiddenFiles(), timeout: 300) { account, files, errorCode, errorDescription in + let options = NKRequestOptions(timeout: 300) + + NextcloudKit.shared.searchMedia(path: mediaPath, lessDate: lessDate, greaterDate: greaterDate, elementDate: "d:getlastmodified/", limit: limit, showHiddenFiles: CCUtility.getShowHiddenFiles(), options: options) { account, files, data, error in self.oldInProgress = false NCActivityIndicator.shared.stop() self.collectionView.reloadData() - if errorCode == 0 && account == self.appDelegate.account { + if error == .success && account == self.appDelegate.account { if files.count > 0 { - NCManageDatabase.shared.convertNCCommunicationFilesToMetadatas(files, useMetadataFolder: false, account: self.appDelegate.account) { _, _, metadatas in + NCManageDatabase.shared.convertNKFilesToMetadatas(files, useMetadataFolder: false, account: self.appDelegate.account) { _, _, metadatas in let predicateDate = NSPredicate(format: "date > %@ AND date < %@", greaterDate as NSDate, lessDate as NSDate) let predicateResult = NSCompoundPredicate(andPredicateWithSubpredicates: [predicateDate, self.predicateDefault!]) let metadatasResult = NCManageDatabase.shared.getMetadatas(predicate: predicateResult) @@ -551,8 +547,8 @@ extension NCMedia { } else { self.researchOldMedia(value: value, limit: limit, withElseReloadDataSource: false) } - } else if errorCode != 0 { - NCCommunicationCommon.shared.writeLog("Media search old media error code \(errorCode) " + errorDescription) + } else if error != .success { + NKCommon.shared.writeLog("[INFO] Media search old media error code \(error.errorCode) " + error.errorDescription) } } } @@ -608,13 +604,15 @@ extension NCMedia { reloadDataThenPerform { - NCCommunication.shared.searchMedia(path: self.mediaPath, lessDate: lessDate, greaterDate: greaterDate, elementDate: "d:getlastmodified/", limit: limit, showHiddenFiles: CCUtility.getShowHiddenFiles(), timeout: 300) { account, files, errorCode, errorDescription in + let options = NKRequestOptions(timeout: 300) + + NextcloudKit.shared.searchMedia(path: self.mediaPath, lessDate: lessDate, greaterDate: greaterDate, elementDate: "d:getlastmodified/", limit: limit, showHiddenFiles: CCUtility.getShowHiddenFiles(), options: options) { account, files, data, error in self.newInProgress = false self.mediaCommandView?.activityIndicator.stopAnimating() - if errorCode == 0 && account == self.appDelegate.account && files.count > 0 { - NCManageDatabase.shared.convertNCCommunicationFilesToMetadatas(files, useMetadataFolder: false, account: account) { _, _, metadatas in + if error == .success && account == self.appDelegate.account && files.count > 0 { + NCManageDatabase.shared.convertNKFilesToMetadatas(files, useMetadataFolder: false, account: account) { _, _, metadatas in let predicate = NSPredicate(format: "date > %@ AND date < %@", greaterDate as NSDate, lessDate as NSDate) let predicateResult = NSCompoundPredicate(andPredicateWithSubpredicates: [predicate, self.predicate!]) let metadatasResult = NCManageDatabase.shared.getMetadatas(predicate: predicateResult) @@ -623,10 +621,10 @@ extension NCMedia { self.reloadDataSourceWithCompletion { _ in } } } - } else if errorCode == 0 && files.count == 0 && self.metadatas.count == 0 { + } else if error == .success && files.count == 0 && self.metadatas.count == 0 { self.searchOldMedia() - } else if errorCode != 0 { - NCCommunicationCommon.shared.writeLog("Media search new media error code \(errorCode) " + errorDescription) + } else if error != .success { + NKCommon.shared.writeLog("[ERROR] Media search new media error code \(error.errorCode) " + error.errorDescription) } } } @@ -781,7 +779,7 @@ class NCMediaCommandView: UIView { class NCGridMediaLayout: UICollectionViewFlowLayout { - var marginLeftRight: CGFloat = 6 + var marginLeftRight: CGFloat = 2 var itemForLine: CGFloat = 3 override init() { diff --git a/iOSClient/Menu/AppDelegate+Menu.swift b/iOSClient/Menu/AppDelegate+Menu.swift index f17217067..559c78d78 100644 --- a/iOSClient/Menu/AppDelegate+Menu.swift +++ b/iOSClient/Menu/AppDelegate+Menu.swift @@ -25,7 +25,7 @@ import UIKit import FloatingPanel -import NCCommunication +import NextcloudKit extension AppDelegate { @@ -61,7 +61,7 @@ extension AppDelegate { ) ) - if NCCommunication.shared.isNetworkReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == NCGlobal.shared.editorText}) && !isEncrypted { + if NextcloudKit.shared.isNetworkReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == NCGlobal.shared.editorText}) && !isEncrypted { let directEditingCreator = directEditingCreators!.first(where: { $0.editor == NCGlobal.shared.editorText})! actions.append( NCMenuAction(title: NSLocalizedString("_create_nextcloudtext_document_", comment: ""), icon: UIImage(named: "file_txt")!.image(color: NCBrandColor.shared.gray, size: 50), action: { _ in @@ -82,22 +82,19 @@ extension AppDelegate { ) } - if #available(iOS 13.0, *) { - actions.append( - NCMenuAction( - title: NSLocalizedString("_scans_document_", comment: ""), icon: NCUtility.shared.loadImage(named: "doc.text.viewfinder"), action: { _ in - if let viewController = appDelegate.window?.rootViewController { - NCCreateScanDocument.shared.openScannerDocument(viewController: viewController) - } + actions.append( + NCMenuAction( + title: NSLocalizedString("_scans_document_", comment: ""), icon: NCUtility.shared.loadImage(named: "scan"), action: { _ in + if let viewController = appDelegate.window?.rootViewController { + NCCreateScanDocument.shared.openScannerDocument(viewController: viewController) } - ) + } ) - } + ) actions.append( NCMenuAction( title: NSLocalizedString("_create_voice_memo_", comment: ""), icon: UIImage(named: "microphone")!.image(color: NCBrandColor.shared.gray, size: 50), action: { _ in - NCAskAuthorization.shared.askAuthorizationAudioRecord(viewController: viewController) { hasPermission in if hasPermission { let fileName = CCUtility.createFileNameDate(NSLocalizedString("_voice_memo_filename_", comment: ""), extension: "m4a")! @@ -125,7 +122,7 @@ extension AppDelegate { ) ) - if serverVersionMajor >= NCGlobal.shared.nextcloudVersion18 && directory?.richWorkspace == nil && !isEncrypted && NCCommunication.shared.isNetworkReachable() { + if serverVersionMajor >= NCGlobal.shared.nextcloudVersion18 && directory?.richWorkspace == nil && !isEncrypted && NextcloudKit.shared.isNetworkReachable() { actions.append( NCMenuAction( title: NSLocalizedString("_add_folder_info_", comment: ""), icon: UIImage(named: "addFolderInfo")!.image(color: NCBrandColor.shared.gray, size: 50), action: { _ in @@ -142,7 +139,7 @@ extension AppDelegate { ) } - if NCCommunication.shared.isNetworkReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == NCGlobal.shared.editorOnlyoffice && $0.identifier == NCGlobal.shared.onlyofficeDocx}) && !isEncrypted { + if NextcloudKit.shared.isNetworkReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == NCGlobal.shared.editorOnlyoffice && $0.identifier == NCGlobal.shared.onlyofficeDocx}) && !isEncrypted { let directEditingCreator = directEditingCreators!.first(where: { $0.editor == NCGlobal.shared.editorOnlyoffice && $0.identifier == NCGlobal.shared.onlyofficeDocx})! actions.append( NCMenuAction( @@ -165,7 +162,7 @@ extension AppDelegate { ) } - if NCCommunication.shared.isNetworkReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == NCGlobal.shared.editorOnlyoffice && $0.identifier == NCGlobal.shared.onlyofficeXlsx}) && !isEncrypted { + if NextcloudKit.shared.isNetworkReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == NCGlobal.shared.editorOnlyoffice && $0.identifier == NCGlobal.shared.onlyofficeXlsx}) && !isEncrypted { let directEditingCreator = directEditingCreators!.first(where: { $0.editor == NCGlobal.shared.editorOnlyoffice && $0.identifier == NCGlobal.shared.onlyofficeXlsx})! actions.append( NCMenuAction( @@ -188,7 +185,7 @@ extension AppDelegate { ) } - if NCCommunication.shared.isNetworkReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == NCGlobal.shared.editorOnlyoffice && $0.identifier == NCGlobal.shared.onlyofficePptx}) && !isEncrypted { + if NextcloudKit.shared.isNetworkReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == NCGlobal.shared.editorOnlyoffice && $0.identifier == NCGlobal.shared.onlyofficePptx}) && !isEncrypted { let directEditingCreator = directEditingCreators!.first(where: { $0.editor == NCGlobal.shared.editorOnlyoffice && $0.identifier == NCGlobal.shared.onlyofficePptx})! actions.append( NCMenuAction( @@ -212,7 +209,7 @@ extension AppDelegate { } if let richdocumentsMimetypes = NCManageDatabase.shared.getCapabilitiesServerArray(account: appDelegate.account, elements: NCElementsJSON.shared.capabilitiesRichdocumentsMimetypes) { - if richdocumentsMimetypes.count > 0 && NCCommunication.shared.isNetworkReachable() && !isEncrypted { + if richdocumentsMimetypes.count > 0 && NextcloudKit.shared.isNetworkReachable() && !isEncrypted { actions.append( NCMenuAction( title: NSLocalizedString("_create_new_document_", comment: ""), icon: UIImage(named: "create_file_document")!, action: { _ in diff --git a/iOSClient/Menu/NCCollectionViewCommon+Menu.swift b/iOSClient/Menu/NCCollectionViewCommon+Menu.swift index 9339cd17c..93fd5cd0a 100644 --- a/iOSClient/Menu/NCCollectionViewCommon+Menu.swift +++ b/iOSClient/Menu/NCCollectionViewCommon+Menu.swift @@ -27,7 +27,7 @@ import UIKit import FloatingPanel -import NCCommunication +import NextcloudKit import Queuer extension NCCollectionViewCommon { @@ -115,9 +115,9 @@ extension NCCollectionViewCommon { title: metadata.favorite ? NSLocalizedString("_remove_favorites_", comment: "") : NSLocalizedString("_add_favorites_", comment: ""), icon: NCUtility.shared.loadImage(named: "star.fill", color: NCBrandColor.shared.yellowFavorite), action: { _ in - NCNetworking.shared.favoriteMetadata(metadata) { errorCode, errorDescription in - if errorCode != 0 { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCNetworking.shared.favoriteMetadata(metadata) { error in + if error != .success { + NCContentPresenter.shared.showError(error: error) } } } @@ -166,7 +166,7 @@ extension NCCollectionViewCommon { // // OPEN with external editor // - if metadata.classFile == NCCommunicationCommon.typeClassFile.document.rawValue && editors.contains(NCGlobal.shared.editorText) && ((editors.contains(NCGlobal.shared.editorOnlyoffice) || isRichDocument)) { + if metadata.classFile == NKCommon.typeClassFile.document.rawValue && editors.contains(NCGlobal.shared.editorText) && ((editors.contains(NCGlobal.shared.editorOnlyoffice) || isRichDocument)) { var editor = "" var title = "" @@ -212,25 +212,23 @@ extension NCCollectionViewCommon { // // SAVE // - if (metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue && metadata.contentType != "image/svg+xml") || metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue { + if (metadata.classFile == NKCommon.typeClassFile.image.rawValue && metadata.contentType != "image/svg+xml") || metadata.classFile == NKCommon.typeClassFile.video.rawValue { actions.append(.saveMediaAction(selectedMediaMetadatas: [metadata])) } // // SAVE AS SCAN // - if #available(iOS 13.0, *) { - if metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue && metadata.contentType != "image/svg+xml" { - actions.append( - NCMenuAction( - title: NSLocalizedString("_save_as_scan_", comment: ""), - icon: NCUtility.shared.loadImage(named: "viewfinder.circle"), - action: { _ in - NCFunctionCenter.shared.openDownload(metadata: metadata, selector: NCGlobal.shared.selectorSaveAsScan) - } - ) + if metadata.classFile == NKCommon.typeClassFile.image.rawValue && metadata.contentType != "image/svg+xml" { + actions.append( + NCMenuAction( + title: NSLocalizedString("_save_as_scan_", comment: ""), + icon: NCUtility.shared.loadImage(named: "viewfinder.circle"), + action: { _ in + NCFunctionCenter.shared.openDownload(metadata: metadata, selector: NCGlobal.shared.selectorSaveAsScan) + } ) - } + ) } // @@ -274,18 +272,16 @@ extension NCCollectionViewCommon { // // MODIFY // - if #available(iOS 13.0, *) { - if !isFolderEncrypted && metadata.contentType != "image/gif" && metadata.contentType != "image/svg+xml" && (metadata.contentType == "com.adobe.pdf" || metadata.contentType == "application/pdf" || metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue) { - actions.append( - NCMenuAction( - title: NSLocalizedString("_modify_", comment: ""), - icon: NCUtility.shared.loadImage(named: "pencil.tip.crop.circle"), - action: { menuAction in - NCFunctionCenter.shared.openDownload(metadata: metadata, selector: NCGlobal.shared.selectorLoadFileQuickLook) - } - ) + if !isFolderEncrypted && metadata.contentType != "image/gif" && metadata.contentType != "image/svg+xml" && (metadata.contentType == "com.adobe.pdf" || metadata.contentType == "application/pdf" || metadata.classFile == NKCommon.typeClassFile.image.rawValue) { + actions.append( + NCMenuAction( + title: NSLocalizedString("_modify_", comment: ""), + icon: NCUtility.shared.loadImage(named: "pencil.tip.crop.circle"), + action: { menuAction in + NCFunctionCenter.shared.openDownload(metadata: metadata, selector: NCGlobal.shared.selectorLoadFileQuickLook) + } ) - } + ) } // @@ -322,15 +318,15 @@ extension NCCollectionViewCommon { title: NSLocalizedString("_e2e_set_folder_encrypted_", comment: ""), icon: NCUtility.shared.loadImage(named: "lock"), action: { _ in - NCCommunication.shared.markE2EEFolder(fileId: metadata.fileId, delete: false) { account, errorCode, errorDescription in - if errorCode == 0 { + NextcloudKit.shared.markE2EEFolder(fileId: metadata.fileId, delete: false) { account, error in + if error == .success { NCManageDatabase.shared.deleteE2eEncryption(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", self.appDelegate.account, serverUrl)) NCManageDatabase.shared.setDirectory(serverUrl: serverUrl, serverUrlTo: nil, etag: nil, ocId: nil, fileId: nil, encrypted: true, richWorkspace: nil, account: metadata.account) NCManageDatabase.shared.setMetadataEncrypted(ocId: metadata.ocId, encrypted: true) NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterChangeStatusFolderE2EE, userInfo: ["serverUrl": metadata.serverUrl]) } else { - NCContentPresenter.shared.messageNotification(NSLocalizedString("_e2e_error_mark_folder_", comment: ""), description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: .error, errorCode: errorCode) + NCContentPresenter.shared.messageNotification(NSLocalizedString("_e2e_error_mark_folder_", comment: ""), error: error, delay: NCGlobal.shared.dismissAfterSecond, type: .error) } } } @@ -347,15 +343,15 @@ extension NCCollectionViewCommon { title: NSLocalizedString("_e2e_remove_folder_encrypted_", comment: ""), icon: NCUtility.shared.loadImage(named: "lock"), action: { _ in - NCCommunication.shared.markE2EEFolder(fileId: metadata.fileId, delete: true) { account, errorCode, errorDescription in - if errorCode == 0 { + NextcloudKit.shared.markE2EEFolder(fileId: metadata.fileId, delete: true) { account, error in + if error == .success { NCManageDatabase.shared.deleteE2eEncryption(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", self.appDelegate.account, serverUrl)) NCManageDatabase.shared.setDirectory(serverUrl: serverUrl, serverUrlTo: nil, etag: nil, ocId: nil, fileId: nil, encrypted: false, richWorkspace: nil, account: metadata.account) NCManageDatabase.shared.setMetadataEncrypted(ocId: metadata.ocId, encrypted: false) NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterChangeStatusFolderE2EE, userInfo: ["serverUrl": metadata.serverUrl]) } else { - NCContentPresenter.shared.messageNotification(NSLocalizedString("_e2e_error_delete_mark_folder_", comment: ""), description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: .error, errorCode: errorCode) + NCContentPresenter.shared.messageNotification(NSLocalizedString("_e2e_error_delete_mark_folder_", comment: ""), error: error, delay: NCGlobal.shared.dismissAfterSecond, type: .error) } } } diff --git a/iOSClient/Menu/NCLoginWeb+Menu.swift b/iOSClient/Menu/NCLoginWeb+Menu.swift index c01d18b38..a612da97b 100644 --- a/iOSClient/Menu/NCLoginWeb+Menu.swift +++ b/iOSClient/Menu/NCLoginWeb+Menu.swift @@ -55,7 +55,6 @@ extension NCLoginWeb { NCManageDatabase.shared.setAccountActive(account.account) self.dismiss(animated: true) { self.appDelegate.settingAccount(account.account, urlBase: account.urlBase, user: account.user, userId: account.userId, password: CCUtility.getPassword(account.account)) - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize) } } } diff --git a/iOSClient/Menu/NCMedia+Menu.swift b/iOSClient/Menu/NCMedia+Menu.swift index a963d3302..8cf4dbbc1 100644 --- a/iOSClient/Menu/NCMedia+Menu.swift +++ b/iOSClient/Menu/NCMedia+Menu.swift @@ -23,7 +23,7 @@ import UIKit import FloatingPanel -import NCCommunication +import NextcloudKit extension NCMedia { func tapSelect() { diff --git a/iOSClient/Menu/NCMenu+FloatingPanel.swift b/iOSClient/Menu/NCMenu+FloatingPanel.swift index 71735a202..791d49c31 100644 --- a/iOSClient/Menu/NCMenu+FloatingPanel.swift +++ b/iOSClient/Menu/NCMenu+FloatingPanel.swift @@ -72,10 +72,11 @@ class NCMenuPanelController: FloatingPanelController { override func viewDidLoad() { super.viewDidLoad() - self.surfaceView.backgroundColor = NCBrandColor.shared.systemBackground + self.surfaceView.backgroundColor = .systemBackground self.isRemovalInteractionEnabled = true self.backdropView.dismissalTapGestureRecognizer.isEnabled = true self.surfaceView.layer.cornerRadius = 16 + self.surfaceView.clipsToBounds = true surfaceView.grabberHandle.accessibilityLabel = NSLocalizedString("_cart_controller_", comment: "") diff --git a/iOSClient/Menu/NCMenu.swift b/iOSClient/Menu/NCMenu.swift index cf7f99e44..931600289 100644 --- a/iOSClient/Menu/NCMenu.swift +++ b/iOSClient/Menu/NCMenu.swift @@ -72,7 +72,7 @@ class NCMenu: UITableViewController { let action = actions[indexPath.row] guard action.title != NCMenuAction.seperatorIdentifier else { let cell = UITableViewCell() - cell.backgroundColor = NCBrandColor.shared.separator + cell.backgroundColor = .separator return cell } let cell = tableView.dequeueReusableCell(withIdentifier: "menuActionCell", for: indexPath) diff --git a/iOSClient/Menu/NCMenuAction.swift b/iOSClient/Menu/NCMenuAction.swift index 66543d53e..2f5d49792 100644 --- a/iOSClient/Menu/NCMenuAction.swift +++ b/iOSClient/Menu/NCMenuAction.swift @@ -192,7 +192,7 @@ extension NCMenuAction { /// Set (or remove) a file as *available offline*. Downloads the file if not downloaded already static func setAvailableOfflineAction(selectedMetadatas: [tableMetadata], isAnyOffline: Bool, viewController: UIViewController, completion: (() -> Void)? = nil) -> NCMenuAction { NCMenuAction( - title: isAnyOffline ? NSLocalizedString("_remove_available_offline_", comment: "") : NSLocalizedString("_set_available_offline_", comment: ""), + title: isAnyOffline ? NSLocalizedString("_remove_available_offline_", comment: "") : NSLocalizedString("_set_available_offline_", comment: ""), icon: NCUtility.shared.loadImage(named: "tray.and.arrow.down"), action: { _ in if !isAnyOffline, selectedMetadatas.count > 3 { diff --git a/iOSClient/Menu/NCNotification+Menu.swift b/iOSClient/Menu/NCNotification+Menu.swift new file mode 100644 index 000000000..19374e6fc --- /dev/null +++ b/iOSClient/Menu/NCNotification+Menu.swift @@ -0,0 +1,53 @@ +// +// NCNotification+Menu.swift +// Nextcloud +// +// Created by Marino Faggiana on 31/08/2022. +// Copyright © 2022 Marino Faggiana. All rights reserved. +// +// Author Marino Faggiana <marino.faggiana@nextcloud.com> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// + +import UIKit +import FloatingPanel +import SwiftyJSON +import NextcloudKit + +extension NCNotification { + + func toggleMenu(notification: NKNotifications) { + + var actions = [NCMenuAction]() + + if let notificationActions = notification.actions, let jsonNotificationActionsActions = JSON(notificationActions).array { + + for action in jsonNotificationActionsActions { + let label = action["label"].stringValue + actions.append( + NCMenuAction( + title: action["label"].stringValue, + icon: UIImage(), + action: { _ in + self.tapAction(with: notification, label: label) + } + ) + ) + } + } + + presentMenu(with: actions) + } +} diff --git a/iOSClient/Menu/NCSortMenu.swift b/iOSClient/Menu/NCSortMenu.swift index 754714c50..7a6163c92 100644 --- a/iOSClient/Menu/NCSortMenu.swift +++ b/iOSClient/Menu/NCSortMenu.swift @@ -23,7 +23,7 @@ import UIKit import FloatingPanel -import NCCommunication +import NextcloudKit class NCSortMenu: NSObject { diff --git a/iOSClient/Menu/NCTrash+Menu.swift b/iOSClient/Menu/NCTrash+Menu.swift index e3677651d..aa10f9460 100644 --- a/iOSClient/Menu/NCTrash+Menu.swift +++ b/iOSClient/Menu/NCTrash+Menu.swift @@ -25,7 +25,7 @@ import UIKit import FloatingPanel -import NCCommunication +import NextcloudKit extension NCTrash { var selectActions: [NCMenuAction] { diff --git a/iOSClient/Menu/NCViewer+Menu.swift b/iOSClient/Menu/NCViewer+Menu.swift index 160d9fef1..1429e72a1 100644 --- a/iOSClient/Menu/NCViewer+Menu.swift +++ b/iOSClient/Menu/NCViewer+Menu.swift @@ -23,7 +23,7 @@ import UIKit import FloatingPanel -import NCCommunication +import NextcloudKit extension NCViewer { @@ -48,9 +48,9 @@ extension NCViewer { title: titleFavorite, icon: NCUtility.shared.loadImage(named: "star.fill", color: NCBrandColor.shared.yellowFavorite), action: { _ in - NCNetworking.shared.favoriteMetadata(metadata) { errorCode, errorDescription in - if errorCode != 0 { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCNetworking.shared.favoriteMetadata(metadata) { error in + if error != .success { + NCContentPresenter.shared.showError(error: error) } } } @@ -90,7 +90,7 @@ extension NCViewer { // // PRINT // - if metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue || metadata.contentType == "application/pdf" || metadata.contentType == "com.adobe.pdf" { + if metadata.classFile == NKCommon.typeClassFile.image.rawValue || metadata.contentType == "application/pdf" || metadata.contentType == "com.adobe.pdf" { actions.append( NCMenuAction( title: NSLocalizedString("_print_", comment: ""), @@ -106,7 +106,7 @@ extension NCViewer { // CONVERSION VIDEO TO MPEG4 (MFFF Lib) // #if MFFFLIB - if metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue { + if metadata.classFile == NKCommon.typeClassFile.video.rawValue { actions.append( NCMenuAction( @@ -125,25 +125,23 @@ extension NCViewer { // // SAVE IMAGE / VIDEO // - if metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue { + if metadata.classFile == NKCommon.typeClassFile.image.rawValue || metadata.classFile == NKCommon.typeClassFile.video.rawValue { actions.append(.saveMediaAction(selectedMediaMetadatas: [metadata])) } // // SAVE AS SCAN // - if #available(iOS 13.0, *) { - if metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue && metadata.contentType != "image/svg+xml" { - actions.append( - NCMenuAction( - title: NSLocalizedString("_save_as_scan_", comment: ""), - icon: NCUtility.shared.loadImage(named: "viewfinder.circle"), - action: { _ in - NCFunctionCenter.shared.openDownload(metadata: metadata, selector: NCGlobal.shared.selectorSaveAsScan) - } - ) + if metadata.classFile == NKCommon.typeClassFile.image.rawValue && metadata.contentType != "image/svg+xml" { + actions.append( + NCMenuAction( + title: NSLocalizedString("_save_as_scan_", comment: ""), + icon: NCUtility.shared.loadImage(named: "viewfinder.circle"), + action: { _ in + NCFunctionCenter.shared.openDownload(metadata: metadata, selector: NCGlobal.shared.selectorSaveAsScan) + } ) - } + ) } // @@ -192,7 +190,7 @@ extension NCViewer { title: NSLocalizedString("_view_in_folder_", comment: ""), icon: NCUtility.shared.loadImage(named: "arrow.forward.square"), action: { menuAction in - NCFunctionCenter.shared.openFileViewInFolder(serverUrl: metadata.serverUrl, fileNameBlink: metadata.fileName) + NCFunctionCenter.shared.openFileViewInFolder(serverUrl: metadata.serverUrl, fileNameBlink: metadata.fileName, fileNameOpen: nil) } ) ) @@ -202,13 +200,13 @@ extension NCViewer { // DOWNLOAD IMAGE MAX RESOLUTION // if metadata.session == "" { - if metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue && !CCUtility.fileProviderStorageExists(metadata) && metadata.session == "" { + if metadata.classFile == NKCommon.typeClassFile.image.rawValue && !CCUtility.fileProviderStorageExists(metadata) && metadata.session == "" { actions.append( NCMenuAction( title: NSLocalizedString("_download_image_max_", comment: ""), icon: NCUtility.shared.loadImage(named: "square.and.arrow.down"), action: { _ in - NCNetworking.shared.download(metadata: metadata, selector: "") { _ in } + NCNetworking.shared.download(metadata: metadata, selector: "") { _, _ in } } ) ) @@ -243,18 +241,16 @@ extension NCViewer { // // MODIFY // - if #available(iOS 13.0, *) { - if !isFolderEncrypted && metadata.contentType != "image/gif" && (metadata.contentType == "com.adobe.pdf" || metadata.contentType == "application/pdf" || metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue) { - actions.append( - NCMenuAction( - title: NSLocalizedString("_modify_", comment: ""), - icon: NCUtility.shared.loadImage(named: "pencil.tip.crop.circle"), - action: { _ in - NCFunctionCenter.shared.openDownload(metadata: metadata, selector: NCGlobal.shared.selectorLoadFileQuickLook) - } - ) + if !isFolderEncrypted && metadata.contentType != "image/gif" && (metadata.contentType == "com.adobe.pdf" || metadata.contentType == "application/pdf" || metadata.classFile == NKCommon.typeClassFile.image.rawValue) { + actions.append( + NCMenuAction( + title: NSLocalizedString("_modify_", comment: ""), + icon: NCUtility.shared.loadImage(named: "pencil.tip.crop.circle"), + action: { _ in + NCFunctionCenter.shared.openDownload(metadata: metadata, selector: NCGlobal.shared.selectorLoadFileQuickLook) + } ) - } + ) } // diff --git a/iOSClient/Menu/UIViewController+Menu.swift b/iOSClient/Menu/UIViewController+Menu.swift index e30a16263..b61ca8173 100644 --- a/iOSClient/Menu/UIViewController+Menu.swift +++ b/iOSClient/Menu/UIViewController+Menu.swift @@ -23,11 +23,11 @@ import Foundation import SVGKit -import NCCommunication +import NextcloudKit import UIKit extension UIViewController { - fileprivate func handleProfileAction(_ action: NCCHovercard.Action, for userId: String) { + fileprivate func handleProfileAction(_ action: NKHovercard.Action, for userId: String) { switch action.appId { case "email": guard @@ -35,7 +35,8 @@ extension UIViewController { url.scheme == "mailto", let components = URLComponents(url: url, resolvingAgainstBaseURL: false) else { - NCContentPresenter.shared.showError(description: "_cannot_send_mail_error_") + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_cannot_send_mail_error_") + NCContentPresenter.shared.showError(error: error) return } sendEmail(to: components.path) @@ -50,7 +51,8 @@ extension UIViewController { default: guard let url = action.hyperlinkUrl, UIApplication.shared.canOpenURL(url) else { - NCContentPresenter.shared.showError(description: "_open_url_error_") + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_open_url_error_") + NCContentPresenter.shared.showError(error: error) return } UIApplication.shared.open(url, options: [:]) @@ -63,8 +65,8 @@ extension UIViewController { let serverVersionMajor = NCManageDatabase.shared.getCapabilitiesServerInt(account: appDelegate.account, elements: NCElementsJSON.shared.capabilitiesVersionMajor) guard serverVersionMajor >= NCGlobal.shared.nextcloudVersion23 else { return } - NCCommunication.shared.getHovercard(for: userId) { card, _, _ in - guard let card = card else { return } + NextcloudKit.shared.getHovercard(for: userId) { account, card, data, _ in + guard let card = card, account == appDelegate.account else { return } let personHeader = NCMenuAction( title: card.displayName, @@ -75,11 +77,11 @@ extension UIViewController { action: nil) let actions = card.actions.map { action -> NCMenuAction in - var image = NCUtility.shared.loadImage(named: "user", color: NCBrandColor.shared.label) + var image = NCUtility.shared.loadImage(named: "user", color: .label) if let url = URL(string: action.icon), let svgSource = SVGKSourceURL.source(from: url), let svg = SVGKImage(source: svgSource) { - image = svg.uiImage.imageColor(NCBrandColor.shared.label) + image = svg.uiImage.withTintColor(.label, renderingMode: .alwaysOriginal) } return NCMenuAction( title: action.title, @@ -94,7 +96,8 @@ extension UIViewController { func sendEmail(to email: String) { guard MFMailComposeViewController.canSendMail() else { - NCContentPresenter.shared.showError(description: "_cannot_send_mail_error_") + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_cannot_send_mail_error_") + NCContentPresenter.shared.showError(error: error) return } @@ -108,7 +111,8 @@ extension UIViewController { func presentMenu(with actions: [NCMenuAction]) { guard !actions.isEmpty else { return } guard let menuViewController = NCMenu.makeNCMenu(with: actions) else { - NCContentPresenter.shared.showError(description: "_internal_generic_error_") + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_internal_generic_error_") + NCContentPresenter.shared.showError(error: error) return } diff --git a/iOSClient/More/NCMore.storyboard b/iOSClient/More/NCMore.storyboard index 2ddec7257..fbf45b901 100644 --- a/iOSClient/More/NCMore.storyboard +++ b/iOSClient/More/NCMore.storyboard @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21225" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <device id="retina6_1" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21207"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="System colors in document resources" minToolsVersion="11.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> @@ -17,15 +17,10 @@ <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> - <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" rowHeight="50" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="vQk-TA-f9i"> + <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="none" rowHeight="50" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="vQk-TA-f9i"> <rect key="frame" x="0.0" y="0.0" width="414" height="780"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/> <inset key="separatorInset" minX="56" minY="0.0" maxX="0.0" maxY="0.0"/> - <view key="tableFooterView" contentMode="scaleToFill" id="5bU-gg-892"> - <rect key="frame" x="0.0" y="123.5" width="414" height="44"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> - <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> - </view> <prototypes> <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" rowHeight="50" id="qwS-lS-XzK" customClass="CCCellMore" customModule="Nextcloud" customModuleProvider="target"> <rect key="frame" x="0.0" y="55.5" width="414" height="50"/> @@ -35,30 +30,44 @@ <autoresizingMask key="autoresizingMask"/> <subviews> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="ybA-XY-jKA"> - <rect key="frame" x="20" y="12.5" width="25" height="25"/> + <rect key="frame" x="15" y="12.5" width="25" height="25"/> <constraints> <constraint firstAttribute="height" constant="25" id="97R-Fz-3Om"/> <constraint firstAttribute="width" constant="25" id="ldi-oV-Yce"/> </constraints> </imageView> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="E8e-56-e81"> - <rect key="frame" x="65" y="15" width="329" height="20"/> + <rect key="frame" x="60" y="15" width="334" height="20"/> <fontDescription key="fontDescription" type="system" pointSize="16"/> <nil key="textColor"/> <nil key="highlightedColor"/> </label> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TWu-zj-BGR"> + <rect key="frame" x="60" y="49" width="354" height="1"/> + <color key="backgroundColor" systemColor="systemBackgroundColor"/> + <constraints> + <constraint firstAttribute="height" constant="1" id="Klt-Ll-q9e"/> + </constraints> + </view> </subviews> <constraints> <constraint firstItem="E8e-56-e81" firstAttribute="centerY" secondItem="1FG-Yi-cbC" secondAttribute="centerY" id="7hX-BA-LAg"/> <constraint firstItem="E8e-56-e81" firstAttribute="leading" secondItem="ybA-XY-jKA" secondAttribute="trailing" constant="20" id="KY9-RM-FdA"/> - <constraint firstAttribute="leadingMargin" secondItem="ybA-XY-jKA" secondAttribute="leading" id="VBx-FZ-Ld2"/> <constraint firstItem="ybA-XY-jKA" firstAttribute="centerY" secondItem="1FG-Yi-cbC" secondAttribute="centerY" id="ZLU-lg-ptd"/> <constraint firstAttribute="trailingMargin" secondItem="E8e-56-e81" secondAttribute="trailing" id="mcH-pH-ru3"/> </constraints> </tableViewCellContentView> + <constraints> + <constraint firstAttribute="bottom" secondItem="TWu-zj-BGR" secondAttribute="bottom" id="9O4-Bg-VsT"/> + <constraint firstItem="ybA-XY-jKA" firstAttribute="leading" secondItem="qwS-lS-XzK" secondAttribute="leading" constant="15" id="BsW-KZ-h40"/> + <constraint firstAttribute="trailing" secondItem="TWu-zj-BGR" secondAttribute="trailing" id="Rbr-HX-HTX"/> + <constraint firstItem="TWu-zj-BGR" firstAttribute="leading" secondItem="qwS-lS-XzK" secondAttribute="leading" constant="60" id="v0q-dO-4yn"/> + </constraints> <connections> <outlet property="imageIcon" destination="ybA-XY-jKA" id="YlP-ic-UyR"/> <outlet property="labelText" destination="E8e-56-e81" id="LB7-UK-1fa"/> + <outlet property="separator" destination="TWu-zj-BGR" id="ZLw-uO-cd7"/> + <outlet property="separatorHeigth" destination="Klt-Ll-q9e" id="swb-P6-Nu9"/> </connections> </tableViewCell> </prototypes> @@ -71,7 +80,7 @@ <rect key="frame" x="0.0" y="780" width="414" height="66"/> <subviews> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="elX-0f-dn0"> - <rect key="frame" x="35" y="8" width="344" height="20"/> + <rect key="frame" x="20.5" y="8" width="373" height="20"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <constraints> <constraint firstAttribute="height" constant="20" id="4w7-0l-rmL"/> @@ -81,10 +90,10 @@ <nil key="highlightedColor"/> </label> <progressView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="750" progress="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="NSn-Xf-dwd"> - <rect key="frame" x="35" y="31" width="344" height="4"/> + <rect key="frame" x="20.5" y="31" width="373" height="4"/> </progressView> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZH2-NQ-RL0"> - <rect key="frame" x="35" y="37" width="344" height="20"/> + <rect key="frame" x="20.5" y="37" width="373" height="20"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <constraints> <constraint firstAttribute="height" constant="20" id="cqG-BZ-26w"/> @@ -96,16 +105,16 @@ </subviews> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <constraints> - <constraint firstAttribute="trailing" secondItem="elX-0f-dn0" secondAttribute="trailing" constant="35" id="BpT-pr-ezO"/> - <constraint firstAttribute="trailing" secondItem="ZH2-NQ-RL0" secondAttribute="trailing" constant="35" id="FnW-iy-Zh0"/> + <constraint firstItem="ZH2-NQ-RL0" firstAttribute="width" secondItem="4TU-gr-dbP" secondAttribute="width" multiplier="0.9" id="5ez-YH-tEO"/> + <constraint firstItem="elX-0f-dn0" firstAttribute="width" secondItem="4TU-gr-dbP" secondAttribute="width" multiplier="0.9" id="8T6-cu-SjU"/> + <constraint firstItem="NSn-Xf-dwd" firstAttribute="centerX" secondItem="4TU-gr-dbP" secondAttribute="centerX" id="EMe-Yu-FJF"/> + <constraint firstItem="NSn-Xf-dwd" firstAttribute="width" secondItem="4TU-gr-dbP" secondAttribute="width" multiplier="0.9" id="Fvh-IK-PHn"/> <constraint firstItem="elX-0f-dn0" firstAttribute="top" secondItem="4TU-gr-dbP" secondAttribute="top" constant="8" id="Glp-6T-8Pn"/> <constraint firstItem="NSn-Xf-dwd" firstAttribute="top" secondItem="elX-0f-dn0" secondAttribute="bottom" constant="3" id="JWB-v2-iRd"/> - <constraint firstItem="NSn-Xf-dwd" firstAttribute="leading" secondItem="4TU-gr-dbP" secondAttribute="leading" constant="35" id="LBI-9V-ggV"/> - <constraint firstItem="elX-0f-dn0" firstAttribute="leading" secondItem="4TU-gr-dbP" secondAttribute="leading" constant="35" id="LPV-M7-L8u"/> <constraint firstItem="ZH2-NQ-RL0" firstAttribute="top" secondItem="NSn-Xf-dwd" secondAttribute="bottom" constant="2" id="NYA-7B-WTf"/> - <constraint firstItem="ZH2-NQ-RL0" firstAttribute="leading" secondItem="4TU-gr-dbP" secondAttribute="leading" constant="35" id="ZpZ-5r-YIp"/> + <constraint firstItem="elX-0f-dn0" firstAttribute="centerX" secondItem="4TU-gr-dbP" secondAttribute="centerX" id="bRk-I2-MgU"/> + <constraint firstItem="ZH2-NQ-RL0" firstAttribute="centerX" secondItem="4TU-gr-dbP" secondAttribute="centerX" id="ctW-8O-era"/> <constraint firstAttribute="height" constant="66" id="xWW-QX-DBs"/> - <constraint firstAttribute="trailing" secondItem="NSn-Xf-dwd" secondAttribute="trailing" constant="35" id="ztv-tW-d6s"/> </constraints> </view> </subviews> diff --git a/iOSClient/More/NCMore.swift b/iOSClient/More/NCMore.swift index 8f2be2f0e..09b2522e0 100644 --- a/iOSClient/More/NCMore.swift +++ b/iOSClient/More/NCMore.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit import MarqueeLabel class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { @@ -33,13 +33,14 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { @IBOutlet weak var progressQuota: UIProgressView! @IBOutlet weak var viewQuota: UIView! - var functionMenu: [NCCommunicationExternalSite] = [] - var externalSiteMenu: [NCCommunicationExternalSite] = [] - var settingsMenu: [NCCommunicationExternalSite] = [] - var quotaMenu: [NCCommunicationExternalSite] = [] + var functionMenu: [NKExternalSite] = [] + var externalSiteMenu: [NKExternalSite] = [] + var settingsMenu: [NKExternalSite] = [] + var quotaMenu: [NKExternalSite] = [] let appDelegate = UIApplication.shared.delegate as! AppDelegate - + let defaultCornerRadius: CGFloat = 10.0 + var tabAccount: tableAccount? // MARK: - View Life Cycle @@ -48,13 +49,11 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { super.viewDidLoad() self.navigationItem.title = NSLocalizedString("_more_", comment: "") - view.backgroundColor = NCBrandColor.shared.systemGroupedBackground + view.backgroundColor = .systemGroupedBackground tableView.delegate = self tableView.dataSource = self - tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground - tableView.separatorColor = NCBrandColor.shared.separator - + tableView.backgroundColor = .systemGroupedBackground tableView.register(UINib(nibName: "NCMoreUserCell", bundle: nil), forCellReuseIdentifier: "userCell") // create tap gesture recognizer @@ -69,9 +68,11 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + navigationController?.setGroupeAppreance() + appDelegate.activeViewController = self - loadItems() + tableView.reloadData() } // MARK: - NotificationCenter @@ -84,7 +85,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { func loadItems() { - var item = NCCommunicationExternalSite() + var item = NKExternalSite() var quota: String = "" // Clear @@ -96,28 +97,28 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { progressQuota.progressTintColor = NCBrandColor.shared.brandElement // ITEM : Transfer - item = NCCommunicationExternalSite() + item = NKExternalSite() item.name = "_transfers_" item.icon = "arrow.left.arrow.right" item.url = "segueTransfers" functionMenu.append(item) // ITEM : Recent - item = NCCommunicationExternalSite() + item = NKExternalSite() item.name = "_recent_" item.icon = "recent" item.url = "segueRecent" functionMenu.append(item) // ITEM : Notification - item = NCCommunicationExternalSite() + item = NKExternalSite() item.name = "_notification_" item.icon = "bell" item.url = "segueNotification" functionMenu.append(item) // ITEM : Activity - item = NCCommunicationExternalSite() + item = NKExternalSite() item.name = "_activity_" item.icon = "bolt" item.url = "segueActivity" @@ -126,7 +127,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { // ITEM : Shares let isFilesSharingEnabled = NCManageDatabase.shared.getCapabilitiesServerBool(account: appDelegate.account, elements: NCElementsJSON.shared.capabilitiesFileSharingApiEnabled, exists: false) if isFilesSharingEnabled { - item = NCCommunicationExternalSite() + item = NKExternalSite() item.name = "_list_shares_" item.icon = "share" item.url = "segueShares" @@ -134,26 +135,24 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { } // ITEM : Offline - item = NCCommunicationExternalSite() + item = NKExternalSite() item.name = "_manage_file_offline_" item.icon = "tray.and.arrow.down" item.url = "segueOffline" functionMenu.append(item) // ITEM : Scan - if #available(iOS 13.0, *) { - item = NCCommunicationExternalSite() - item.name = "_scanned_images_" - item.icon = "doc.text.viewfinder" - item.url = "openStoryboardNCScan" - functionMenu.append(item) - } + item = NKExternalSite() + item.name = "_scanned_images_" + item.icon = "scan" + item.url = "openStoryboardNCScan" + functionMenu.append(item) // ITEM : Trash let serverVersionMajor = NCManageDatabase.shared.getCapabilitiesServerInt(account: appDelegate.account, elements: NCElementsJSON.shared.capabilitiesVersionMajor) if serverVersionMajor >= NCGlobal.shared.nextcloudVersion15 { - item = NCCommunicationExternalSite() + item = NKExternalSite() item.name = "_trash_view_" item.icon = "trash" item.url = "segueTrash" @@ -161,7 +160,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { } // ITEM : Settings - item = NCCommunicationExternalSite() + item = NKExternalSite() item.name = "_settings_" item.icon = "gear" item.url = "segueSettings" @@ -169,7 +168,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { // ITEM: Test API if NCUtility.shared.isSimulator() { - item = NCCommunicationExternalSite() + item = NKExternalSite() item.name = "Test API" item.icon = "swift" item.url = "test" @@ -214,7 +213,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { if let externalSites = NCManageDatabase.shared.getAllExternalSites(account: appDelegate.account) { for externalSite in externalSites { if (externalSite.name != "" && externalSite.url != ""), let urlEncoded = externalSite.url.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) { - item = NCCommunicationExternalSite() + item = NKExternalSite() item.name = externalSite.name item.url = urlEncoded item.icon = "network" @@ -224,12 +223,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { externalSiteMenu.append(item) } } - tableView.reloadData() - } else { - tableView.reloadData() } - } else { - tableView.reloadData() } } @@ -260,7 +254,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { if indexPath.section == 0 { - return 100 + return 75 } else { return NCGlobal.shared.heightCellSettings } @@ -274,6 +268,15 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { return 4 } } + + func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { + + if section == 0 { + return 10 + } else { + return 20 + } + } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { @@ -307,10 +310,10 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { return cont } - + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - var item = NCCommunicationExternalSite() + var item = NKExternalSite() // change color selection and disclosure indicator let selectionColor: UIView = UIView() @@ -334,10 +337,10 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { } else { cell.displayName?.text = account.displayName + " (" + account.alias + ")" } - cell.displayName.textColor = NCBrandColor.shared.label + cell.displayName.textColor = .label } cell.selectedBackgroundView = selectionColor - cell.backgroundColor = NCBrandColor.shared.secondarySystemGroupedBackground + cell.backgroundColor = .secondarySystemGroupedBackground cell.accessoryType = UITableViewCell.AccessoryType.disclosureIndicator if NCManageDatabase.shared.getCapabilitiesServerBool(account: appDelegate.account, elements: NCElementsJSON.shared.capabilitiesUserStatusEnabled, exists: false) { @@ -345,7 +348,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { let status = NCUtility.shared.getUserStatus(userIcon: account.userStatusIcon, userStatus: account.userStatusStatus, userMessage: account.userStatusMessage) cell.icon.image = status.onlineStatus cell.status.text = status.statusMessage - cell.status.textColor = NCBrandColor.shared.label + cell.status.textColor = .label cell.status.trailingBuffer = cell.status.frame.width if cell.status.labelShouldScroll() { cell.status.tapToScroll = true @@ -354,6 +357,9 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { } } } + + cell.layer.cornerRadius = defaultCornerRadius + cell.layer.maskedCorners = [.layerMaxXMinYCorner, .layerMinXMinYCorner, .layerMaxXMaxYCorner, .layerMinXMaxYCorner] return cell @@ -363,7 +369,6 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { // Menu Normal if indexPath.section == 1 { - item = functionMenu[indexPath.row] } // Menu External Site @@ -377,12 +382,32 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { cell.imageIcon?.image = NCUtility.shared.loadImage(named: item.icon) cell.labelText?.text = NSLocalizedString(item.name, comment: "") - cell.labelText.textColor = NCBrandColor.shared.label + cell.labelText.textColor = .label cell.selectedBackgroundView = selectionColor - cell.backgroundColor = NCBrandColor.shared.secondarySystemGroupedBackground + cell.backgroundColor = .secondarySystemGroupedBackground cell.accessoryType = UITableViewCell.AccessoryType.disclosureIndicator + cell.separator.backgroundColor = .separator + cell.separatorHeigth.constant = 0.4 + + cell.layer.cornerRadius = 0 + let rows = tableView.numberOfRows(inSection: indexPath.section) + + if indexPath.row == 0 { + cell.layer.cornerRadius = defaultCornerRadius + if indexPath.row == rows - 1 { + cell.separator.backgroundColor = .clear + cell.layer.maskedCorners = [.layerMaxXMinYCorner, .layerMinXMinYCorner, .layerMaxXMaxYCorner, .layerMinXMaxYCorner] + } else { + cell.layer.maskedCorners = [.layerMaxXMinYCorner, .layerMinXMinYCorner] + } + } else if indexPath.row == rows - 1 { + cell.layer.cornerRadius = defaultCornerRadius + cell.layer.maskedCorners = [.layerMaxXMaxYCorner, .layerMinXMaxYCorner] + cell.separator.backgroundColor = .clear + } + return cell } } @@ -390,7 +415,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { // method to run when table view cell is tapped func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - var item = NCCommunicationExternalSite() + var item = NKExternalSite() if indexPath.section == 0 { tapImageLogoManageAccount() @@ -466,6 +491,22 @@ class CCCellMore: UITableViewCell { @IBOutlet weak var labelText: UILabel! @IBOutlet weak var imageIcon: UIImageView! + @IBOutlet weak var separator: UIView! + @IBOutlet weak var separatorHeigth: NSLayoutConstraint! + + override var frame: CGRect { + get { + return super.frame + } + set (newFrame) { + var frame = newFrame + let newWidth = frame.width * 0.90 + let space = (frame.width - newWidth) / 2 + frame.size.width = newWidth + frame.origin.x += space + super.frame = frame + } + } } class NCMoreUserCell: UITableViewCell { @@ -474,4 +515,18 @@ class NCMoreUserCell: UITableViewCell { @IBOutlet weak var avatar: UIImageView! @IBOutlet weak var icon: UIImageView! @IBOutlet weak var status: MarqueeLabel! + + override var frame: CGRect { + get { + return super.frame + } + set (newFrame) { + var frame = newFrame + let newWidth = frame.width * 0.90 + let space = (frame.width - newWidth) / 2 + frame.size.width = newWidth + frame.origin.x += space + super.frame = frame + } + } } diff --git a/iOSClient/More/NCMoreUserCell.xib b/iOSClient/More/NCMoreUserCell.xib index 3f9ac2201..f8bf291db 100755 --- a/iOSClient/More/NCMoreUserCell.xib +++ b/iOSClient/More/NCMoreUserCell.xib @@ -1,28 +1,23 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21225" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES"> <device id="retina4_7" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21207"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <objects> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="CustomCellFileAndDirectory"/> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> <tableViewCell contentMode="scaleToFill" selectionStyle="blue" indentationWidth="0.0" reuseIdentifier="userCell" rowHeight="107" id="2" customClass="NCMoreUserCell" customModule="Nextcloud" customModuleProvider="target"> - <rect key="frame" x="0.0" y="0.0" width="600" height="100"/> + <rect key="frame" x="0.0" y="0.0" width="600" height="75"/> <autoresizingMask key="autoresizingMask" flexibleMaxY="YES"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="2" id="sQq-jC-UEV"> - <rect key="frame" x="0.0" y="0.0" width="600" height="100"/> + <rect key="frame" x="0.0" y="0.0" width="600" height="75"/> <autoresizingMask key="autoresizingMask"/> <subviews> - <label opaque="NO" userInteractionEnabled="NO" tag="101" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="display name" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QNC-8X-DAC"> - <rect key="frame" x="20" y="75" width="560" height="18"/> - <fontDescription key="fontDescription" type="system" pointSize="15"/> - <nil key="highlightedColor"/> - </label> <label opaque="NO" userInteractionEnabled="NO" tag="102" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="status" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="p7I-KN-FVZ" customClass="MarqueeLabel" customModule="MarqueeLabel"> - <rect key="frame" x="335" y="48" width="245" height="14.5"/> + <rect key="frame" x="80" y="42.5" width="500" height="15"/> <fontDescription key="fontDescription" type="system" pointSize="12"/> <nil key="highlightedColor"/> <userDefinedRuntimeAttributes> @@ -30,35 +25,41 @@ </userDefinedRuntimeAttributes> </label> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" translatesAutoresizingMaskIntoConstraints="NO" id="5"> - <rect key="frame" x="275" y="10" width="50" height="50"/> + <rect key="frame" x="15" y="12.5" width="50" height="50"/> <constraints> <constraint firstAttribute="width" constant="50" id="kM5-Uf-S8Z"/> <constraint firstAttribute="height" constant="50" id="l9C-BW-ogy"/> </constraints> </imageView> <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="jy6-cx-LK4"> - <rect key="frame" x="310" y="45" width="20" height="20"/> + <rect key="frame" x="50" y="47.5" width="20" height="20"/> <constraints> <constraint firstAttribute="width" constant="20" id="3xZ-lf-n4v"/> <constraint firstAttribute="height" constant="20" id="l81-IO-fzK"/> </constraints> </imageView> + <label opaque="NO" userInteractionEnabled="NO" tag="101" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="display name" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QNC-8X-DAC"> + <rect key="frame" x="80" y="20" width="500" height="20.5"/> + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/> + <nil key="highlightedColor"/> + </label> </subviews> - <color key="tintColor" red="1" green="0.5" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <constraints> - <constraint firstItem="QNC-8X-DAC" firstAttribute="leading" secondItem="sQq-jC-UEV" secondAttribute="leading" constant="20" id="Gpf-ni-W0A"/> - <constraint firstAttribute="trailing" secondItem="QNC-8X-DAC" secondAttribute="trailing" constant="20" id="ICD-Fn-jbL"/> - <constraint firstItem="p7I-KN-FVZ" firstAttribute="leading" secondItem="jy6-cx-LK4" secondAttribute="trailing" constant="5" id="JtQ-Rf-ngA"/> + <constraint firstAttribute="trailing" secondItem="QNC-8X-DAC" secondAttribute="trailing" constant="20" id="28X-bj-Yak"/> + <constraint firstItem="p7I-KN-FVZ" firstAttribute="leading" secondItem="5" secondAttribute="trailing" constant="15" id="DXv-dr-zaw"/> <constraint firstItem="jy6-cx-LK4" firstAttribute="bottom" secondItem="5" secondAttribute="bottom" constant="5" id="MNe-PS-i7m"/> - <constraint firstItem="5" firstAttribute="centerX" secondItem="sQq-jC-UEV" secondAttribute="centerX" id="MQs-0w-slX"/> <constraint firstItem="jy6-cx-LK4" firstAttribute="trailing" secondItem="5" secondAttribute="trailing" constant="5" id="Ooq-nL-VC8"/> - <constraint firstItem="5" firstAttribute="top" secondItem="sQq-jC-UEV" secondAttribute="top" constant="10" id="a8p-7g-2Em"/> + <constraint firstItem="QNC-8X-DAC" firstAttribute="leading" secondItem="5" secondAttribute="trailing" constant="15" id="YCQ-mz-zQS"/> <constraint firstAttribute="trailing" secondItem="p7I-KN-FVZ" secondAttribute="trailing" constant="20" id="bQd-pS-6a6"/> - <constraint firstItem="QNC-8X-DAC" firstAttribute="top" secondItem="5" secondAttribute="bottom" constant="15" id="gDU-yC-ZfX"/> - <constraint firstItem="p7I-KN-FVZ" firstAttribute="centerY" secondItem="jy6-cx-LK4" secondAttribute="centerY" id="m7R-Q5-0AI"/> + <constraint firstItem="p7I-KN-FVZ" firstAttribute="top" secondItem="QNC-8X-DAC" secondAttribute="bottom" constant="2" id="xpT-Lo-lhI"/> </constraints> </tableViewCellContentView> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + <constraints> + <constraint firstItem="QNC-8X-DAC" firstAttribute="top" secondItem="2" secondAttribute="top" constant="20" id="NjO-V7-q8i"/> + <constraint firstItem="5" firstAttribute="centerY" secondItem="2" secondAttribute="centerY" id="bRf-Xg-Vtj"/> + <constraint firstItem="5" firstAttribute="leading" secondItem="2" secondAttribute="leading" constant="15" id="pDp-UJ-IcD"/> + </constraints> <connections> <outlet property="avatar" destination="5" id="th9-2m-8sL"/> <outlet property="displayName" destination="QNC-8X-DAC" id="H4w-nI-tsr"/> @@ -68,4 +69,9 @@ <point key="canvasLocation" x="662.39999999999998" y="189.3553223388306"/> </tableViewCell> </objects> + <designables> + <designable name="p7I-KN-FVZ"> + <size key="intrinsicContentSize" width="35" height="14.5"/> + </designable> + </designables> </document> diff --git a/iOSClient/NCGlobal.swift b/iOSClient/NCGlobal.swift index 1527247e5..7fe60e70c 100644 --- a/iOSClient/NCGlobal.swift +++ b/iOSClient/NCGlobal.swift @@ -100,6 +100,7 @@ class NCGlobal: NSObject { // Name // @objc let appName = "files" + @objc let talkName = "talk-message" // Nextcloud version // @@ -109,11 +110,13 @@ class NCGlobal: NSObject { let nextcloudVersion18: Int = 18 let nextcloudVersion20: Int = 20 let nextcloudVersion23: Int = 23 + let nextcloudVersion24: Int = 24 + let nextcloudVersion25: Int = 25 // Database Realm // let databaseDefault = "nextcloud.realm" - let databaseSchemaVersion: UInt64 = 237 + let databaseSchemaVersion: UInt64 = 246 // Intro selector // @@ -220,14 +223,18 @@ class NCGlobal: NSObject { // Error // - @objc let errorNoError: Int = 0 @objc let errorRequestExplicityCancelled: Int = 15 @objc let errorNotModified: Int = 304 @objc let errorBadRequest: Int = 400 + @objc let errorUnauthorized: Int = 401 + @objc let errorForbidden: Int = 403 @objc let errorResourceNotFound: Int = 404 @objc let errordMethodNotSupported: Int = 405 @objc let errorConflict: Int = 409 + @objc let errorPreconditionFailed: Int = 412 + @objc let errorNCUnauthorized: Int = 997 @objc let errorConnectionLost: Int = -1005 + @objc let errorNetworkNotAvailable: Int = -1009 @objc let errorBadServerResponse: Int = -1011 @objc let errorInternalError: Int = -99999 @objc let errorFileNotSaved: Int = -99998 @@ -237,7 +244,6 @@ class NCGlobal: NSObject { @objc let errorCharactersForbidden: Int = -99993 @objc let errorCreationFile: Int = -99992 @objc let errorReadFile: Int = -99991 - @objc let errorGeneric: Int = -99990 // Constants to identify the different permissions of a file // @@ -317,6 +323,10 @@ class NCGlobal: NSObject { let metadataStatusUploading: Int = 3 let metadataStatusUploadError: Int = 4 + // Upload Operation Background + // + let maxConcurrentOperationUpload = 10 + // Notification Center // @objc let notificationCenterApplicationDidEnterBackground = "applicationDidEnterBackground" @@ -339,11 +349,11 @@ class NCGlobal: NSObject { let notificationCenterChangeStatusFolderE2EE = "changeStatusFolderE2EE" // userInfo: serverUrl let notificationCenterDownloadStartFile = "downloadStartFile" // userInfo: ocId, serverUrl, account - let notificationCenterDownloadedFile = "downloadedFile" // userInfo: ocId, serverUrl, account, selector, errorCode, errorDescription + let notificationCenterDownloadedFile = "downloadedFile" // userInfo: ocId, serverUrl, account, selector, error let notificationCenterDownloadCancelFile = "downloadCancelFile" // userInfo: ocId, serverUrl, account let notificationCenterUploadStartFile = "uploadStartFile" // userInfo: ocId, serverUrl, account, fileName, sessionSelector - @objc let notificationCenterUploadedFile = "uploadedFile" // userInfo: ocId, serverUrl, account, fileName, ocIdTemp, errorCode, errorDescription + @objc let notificationCenterUploadedFile = "uploadedFile" // userInfo: ocId, serverUrl, account, fileName, ocIdTemp, error let notificationCenterUploadCancelFile = "uploadCancelFile" // userInfo: ocId, serverUrl, account let notificationCenterProgressTask = "progressTask" // userInfo: account, ocId, serverUrl, status, progress, totalBytes, totalBytesExpected @@ -378,4 +388,37 @@ class NCGlobal: NSObject { let tipNCCollectionViewCommonAccountRequest = "tipnccollectionviewcommonaccountrequest" let tipNCScanAddImage = "tipncscanaddimage" let tipNCViewerMediaDetailView = "tipncviewermediadetailview" + + // ACTION + // + let actionNoAction = "no-action" + let actionUploadAsset = "upload-asset" + let actionScanDocument = "add-scan-document" + let actionTextDocument = "create-text-document" + let actionVoiceMemo = "create-voice-memo" + + // WIDGET ACTION + // + let widgetActionNoAction = URL(string: "nextcloud://open-action?action=no-action")! + let widgetActionUploadAsset = URL(string: "nextcloud://open-action?action=upload-asset")! + let widgetActionScanDocument = URL(string: "nextcloud://open-action?action=add-scan-document")! + let widgetActionTextDocument = URL(string: "nextcloud://open-action?action=create-text-document")! + let widgetActionVoiceMemo = URL(string: "nextcloud://open-action?action=create-voice-memo")! + + // APPCONFIG + // + let configuration_brand = "brand" + + let configuration_serverUrl = "serverUrl" + let configuration_username = "username" + let configuration_password = "password" + let configuration_apppassword = "apppassword" + + let configuration_disable_intro = "disable_intro" + let configuration_disable_multiaccount = "disable_multiaccount" + let configuration_disable_crash_service = "disable_crash_service" + let configuration_disable_log = "disable_log" + let configuration_disable_manage_account = "disable_manage_account" + let configuration_disable_more_external_site = "disable_more_external_site" + let configuration_disable_openin_file = "disable_openin_file" } diff --git a/iOSClient/Networking/NCAutoUpload.swift b/iOSClient/Networking/NCAutoUpload.swift index 856c3f792..84d2adef2 100644 --- a/iOSClient/Networking/NCAutoUpload.swift +++ b/iOSClient/Networking/NCAutoUpload.swift @@ -23,7 +23,7 @@ import UIKit import CoreLocation -import NCCommunication +import NextcloudKit import Photos class NCAutoUpload: NSObject { @@ -32,13 +32,14 @@ class NCAutoUpload: NSObject { return instance }() - private let appDelegate = UIApplication.shared.delegate as! AppDelegate private var endForAssetToUpload: Bool = false + private let appDelegate = UIApplication.shared.delegate as? AppDelegate + private let applicationState = UIApplication.shared.applicationState // MARK: - @objc func initAutoUpload(viewController: UIViewController?, completion: @escaping (_ items: Int) -> Void) { - guard let activeAccount = NCManageDatabase.shared.getActiveAccount(), activeAccount.autoUpload else { + guard let account = NCManageDatabase.shared.getActiveAccount(), account.autoUpload else { completion(0) return } @@ -49,130 +50,134 @@ class NCAutoUpload: NSObject { completion(0) return } - - self.uploadAssetsNewAndFull(viewController: viewController, selector: NCGlobal.shared.selectorUploadAutoUpload, log: "Init Auto Upload") { items in - completion(items) + DispatchQueue.global().async { + self.uploadAssetsNewAndFull(viewController: viewController, selector: NCGlobal.shared.selectorUploadAutoUpload, log: "Init Auto Upload") { items in + completion(items) + } } } } @objc func autoUploadFullPhotos(viewController: UIViewController?, log: String) { - NCAskAuthorization.shared.askAuthorizationPhotoLibrary(viewController: appDelegate.window?.rootViewController) { hasPermission in + NCAskAuthorization.shared.askAuthorizationPhotoLibrary(viewController: viewController) { hasPermission in guard hasPermission else { return } - - NCContentPresenter.shared.messageNotification("_attention_", description: "_create_full_upload_", delay: NCGlobal.shared.dismissAfterSecondLong, type: .info, errorCode: NCGlobal.shared.errorNoError, priority: .max) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_create_full_upload_") + NCContentPresenter.shared.showWarning(error: error, priority: .max) NCActivityIndicator.shared.start() - self.uploadAssetsNewAndFull(viewController: viewController, selector: NCGlobal.shared.selectorUploadAutoUploadAll, log: log) { _ in - NCActivityIndicator.shared.stop() + DispatchQueue.global().async { + self.uploadAssetsNewAndFull(viewController: viewController, selector: NCGlobal.shared.selectorUploadAutoUploadAll, log: log) { _ in + NCActivityIndicator.shared.stop() + } } } } private func uploadAssetsNewAndFull(viewController: UIViewController?, selector: String, log: String, completion: @escaping (_ items: Int) -> Void) { - guard !appDelegate.account.isEmpty else { + guard let account = NCManageDatabase.shared.getActiveAccount() else { completion(0) return } - guard let account = NCManageDatabase.shared.getAccount(predicate: NSPredicate(format: "account == %@", appDelegate.account)) else { return } - - DispatchQueue.global(qos: .background).async { - let autoUploadPath = NCManageDatabase.shared.getAccountAutoUploadPath(urlBase: account.urlBase, account: account.account) - var metadatas: [tableMetadata] = [] + let autoUploadPath = NCManageDatabase.shared.getAccountAutoUploadPath(urlBase: account.urlBase, account: account.account) + var metadatas: [tableMetadata] = [] - self.getCameraRollAssets(viewController: viewController, account: account, selector: selector, alignPhotoLibrary: false) { assets in - guard let assets = assets, !assets.isEmpty else { - NCCommunicationCommon.shared.writeLog("Automatic upload, no new assets found [" + log + "]") - completion(0) - return + self.getCameraRollAssets(viewController: viewController, account: account, selector: selector, alignPhotoLibrary: false) { assets in + guard let assets = assets, !assets.isEmpty else { + NKCommon.shared.writeLog("[INFO] Automatic upload, no new assets found [" + log + "]") + completion(0) + return + } + NKCommon.shared.writeLog("[INFO] Automatic upload, new \(assets.count) assets found [" + log + "]") + // Create the folder for auto upload & if request the subfolders + if !NCNetworking.shared.createFolder(assets: assets, selector: selector, useSubFolder: account.autoUploadCreateSubfolder, account: account.account, urlBase: account.urlBase) { + if selector == NCGlobal.shared.selectorUploadAutoUploadAll { + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_error_createsubfolders_upload_") + NCContentPresenter.shared.showError(error: error, priority: .max) } - NCCommunicationCommon.shared.writeLog("Automatic upload, new \(assets.count) assets found [" + log + "]") + return completion(0) + } - // Create the folder for auto upload & if request the subfolders - if !NCNetworking.shared.createFolder(assets: assets, selector: selector, useSubFolder: account.autoUploadCreateSubfolder, account: account.account, urlBase: account.urlBase) { - if selector == NCGlobal.shared.selectorUploadAutoUploadAll { - NCContentPresenter.shared.messageNotification("_error_", description: "_error_createsubfolders_upload_", delay: NCGlobal.shared.dismissAfterSecond, type: .error, errorCode: NCGlobal.shared.errorInternalError, priority: .max) - } - return completion(0) - } + self.endForAssetToUpload = false - self.endForAssetToUpload = false + for asset in assets { - for asset in assets { + var livePhoto = false + var session: String = "" + guard let assetDate = asset.creationDate else { continue } + let assetMediaType = asset.mediaType + var serverUrl: String = "" + let fileName = CCUtility.createFileName(asset.value(forKey: "filename") as? String, fileDate: assetDate, fileType: assetMediaType, keyFileName: NCGlobal.shared.keyFileNameAutoUploadMask, keyFileNameType: NCGlobal.shared.keyFileNameAutoUploadType, keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginalAutoUpload, forcedNewFileName: false)! + let formatter = DateFormatter() + formatter.dateFormat = "yyyy" + let yearString = formatter.string(from: assetDate) + formatter.dateFormat = "MM" + let monthString = formatter.string(from: assetDate) - var livePhoto = false - var session: String = "" - guard let assetDate = asset.creationDate else { continue } - let assetMediaType = asset.mediaType - var serverUrl: String = "" - let fileName = CCUtility.createFileName(asset.value(forKey: "filename") as? String, fileDate: assetDate, fileType: assetMediaType, keyFileName: NCGlobal.shared.keyFileNameAutoUploadMask, keyFileNameType: NCGlobal.shared.keyFileNameAutoUploadType, keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginalAutoUpload, forcedNewFileName: false)! - let formatter = DateFormatter() - formatter.dateFormat = "yyyy" - let yearString = formatter.string(from: assetDate) - formatter.dateFormat = "MM" - let monthString = formatter.string(from: assetDate) + if asset.mediaSubtypes.contains(.photoLive) && CCUtility.getLivePhoto() { + livePhoto = true + } - if asset.mediaSubtypes.contains(.photoLive) && CCUtility.getLivePhoto() { - livePhoto = true - } + if selector == NCGlobal.shared.selectorUploadAutoUploadAll { + session = NKCommon.shared.sessionIdentifierUpload + } else { + if assetMediaType == PHAssetMediaType.image && account.autoUploadWWAnPhoto == false { + session = NCNetworking.shared.sessionIdentifierBackground + } else if assetMediaType == PHAssetMediaType.video && account.autoUploadWWAnVideo == false { + session = NCNetworking.shared.sessionIdentifierBackground + } else if assetMediaType == PHAssetMediaType.image && account.autoUploadWWAnPhoto { + session = NCNetworking.shared.sessionIdentifierBackgroundWWan + } else if assetMediaType == PHAssetMediaType.video && account.autoUploadWWAnVideo { + session = NCNetworking.shared.sessionIdentifierBackgroundWWan + } else { session = NCNetworking.shared.sessionIdentifierBackground } + } - if selector == NCGlobal.shared.selectorUploadAutoUploadAll { - session = NCCommunicationCommon.shared.sessionIdentifierUpload - } else { - if assetMediaType == PHAssetMediaType.image && account.autoUploadWWAnPhoto == false { - session = NCNetworking.shared.sessionIdentifierBackground - } else if assetMediaType == PHAssetMediaType.video && account.autoUploadWWAnVideo == false { - session = NCNetworking.shared.sessionIdentifierBackground - } else if assetMediaType == PHAssetMediaType.image && account.autoUploadWWAnPhoto { - session = NCNetworking.shared.sessionIdentifierBackgroundWWan - } else if assetMediaType == PHAssetMediaType.video && account.autoUploadWWAnVideo { - session = NCNetworking.shared.sessionIdentifierBackgroundWWan - } else { session = NCNetworking.shared.sessionIdentifierBackground } - } + if account.autoUploadCreateSubfolder { + serverUrl = autoUploadPath + "/" + yearString + "/" + monthString + } else { + serverUrl = autoUploadPath + } - if account.autoUploadCreateSubfolder { - serverUrl = autoUploadPath + "/" + yearString + "/" + monthString - } else { - serverUrl = autoUploadPath + // MOST COMPATIBLE SEARCH --> HEIC --> JPG + var fileNameSearchMetadata = fileName + let ext = (fileNameSearchMetadata as NSString).pathExtension.uppercased() + if ext == "HEIC" && CCUtility.getFormatCompatibility() { + fileNameSearchMetadata = (fileNameSearchMetadata as NSString).deletingPathExtension + ".jpg" + } + if NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameView == %@", account.account, serverUrl, fileNameSearchMetadata)) != nil { + if selector == NCGlobal.shared.selectorUploadAutoUpload { + NCManageDatabase.shared.addPhotoLibrary([asset], account: account.account) } - - // MOST COMPATIBLE SEARCH --> HEIC --> JPG - var fileNameSearchMetadata = fileName - let ext = (fileNameSearchMetadata as NSString).pathExtension.uppercased() - if ext == "HEIC" && CCUtility.getFormatCompatibility() { - fileNameSearchMetadata = (fileNameSearchMetadata as NSString).deletingPathExtension + ".jpg" + } else { + let metadata = NCManageDatabase.shared.createMetadata(account: account.account, user: account.user, userId: account.userId, fileName: fileName, fileNameView: fileName, ocId: NSUUID().uuidString, serverUrl: serverUrl, urlBase: account.urlBase, url: "", contentType: "", isLivePhoto: livePhoto) + metadata.assetLocalIdentifier = asset.localIdentifier + metadata.session = session + metadata.sessionSelector = selector + metadata.status = NCGlobal.shared.metadataStatusWaitUpload + if assetMediaType == PHAssetMediaType.video { + metadata.classFile = NKCommon.typeClassFile.video.rawValue + } else if assetMediaType == PHAssetMediaType.image { + metadata.classFile = NKCommon.typeClassFile.image.rawValue } - if NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameView == %@", account.account, serverUrl, fileNameSearchMetadata)) != nil { - if selector == NCGlobal.shared.selectorUploadAutoUpload { - NCManageDatabase.shared.addPhotoLibrary([asset], account: account.account) - } - } else { - let metadata = NCManageDatabase.shared.createMetadata(account: account.account, user: account.user, userId: account.userId, fileName: fileName, fileNameView: fileName, ocId: NSUUID().uuidString, serverUrl: serverUrl, urlBase: account.urlBase, url: "", contentType: "", isLivePhoto: livePhoto) - metadata.assetLocalIdentifier = asset.localIdentifier - metadata.session = session - metadata.sessionSelector = selector - metadata.status = NCGlobal.shared.metadataStatusWaitUpload - if assetMediaType == PHAssetMediaType.video { - metadata.classFile = NCCommunicationCommon.typeClassFile.video.rawValue - } else if assetMediaType == PHAssetMediaType.image { - metadata.classFile = NCCommunicationCommon.typeClassFile.image.rawValue - } - if selector == NCGlobal.shared.selectorUploadAutoUpload { - NCCommunicationCommon.shared.writeLog("Automatic upload added \(metadata.fileNameView) with Identifier \(metadata.assetLocalIdentifier)") - NCManageDatabase.shared.addPhotoLibrary([asset], account: account.account) - } - metadatas.append(metadata) + if selector == NCGlobal.shared.selectorUploadAutoUpload { + NKCommon.shared.writeLog("[INFO] Automatic upload added \(metadata.fileNameView) with Identifier \(metadata.assetLocalIdentifier)") + NCManageDatabase.shared.addPhotoLibrary([asset], account: account.account) } + metadatas.append(metadata) } + } - self.endForAssetToUpload = true - if selector == NCGlobal.shared.selectorUploadAutoUploadAll { - self.appDelegate.networkingProcessUpload?.createProcessUploads(metadatas: metadatas) - } else { - self.appDelegate.networkingProcessUpload?.createProcessUploads(metadatas: metadatas, verifyAlreadyExists: true) + self.endForAssetToUpload = true + if selector == NCGlobal.shared.selectorUploadAutoUploadAll { + self.appDelegate?.networkingProcessUpload?.createProcessUploads(metadatas: metadatas, completion: completion) + } else { + var metadatasForUpload: [tableMetadata] = [] + for metadata in metadatas { + if NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ && serverUrl == %@ && fileName == %@ && session != ''", metadata.account, metadata.serverUrl, metadata.fileName)) != nil { continue } + metadatasForUpload.append(metadata) } - completion(metadatas.count) + NCManageDatabase.shared.addMetadatas(metadatasForUpload) + NCNetworking.shared.createUploadProcessAutoUpload(completion: completion) } } } @@ -187,7 +192,7 @@ class NCAutoUpload: NSObject { guard let assets = assets else { return } NCManageDatabase.shared.addPhotoLibrary(assets, account: activeAccount.account) - NCCommunicationCommon.shared.writeLog("Align Photo Library \(assets.count)") + NKCommon.shared.writeLog("[INFO] Align Photo Library \(assets.count)") } } diff --git a/iOSClient/Networking/NCNetworking.swift b/iOSClient/Networking/NCNetworking.swift index 1f7ee36c1..855944740 100644 --- a/iOSClient/Networking/NCNetworking.swift +++ b/iOSClient/Networking/NCNetworking.swift @@ -23,19 +23,18 @@ import UIKit import OpenSSL -import NCCommunication +import NextcloudKit import Alamofire -import Queuer import Photos @objc public protocol NCNetworkingDelegate { @objc optional func downloadProgress(_ progress: Float, totalBytes: Int64, totalBytesExpected: Int64, fileName: String, serverUrl: String, session: URLSession, task: URLSessionTask) @objc optional func uploadProgress(_ progress: Float, totalBytes: Int64, totalBytesExpected: Int64, fileName: String, serverUrl: String, session: URLSession, task: URLSessionTask) - @objc optional func downloadComplete(fileName: String, serverUrl: String, etag: String?, date: NSDate?, dateLastModified: NSDate?, length: Int64, description: String?, task: URLSessionTask, errorCode: Int, errorDescription: String) - @objc optional func uploadComplete(fileName: String, serverUrl: String, ocId: String?, etag: String?, date: NSDate?, size: Int64, description: String?, task: URLSessionTask, errorCode: Int, errorDescription: String) + @objc optional func downloadComplete(fileName: String, serverUrl: String, etag: String?, date: NSDate?, dateLastModified: NSDate?, length: Int64, description: String?, task: URLSessionTask, error: NKError) + @objc optional func uploadComplete(fileName: String, serverUrl: String, ocId: String?, etag: String?, date: NSDate?, size: Int64, description: String?, task: URLSessionTask, error: NKError) } -@objc class NCNetworking: NSObject, NCCommunicationCommonDelegate { +@objc class NCNetworking: NSObject, NKCommonDelegate { @objc public static let shared: NCNetworking = { let instance = NCNetworking() return instance @@ -44,7 +43,7 @@ import Photos weak var delegate: NCNetworkingDelegate? var lastReachability: Bool = true - var networkReachability: NCCommunicationCommon.typeReachability? + var networkReachability: NKCommon.typeReachability? let downloadRequest = ThreadSafeDictionary<String,DownloadRequest>() let uploadRequest = ThreadSafeDictionary<String,UploadRequest>() let uploadMetadataInBackground = ThreadSafeDictionary<String,tableMetadata>() @@ -61,7 +60,7 @@ import Photos configuration.isDiscretionary = false configuration.httpMaximumConnectionsPerHost = sessionMaximumConnectionsPerHost configuration.requestCachePolicy = NSURLRequest.CachePolicy.reloadIgnoringLocalCacheData - let session = URLSession(configuration: configuration, delegate: NCCommunicationBackground.shared, delegateQueue: OperationQueue.main) + let session = URLSession(configuration: configuration, delegate: NKBackground.shared, delegateQueue: OperationQueue.main) return session }() @@ -72,7 +71,7 @@ import Photos configuration.isDiscretionary = false configuration.httpMaximumConnectionsPerHost = sessionMaximumConnectionsPerHost configuration.requestCachePolicy = NSURLRequest.CachePolicy.reloadIgnoringLocalCacheData - let session = URLSession(configuration: configuration, delegate: NCCommunicationBackground.shared, delegateQueue: OperationQueue.main) + let session = URLSession(configuration: configuration, delegate: NKBackground.shared, delegateQueue: OperationQueue.main) return session }() @@ -85,7 +84,7 @@ import Photos configuration.httpMaximumConnectionsPerHost = sessionMaximumConnectionsPerHost configuration.requestCachePolicy = NSURLRequest.CachePolicy.reloadIgnoringLocalCacheData configuration.sharedContainerIdentifier = NCBrandOptions.shared.capabilitiesGroups - let session = URLSession(configuration: configuration, delegate: NCCommunicationBackground.shared, delegateQueue: OperationQueue.main) + let session = URLSession(configuration: configuration, delegate: NKBackground.shared, delegateQueue: OperationQueue.main) return session }() #endif @@ -110,17 +109,18 @@ import Photos // MARK: - Communication Delegate - func networkReachabilityObserver(_ typeReachability: NCCommunicationCommon.typeReachability) { + func networkReachabilityObserver(_ typeReachability: NKCommon.typeReachability) { -#if !EXTENSION - if typeReachability == NCCommunicationCommon.typeReachability.reachableCellular || typeReachability == NCCommunicationCommon.typeReachability.reachableEthernetOrWiFi { + #if !EXTENSION + if typeReachability == NKCommon.typeReachability.reachableCellular || typeReachability == NKCommon.typeReachability.reachableEthernetOrWiFi { if !lastReachability { NCService.shared.startRequestServicesServer() } lastReachability = true } else { if lastReachability { - NCContentPresenter.shared.messageNotification("_network_not_available_", description: nil, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: -1009) + let error = NKError(errorCode: NCGlobal.shared.errorNetworkNotAvailable, errorDescription: "") + NCContentPresenter.shared.messageNotification("_network_not_available_", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info) } lastReachability = false } @@ -141,15 +141,15 @@ import Photos delegate?.downloadProgress?(progress, totalBytes: totalBytes, totalBytesExpected: totalBytesExpected, fileName: fileName, serverUrl: serverUrl, session: session, task: task) } - func downloadComplete(fileName: String, serverUrl: String, etag: String?, date: NSDate?, dateLastModified: NSDate?, length: Int64, description: String?, task: URLSessionTask, errorCode: Int, errorDescription: String) { - delegate?.downloadComplete?(fileName: fileName, serverUrl: serverUrl, etag: etag, date: date, dateLastModified: dateLastModified, length: length, description: description, task: task, errorCode: errorCode, errorDescription: errorDescription) + func downloadComplete(fileName: String, serverUrl: String, etag: String?, date: NSDate?, dateLastModified: NSDate?, length: Int64, description: String?, task: URLSessionTask, error: NKError) { + delegate?.downloadComplete?(fileName: fileName, serverUrl: serverUrl, etag: etag, date: date, dateLastModified: dateLastModified, length: length, description: description, task: task, error: error) } func urlSessionDidFinishEvents(forBackgroundURLSession session: URLSession) { #if !EXTENSION if let appDelegate = UIApplication.shared.delegate as? AppDelegate, let completionHandler = appDelegate.backgroundSessionCompletionHandler { - NCCommunicationCommon.shared.writeLog("Called urlSessionDidFinishEvents for Background URLSession") + NKCommon.shared.writeLog("[INFO] Called urlSessionDidFinishEvents for Background URLSession") appDelegate.backgroundSessionCompletionHandler = nil completionHandler() } @@ -168,16 +168,12 @@ import Photos #if !EXTENSION defer { - DispatchQueue.main.async { - if !isTrusted { - (UIApplication.shared.delegate as? AppDelegate)?.trustCertificateError(host: host) - } + if !isTrusted { + DispatchQueue.main.async { (UIApplication.shared.delegate as? AppDelegate)?.trustCertificateError(host: host) } } } #endif - print("SSL host: \(host)") - if let serverTrust: SecTrust = protectionSpace.serverTrust, let certificate = SecTrustGetCertificateAtIndex(serverTrust, 0) { // extarct certificate txt @@ -215,7 +211,8 @@ import Photos let certificateToPath = directoryCertificate + "/" + host + ".der" if !NCUtilityFileSystem.shared.moveFile(atPath: certificateAtPath, toPath: certificateToPath) { - NCContentPresenter.shared.messageNotification("_error_", description: "_error_creation_file_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorCreationFile, priority: .max) + let error = NKError(errorCode: NCGlobal.shared.errorCreationFile, errorDescription: "_error_creation_file_") + NCContentPresenter.shared.showError(error: error, priority: .max) } } @@ -248,26 +245,26 @@ import Photos BIO_free(mem) } - func checkPushNotificationServerProxyCertificateUntrusted(viewController: UIViewController?, completion: @escaping (_ errorCode: Int) -> Void) { + func checkPushNotificationServerProxyCertificateUntrusted(viewController: UIViewController?, completion: @escaping (_ error: NKError) -> Void) { guard let host = URL(string: NCBrandOptions.shared.pushNotificationServerProxy)?.host else { return } - NCCommunication.shared.checkServer(serverUrl: NCBrandOptions.shared.pushNotificationServerProxy) { errorCode, _ in - guard errorCode == 0 else { - completion(0) + NextcloudKit.shared.checkServer(serverUrl: NCBrandOptions.shared.pushNotificationServerProxy) { error in + guard error == .success else { + completion(.success) return } - if errorCode == 0 { + if error == .success { NCNetworking.shared.writeCertificate(host: host) - completion(errorCode) - } else if errorCode == NSURLErrorServerCertificateUntrusted { + completion(error) + } else if error.errorCode == NSURLErrorServerCertificateUntrusted { let alertController = UIAlertController(title: NSLocalizedString("_ssl_certificate_untrusted_", comment: ""), message: NSLocalizedString("_connect_server_anyway_", comment: ""), preferredStyle: .alert) alertController.addAction(UIAlertAction(title: NSLocalizedString("_yes_", comment: ""), style: .default, handler: { _ in NCNetworking.shared.writeCertificate(host: host) - completion(0) + completion(.success) })) alertController.addAction(UIAlertAction(title: NSLocalizedString("_no_", comment: ""), style: .default, handler: { _ in - completion(errorCode) + completion(error) })) alertController.addAction(UIAlertAction(title: NSLocalizedString("_certificate_details_", comment: ""), style: .default, handler: { _ in if let navigationController = UIStoryboard(name: "NCViewCertificateDetails", bundle: nil).instantiateInitialViewController() as? UINavigationController { @@ -284,19 +281,39 @@ import Photos // MARK: - Utility func cancelTaskWithUrl(_ url: URL) { - NCCommunication.shared.getSessionManager().getAllTasks { tasks in + NextcloudKit.shared.getSessionManager().getAllTasks { tasks in tasks.filter { $0.state == .running }.filter { $0.originalRequest?.url == url }.first?.cancel() } } @objc func cancelAllTask() { - NCCommunication.shared.getSessionManager().getAllTasks { tasks in + NextcloudKit.shared.getSessionManager().getAllTasks { tasks in for task in tasks { task.cancel() } } } + func isInTaskUploadBackground(fileName: String, completion: @escaping (_ exists: Bool) -> Void) { + + let sessions: [URLSession] = [NCNetworking.shared.sessionManagerBackground, NCNetworking.shared.sessionManagerBackgroundWWan] + + for session in sessions { + session.getAllTasks(completionHandler: { tasks in + for task in tasks { + let url = task.originalRequest?.url + let urlFileName = url?.lastPathComponent + if urlFileName == fileName { + completion(true) + } + } + if session == sessions.last { + completion(false) + } + }) + } + } + // MARK: - Download @objc func cancelDownload(ocId: String, serverUrl: String, fileNameView: String) { @@ -311,7 +328,7 @@ import Photos } } - @objc func download(metadata: tableMetadata, selector: String, notificationCenterProgressTask: Bool = true, progressHandler: @escaping (_ progress: Progress) -> Void = { _ in }, completion: @escaping (_ errorCode: Int) -> Void) { + func download(metadata: tableMetadata, selector: String, notificationCenterProgressTask: Bool = true, progressHandler: @escaping (_ progress: Progress) -> Void = { _ in }, completion: @escaping (_ afError: AFError?, _ error: NKError) -> Void) { let serverUrlFileName = metadata.serverUrl + "/" + metadata.fileName let fileNameLocalPath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileName)! @@ -322,12 +339,11 @@ import Photos if metadata.status == NCGlobal.shared.metadataStatusInDownload || metadata.status == NCGlobal.shared.metadataStatusDownloading { return } - NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: NCCommunicationCommon.shared.sessionIdentifierDownload, sessionError: "", sessionSelector: selector, sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusInDownload) + NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: NKCommon.shared.sessionIdentifierDownload, sessionError: "", sessionSelector: selector, sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusInDownload) - NCCommunication.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, queue: NCCommunicationCommon.shared.backgroundQueue, requestHandler: { request in + NextcloudKit.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, queue: NKCommon.shared.backgroundQueue, requestHandler: { request in self.downloadRequest[fileNameLocalPath] = request - self.downloadRequest.removeValue(forKey: fileNameLocalPath) NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, status: NCGlobal.shared.metadataStatusDownloading) NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDownloadStartFile, userInfo: ["ocId":metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account]) @@ -341,16 +357,16 @@ import Photos } progressHandler(progress) - }) { (account, etag, date, _, allHeaderFields, error, errorCode, errorDescription) in + }) { (account, etag, date, _, allHeaderFields, afError, error) in self.downloadRequest.removeValue(forKey:fileNameLocalPath) - if error?.isExplicitlyCancelledError ?? false { + if afError?.isExplicitlyCancelledError ?? false { NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: "", sessionError: "", sessionSelector: selector, sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusNormal) NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDownloadCancelFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account]) - } else if errorCode == 0 { + } else if error == .success { NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: "", sessionError: "", sessionSelector: selector, sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusNormal, etag: etag) NCManageDatabase.shared.addLocalFile(metadata: metadata) @@ -360,20 +376,15 @@ import Photos } CCUtility.setExif(metadata) { _, _, _, _, _ in } #endif - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDownloadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "selector": selector, "errorCode": 0, "errorDescription": ""]) + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDownloadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "selector": selector, "error": error]) } else { - NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: "", sessionError: errorDescription, sessionSelector: selector, sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusDownloadError) - #if !EXTENSION - if errorCode == 401 || errorCode == 403 { - NCNetworkingCheckRemoteUser.shared.checkRemoteUser(account: metadata.account, errorCode: errorCode, errorDescription: errorDescription) - } - #endif - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDownloadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "selector": selector, "errorCode": errorCode, "errorDescription": errorDescription]) + NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: "", sessionError: error.errorDescription, sessionSelector: selector, sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusDownloadError) + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDownloadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "selector": selector, "error": error]) } - DispatchQueue.main.async { completion(errorCode) } + DispatchQueue.main.async { completion(afError, error) } } } @@ -381,48 +392,40 @@ import Photos @objc func upload(metadata: tableMetadata, start: @escaping () -> () = { }, - completion: @escaping (_ errorCode: Int, _ errorDescription: String) -> () = { errorCode, errorDescription in }) { + completion: @escaping (_ error: NKError) -> () = { error in }) { let metadata = tableMetadata.init(value: metadata) - NCCommunicationCommon.shared.writeLog("Upload file \(metadata.fileNameView) with Identifier \(metadata.assetLocalIdentifier) with size \(metadata.size) [CHUNCK \(metadata.chunk), E2EE \(metadata.e2eEncrypted)]") + NKCommon.shared.writeLog("[INFO] Upload file \(metadata.fileNameView) with Identifier \(metadata.assetLocalIdentifier) with size \(metadata.size) [CHUNCK \(metadata.chunk), E2EE \(metadata.e2eEncrypted)]") if metadata.e2eEncrypted { - #if !EXTENSION_FILE_PROVIDER_EXTENSION - NCNetworkingE2EE.shared.upload(metadata: metadata, start: start) { errorCode, errorDescription in - DispatchQueue.main.async { - completion(errorCode, errorDescription) - } + #if !EXTENSION_FILE_PROVIDER_EXTENSION && !EXTENSION_WIDGET + NCNetworkingE2EE.shared.upload(metadata: metadata, start: start) { error in + completion(error) } #endif } else if metadata.chunk { - uploadChunkedFile(metadata: metadata, start: start) { errorCode, errorDescription in - DispatchQueue.main.async { - completion(errorCode, errorDescription) - } + uploadChunkedFile(metadata: metadata, start: start) { error in + completion(error) } - } else if metadata.session == NCCommunicationCommon.shared.sessionIdentifierUpload { - uploadFile(metadata: metadata, start: start) { errorCode, errorDescription in - DispatchQueue.main.async { - completion(errorCode, errorDescription) - } + } else if metadata.session == NKCommon.shared.sessionIdentifierUpload { + uploadFile(metadata: metadata, start: start) { error in + completion(error) } } else { - uploadFileInBackground(metadata: metadata, start: start) { errorCode, errorDescription in - DispatchQueue.main.async { - completion(errorCode, errorDescription) - } + self.uploadFileInBackground(metadata: metadata, start: start) { error in + completion(error) } } } - private func uploadFile(metadata: tableMetadata, start: @escaping () -> Void, completion: @escaping (_ errorCode: Int, _ errorDescription: String) -> Void) { + private func uploadFile(metadata: tableMetadata, start: @escaping () -> Void, completion: @escaping (_ error: NKError) -> Void) { let serverUrlFileName = metadata.serverUrl + "/" + metadata.fileName let fileNameLocalPath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)! var uploadTask: URLSessionTask? let description = metadata.ocId - NCCommunication.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, dateCreationFile: metadata.creationDate as Date, dateModificationFile: metadata.date as Date, customUserAgent: nil, addCustomHeaders: nil, requestHandler: { request in + NextcloudKit.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, dateCreationFile: metadata.creationDate as Date, dateModificationFile: metadata.date as Date, customUserAgent: nil, addCustomHeaders: nil, requestHandler: { request in self.uploadRequest[fileNameLocalPath] = request @@ -447,17 +450,17 @@ import Photos "totalBytes": NSNumber(value: progress.totalUnitCount), "totalBytesExpected": NSNumber(value: progress.completedUnitCount)]) - }) { _, ocId, etag, date, size, _, _, errorCode, errorDescription in + }) { _, ocId, etag, date, size, _, _, error in self.uploadRequest.removeValue(forKey: fileNameLocalPath) if let uploadTask = uploadTask { - self.uploadComplete(fileName: metadata.fileName, serverUrl: metadata.serverUrl, ocId: ocId, etag: etag, date: date, size: size, description: description, task: uploadTask, errorCode: errorCode, errorDescription: errorDescription) + self.uploadComplete(fileName: metadata.fileName, serverUrl: metadata.serverUrl, ocId: ocId, etag: etag, date: date, size: size, description: description, task: uploadTask, error: error) } - completion(errorCode, errorDescription) + completion(error) } } - private func uploadFileInBackground(metadata: tableMetadata, start: @escaping () -> Void, completion: @escaping (_ errorCode: Int, _ errorDescription: String) -> Void) { + private func uploadFileInBackground(metadata: tableMetadata, start: @escaping () -> Void, completion: @escaping (_ error: NKError) -> Void) { var session: URLSession? let metadata = tableMetadata.init(value: metadata) @@ -476,35 +479,37 @@ import Photos if NCUtilityFileSystem.shared.getFileSize(filePath: fileNameLocalPath) == 0 && metadata.size != 0 { NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)) - completion(NCGlobal.shared.errorResourceNotFound, NSLocalizedString("_error_not_found_", value: "The requested resource could not be found", comment: "")) + completion(NKError(errorCode: NCGlobal.shared.errorResourceNotFound, errorDescription: NSLocalizedString("_error_not_found_", value: "The requested resource could not be found", comment: ""))) } else { - if let task = NCCommunicationBackground.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, dateCreationFile: metadata.creationDate as Date, dateModificationFile: metadata.date as Date, description: metadata.ocId, session: session!) { + if let task = NKBackground.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, dateCreationFile: metadata.creationDate as Date, dateModificationFile: metadata.date as Date, description: metadata.ocId, session: session!) { + + NKCommon.shared.writeLog("[INFO] Upload file \(metadata.fileNameView) with task with taskIdentifier \(task.taskIdentifier)") NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, sessionError: "", sessionTaskIdentifier: task.taskIdentifier, status: NCGlobal.shared.metadataStatusUploading) NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadStartFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "fileName": metadata.fileName, "sessionSelector": metadata.sessionSelector]) - completion(0, "") + completion(NKError()) } else { NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)) - completion(NCGlobal.shared.errorInternalError, "task null") + completion(NKError(errorCode: NCGlobal.shared.errorResourceNotFound, errorDescription: "task null")) } } } - func uploadComplete(fileName: String, serverUrl: String, ocId: String?, etag: String?, date: NSDate?, size: Int64, description: String?, task: URLSessionTask, errorCode: Int, errorDescription: String) { + func uploadComplete(fileName: String, serverUrl: String, ocId: String?, etag: String?, date: NSDate?, size: Int64, description: String?, task: URLSessionTask, error: NKError) { DispatchQueue.global().async { guard self.delegate == nil, let metadata = NCManageDatabase.shared.getMetadataFromOcId(description) else { - self.delegate?.uploadComplete?(fileName: fileName, serverUrl: serverUrl, ocId: ocId, etag: etag, date: date, size: size, description: description, task: task, errorCode: errorCode, errorDescription: errorDescription) + self.delegate?.uploadComplete?(fileName: fileName, serverUrl: serverUrl, ocId: ocId, etag: etag, date: date, size: size, description: description, task: task, error: error) return } let ocIdTemp = metadata.ocId - var errorDescription = errorDescription + var errorDescription = error.errorDescription let selector = metadata.sessionSelector - if errorCode == 0, let ocId = ocId, size == metadata.size { + if error == .success, let ocId = ocId, size == metadata.size { let metadata = tableMetadata.init(value: metadata) @@ -536,35 +541,26 @@ import Photos NCUtilityFileSystem.shared.deleteFile(filePath: CCUtility.getDirectoryProviderStorageOcId(ocIdTemp)) } - NCCommunicationCommon.shared.writeLog("Upload complete " + serverUrl + "/" + fileName + ", result: success(\(size) bytes)") - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "fileName": metadata.fileName, "ocIdTemp": ocIdTemp, "errorCode": errorCode, "errorDescription": ""]) + NKCommon.shared.writeLog("[SUCCESS] Upload complete " + serverUrl + "/" + fileName + ", result: success(\(size) bytes)") + 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 { - if errorCode == NSURLErrorCancelled || errorCode == NCGlobal.shared.errorRequestExplicityCancelled { + + if error.errorCode == NSURLErrorCancelled || error.errorCode == NCGlobal.shared.errorRequestExplicityCancelled { CCUtility.removeFile(atPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId)) NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)) NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadCancelFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account]) - } else if errorCode == 401 || errorCode == 403 { - - #if !EXTENSION - NCNetworkingCheckRemoteUser.shared.checkRemoteUser(account: metadata.account, errorCode: errorCode, errorDescription: errorDescription) - #endif - NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: nil, sessionError: 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, "errorCode": errorCode, "errorDescription": ""]) - } else { - if size == 0 { - errorDescription = "File length 0" - NCCommunicationCommon.shared.writeLog("Upload error 0 length " + serverUrl + "/" + fileName + ", result: success(\(size) bytes)") - } + NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: nil, sessionError: 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, "errorCode": errorCode, "errorDescription": ""]) + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "fileName": metadata.fileName, "ocIdTemp": ocIdTemp, "error": error]) } } self.uploadMetadataInBackground.removeValue(forKey: fileName + serverUrl) - self.delegate?.uploadComplete?(fileName: fileName, serverUrl: serverUrl, ocId: ocId, etag: etag, date: date, size: size, description: description, task: task, errorCode: errorCode, errorDescription: errorDescription) + self.delegate?.uploadComplete?(fileName: fileName, serverUrl: serverUrl, ocId: ocId, etag: etag, date: date, size: size, description: description, task: task, error: error) } } @@ -598,6 +594,55 @@ import Photos } } + func createUploadProcessAutoUpload(completion: @escaping (_ items: Int) -> Void) { + + var numStartUpload: Int = 0 + let isWiFi = NCNetworking.shared.networkReachability == NKCommon.typeReachability.reachableEthernetOrWiFi + + let metadatasInUpload = NCManageDatabase.shared.getMetadatas(predicate: NSPredicate(format: "status == %d OR status == %d", NCGlobal.shared.metadataStatusInUpload, NCGlobal.shared.metadataStatusUploading)) + let counterUpload = NCGlobal.shared.maxConcurrentOperationUpload - metadatasInUpload.count + if counterUpload <= 0 { return completion(0) } + + // Extract file + let metadatas = NCManageDatabase.shared.getAdvancedMetadatas(predicate: NSPredicate(format: "sessionSelector == %@ AND status == %d", NCGlobal.shared.selectorUploadAutoUpload, NCGlobal.shared.metadataStatusWaitUpload), page: 0, limit: counterUpload, sorted: "date", ascending: true) + for metadata in metadatas { + + let metadata = tableMetadata.init(value: metadata) + let semaphore = DispatchSemaphore(value: 0) + + NCUtility.shared.extractFiles(from: metadata) { metadatas in + if metadatas.isEmpty { + NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)) + } + for metadata in metadatas { + if (metadata.e2eEncrypted || metadata.chunk) { + NKCommon.shared.writeLog("[INFO] Autoupload file skipped, E2E:\(metadata.e2eEncrypted) - CHUNK:\(metadata.chunk)") + continue + } + if (metadata.session == NCNetworking.shared.sessionIdentifierBackgroundWWan && !isWiFi) { + NKCommon.shared.writeLog("[INFO] Autoupload file skipped, required WiFi") + continue + } + guard let metadata = NCManageDatabase.shared.setMetadataStatus(ocId: metadata.ocId, status: NCGlobal.shared.metadataStatusInUpload) else { + NKCommon.shared.writeLog("[INFO] Autoupload file skipped, file status in upload error") + continue + } + // Upload + let semaphoreUpload = DispatchSemaphore(value: 1) + NCNetworking.shared.upload(metadata: metadata) { + numStartUpload += 1 + } completion: { error in + semaphoreUpload.signal() + } + semaphoreUpload.wait() + } + semaphore.signal() + } + semaphore.wait() + } + completion(numStartUpload) + } + func getOcIdInBackgroundSession(queue: DispatchQueue = .main, completion: @escaping (_ listOcId: [String]) -> Void) { var listOcId: [String] = [] @@ -626,13 +671,13 @@ import Photos return completion() } - if metadata.session == NCCommunicationCommon.shared.sessionIdentifierDownload { + if metadata.session == NKCommon.shared.sessionIdentifierDownload { NCNetworking.shared.cancelDownload(ocId: metadata.ocId, serverUrl: metadata.serverUrl, fileNameView: metadata.fileNameView) return completion() } - if metadata.session == NCCommunicationCommon.shared.sessionIdentifierUpload || metadata.chunk { + if metadata.session == NKCommon.shared.sessionIdentifierUpload || metadata.chunk { guard let fileNameLocalPath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView) else { return } @@ -716,7 +761,7 @@ import Photos if metadata.status == NCGlobal.shared.metadataStatusWaitDownload || metadata.status == NCGlobal.shared.metadataStatusDownloadError { NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: "", sessionError: "", sessionSelector: "", sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusNormal) } - if metadata.status == NCGlobal.shared.metadataStatusDownloading && metadata.session == NCCommunicationCommon.shared.sessionIdentifierDownload { + if metadata.status == NCGlobal.shared.metadataStatusDownloading && metadata.session == NKCommon.shared.sessionIdentifierDownload { cancelDownload(ocId: metadata.ocId, serverUrl: metadata.serverUrl, fileNameView: metadata.fileNameView) } } @@ -728,15 +773,17 @@ import Photos // MARK: - WebDav Read file, folder - @objc func readFolder(serverUrl: String, account: String, completion: @escaping (_ account: String, _ metadataFolder: tableMetadata?, _ metadatas: [tableMetadata]?, _ metadatasUpdate: [tableMetadata]?, _ metadatasLocalUpdate: [tableMetadata]?, _ metadatasDelete: [tableMetadata]?, _ errorCode: Int, _ errorDescription: String) -> Void) { + @objc func readFolder(serverUrl: String, account: String, completion: @escaping (_ account: String, _ metadataFolder: tableMetadata?, _ metadatas: [tableMetadata]?, _ metadatasUpdate: [tableMetadata]?, _ metadatasLocalUpdate: [tableMetadata]?, _ metadatasDelete: [tableMetadata]?, _ error: NKError) -> Void) { - NCCommunication.shared.readFileOrFolder(serverUrlFileName: serverUrl, depth: "1", showHiddenFiles: CCUtility.getShowHiddenFiles(), queue: NCCommunicationCommon.shared.backgroundQueue) { account, files, _, errorCode, errorDescription in - guard errorCode == 0 else { - completion(account, nil, nil, nil, nil, nil, errorCode, errorDescription) + let options = NKRequestOptions(queue: NKCommon.shared.backgroundQueue) + + NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrl, depth: "1", showHiddenFiles: CCUtility.getShowHiddenFiles(), options: options) { account, files, _, error in + guard error == .success else { + completion(account, nil, nil, nil, nil, nil, error) return } - NCManageDatabase.shared.convertNCCommunicationFilesToMetadatas(files, useMetadataFolder: true, account: account) { metadataFolder, metadatasFolder, metadatas in + NCManageDatabase.shared.convertNKFilesToMetadatas(files, useMetadataFolder: true, account: account) { metadataFolder, metadatasFolder, metadatas in // Add metadata folder NCManageDatabase.shared.addMetadata(tableMetadata.init(value: metadataFolder)) @@ -754,37 +801,41 @@ import Photos let metadatasResult = NCManageDatabase.shared.getMetadatas(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND status == %d", account, serverUrl, NCGlobal.shared.metadataStatusNormal)) let metadatasChanged = NCManageDatabase.shared.updateMetadatas(metadatas, metadatasResult: metadatasResult, addCompareEtagLocal: true) - completion(account, metadataFolder, metadatas, metadatasChanged.metadatasUpdate, metadatasChanged.metadatasLocalUpdate, metadatasChanged.metadatasDelete, errorCode, "") + completion(account, metadataFolder, metadatas, metadatasChanged.metadatasUpdate, metadatasChanged.metadatasLocalUpdate, metadatasChanged.metadatasDelete, error) } } } - @objc func readFile(serverUrlFileName: String, showHiddenFiles: Bool = CCUtility.getShowHiddenFiles(), queue: DispatchQueue = NCCommunicationCommon.shared.backgroundQueue, completion: @escaping (_ account: String, _ metadata: tableMetadata?, _ errorCode: Int, _ errorDescription: String) -> Void) { + @objc func readFile(serverUrlFileName: String, showHiddenFiles: Bool = CCUtility.getShowHiddenFiles(), queue: DispatchQueue = NKCommon.shared.backgroundQueue, completion: @escaping (_ account: String, _ metadata: tableMetadata?, _ error: NKError) -> Void) { + + let options = NKRequestOptions(queue: queue) - NCCommunication.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0", showHiddenFiles: showHiddenFiles, queue: queue) { account, files, _, errorCode, errorDescription in - guard errorCode == 0, files.count == 1, let file = files.first else { - completion(account, nil, errorCode, errorDescription) + NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0", showHiddenFiles: showHiddenFiles, options: options) { account, files, _, error in + guard error == .success, files.count == 1, let file = files.first else { + completion(account, nil, error) return } let isEncrypted = CCUtility.isFolderEncrypted(file.serverUrl, e2eEncrypted: file.e2eEncrypted, account: account, urlBase: file.urlBase) let metadata = NCManageDatabase.shared.convertNCFileToMetadata(file, isEncrypted: isEncrypted, account: account) - completion(account, metadata, errorCode, errorDescription) + completion(account, metadata, error) } } //MARK: - Search /// WebDAV search - @objc func searchFiles(urlBase: NCUserBaseUrl, literal: String, completion: @escaping (_ metadatas: [tableMetadata]?, _ errorCode: Int, _ errorDescription: String) -> ()) { + @objc func searchFiles(urlBase: NCUserBaseUrl, literal: String, completion: @escaping (_ metadatas: [tableMetadata]?, _ error: NKError) -> ()) { - NCCommunication.shared.searchLiteral(serverUrl: urlBase.urlBase, depth: "infinity", literal: literal, showHiddenFiles: CCUtility.getShowHiddenFiles(), queue: NCCommunicationCommon.shared.backgroundQueue) { (account, files, errorCode, errorDescription) in - guard errorCode == 0 else { - return completion(nil, errorCode, errorDescription) + let options = NKRequestOptions(queue: NKCommon.shared.backgroundQueue) + + NextcloudKit.shared.searchLiteral(serverUrl: urlBase.urlBase, depth: "infinity", literal: literal, showHiddenFiles: CCUtility.getShowHiddenFiles(), options: options) { (account, files, data, error) in + guard error == .success else { + return completion(nil, error) } - NCManageDatabase.shared.convertNCCommunicationFilesToMetadatas(files, useMetadataFolder: false, account: account) { _, metadatasFolder, metadatas in + NCManageDatabase.shared.convertNKFilesToMetadatas(files, useMetadataFolder: false, account: account) { _, metadatasFolder, metadatas in // Update sub directories for folder in metadatasFolder { @@ -794,24 +845,22 @@ import Photos NCManageDatabase.shared.addMetadatas(metadatas) let metadatas = Array(metadatas.map(tableMetadata.init)) - completion(metadatas, errorCode, errorDescription) + completion(metadatas, error) } } } /// Unified Search (NC>=20) /// - func unifiedSearchFiles(urlBase: NCUserBaseUrl, literal: String, providers: @escaping ([NCCSearchProvider]?) -> Void, update: @escaping (_ id: String, NCCSearchResult?, [tableMetadata]?) -> Void, completion: @escaping (_ errorCode: Int, _ errorDescription: String) -> ()) { + func unifiedSearchFiles(userBaseUrl: NCUserBaseUrl, literal: String, providers: @escaping (_ accout: String, _ searchProviders: [NKSearchProvider]?) -> Void, update: @escaping (_ account: String, _ id: String, NKSearchResult?, [tableMetadata]?) -> Void, completion: @escaping (_ account: String, _ error: NKError) -> ()) { - var errorCode = 0 - var errorDescription = "" let dispatchGroup = DispatchGroup() dispatchGroup.enter() dispatchGroup.notify(queue: .main) { - completion(errorCode, errorDescription) + completion(userBaseUrl.account, NKError()) } - NCCommunication.shared.unifiedSearch(term: literal, timeout: 30, timeoutProvider: 90) { provider in + NextcloudKit.shared.unifiedSearch(term: literal, timeout: 30, timeoutProvider: 90) { provider in // example filter // ["calendar", "files", "fulltextsearch"].contains(provider.id) return true @@ -819,9 +868,9 @@ import Photos if let request = request { self.requestsUnifiedSearch.append(request) } - } providers: { allProviders in - providers(allProviders) - } update: { partialResult, provider, errorCode, errorDescription in + } providers: { account, searchProviders in + providers(account, searchProviders) + } update: { account, partialResult, provider, error in guard let partialResult = partialResult else { return } var metadatas: [tableMetadata] = [] @@ -829,13 +878,13 @@ import Photos case "files": partialResult.entries.forEach({ entry in if let fileId = entry.fileId, - let metadata = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ && fileId == %@", urlBase.userAccount, String(fileId))) { + let metadata = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ && fileId == %@", userBaseUrl.userAccount, String(fileId))) { metadatas.append(metadata) } else if let filePath = entry.filePath { - let semaphore = Semaphore() - self.loadMetadata(urlBase: urlBase, filePath: filePath, dispatchGroup: dispatchGroup) { account, metadata, errorCode, errorDescription in + let semaphore = DispatchSemaphore(value: 0) + self.loadMetadata(userBaseUrl: userBaseUrl, filePath: filePath, dispatchGroup: dispatchGroup) { account, metadata, error in metadatas.append(metadata) - semaphore.continue() + semaphore.signal() } semaphore.wait() } else { print(#function, "[ERROR]: File search entry has no path: \(entry)") } @@ -849,54 +898,52 @@ import Photos guard let dir = url?.queryItems?["dir"]?.value, let filename = url?.queryItems?["scrollto"]?.value else { return } if let metadata = NCManageDatabase.shared.getMetadata(predicate: NSPredicate( format: "account == %@ && path == %@ && fileName == %@", - urlBase.userAccount, - "/remote.php/dav/files/" + urlBase.user + dir, + userBaseUrl.userAccount, + "/remote.php/dav/files/" + userBaseUrl.user + dir, filename)) { metadatas.append(metadata) } else { - let semaphore = Semaphore() - self.loadMetadata(urlBase: urlBase, filePath: dir + filename, dispatchGroup: dispatchGroup) { account, metadata, errorCode, errorDescription in + let semaphore = DispatchSemaphore(value: 0) + self.loadMetadata(userBaseUrl: userBaseUrl, filePath: dir + filename, dispatchGroup: dispatchGroup) { account, metadata, error in metadatas.append(metadata) - semaphore.continue() + semaphore.signal() } semaphore.wait() } }) default: partialResult.entries.forEach({ entry in - let metadata = NCManageDatabase.shared.createMetadata(account: urlBase.account, user: urlBase.user, userId: urlBase.userId, fileName: entry.title, fileNameView: entry.title, ocId: NSUUID().uuidString, serverUrl: urlBase.urlBase, urlBase: urlBase.urlBase, url: entry.resourceURL, contentType: "", isUrl: true, name: partialResult.id, subline: entry.subline, iconName: entry.icon, iconUrl: entry.thumbnailURL) + let metadata = NCManageDatabase.shared.createMetadata(account: userBaseUrl.account, user: userBaseUrl.user, userId: userBaseUrl.userId, fileName: entry.title, fileNameView: entry.title, ocId: NSUUID().uuidString, serverUrl: userBaseUrl.urlBase, urlBase: userBaseUrl.urlBase, url: entry.resourceURL, contentType: "", isUrl: true, name: partialResult.id, subline: entry.subline, iconName: entry.icon, iconUrl: entry.thumbnailURL) metadatas.append(metadata) }) } - update(provider.id, partialResult, metadatas) - } completion: { err, description in + update(account, provider.id, partialResult, metadatas) + } completion: { account, data, error in self.requestsUnifiedSearch.removeAll() - errorCode = err - errorDescription = description dispatchGroup.leave() } } - func unifiedSearchFilesProvider(urlBase: NCUserBaseUrl, id: String, term: String, limit: Int, cursor: Int, completion: @escaping (NCCSearchResult?, _ metadatas: [tableMetadata]?, _ errorCode: Int, _ errorDescription: String) -> ()) { + func unifiedSearchFilesProvider(userBaseUrl: NCUserBaseUrl, id: String, term: String, limit: Int, cursor: Int, completion: @escaping (_ account: String, _ searchResult: NKSearchResult?, _ metadatas: [tableMetadata]?, _ error: NKError) -> ()) { var metadatas: [tableMetadata] = [] - let request = NCCommunication.shared.searchProvider(id, term: term, limit: limit, cursor: cursor, timeout: 60) { searchResult, errorCode, errorDescription in + let request = NextcloudKit.shared.searchProvider(id, account: userBaseUrl.account, term: term, limit: limit, cursor: cursor, timeout: 60) { account, searchResult, data, error in guard let searchResult = searchResult else { - completion(nil, metadatas, errorCode, errorDescription) + completion(account, nil, metadatas, error) return } switch id { case "files": searchResult.entries.forEach({ entry in - if let fileId = entry.fileId, let metadata = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ && fileId == %@", urlBase.userAccount, String(fileId))) { + if let fileId = entry.fileId, let metadata = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ && fileId == %@", userBaseUrl.userAccount, String(fileId))) { metadatas.append(metadata) } else if let filePath = entry.filePath { - let semaphore = Semaphore() - self.loadMetadata(urlBase: urlBase, filePath: filePath, dispatchGroup: nil) { account, metadata, errorCode, errorDescription in + let semaphore = DispatchSemaphore(value: 0) + self.loadMetadata(userBaseUrl: userBaseUrl, filePath: filePath, dispatchGroup: nil) { account, metadata, error in metadatas.append(metadata) - semaphore.continue() + semaphore.signal() } semaphore.wait() } else { print(#function, "[ERROR]: File search entry has no path: \(entry)") } @@ -908,25 +955,25 @@ import Photos searchResult.entries.forEach({ entry in let url = URLComponents(string: entry.resourceURL) guard let dir = url?.queryItems?["dir"]?.value, let filename = url?.queryItems?["scrollto"]?.value else { return } - if let metadata = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ && path == %@ && fileName == %@", urlBase.userAccount, "/remote.php/dav/files/" + urlBase.user + dir, filename)) { + if let metadata = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ && path == %@ && fileName == %@", userBaseUrl.userAccount, "/remote.php/dav/files/" + userBaseUrl.user + dir, filename)) { metadatas.append(metadata) } else { - let semaphore = Semaphore() - self.loadMetadata(urlBase: urlBase, filePath: dir + filename, dispatchGroup: nil) { account, metadata, errorCode, errorDescription in + let semaphore = DispatchSemaphore(value: 0) + self.loadMetadata(userBaseUrl: userBaseUrl, filePath: dir + filename, dispatchGroup: nil) { account, metadata, error in metadatas.append(metadata) - semaphore.continue() + semaphore.signal() } semaphore.wait() } }) default: searchResult.entries.forEach({ entry in - let newMetadata = NCManageDatabase.shared.createMetadata(account: urlBase.account, user: urlBase.user, userId: urlBase.userId, fileName: entry.title, fileNameView: entry.title, ocId: NSUUID().uuidString, serverUrl: urlBase.urlBase, urlBase: urlBase.urlBase, url: entry.resourceURL, contentType: "", isUrl: true, name: searchResult.name.lowercased(), subline: entry.subline, iconName: entry.icon, iconUrl: entry.thumbnailURL) + let newMetadata = NCManageDatabase.shared.createMetadata(account: userBaseUrl.account, user: userBaseUrl.user, userId: userBaseUrl.userId, fileName: entry.title, fileNameView: entry.title, ocId: NSUUID().uuidString, serverUrl: userBaseUrl.urlBase, urlBase: userBaseUrl.urlBase, url: entry.resourceURL, contentType: "", isUrl: true, name: searchResult.name.lowercased(), subline: entry.subline, iconName: entry.icon, iconUrl: entry.thumbnailURL) metadatas.append(newMetadata) }) } - completion(searchResult, metadatas, errorCode, errorDescription) + completion(account, searchResult, metadatas, error) } if let request = request { requestsUnifiedSearch.append(request) @@ -940,21 +987,21 @@ import Photos requestsUnifiedSearch.removeAll() } - private func loadMetadata(urlBase: NCUserBaseUrl, filePath: String, dispatchGroup: DispatchGroup? = nil, completion: @escaping (String, tableMetadata, Int, String) -> Void) { - let urlPath = urlBase.urlBase + "/remote.php/dav/files/" + urlBase.user + filePath + private func loadMetadata(userBaseUrl: NCUserBaseUrl, filePath: String, dispatchGroup: DispatchGroup? = nil, completion: @escaping (String, tableMetadata, NKError) -> Void) { + let urlPath = userBaseUrl.urlBase + "/remote.php/dav/files/" + userBaseUrl.user + filePath dispatchGroup?.enter() - self.readFile(serverUrlFileName: urlPath) { account, metadata, errorCode, errorDescription in + self.readFile(serverUrlFileName: urlPath) { account, metadata, error in defer { dispatchGroup?.leave() } guard let metadata = metadata else { return } let returnMetadata = tableMetadata.init(value: metadata) NCManageDatabase.shared.addMetadata(metadata) - completion(account, returnMetadata, errorCode, errorDescription) + completion(account, returnMetadata, error) } } // MARK: - WebDav Create Folder - @objc func createFolder(fileName: String, serverUrl: String, account: String, urlBase: String, overwrite: Bool = false, completion: @escaping (_ errorCode: Int, _ errorDescription: String) -> Void) { + @objc func createFolder(fileName: String, serverUrl: String, account: String, urlBase: String, overwrite: Bool = false, completion: @escaping (_ error: NKError) -> Void) { let isDirectoryEncrypted = CCUtility.isFolderEncrypted(serverUrl, e2eEncrypted: false, account: account, urlBase: urlBase) let fileName = fileName.trimmingCharacters(in: .whitespacesAndNewlines) @@ -968,7 +1015,7 @@ import Photos } } - private func createFolderPlain(fileName: String, serverUrl: String, account: String, urlBase: String, overwrite: Bool, completion: @escaping (_ errorCode: Int, _ errorDescription: String) -> Void) { + private func createFolderPlain(fileName: String, serverUrl: String, account: String, urlBase: String, overwrite: Bool, completion: @escaping (_ error: NKError) -> Void) { var fileNameFolder = CCUtility.removeForbiddenCharactersServer(fileName)! @@ -976,23 +1023,23 @@ import Photos fileNameFolder = NCUtilityFileSystem.shared.createFileName(fileNameFolder, serverUrl: serverUrl, account: account) } if fileNameFolder.count == 0 { - return completion(0, "") + return completion(NKError()) } let fileNameFolderUrl = serverUrl + "/" + fileNameFolder - NCCommunication.shared.createFolder(fileNameFolderUrl) { account, ocId, _, errorCode, errorDescription in - guard errorCode == 0 else { - if errorCode == 405 && overwrite { - completion(0, "") + NextcloudKit.shared.createFolder(fileNameFolderUrl) { account, ocId, _, error in + guard error == .success else { + if error.errorCode == NCGlobal.shared.errordMethodNotSupported && overwrite { + completion(NKError()) } else { - completion(errorCode, errorDescription) + completion(error) } return } - self.readFile(serverUrlFileName: fileNameFolderUrl) { (account, metadataFolder, errorCode, errorDescription) in + self.readFile(serverUrlFileName: fileNameFolderUrl) { (account, metadataFolder, error) in - if errorCode == 0 { + if error == .success { if let metadata = metadataFolder { NCManageDatabase.shared.addMetadata(metadata) NCManageDatabase.shared.addDirectory(encrypted: metadata.e2eEncrypted, favorite: metadata.favorite, ocId: metadata.ocId, fileId: metadata.fileId, etag: nil, permissions: metadata.permissions, serverUrl: fileNameFolderUrl, account: account) @@ -1001,7 +1048,7 @@ import Photos NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterCreateFolder, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account]) } } - completion(errorCode, errorDescription) + completion(error) } } } @@ -1028,20 +1075,20 @@ import Photos private func createFolderWithSemaphore(fileName: String, serverUrl: String, account: String, urlBase: String) -> Bool { var result: Bool = false - let semaphore = Semaphore() + let semaphore = DispatchSemaphore(value: 0) - NCNetworking.shared.createFolder(fileName: fileName, serverUrl: serverUrl, account: account, urlBase: urlBase, overwrite: true) { errorCode, _ in - if errorCode == 0 { result = true } - semaphore.continue() + NCNetworking.shared.createFolder(fileName: fileName, serverUrl: serverUrl, account: account, urlBase: urlBase, overwrite: true) { error in + if error == .success { result = true } + semaphore.signal() } + semaphore.wait() - if semaphore.wait() == .success { result = true } return result } // MARK: - WebDav Delete - @objc func deleteMetadata(_ metadata: tableMetadata, onlyLocalCache: Bool, completion: @escaping (_ errorCode: Int, _ errorDescription: String) -> Void) { + @objc func deleteMetadata(_ metadata: tableMetadata, onlyLocalCache: Bool, completion: @escaping (_ error: NKError) -> Void) { if onlyLocalCache { @@ -1065,7 +1112,7 @@ import Photos NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["ocId": metadata.ocId, "fileNameView": metadata.fileNameView, "serverUrl": metadata.serverUrl, "account": metadata.account, "classFile": metadata.classFile, "onlyLocalCache": true]) } - return completion(0, "") + return completion(NKError()) } let isDirectoryEncrypted = CCUtility.isFolderEncrypted(metadata.serverUrl, e2eEncrypted: metadata.e2eEncrypted, account: metadata.account, urlBase: metadata.urlBase) @@ -1076,42 +1123,44 @@ import Photos if metadataLive == nil { NCNetworkingE2EE.shared.deleteMetadata(metadata, completion: completion) } else { - NCNetworkingE2EE.shared.deleteMetadata(metadataLive!) { errorCode, errorDescription in - if errorCode == 0 { + NCNetworkingE2EE.shared.deleteMetadata(metadataLive!) { error in + if error == .success { NCNetworkingE2EE.shared.deleteMetadata(metadata, completion: completion) } else { - completion(errorCode, errorDescription) + completion(error) } } } #endif } else { if metadataLive == nil { - self.deleteMetadataPlain(metadata, addCustomHeaders: nil, completion: completion) + self.deleteMetadataPlain(metadata, customHeader: nil, completion: completion) } else { - self.deleteMetadataPlain(metadataLive!, addCustomHeaders: nil) { errorCode, errorDescription in - if errorCode == 0 { - self.deleteMetadataPlain(metadata, addCustomHeaders: nil, completion: completion) + self.deleteMetadataPlain(metadataLive!, customHeader: nil) { error in + if error == .success { + self.deleteMetadataPlain(metadata, customHeader: nil, completion: completion) } else { - completion(errorCode, errorDescription) + completion(error) } } } } } - func deleteMetadataPlain(_ metadata: tableMetadata, addCustomHeaders: [String: String]?, completion: @escaping (_ errorCode: Int, _ errorDescription: String) -> Void) { + func deleteMetadataPlain(_ metadata: tableMetadata, customHeader: [String: String]?, completion: @escaping (_ error: NKError) -> Void) { // verify permission let permission = NCUtility.shared.permissionsContainsString(metadata.permissions, permissions: NCGlobal.shared.permissionCanDelete) if metadata.permissions != "" && permission == false { - return completion(NCGlobal.shared.errorInternalError, "_no_permission_delete_file_") + return completion(NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_no_permission_delete_file_")) } let serverUrlFileName = metadata.serverUrl + "/" + metadata.fileName - NCCommunication.shared.deleteFileOrFolder(serverUrlFileName, customUserAgent: nil, addCustomHeaders: addCustomHeaders) { account, errorCode, errorDescription in + let options = NKRequestOptions(customHeader: customHeader) + + NextcloudKit.shared.deleteFileOrFolder(serverUrlFileName, options: options) { account, error in - if errorCode == 0 || errorCode == NCGlobal.shared.errorResourceNotFound { + if error == .success || error.errorCode == NCGlobal.shared.errorResourceNotFound { do { try FileManager.default.removeItem(atPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId)) @@ -1128,20 +1177,20 @@ import Photos NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["ocId": metadata.ocId, "fileNameView": metadata.fileNameView, "serverUrl": metadata.serverUrl, "account": metadata.account, "classFile": metadata.classFile, "onlyLocalCache": false]) } - completion(errorCode, errorDescription) + completion(error) } } // MARK: - WebDav Favorite - @objc func favoriteMetadata(_ metadata: tableMetadata, completion: @escaping (_ errorCode: Int, _ errorDescription: String) -> Void) { + @objc func favoriteMetadata(_ metadata: tableMetadata, completion: @escaping (_ error: NKError) -> Void) { if let metadataLive = NCManageDatabase.shared.getMetadataLivePhoto(metadata: metadata) { - favoriteMetadataPlain(metadataLive) { errorCode, errorDescription in - if errorCode == 0 { + favoriteMetadataPlain(metadataLive) { error in + if error == .success { self.favoriteMetadataPlain(metadata, completion: completion) } else { - completion(errorCode, errorDescription) + completion(error) } } } else { @@ -1149,14 +1198,14 @@ import Photos } } - private func favoriteMetadataPlain(_ metadata: tableMetadata, completion: @escaping (_ errorCode: Int, _ errorDescription: String) -> Void) { + private func favoriteMetadataPlain(_ metadata: tableMetadata, completion: @escaping (_ error: NKError) -> Void) { let fileName = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, urlBase: metadata.urlBase, account: metadata.account)! let favorite = !metadata.favorite let ocId = metadata.ocId - NCCommunication.shared.setFavorite(fileName: fileName, favorite: favorite) { account, errorCode, errorDescription in - if errorCode == 0 && metadata.account == account { + NextcloudKit.shared.setFavorite(fileName: fileName, favorite: favorite) { account, error in + if error == .success && metadata.account == account { NCManageDatabase.shared.setMetadataFavorite(ocId: metadata.ocId, favorite: favorite) #if !EXTENSION if favorite { @@ -1165,18 +1214,21 @@ import Photos #endif NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterFavoriteFile, userInfo: ["ocId": ocId, "serverUrl": metadata.serverUrl]) } - completion(errorCode, errorDescription) + completion(error) } } - @objc func listingFavoritescompletion(selector: String, completion: @escaping (_ account: String, _ metadatas: [tableMetadata]?, _ errorCode: Int, _ errorDescription: String) -> Void) { - NCCommunication.shared.listingFavorites(showHiddenFiles: CCUtility.getShowHiddenFiles(), queue: NCCommunicationCommon.shared.backgroundQueue) { account, files, errorCode, errorDescription in - guard errorCode == 0 else { - completion(account, nil, errorCode, errorDescription) + @objc func listingFavoritescompletion(selector: String, completion: @escaping (_ account: String, _ metadatas: [tableMetadata]?, _ error: NKError) -> Void) { + + let options = NKRequestOptions(queue: NKCommon.shared.backgroundQueue) + + NextcloudKit.shared.listingFavorites(showHiddenFiles: CCUtility.getShowHiddenFiles(), options: options) { account, files, data, error in + guard error == .success else { + completion(account, nil, error) return } - NCManageDatabase.shared.convertNCCommunicationFilesToMetadatas(files, useMetadataFolder: false, account: account) { _, _, metadatas in + NCManageDatabase.shared.convertNKFilesToMetadatas(files, useMetadataFolder: false, account: account) { _, _, metadatas in NCManageDatabase.shared.updateMetadatasFavorite(account: account, metadatas: metadatas) if selector != NCGlobal.shared.selectorListingFavorite { #if !EXTENSION @@ -1185,7 +1237,7 @@ import Photos } #endif } - completion(account, metadatas, errorCode, errorDescription) + completion(account, metadatas, error) } } } @@ -1193,14 +1245,15 @@ import Photos // MARK: - Lock Files @objc func lockUnlockFile(_ metadata: tableMetadata, shoulLock: Bool) { - NCCommunication.shared.lockUnlockFile(serverUrlFileName: metadata.serverUrl + "/" + metadata.fileName, shouldLock: shoulLock) { errorCode, errorDescription in + NextcloudKit.shared.lockUnlockFile(serverUrlFileName: metadata.serverUrl + "/" + metadata.fileName, shouldLock: shoulLock) { account, error in // 0: lock was successful; 412: lock did not change, no error, refresh - guard errorCode == 0 || errorCode == 412 else { - NCContentPresenter.shared.messageNotification(metadata.fileName, description: "_files_lock_error_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + guard error == .success || error.errorCode == NCGlobal.shared.errorPreconditionFailed else { + let error = NKError(errorCode: error.errorCode, errorDescription: "_files_lock_error_") + NCContentPresenter.shared.messageNotification(metadata.fileName, error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) return } - NCNetworking.shared.readFile(serverUrlFileName: metadata.serverUrl + "/" + metadata.fileName) { account, metadata, errorCode, errorDescription in - guard errorCode == 0, let metadata = metadata else { return } + NCNetworking.shared.readFile(serverUrlFileName: metadata.serverUrl + "/" + metadata.fileName) { account, metadata, error in + guard error == .success, let metadata = metadata else { return } NCManageDatabase.shared.addMetadata(metadata) NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSource) } @@ -1209,7 +1262,7 @@ import Photos // MARK: - WebDav Rename - @objc func renameMetadata(_ metadata: tableMetadata, fileNameNew: String, viewController: UIViewController?, completion: @escaping (_ errorCode: Int, _ errorDescription: String?) -> Void) { + @objc func renameMetadata(_ metadata: tableMetadata, fileNameNew: String, viewController: UIViewController?, completion: @escaping (_ error: NKError) -> Void) { let isDirectoryEncrypted = CCUtility.isFolderEncrypted(metadata.serverUrl, e2eEncrypted: metadata.e2eEncrypted, account: metadata.account, urlBase: metadata.urlBase) let metadataLive = NCManageDatabase.shared.getMetadataLivePhoto(metadata: metadata) @@ -1221,11 +1274,11 @@ import Photos if metadataLive == nil { NCNetworkingE2EE.shared.renameMetadata(metadata, fileNameNew: fileNameNew, completion: completion) } else { - NCNetworkingE2EE.shared.renameMetadata(metadataLive!, fileNameNew: fileNameNewLive) { errorCode, errorDescription in - if errorCode == 0 { + NCNetworkingE2EE.shared.renameMetadata(metadataLive!, fileNameNew: fileNameNewLive) { error in + if error == .success { NCNetworkingE2EE.shared.renameMetadata(metadata, fileNameNew: fileNameNew, completion: completion) } else { - completion(errorCode, errorDescription) + completion(error) } } } @@ -1234,37 +1287,37 @@ import Photos if metadataLive == nil { renameMetadataPlain(metadata, fileNameNew: fileNameNew, completion: completion) } else { - renameMetadataPlain(metadataLive!, fileNameNew: fileNameNewLive) { errorCode, errorDescription in - if errorCode == 0 { + renameMetadataPlain(metadataLive!, fileNameNew: fileNameNewLive) { error in + if error == .success { self.renameMetadataPlain(metadata, fileNameNew: fileNameNew, completion: completion) } else { - completion(errorCode, errorDescription) + completion(error) } } } } } - private func renameMetadataPlain(_ metadata: tableMetadata, fileNameNew: String, completion: @escaping (_ errorCode: Int, _ errorDescription: String?) -> Void) { + private func renameMetadataPlain(_ metadata: tableMetadata, fileNameNew: String, completion: @escaping (_ error: NKError) -> Void) { let permission = NCUtility.shared.permissionsContainsString(metadata.permissions, permissions: NCGlobal.shared.permissionCanRename) if !(metadata.permissions == "") && !permission { - return completion(NCGlobal.shared.errorInternalError, "_no_permission_modify_file_") + return completion(NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_no_permission_modify_file_")) } guard let fileNameNew = CCUtility.removeForbiddenCharactersServer(fileNameNew) else { - return completion(0, "") + return completion(NKError()) } if fileNameNew.count == 0 || fileNameNew == metadata.fileNameView { - return completion(0, "") + return completion(NKError()) } let fileNamePath = metadata.serverUrl + "/" + metadata.fileName let fileNameToPath = metadata.serverUrl + "/" + fileNameNew let ocId = metadata.ocId - NCCommunication.shared.moveFileOrFolder(serverUrlFileNameSource: fileNamePath, serverUrlFileNameDestination: fileNameToPath, overwrite: false) { account, errorCode, errorDescription in + NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: fileNamePath, serverUrlFileNameDestination: fileNameToPath, overwrite: false) { account, error in - if errorCode == 0 { + if error == .success { NCManageDatabase.shared.renameMetadata(fileNameTo: fileNameNew, ocId: ocId) @@ -1306,20 +1359,20 @@ import Photos } } - completion(errorCode, errorDescription) + completion(error) } } // MARK: - WebDav Move - @objc func moveMetadata(_ metadata: tableMetadata, serverUrlTo: String, overwrite: Bool, completion: @escaping (_ errorCode: Int, _ errorDescription: String?) -> Void) { + @objc func moveMetadata(_ metadata: tableMetadata, serverUrlTo: String, overwrite: Bool, completion: @escaping (_ error: NKError) -> Void) { if let metadataLive = NCManageDatabase.shared.getMetadataLivePhoto(metadata: metadata) { - moveMetadataPlain(metadataLive, serverUrlTo: serverUrlTo, overwrite: overwrite) { errorCode, errorDescription in - if errorCode == 0 { + moveMetadataPlain(metadataLive, serverUrlTo: serverUrlTo, overwrite: overwrite) { error in + if error == .success { self.moveMetadataPlain(metadata, serverUrlTo: serverUrlTo, overwrite: overwrite, completion: completion) } else { - completion(errorCode, errorDescription) + completion(error) } } } else { @@ -1327,20 +1380,20 @@ import Photos } } - private func moveMetadataPlain(_ metadata: tableMetadata, serverUrlTo: String, overwrite: Bool, completion: @escaping (_ errorCode: Int, _ errorDescription: String?) -> Void) { + private func moveMetadataPlain(_ metadata: tableMetadata, serverUrlTo: String, overwrite: Bool, completion: @escaping (_ error: NKError) -> Void) { let permission = NCUtility.shared.permissionsContainsString(metadata.permissions, permissions: NCGlobal.shared.permissionCanRename) if !(metadata.permissions == "") && !permission { - return completion(NCGlobal.shared.errorInternalError, "_no_permission_modify_file_") + return completion(NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_no_permission_modify_file_")) } let serverUrlFrom = metadata.serverUrl let serverUrlFileNameSource = metadata.serverUrl + "/" + metadata.fileName let serverUrlFileNameDestination = serverUrlTo + "/" + metadata.fileName - NCCommunication.shared.moveFileOrFolder(serverUrlFileNameSource: serverUrlFileNameSource, serverUrlFileNameDestination: serverUrlFileNameDestination, overwrite: overwrite) { account, errorCode, errorDescription in + NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: serverUrlFileNameSource, serverUrlFileNameDestination: serverUrlFileNameDestination, overwrite: overwrite) { account, error in - if errorCode == 0 { + if error == .success { if metadata.directory { NCManageDatabase.shared.deleteDirectoryAndSubDirectory(serverUrl: CCUtility.stringAppendServerUrl(metadata.serverUrl, addFileName: metadata.fileName), account: account) } @@ -1348,20 +1401,20 @@ import Photos NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterMoveFile, userInfo: ["ocId": metadata.ocId, "account": metadata.account, "serverUrlFrom": serverUrlFrom]) } - completion(errorCode, errorDescription) + completion(error) } } // MARK: - WebDav Copy - @objc func copyMetadata(_ metadata: tableMetadata, serverUrlTo: String, overwrite: Bool, completion: @escaping (_ errorCode: Int, _ errorDescription: String?) -> Void) { + @objc func copyMetadata(_ metadata: tableMetadata, serverUrlTo: String, overwrite: Bool, completion: @escaping (_ error: NKError) -> Void) { if let metadataLive = NCManageDatabase.shared.getMetadataLivePhoto(metadata: metadata) { - copyMetadataPlain(metadataLive, serverUrlTo: serverUrlTo, overwrite: overwrite) { errorCode, errorDescription in - if errorCode == 0 { + copyMetadataPlain(metadataLive, serverUrlTo: serverUrlTo, overwrite: overwrite) { error in + if error == .success { self.copyMetadataPlain(metadata, serverUrlTo: serverUrlTo, overwrite: overwrite, completion: completion) } else { - completion(errorCode, errorDescription) + completion(error) } } } else { @@ -1369,22 +1422,22 @@ import Photos } } - private func copyMetadataPlain(_ metadata: tableMetadata, serverUrlTo: String, overwrite: Bool, completion: @escaping (_ errorCode: Int, _ errorDescription: String?) -> Void) { + private func copyMetadataPlain(_ metadata: tableMetadata, serverUrlTo: String, overwrite: Bool, completion: @escaping (_ error: NKError) -> Void) { let permission = NCUtility.shared.permissionsContainsString(metadata.permissions, permissions: NCGlobal.shared.permissionCanRename) if !(metadata.permissions == "") && !permission { - return completion(NCGlobal.shared.errorInternalError, "_no_permission_modify_file_") + return completion(NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_no_permission_modify_file_")) } let serverUrlFileNameSource = metadata.serverUrl + "/" + metadata.fileName let serverUrlFileNameDestination = serverUrlTo + "/" + metadata.fileName - NCCommunication.shared.copyFileOrFolder(serverUrlFileNameSource: serverUrlFileNameSource, serverUrlFileNameDestination: serverUrlFileNameDestination, overwrite: overwrite) { _, errorCode, errorDescription in + NextcloudKit.shared.copyFileOrFolder(serverUrlFileNameSource: serverUrlFileNameSource, serverUrlFileNameDestination: serverUrlFileNameDestination, overwrite: overwrite) { _, error in - if errorCode == 0 { + if error == .success { NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterCopyFile, userInfo: ["ocId": metadata.ocId, "serverUrlTo": serverUrlTo]) } - completion(errorCode, errorDescription) + completion(error) } } @@ -1395,8 +1448,8 @@ import Photos if CCUtility.fileProviderStorageExists(metadata) { completition(URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView))) } else { - NCCommunication.shared.getDirectDownload(fileId: metadata.fileId) { _, url, errorCode, _ in - if errorCode == 0 && url != nil { + NextcloudKit.shared.getDirectDownload(fileId: metadata.fileId) { account, url, data, error in + if error == .success && url != nil { if let url = URL(string: url!) { completition(url) } else { @@ -1409,43 +1462,35 @@ import Photos } } - // MARK: - TEST API + // MARK: - NextcloudKit convert completion handlers into async functions - /* - @objc public func getDirectDownload(urlBase: String, username: String, password: String, fileId: String, customUserAgent: String? = nil, completionHandler: @escaping (_ token: String?, _ errorCode: Int, _ errorDescription: String) -> Void) { - - let endpoint = "/ocs/v2.php/apps/dav/api/v1/direct" - - let url:URLConvertible = try! (urlBase + endpoint).asURL() as URLConvertible - var headers: HTTPHeaders = [.authorization(username: username, password: password)] - if customUserAgent != nil { - headers.update(.userAgent(customUserAgent!)) - } - //headers.update(.contentType("application/json")) - headers.update(name: "OCS-APIRequest", value: "true") - - let method = HTTPMethod(rawValue: "POST") - - let parameters = [ - "fileId": fileId, - ] + func getPreview(url: URL, + options: NKRequestOptions = NKRequestOptions()) async -> (account: String, data: Data?, error: NKError) { - AF.request(url, method: method, parameters: parameters, headers: headers).validate(statusCode: 200..<300).response { (response) in - debugPrint(response) - - switch response.result { - case .failure(let error): - completionHandler(nil, 0, "") - case .success(let data): - if let data = data { - completionHandler("", 0, "") - } else { - completionHandler(nil, NSURLErrorBadServerResponse, NSLocalizedString("_error_decode_xml_", value: "Invalid response, error decode XML", comment: "")) - } + await withUnsafeContinuation({ continuation in + NextcloudKit.shared.getPreview(url: url, options: options) { account, data, error in + continuation.resume(returning: (account: account, data: data, error: error)) } - } + }) + } + + func downloadPreview(fileNamePathOrFileId: String, + fileNamePreviewLocalPath: String, + widthPreview: Int, + heightPreview: Int, + fileNameIconLocalPath: String? = nil, + sizeIcon: Int = 0, + etag: String? = nil, + endpointTrashbin: Bool = false, + useInternalEndpoint: Bool = true, + options: NKRequestOptions = NKRequestOptions()) async -> (account: String, imagePreview: UIImage?, imageIcon: UIImage?, imageOriginal: UIImage?, etag: String?, error: NKError) { + + await withUnsafeContinuation({ continuation in + NextcloudKit.shared.downloadPreview(fileNamePathOrFileId: fileNamePathOrFileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, widthPreview: widthPreview, heightPreview: heightPreview, fileNameIconLocalPath: fileNameIconLocalPath, sizeIcon: sizeIcon, etag: etag, options: options) { account, imagePreview, imageIcon, imageOriginal, etag, error in + continuation.resume(returning: (account: account, imagePreview: imagePreview, imageIcon: imageIcon, imageOriginal: imageOriginal, etag: etag, error: error)) + } + }) } - */ } extension Array where Element == URLQueryItem { diff --git a/iOSClient/Networking/NCNetworkingCheckRemoteUser.swift b/iOSClient/Networking/NCNetworkingCheckRemoteUser.swift index 0acf5dd40..16e7dc0da 100644 --- a/iOSClient/Networking/NCNetworkingCheckRemoteUser.swift +++ b/iOSClient/Networking/NCNetworkingCheckRemoteUser.swift @@ -21,78 +21,63 @@ // import UIKit -import NCCommunication +import NextcloudKit -@objc class NCNetworkingCheckRemoteUser: NSObject { - @objc public static let shared: NCNetworkingCheckRemoteUser = { - let instance = NCNetworkingCheckRemoteUser() - return instance - }() +class NCNetworkingCheckRemoteUser { - var checkRemoteUserInProgress = false - - @objc func checkRemoteUser(account: String, errorCode: Int, errorDescription: String) { - - if self.checkRemoteUserInProgress { - return - } else { - self.checkRemoteUserInProgress = true - } + func checkRemoteUser(account: String, error: NKError) { let serverVersionMajor = NCManageDatabase.shared.getCapabilitiesServerInt(account: account, elements: NCElementsJSON.shared.capabilitiesVersionMajor) guard let tableAccount = NCManageDatabase.shared.getAccount(predicate: NSPredicate(format: "account == %@", account)) else { - self.checkRemoteUserInProgress = false return } - if serverVersionMajor >= NCGlobal.shared.nextcloudVersion17 { - - if errorCode == 401 { - - let token = CCUtility.getPassword(account)! - if token == "" { - self.checkRemoteUserInProgress = false - return - } + // remove all process ---- - NCCommunication.shared.getRemoteWipeStatus(serverUrl: tableAccount.urlBase, token: token) { account, wipe, errorCode, _ in + NCNetworking.shared.cancelAllTransfer(account: account) { } + NCOperationQueue.shared.cancelAllQueue() + NCNetworking.shared.cancelAllTask() - let appDelegate = UIApplication.shared.delegate as! AppDelegate - if wipe { + // ----------------------- - appDelegate.deleteAccount(account, wipe: true) - NCContentPresenter.shared.messageNotification(tableAccount.user, description: "_wipe_account_", delay: NCGlobal.shared.dismissAfterSecondLong, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError, priority: .max) - NCCommunication.shared.setRemoteWipeCompletition(serverUrl: tableAccount.urlBase, token: token) { _, _, _ in print("wipe") } + if serverVersionMajor >= NCGlobal.shared.nextcloudVersion17 { - } else { + let token = CCUtility.getPassword(account)! + if token.isEmpty { + return + } - if UIApplication.shared.applicationState == .active && NCCommunication.shared.isNetworkReachable() && !CCUtility.getPassword(account).isEmpty && !appDelegate.deletePasswordSession { - let description = String.localizedStringWithFormat(NSLocalizedString("_error_check_remote_user_", comment: ""), tableAccount.user, tableAccount.urlBase) - NCContentPresenter.shared.messageNotification("_error_", description: description, delay: NCGlobal.shared.dismissAfterSecondLong, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) - CCUtility.setPassword(account, password: nil) - appDelegate.deletePasswordSession = true - } - } + NextcloudKit.shared.getRemoteWipeStatus(serverUrl: tableAccount.urlBase, token: token) { account, wipe, data, error in - self.checkRemoteUserInProgress = false - } + let appDelegate = UIApplication.shared.delegate as! AppDelegate + if wipe { - } else { + appDelegate.deleteAccount(account, wipe: true) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_wipe_account_") + NCContentPresenter.shared.messageNotification(tableAccount.user, error: error, delay: NCGlobal.shared.dismissAfterSecondLong, type: NCContentPresenter.messageType.error, priority: .max) + NextcloudKit.shared.setRemoteWipeCompletition(serverUrl: tableAccount.urlBase, token: token) { _, _ in print("wipe") } - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecondLong, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + } else { - self.checkRemoteUserInProgress = false + if UIApplication.shared.applicationState == .active && NextcloudKit.shared.isNetworkReachable() && !CCUtility.getPassword(account).isEmpty && !appDelegate.deletePasswordSession { + let description = String.localizedStringWithFormat(NSLocalizedString("_error_check_remote_user_", comment: ""), tableAccount.user, tableAccount.urlBase) + let error = NKError(errorCode: error.errorCode, errorDescription: description) + NCContentPresenter.shared.showError(error: error, priority: .max) + CCUtility.setPassword(account, password: nil) + NKCommon.shared.writeLog("[INFO] Password removed.") + appDelegate.deletePasswordSession = true + } + } } } else if CCUtility.getPassword(account) != "" { - if UIApplication.shared.applicationState == .active && NCCommunication.shared.isNetworkReachable() { + if UIApplication.shared.applicationState == .active && NextcloudKit.shared.isNetworkReachable() { let description = String.localizedStringWithFormat(NSLocalizedString("_error_check_remote_user_", comment: ""), tableAccount.user, tableAccount.urlBase) - NCContentPresenter.shared.messageNotification("_error_", description: description, delay: NCGlobal.shared.dismissAfterSecondLong, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + let error = NKError(errorCode: error.errorCode, errorDescription: description) + NCContentPresenter.shared.showError(error: error, priority: .max) CCUtility.setPassword(account, password: nil) } - - self.checkRemoteUserInProgress = false } } } diff --git a/iOSClient/Networking/NCNetworkingChunkedUpload.swift b/iOSClient/Networking/NCNetworkingChunkedUpload.swift index 6335a8e5b..9f66cfeae 100644 --- a/iOSClient/Networking/NCNetworkingChunkedUpload.swift +++ b/iOSClient/Networking/NCNetworkingChunkedUpload.swift @@ -22,12 +22,11 @@ // import UIKit -import NCCommunication -import Queuer +import NextcloudKit extension NCNetworking { - internal func uploadChunkedFile(metadata: tableMetadata, start: @escaping () -> Void, completion: @escaping (_ errorCode: Int, _ errorDescription: String) -> Void) { + internal func uploadChunkedFile(metadata: tableMetadata, start: @escaping () -> Void, completion: @escaping (_ error: NKError) -> Void) { let directoryProviderStorageOcId = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId)! let chunkFolder = NCManageDatabase.shared.getChunkFolder(account: metadata.account, ocId: metadata.ocId) @@ -37,34 +36,33 @@ extension NCNetworking { let fileSizeInGB = Double(metadata.size) / 1e9 let ocIdTemp = metadata.ocId let selector = metadata.sessionSelector - - var uploadErrorCode: Int = 0 - var uploadErrorDescription: String = "" + var uploadError = NKError() var filesNames = NCManageDatabase.shared.getChunks(account: metadata.account, ocId: metadata.ocId) if filesNames.count == 0 { NCContentPresenter.shared.noteTop(text: NSLocalizedString("_upload_chunk_", comment: ""), image: nil, type: NCContentPresenter.messageType.info, delay: .infinity, priority: .max) - filesNames = NCCommunicationCommon.shared.chunkedFile(inputDirectory: directoryProviderStorageOcId, outputDirectory: directoryProviderStorageOcId, fileName: metadata.fileName, chunkSizeMB: chunkSize) + filesNames = NKCommon.shared.chunkedFile(inputDirectory: directoryProviderStorageOcId, outputDirectory: directoryProviderStorageOcId, fileName: metadata.fileName, chunkSizeMB: chunkSize) if filesNames.count > 0 { NCManageDatabase.shared.addChunks(account: metadata.account, ocId: metadata.ocId, chunkFolder: chunkFolder, fileNames: filesNames) } else { NCContentPresenter.shared.dismiss() - NCContentPresenter.shared.messageNotification("_error_", description: "_err_file_not_found_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorReadFile) + let error = NKError(errorCode: NCGlobal.shared.errorReadFile, errorDescription: "_err_file_not_found_") + NCContentPresenter.shared.showError(error: error) NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)) - return completion(uploadErrorCode, uploadErrorDescription) + return completion(uploadError) } } else { NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSource, userInfo: ["serverUrl": metadata.serverUrl]) } - createChunkedFolder(chunkFolderPath: chunkFolderPath, account: metadata.account) { errorCode, errorDescription in + createChunkedFolder(chunkFolderPath: chunkFolderPath, account: metadata.account) { error in NCContentPresenter.shared.dismiss(after: NCGlobal.shared.dismissAfterSecond) start() - guard errorCode == 0 else { - self.uploadChunkFileError(metadata: metadata, chunkFolderPath: chunkFolderPath, directoryProviderStorageOcId: directoryProviderStorageOcId, errorCode: errorCode, errorDescription: errorDescription) - completion(errorCode, errorDescription) + guard error == .success else { + self.uploadChunkFileError(metadata: metadata, chunkFolderPath: chunkFolderPath, directoryProviderStorageOcId: directoryProviderStorageOcId, error: error) + completion(error) return } @@ -80,16 +78,16 @@ extension NCNetworking { size = tableChunk.size - NCUtilityFileSystem.shared.getFileSize(filePath: fileNameChunkLocalPath) } - let semaphore = Semaphore() + let semaphore = DispatchSemaphore(value: 0) - NCCommunication.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameChunkLocalPath, requestHandler: { request in + NextcloudKit.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameChunkLocalPath, requestHandler: { request in self.uploadRequest[fileNameLocalPath] = request }, taskHandler: { task in NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, sessionError: "", sessionTaskIdentifier: task.taskIdentifier, status: NCGlobal.shared.metadataStatusUploading) - NCCommunicationCommon.shared.writeLog("Upload chunk: " + fileName) + NKCommon.shared.writeLog("[INFO] Upload chunk: " + fileName) }, progressHandler: { progress in @@ -112,26 +110,25 @@ extension NCNetworking { "totalBytesExpected": NSNumber(value: totalBytesExpected)]) } - }) { _, _, _, _, _, _, _, errorCode, errorDescription in + }) { _, _, _, _, _, _, _, error in self.uploadRequest.removeValue(forKey: fileNameLocalPath) - uploadErrorCode = errorCode - uploadErrorDescription = errorDescription - semaphore.continue() + uploadError = error + semaphore.signal() } semaphore.wait() - if uploadErrorCode == 0 { + if uploadError == .success { NCManageDatabase.shared.deleteChunk(account: metadata.account, ocId: metadata.ocId, fileName: fileName) } else { break } } - guard uploadErrorCode == 0 else { - self.uploadChunkFileError(metadata: metadata, chunkFolderPath: chunkFolderPath, directoryProviderStorageOcId: directoryProviderStorageOcId, errorCode: uploadErrorCode, errorDescription: uploadErrorDescription) - completion(errorCode, errorDescription) + guard uploadError == .success else { + self.uploadChunkFileError(metadata: metadata, chunkFolderPath: chunkFolderPath, directoryProviderStorageOcId: directoryProviderStorageOcId, error: uploadError) + completion(error) return } @@ -140,12 +137,12 @@ extension NCNetworking { let pathServerUrl = CCUtility.returnPathfromServerUrl(metadata.serverUrl, urlBase: metadata.urlBase, account: metadata.account)! let serverUrlFileNameDestination = metadata.urlBase + "/" + NCUtilityFileSystem.shared.getWebDAV(account: metadata.account) + "/files/" + metadata.userId + pathServerUrl + "/" + metadata.fileName - var addCustomHeaders: [String: String] = [:] + var customHeader: [String: String] = [:] let creationDate = "\(metadata.creationDate.timeIntervalSince1970)" let modificationDate = "\(metadata.date.timeIntervalSince1970)" - addCustomHeaders["X-OC-CTime"] = creationDate - addCustomHeaders["X-OC-MTime"] = modificationDate + customHeader["X-OC-CTime"] = creationDate + customHeader["X-OC-MTime"] = modificationDate // Calculate Assemble Timeout let ASSEMBLE_TIME_PER_GB: Double = 3 * 60 // 3 min @@ -153,13 +150,15 @@ extension NCNetworking { let ASSEMBLE_TIME_MAX: Double = 30 * 60 // 30 min let timeout = max(ASSEMBLE_TIME_MIN, min(ASSEMBLE_TIME_PER_GB * fileSizeInGB, ASSEMBLE_TIME_MAX)) - NCCommunication.shared.moveFileOrFolder(serverUrlFileNameSource: serverUrlFileNameSource, serverUrlFileNameDestination: serverUrlFileNameDestination, overwrite: true, addCustomHeaders: addCustomHeaders, timeout: timeout, queue: DispatchQueue.global(qos: .background)) { _, errorCode, errorDescription in + let options = NKRequestOptions(customHeader: customHeader, timeout: timeout, queue: DispatchQueue.global()) + + NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: serverUrlFileNameSource, serverUrlFileNameDestination: serverUrlFileNameDestination, overwrite: true, options: options) { _, error in - NCCommunicationCommon.shared.writeLog("Assembling chunk with error code: \(errorCode)") + NKCommon.shared.writeLog("[ERROR] Assembling chunk with error code: \(error.errorCode)") - guard uploadErrorCode == 0 else { - self.uploadChunkFileError(metadata: metadata, chunkFolderPath: chunkFolderPath, directoryProviderStorageOcId: directoryProviderStorageOcId, errorCode: errorCode, errorDescription: errorDescription) - completion(errorCode, errorDescription) + guard error == .success else { + self.uploadChunkFileError(metadata: metadata, chunkFolderPath: chunkFolderPath, directoryProviderStorageOcId: directoryProviderStorageOcId, error: error) + completion(error) return } @@ -173,9 +172,9 @@ extension NCNetworking { NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", ocIdTemp)) NCManageDatabase.shared.deleteChunks(account: metadata.account, ocId: ocIdTemp) - self.readFile(serverUrlFileName: serverUrlFileNameDestination) { (_, metadata, _, _) in + self.readFile(serverUrlFileName: serverUrlFileNameDestination) { (_, metadata, _) in - if errorCode == 0, let metadata = metadata { + if error == .success, let metadata = metadata { metadata.assetLocalIdentifier = assetLocalIdentifier metadata.e2eEncrypted = isE2eEncrypted @@ -194,68 +193,71 @@ extension NCNetworking { NCUtilityFileSystem.shared.deleteFile(filePath: directoryProviderStorageOcId) NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSource, userInfo: ["serverUrl": serverUrl]) - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": serverUrl, "account": account, "fileName": fileName, "ocIdTemp": ocIdTemp, "errorCode": errorCode, "errorDescription": ""]) + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": serverUrl, "account": account, "fileName": fileName, "ocIdTemp": ocIdTemp, "error": error]) } else { NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSourceNetworkForced, userInfo: ["serverUrl": serverUrl]) - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": ocIdTemp, "serverUrl": serverUrl, "account": account, "fileName": fileName, "ocIdTemp": ocIdTemp, "errorCode": errorCode, "errorDescription": ""]) + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": ocIdTemp, "serverUrl": serverUrl, "account": account, "fileName": fileName, "ocIdTemp": ocIdTemp, "error": error]) } - completion(errorCode, errorDescription) + completion(error) } } } } - private func createChunkedFolder(chunkFolderPath: String, account: String, completion: @escaping (_ errorCode: Int, _ errorDescription: String) -> Void) { + private func createChunkedFolder(chunkFolderPath: String, account: String, completion: @escaping (_ errorCode: NKError) -> Void) { - NCCommunication.shared.readFileOrFolder(serverUrlFileName: chunkFolderPath, depth: "0", showHiddenFiles: CCUtility.getShowHiddenFiles(), queue: NCCommunicationCommon.shared.backgroundQueue) { _, _, _, errorCode, errorDescription in + let options = NKRequestOptions(queue: NKCommon.shared.backgroundQueue) + + NextcloudKit.shared.readFileOrFolder(serverUrlFileName: chunkFolderPath, depth: "0", showHiddenFiles: CCUtility.getShowHiddenFiles(), options: options) { _, _, _, error in - if errorCode == 0 { - completion(0, "") - } else if errorCode == NCGlobal.shared.errorResourceNotFound { - NCCommunication.shared.createFolder(chunkFolderPath, queue: NCCommunicationCommon.shared.backgroundQueue) { _, _, _, errorCode, errorDescription in - completion(errorCode, errorDescription) + if error == .success { + completion(NKError()) + } else if error.errorCode == NCGlobal.shared.errorResourceNotFound { + NextcloudKit.shared.createFolder(chunkFolderPath, options: options) { _, _, _, error in + completion(error) } } else { - completion(errorCode, errorDescription) + completion(error) } } } - private func uploadChunkFileError(metadata: tableMetadata, chunkFolderPath: String, directoryProviderStorageOcId: String, errorCode: Int, errorDescription: String) { + private func uploadChunkFileError(metadata: tableMetadata, chunkFolderPath: String, directoryProviderStorageOcId: String, error: NKError) { - var errorDescription = errorDescription + var errorDescription = error.errorDescription - NCCommunicationCommon.shared.writeLog("Upload chunk error code: \(errorCode)") + NKCommon.shared.writeLog("[ERROR] Upload chunk error code: \(error.errorCode)") - if errorCode == NSURLErrorCancelled || errorCode == NCGlobal.shared.errorRequestExplicityCancelled { + if error.errorCode == NSURLErrorCancelled || error.errorCode == NCGlobal.shared.errorRequestExplicityCancelled { // Delete chunk folder - NCCommunication.shared.deleteFileOrFolder(chunkFolderPath) { _, _, _ in } + NextcloudKit.shared.deleteFileOrFolder(chunkFolderPath) { _, _ in } NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)) NCManageDatabase.shared.deleteChunks(account: metadata.account, ocId: metadata.ocId) NCUtilityFileSystem.shared.deleteFile(filePath: directoryProviderStorageOcId) - NCCommunication.shared.deleteFileOrFolder(chunkFolderPath) { _, _, _ in } + NextcloudKit.shared.deleteFileOrFolder(chunkFolderPath) { _, _ in } NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadCancelFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account]) } else { // NO report for the connection lost - if errorCode == NCGlobal.shared.errorConnectionLost { + if error.errorCode == NCGlobal.shared.errorConnectionLost { errorDescription = "" } else { - let description = errorDescription + " code: \(errorCode)" - NCContentPresenter.shared.messageNotification("_error_", description: description, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError) + let description = errorDescription + " code: \(error.errorCode)" + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: description) + NCContentPresenter.shared.showError(error: error) } NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: nil, sessionError: errorDescription, sessionTaskIdentifier: NCGlobal.shared.metadataStatusNormal, 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": metadata.ocId, "errorCode": errorCode, "errorDescription": ""]) + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "fileName": metadata.fileName, "ocIdTemp": metadata.ocId, "error": error]) } } diff --git a/iOSClient/Networking/NCNetworkingE2EE.swift b/iOSClient/Networking/NCNetworkingE2EE.swift index a12085b44..98941fe62 100644 --- a/iOSClient/Networking/NCNetworkingE2EE.swift +++ b/iOSClient/Networking/NCNetworkingE2EE.swift @@ -21,7 +21,7 @@ import UIKit import OpenSSL -import NCCommunication +import NextcloudKit import CFNetwork import Alamofire @@ -33,7 +33,7 @@ import Alamofire // MARK: - WebDav Create Folder - func createFolder(fileName: String, serverUrl: String, account: String, urlBase: String, completion: @escaping (_ errorCode: Int, _ errorDescription: String) -> Void) { + func createFolder(fileName: String, serverUrl: String, account: String, urlBase: String, completion: @escaping (_ error: NKError) -> Void) { var fileNameFolder = CCUtility.removeForbiddenCharactersServer(fileName)! var fileNameFolderUrl = "" @@ -43,25 +43,27 @@ import Alamofire fileNameFolder = NCUtilityFileSystem.shared.createFileName(fileNameFolder, serverUrl: serverUrl, account: account) if fileNameFolder.count == 0 { - return completion(0, "") + return completion(NKError()) } fileNameIdentifier = CCUtility.generateRandomIdentifier() fileNameFolderUrl = serverUrl + "/" + fileNameIdentifier - self.lock(account: account, serverUrl: serverUrl) { directory, e2eToken, errorCode, errorDescription in - if errorCode == 0 && e2eToken != nil && directory != nil { + self.lock(account: account, serverUrl: serverUrl) { directory, e2eToken, error in + if error == .success && e2eToken != nil && directory != nil { - NCCommunication.shared.createFolder(fileNameFolderUrl, addCustomHeaders: ["e2e-token": e2eToken!]) { account, ocId, _, errorCode, errorDescription in - if errorCode == 0 { + let options = NKRequestOptions(customHeader: ["e2e-token": e2eToken!]) + + NextcloudKit.shared.createFolder(fileNameFolderUrl, options: options) { account, ocId, _, error in + if error == .success { guard let fileId = NCUtility.shared.ocIdToFileId(ocId: ocId) else { // unlock if let tableLock = NCManageDatabase.shared.getE2ETokenLock(account: account, serverUrl: serverUrl) { - NCCommunication.shared.lockE2EEFolder(fileId: tableLock.fileId, e2eToken: tableLock.e2eToken, method: "DELETE") { _, _, _, _ in } + NextcloudKit.shared.lockE2EEFolder(fileId: tableLock.fileId, e2eToken: tableLock.e2eToken, method: "DELETE") { _, _, _, _ in } } - return completion(NCGlobal.shared.errorInternalError, "Error convert ocId") + return completion(NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "Error convert ocId")) } - NCCommunication.shared.markE2EEFolder(fileId: fileId, delete: false) { account, errorCode, errorDescription in - if errorCode == 0 { + NextcloudKit.shared.markE2EEFolder(fileId: fileId, delete: false) { account, error in + if error == .success { let object = tableE2eEncryption() @@ -88,86 +90,87 @@ import Alamofire NCManageDatabase.shared.addE2eEncryption(object) - self.sendE2EMetadata(account: account, serverUrl: serverUrl, fileNameRename: nil, fileNameNewRename: nil, deleteE2eEncryption: nil, urlBase: urlBase) { e2eToken, errorCode, errorDescription in + self.sendE2EMetadata(account: account, serverUrl: serverUrl, fileNameRename: nil, fileNameNewRename: nil, deleteE2eEncryption: nil, urlBase: urlBase) { e2eToken, error in // unlock if let tableLock = NCManageDatabase.shared.getE2ETokenLock(account: account, serverUrl: serverUrl) { - NCCommunication.shared.lockE2EEFolder(fileId: tableLock.fileId, e2eToken: tableLock.e2eToken, method: "DELETE") { _, _, _, _ in } + NextcloudKit.shared.lockE2EEFolder(fileId: tableLock.fileId, e2eToken: tableLock.e2eToken, method: "DELETE") { _, _, _, _ in } } - if errorCode == 0 { + if error == .success { NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterCreateFolder, userInfo: nil) } - completion(errorCode, errorDescription) + completion(error) } } else { // unlock if let tableLock = NCManageDatabase.shared.getE2ETokenLock(account: account, serverUrl: serverUrl) { - NCCommunication.shared.lockE2EEFolder(fileId: tableLock.fileId, e2eToken: tableLock.e2eToken, method: "DELETE") { _, _, _, _ in } + NextcloudKit.shared.lockE2EEFolder(fileId: tableLock.fileId, e2eToken: tableLock.e2eToken, method: "DELETE") { _, _, _, _ in } } - completion(errorCode, errorDescription) + completion(error) } } } else { // unlock if let tableLock = NCManageDatabase.shared.getE2ETokenLock(account: account, serverUrl: serverUrl) { - NCCommunication.shared.lockE2EEFolder(fileId: tableLock.fileId, e2eToken: tableLock.e2eToken, method: "DELETE") { _, _, _, _ in } + NextcloudKit.shared.lockE2EEFolder(fileId: tableLock.fileId, e2eToken: tableLock.e2eToken, method: "DELETE") { _, _, _, _ in } } - completion(errorCode, errorDescription) + completion(error) } } } else { - completion(errorCode, errorDescription ?? "") + completion(error) } } } // MARK: - WebDav Delete - func deleteMetadata(_ metadata: tableMetadata, completion: @escaping (_ errorCode: Int, _ errorDescription: String) -> Void) { + func deleteMetadata(_ metadata: tableMetadata, completion: @escaping (_ error: NKError) -> Void) { - self.lock(account: metadata.account, serverUrl: metadata.serverUrl) { directory, e2eToken, errorCode, errorDescription in - if errorCode == 0 && e2eToken != nil && directory != nil { + self.lock(account: metadata.account, serverUrl: metadata.serverUrl) { directory, e2eToken, error in + if error == .success && e2eToken != nil && directory != nil { + let deleteE2eEncryption = NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameIdentifier == %@", metadata.account, metadata.serverUrl, metadata.fileName) - NCNetworking.shared.deleteMetadataPlain(metadata, addCustomHeaders: ["e2e-token": e2eToken!]) { errorCode, errorDescription in + NCNetworking.shared.deleteMetadataPlain(metadata, customHeader: ["e2e-token": e2eToken!]) { error in let home = NCUtilityFileSystem.shared.getHomeServer(account: metadata.account) if metadata.serverUrl != home { - self.sendE2EMetadata(account: metadata.account, serverUrl: metadata.serverUrl, fileNameRename: nil, fileNameNewRename: nil, deleteE2eEncryption: deleteE2eEncryption, urlBase: metadata.urlBase) { e2eToken, errorCode, errorDescription in + self.sendE2EMetadata(account: metadata.account, serverUrl: metadata.serverUrl, fileNameRename: nil, fileNameNewRename: nil, deleteE2eEncryption: deleteE2eEncryption, urlBase: metadata.urlBase) { e2eToken, error in // unlock if let tableLock = NCManageDatabase.shared.getE2ETokenLock(account: metadata.account, serverUrl: metadata.serverUrl) { - NCCommunication.shared.lockE2EEFolder(fileId: tableLock.fileId, e2eToken: tableLock.e2eToken, method: "DELETE") { _, _, _, _ in } + NextcloudKit.shared.lockE2EEFolder(fileId: tableLock.fileId, e2eToken: tableLock.e2eToken, method: "DELETE") { _, _, _, _ in } } - completion(errorCode, errorDescription) + completion(error) } } else { // unlock if let tableLock = NCManageDatabase.shared.getE2ETokenLock(account: metadata.account, serverUrl: metadata.serverUrl) { - NCCommunication.shared.lockE2EEFolder(fileId: tableLock.fileId, e2eToken: tableLock.e2eToken, method: "DELETE") { _, _, _, _ in } + NextcloudKit.shared.lockE2EEFolder(fileId: tableLock.fileId, e2eToken: tableLock.e2eToken, method: "DELETE") { _, _, _, _ in } } - completion(errorCode, errorDescription) + completion(error) } } } else { - completion(errorCode, errorDescription ?? "") + completion(error) } } } // MARK: - WebDav Rename - func renameMetadata(_ metadata: tableMetadata, fileNameNew: String, completion: @escaping (_ errorCode: Int, _ errorDescription: String?) -> Void) { + func renameMetadata(_ metadata: tableMetadata, fileNameNew: String, completion: @escaping (_ error: NKError) -> Void) { // verify if exists the new fileName if NCManageDatabase.shared.getE2eEncryption(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileName == %@", metadata.account, metadata.serverUrl, fileNameNew)) != nil { - completion(NCGlobal.shared.errorInternalError, "_file_already_exists_") + return completion(NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_file_already_exists_")) } else { - self.sendE2EMetadata(account: metadata.account, serverUrl: metadata.serverUrl, fileNameRename: metadata.fileName, fileNameNewRename: fileNameNew, deleteE2eEncryption: nil, urlBase: metadata.urlBase) { e2eToken, errorCode, errorDescription in + self.sendE2EMetadata(account: metadata.account, serverUrl: metadata.serverUrl, fileNameRename: metadata.fileName, fileNameNewRename: fileNameNew, deleteE2eEncryption: nil, urlBase: metadata.urlBase) { e2eToken, error in - if errorCode == 0 { + if error == .success { NCManageDatabase.shared.setMetadataFileNameView(serverUrl: metadata.serverUrl, fileName: metadata.fileName, newFileNameView: fileNameNew, account: metadata.account) // Move file system @@ -182,17 +185,17 @@ import Alamofire // unlock if let tableLock = NCManageDatabase.shared.getE2ETokenLock(account: metadata.account, serverUrl: metadata.serverUrl) { - NCCommunication.shared.lockE2EEFolder(fileId: tableLock.fileId, e2eToken: tableLock.e2eToken, method: "DELETE") { _, _, _, _ in } + NextcloudKit.shared.lockE2EEFolder(fileId: tableLock.fileId, e2eToken: tableLock.e2eToken, method: "DELETE") { _, _, _, _ in } } - completion(errorCode, errorDescription) + completion(error) } } } // MARK: - Upload - func upload(metadata: tableMetadata, start: @escaping () -> Void, completion: @escaping (_ errorCode: Int, _ errorDescription: String) -> Void) { + func upload(metadata: tableMetadata, start: @escaping () -> Void, completion: @escaping (_ error: NKError) -> Void) { let objectE2eEncryption = tableE2eEncryption() var key: NSString?, initializationVector: NSString?, authenticationTag: NSString? @@ -202,16 +205,16 @@ import Alamofire // Verify max size if metadata.size > NCGlobal.shared.e2eeMaxFileSize { NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", ocIdTemp)) - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "fileName": metadata.fileName, "ocIdTemp": ocIdTemp, "errorCode": NCGlobal.shared.errorInternalError, "errorDescription": "E2E Error file too big"]) + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "fileName": metadata.fileName, "ocIdTemp": ocIdTemp, "error": NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "E2E Error file too big")]) start() - return completion(NCGlobal.shared.errorInternalError, "E2E Error file too big") + return completion(NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "E2E Error file too big")) } // Update metadata var metadata = tableMetadata.init(value: metadata) metadata.fileName = CCUtility.generateRandomIdentifier()! metadata.e2eEncrypted = true - metadata.session = NCCommunicationCommon.shared.sessionIdentifierUpload + metadata.session = NKCommon.shared.sessionIdentifierUpload metadata.sessionError = "" NCManageDatabase.shared.addMetadata(metadata) @@ -221,9 +224,9 @@ import Alamofire if NCEndToEndEncryption.sharedManager()?.encryptFileName(metadata.fileNameView, fileNameIdentifier: metadata.fileName, directory: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId), key: &key, initializationVector: &initializationVector, authenticationTag: &authenticationTag) == false { NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", ocIdTemp)) - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "fileName": metadata.fileName, "ocIdTemp": ocIdTemp, "errorCode": NCGlobal.shared.errorInternalError, "errorDescription": "_e2e_error_create_encrypted_"]) + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "fileName": metadata.fileName, "ocIdTemp": ocIdTemp, "error": NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_e2e_error_create_encrypted_")]) start() - return completion(NCGlobal.shared.errorInternalError, "_e2e_error_create_encrypted_") + return completion(NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_e2e_error_create_encrypted_")) } if let result = NCManageDatabase.shared.getE2eEncryption(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", metadata.account, serverUrl)) { @@ -252,18 +255,18 @@ import Alamofire metadata = getMetadata } else { start() - return completion(NCGlobal.shared.errorInternalError, "_e2e_error_create_encrypted_") + return completion(NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_e2e_error_create_encrypted_")) } NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSource, userInfo: ["serverUrl": metadata.serverUrl]) NCContentPresenter.shared.noteTop(text: NSLocalizedString("_upload_e2ee_", comment: ""), image: nil, type: NCContentPresenter.messageType.info, delay: NCGlobal.shared.dismissAfterSecond, priority: .max) - NCNetworkingE2EE.shared.sendE2EMetadata(account: metadata.account, serverUrl: serverUrl, fileNameRename: nil, fileNameNewRename: nil, deleteE2eEncryption: nil, urlBase: metadata.urlBase, upload: true) { e2eToken, errorCode, errorDescription in + NCNetworkingE2EE.shared.sendE2EMetadata(account: metadata.account, serverUrl: serverUrl, fileNameRename: nil, fileNameNewRename: nil, deleteE2eEncryption: nil, urlBase: metadata.urlBase, upload: true) { e2eToken, error in start() - if errorCode == 0 && e2eToken != nil { + if error == .success && e2eToken != nil { - NCCommunication.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, dateCreationFile: metadata.date as Date, dateModificationFile: metadata.date as Date, addCustomHeaders: ["e2e-token": e2eToken!], requestHandler: { request in + NextcloudKit.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, dateCreationFile: metadata.date as Date, dateModificationFile: metadata.date as Date, addCustomHeaders: ["e2e-token": e2eToken!], requestHandler: { request in NCNetworking.shared.uploadRequest[fileNameLocalPathRequest] = request NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: nil, sessionError: nil, sessionSelector: nil, sessionTaskIdentifier: nil, status: NCGlobal.shared.metadataStatusUploading) @@ -285,18 +288,18 @@ import Alamofire "totalBytes": NSNumber(value: progress.totalUnitCount), "totalBytesExpected": NSNumber(value: progress.completedUnitCount)]) - }) { account, ocId, etag, date, _, _, error, errorCode, errorDescription in + }) { account, ocId, etag, date, _, _, afError, error in NCNetworking.shared.uploadRequest.removeValue(forKey: fileNameLocalPath) if let metadata = NCManageDatabase.shared.getMetadataFromOcId(metadata.ocId) { - if error?.isExplicitlyCancelledError ?? false { + if afError?.isExplicitlyCancelledError ?? false { 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, "errorCode": errorCode, "errorDescription": ""]) - completion(0, "") + 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()) - } else if errorCode == 0 && ocId != nil { + } else if error == .success && ocId != nil { NCUtilityFileSystem.shared.moveFileInBackground(atPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId), toPath: CCUtility.getDirectoryProviderStorageOcId(ocId)) @@ -314,95 +317,85 @@ import Alamofire NCManageDatabase.shared.addLocalFile(metadata: metadata) 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, "errorCode": errorCode, "errorDescription": ""]) + 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 { - if errorCode == 401 || errorCode == 403 { + NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: nil, sessionError: error.errorDescription, sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusUploadError) - #if !EXTENSION - NCNetworkingCheckRemoteUser.shared.checkRemoteUser(account: metadata.account, errorCode: errorCode, errorDescription: errorDescription) - #endif - NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: nil, sessionError: errorDescription, sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusUploadError) - - } else { - - NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: nil, sessionError: 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, "errorCode": errorCode, "errorDescription": ""]) + 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(errorCode, errorDescription) + NCNetworkingE2EE.shared.unlock(account: metadata.account, serverUrl: serverUrl) { _, _, _ in + completion(error) } } } else { if let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocIdTemp) { - NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: nil, sessionError: 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, "errorCode": errorCode, "errorDescription": errorDescription]) + 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]) } - completion(errorCode, errorDescription) + completion(error) } } } // MARK: - E2EE - @objc func lock(account: String, serverUrl: String, completion: @escaping (_ direcrtory: tableDirectory?, _ e2eToken: String?, _ errorCode: Int, _ errorDescription: String?) -> Void) { + @objc func lock(account: String, serverUrl: String, completion: @escaping (_ direcrtory: tableDirectory?, _ e2eToken: String?, _ error: NKError) -> Void) { var e2eToken: String? guard let directory = NCManageDatabase.shared.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", account, serverUrl)) else { - return completion(nil, nil, 0, "") + return completion(nil, nil, NKError()) } if let tableLock = NCManageDatabase.shared.getE2ETokenLock(account: account, serverUrl: serverUrl) { e2eToken = tableLock.e2eToken } - NCCommunication.shared.lockE2EEFolder(fileId: directory.fileId, e2eToken: e2eToken, method: "POST") { account, e2eToken, errorCode, errorDescription in - if errorCode == 0 && e2eToken != nil { + NextcloudKit.shared.lockE2EEFolder(fileId: directory.fileId, e2eToken: e2eToken, method: "POST") { account, e2eToken, data, error in + if error == .success && e2eToken != nil { NCManageDatabase.shared.setE2ETokenLock(account: account, serverUrl: serverUrl, fileId: directory.fileId, e2eToken: e2eToken!) } - completion(directory, e2eToken, errorCode, errorDescription) + completion(directory, e2eToken, error) } } - @objc func unlock(account: String, serverUrl: String, completion: @escaping (_ direcrtory: tableDirectory?, _ e2eToken: String?, _ errorCode: Int, _ errorDescription: String?) -> Void) { + @objc func unlock(account: String, serverUrl: String, completion: @escaping (_ direcrtory: tableDirectory?, _ e2eToken: String?, _ error: NKError) -> Void) { var e2eToken: String? guard let directory = NCManageDatabase.shared.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", account, serverUrl)) else { - return completion(nil, nil, 0, "") + return completion(nil, nil, NKError()) } if let tableLock = NCManageDatabase.shared.getE2ETokenLock(account: account, serverUrl: serverUrl) { e2eToken = tableLock.e2eToken } - NCCommunication.shared.lockE2EEFolder(fileId: directory.fileId, e2eToken: e2eToken, method: "DELETE") { account, e2eToken, errorCode, errorDescription in - if errorCode == 0 { + NextcloudKit.shared.lockE2EEFolder(fileId: directory.fileId, e2eToken: e2eToken, method: "DELETE") { account, e2eToken, data, error in + if error == .success { NCManageDatabase.shared.deteleE2ETokenLock(account: account, serverUrl: serverUrl) } - completion(directory, e2eToken, errorCode, errorDescription) + completion(directory, e2eToken, error) } } - @objc func sendE2EMetadata(account: String, serverUrl: String, fileNameRename: String?, fileNameNewRename: String?, deleteE2eEncryption: NSPredicate?, urlBase: String, upload: Bool = false, completion: @escaping (_ e2eToken: String?, _ errorCode: Int, _ errorDescription: String) -> Void) { + @objc func sendE2EMetadata(account: String, serverUrl: String, fileNameRename: String?, fileNameNewRename: String?, deleteE2eEncryption: NSPredicate?, urlBase: String, upload: Bool = false, completion: @escaping (_ e2eToken: String?, _ error: NKError) -> Void) { - self.lock(account: account, serverUrl: serverUrl) { directory, e2eToken, errorCode, errorDescription in - if errorCode == 0 && e2eToken != nil && directory != nil { + self.lock(account: account, serverUrl: serverUrl) { directory, e2eToken, error in + if error == .success && e2eToken != nil && directory != nil { - NCCommunication.shared.getE2EEMetadata(fileId: directory!.fileId, e2eToken: e2eToken) { account, e2eMetadata, errorCode, errorDescription in + NextcloudKit.shared.getE2EEMetadata(fileId: directory!.fileId, e2eToken: e2eToken) { account, e2eMetadata, data, error in var method = "POST" var e2eMetadataNew: String? - if errorCode == 0 && e2eMetadata != nil { + if error == .success && e2eMetadata != nil { if !NCEndToEndMetadata.shared.decoderMetadata(e2eMetadata!, privateKey: CCUtility.getEndToEndPrivateKey(account), serverUrl: serverUrl, account: account, urlBase: urlBase) { - return completion(e2eToken, NCGlobal.shared.errorInternalError, NSLocalizedString("_e2e_error_encode_metadata_", comment: "")) + return completion(e2eToken, NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: NSLocalizedString("_e2e_error_encode_metadata_", comment: ""))) } method = "PUT" } @@ -425,19 +418,19 @@ import Alamofire method = "DELETE" } - NCCommunication.shared.putE2EEMetadata(fileId: directory!.fileId, e2eToken: e2eToken!, e2eMetadata: e2eMetadataNew, method: method) { account, _, errorCode, errorDescription in + NextcloudKit.shared.putE2EEMetadata(fileId: directory!.fileId, e2eToken: e2eToken!, e2eMetadata: e2eMetadataNew, method: method) { account, _, _, error in if upload { - completion(e2eToken, errorCode, errorDescription) + completion(e2eToken, error) } else { - self.unlock(account: account, serverUrl: serverUrl) { _, e2eToken, _, _ in - completion(e2eToken, errorCode, errorDescription) + self.unlock(account: account, serverUrl: serverUrl) { _, e2eToken, _ in + completion(e2eToken, error) } } } } } else { - completion(e2eToken, errorCode, errorDescription ?? "") + completion(e2eToken, error) } } } diff --git a/iOSClient/Networking/NCNetworkingProcessUpload.swift b/iOSClient/Networking/NCNetworkingProcessUpload.swift index 6ed7bdc2d..6da60e424 100644 --- a/iOSClient/Networking/NCNetworkingProcessUpload.swift +++ b/iOSClient/Networking/NCNetworkingProcessUpload.swift @@ -22,43 +22,38 @@ // import UIKit -import NCCommunication +import NextcloudKit import Photos -import Queuer class NCNetworkingProcessUpload: NSObject { - let appDelegate = UIApplication.shared.delegate as! AppDelegate var timerProcess: Timer? - let maxConcurrentOperationUpload = 5 - override init() { super.init() startTimer() } - private func startProcess() { + private func startProcess(completion: @escaping (_ items: Int) -> Void) { if timerProcess?.isValid ?? false { - DispatchQueue.main.async { self.process() } + DispatchQueue.main.async { self.processForeground() } } } func startTimer() { timerProcess?.invalidate() - timerProcess = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(process), userInfo: nil, repeats: true) + timerProcess = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(processForeground), userInfo: nil, repeats: true) } func stopTimer() { timerProcess?.invalidate() } - @objc private func process() { - guard !appDelegate.account.isEmpty else { return } + @objc private func processForeground() { + guard let account = NCManageDatabase.shared.getActiveAccount(), UIApplication.shared.applicationState == .active else { return } stopTimer() - let applicationState = UIApplication.shared.applicationState var counterUpload: Int = 0 let sessionSelectors = [NCGlobal.shared.selectorUploadFileNODelete, NCGlobal.shared.selectorUploadFile, NCGlobal.shared.selectorUploadAutoUpload, NCGlobal.shared.selectorUploadAutoUploadAll] let metadatasUpload = NCManageDatabase.shared.getMetadatas(predicate: NSPredicate(format: "status == %d OR status == %d", NCGlobal.shared.metadataStatusInUpload, NCGlobal.shared.metadataStatusUploading)) @@ -70,28 +65,28 @@ class NCNetworkingProcessUpload: NSObject { 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 + NCNetworking.shared.getOcIdInBackgroundSession(queue: DispatchQueue.global(), completion: { listOcId in for sessionSelector in sessionSelectors { - if counterUpload < self.maxConcurrentOperationUpload { + if counterUpload < NCGlobal.shared.maxConcurrentOperationUpload { - let limit = self.maxConcurrentOperationUpload - counterUpload + let limit = NCGlobal.shared.maxConcurrentOperationUpload - counterUpload 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") + NKCommon.shared.writeLog("[INFO] PROCESS-UPLOAD find \(metadatas.count) items") } for metadata in metadatas { // Different account - if self.appDelegate.account != metadata.account { - NCCommunicationCommon.shared.writeLog("Process auto upload skipped file: \(metadata.serverUrl)/\(metadata.fileNameView) on account: \(metadata.account), because the actual account is \(self.appDelegate.account).") + if account.account != metadata.account { + NKCommon.shared.writeLog("[INFO] Process auto upload skipped file: \(metadata.serverUrl)/\(metadata.fileNameView) on account: \(metadata.account), because the actual account is \(account.account).") continue } // Is already in upload background? skipped if listOcId.contains(metadata.ocId) { - NCCommunicationCommon.shared.writeLog("Process auto upload skipped file: \(metadata.serverUrl)/\(metadata.fileNameView), because is already in session.") + NKCommon.shared.writeLog("[INFO] Process auto upload skipped file: \(metadata.serverUrl)/\(metadata.fileNameView), because is already in session.") continue } @@ -103,30 +98,29 @@ class NCNetworkingProcessUpload: NSObject { // Is already in upload E2EE / CHUNK ? exit [ ONLY ONE IN QUEUE ] for metadata in metadatasUpload { if metadata.chunk || metadata.e2eEncrypted { - counterUpload = self.maxConcurrentOperationUpload + counterUpload = NCGlobal.shared.maxConcurrentOperationUpload continue } } - let semaphore = Semaphore() - self.extractFiles(from: metadata) { metadatas in + let semaphore = DispatchSemaphore(value: 0) + NCUtility.shared.extractFiles(from: metadata) { metadatas in if metadatas.isEmpty { NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)) } for metadata in metadatas { - if (metadata.e2eEncrypted || metadata.chunk) && applicationState != .active { continue } - let isWiFi = NCNetworking.shared.networkReachability == NCCommunicationCommon.typeReachability.reachableEthernetOrWiFi + let isWiFi = NCNetworking.shared.networkReachability == NKCommon.typeReachability.reachableEthernetOrWiFi if metadata.session == NCNetworking.shared.sessionIdentifierBackgroundWWan && !isWiFi { continue } if let metadata = NCManageDatabase.shared.setMetadataStatus(ocId: metadata.ocId, status: NCGlobal.shared.metadataStatusInUpload) { NCNetworking.shared.upload(metadata: metadata) } if metadata.e2eEncrypted || metadata.chunk { - counterUpload = self.maxConcurrentOperationUpload + counterUpload = NCGlobal.shared.maxConcurrentOperationUpload } else { counterUpload += 1 } } - semaphore.continue() + semaphore.signal() } semaphore.wait() } @@ -143,8 +137,8 @@ class NCNetworkingProcessUpload: NSObject { // verify delete Asset Local Identifiers in auto upload (DELETE Photos album) DispatchQueue.main.async { - if (counterUpload == 0 && !self.appDelegate.isPasscodePresented()) { - self.deleteAssetLocalIdentifiers(account: self.appDelegate.account) { + if UIApplication.shared.applicationState == .active && counterUpload == 0 && !(UIApplication.shared.delegate as! AppDelegate).isPasscodePresented() { + self.deleteAssetLocalIdentifiers(account: account.account) { self.startTimer() } } else { @@ -184,56 +178,7 @@ class NCNetworkingProcessUpload: NSObject { // MARK: - - func extractFiles(from metadata: tableMetadata, completition: @escaping (_ metadatas: [tableMetadata]) -> Void) { - - let chunckSize = CCUtility.getChunkSize() * 1000000 - var metadatas: [tableMetadata] = [] - let metadataSource = tableMetadata.init(value: metadata) - - guard !metadata.isExtractFile else { return completition([metadataSource]) } - guard !metadataSource.assetLocalIdentifier.isEmpty else { - let filePath = CCUtility.getDirectoryProviderStorageOcId(metadataSource.ocId, fileNameView: metadataSource.fileName)! - metadataSource.size = NCUtilityFileSystem.shared.getFileSize(filePath: filePath) - let results = NCCommunicationCommon.shared.getInternalType(fileName: metadataSource.fileNameView, mimeType: metadataSource.contentType, directory: false) - metadataSource.contentType = results.mimeType - metadataSource.iconName = results.iconName - metadataSource.classFile = results.classFile - if let date = NCUtilityFileSystem.shared.getFileCreationDate(filePath: filePath) { metadataSource.creationDate = date } - if let date = NCUtilityFileSystem.shared.getFileModificationDate(filePath: filePath) { metadataSource.date = date } - metadataSource.chunk = chunckSize != 0 && metadata.size > chunckSize - metadataSource.e2eEncrypted = CCUtility.isFolderEncrypted(metadata.serverUrl, e2eEncrypted: metadata.e2eEncrypted, account: metadata.account, urlBase: metadata.urlBase) - metadataSource.isExtractFile = true - if let metadata = NCManageDatabase.shared.addMetadata(metadataSource) { - metadatas.append(metadata) - } - return completition(metadatas) - } - - NCUtility.shared.extractImageVideoFromAssetLocalIdentifier(metadata: metadataSource, modifyMetadataForUpload: true) { metadata, fileNamePath, returnError in - if let metadata = metadata, let fileNamePath = fileNamePath, !returnError { - metadatas.append(metadata) - let toPath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)! - NCUtilityFileSystem.shared.moveFile(atPath: fileNamePath, toPath: toPath) - } else { - return completition(metadatas) - } - let fetchAssets = PHAsset.fetchAssets(withLocalIdentifiers: [metadataSource.assetLocalIdentifier], options: nil) - if metadataSource.livePhoto, fetchAssets.count > 0 { - NCUtility.shared.createMetadataLivePhotoFromMetadata(metadataSource, asset: fetchAssets.firstObject) { metadata in - if let metadata = metadata, let metadata = NCManageDatabase.shared.addMetadata(metadata) { - metadatas.append(metadata) - } - completition(metadatas) - } - } else { - completition(metadatas) - } - } - } - - // MARK: - - - @objc func createProcessUploads(metadatas: [tableMetadata], verifyAlreadyExists: Bool = false) { + @objc func createProcessUploads(metadatas: [tableMetadata], verifyAlreadyExists: Bool = false, completion: @escaping (_ items: Int) -> Void) { var metadatasForUpload: [tableMetadata] = [] for metadata in metadatas { @@ -245,7 +190,7 @@ class NCNetworkingProcessUpload: NSObject { metadatasForUpload.append(metadata) } NCManageDatabase.shared.addMetadatas(metadatasForUpload) - startProcess() + startProcess(completion: completion) } // MARK: - @@ -255,7 +200,7 @@ class NCNetworkingProcessUpload: NSObject { var session: URLSession? // remove leaning upload share extension - let metadatasUploadShareExtension = NCManageDatabase.shared.getMetadatas(predicate: NSPredicate(format: "session == %@ AND sessionSelector == %@", NCCommunicationCommon.shared.sessionIdentifierUpload, NCGlobal.shared.selectorUploadFileShareExtension)) + let metadatasUploadShareExtension = NCManageDatabase.shared.getMetadatas(predicate: NSPredicate(format: "session == %@ AND sessionSelector == %@", NKCommon.shared.sessionIdentifierUpload, NCGlobal.shared.selectorUploadFileShareExtension)) for metadata in metadatasUploadShareExtension { let path = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId)! NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)) @@ -307,7 +252,7 @@ class NCNetworkingProcessUpload: NSObject { } // metadataStatusUploading OR metadataStatusInUpload (FOREGROUND) - let metadatasUploading = NCManageDatabase.shared.getMetadatas(predicate: NSPredicate(format: "session == %@ AND (status == %d OR status == %d)", NCCommunicationCommon.shared.sessionIdentifierUpload, NCGlobal.shared.metadataStatusUploading, NCGlobal.shared.metadataStatusInUpload)) + let metadatasUploading = NCManageDatabase.shared.getMetadatas(predicate: NSPredicate(format: "session == %@ AND (status == %d OR status == %d)", NKCommon.shared.sessionIdentifierUpload, NCGlobal.shared.metadataStatusUploading, NCGlobal.shared.metadataStatusInUpload)) for metadata in metadatasUploading { let fileNameLocalPath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)! if NCNetworking.shared.uploadRequest[fileNameLocalPath] == nil { @@ -316,7 +261,7 @@ class NCNetworkingProcessUpload: NSObject { } // download - let metadatasDownload = NCManageDatabase.shared.getMetadatas(predicate: NSPredicate(format: "session == %@", NCCommunicationCommon.shared.sessionIdentifierDownload)) + let metadatasDownload = NCManageDatabase.shared.getMetadatas(predicate: NSPredicate(format: "session == %@", NKCommon.shared.sessionIdentifierDownload)) for metadata in metadatasDownload { NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: "", sessionError: "", sessionSelector: "", sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusNormal) } diff --git a/iOSClient/Networking/NCOperationQueue.swift b/iOSClient/Networking/NCOperationQueue.swift index a39e59365..260e0f785 100644 --- a/iOSClient/Networking/NCOperationQueue.swift +++ b/iOSClient/Networking/NCOperationQueue.swift @@ -23,7 +23,7 @@ import UIKit import Queuer -import NCCommunication +import NextcloudKit @objc class NCOperationQueue: NSObject { @objc public static let shared: NCOperationQueue = { @@ -220,7 +220,7 @@ import NCCommunication // MARK: - Unified Search - func unifiedSearchAddSection(collectionViewCommon: NCCollectionViewCommon, metadatas: [tableMetadata], searchResult: NCCSearchResult) { + func unifiedSearchAddSection(collectionViewCommon: NCCollectionViewCommon, metadatas: [tableMetadata], searchResult: NKSearchResult) { unifiedSearchQueue.addOperation(NCOperationUnifiedSearch.init(collectionViewCommon: collectionViewCommon, metadatas: metadatas, searchResult: searchResult)) } @@ -245,7 +245,7 @@ class NCOperationDownload: ConcurrentOperation { if isCancelled { self.finish() } else { - NCNetworking.shared.download(metadata: metadata, selector: self.selector) { _ in + NCNetworking.shared.download(metadata: metadata, selector: self.selector) { _, _ in self.finish() } } @@ -268,9 +268,9 @@ class NCOperationDelete: ConcurrentOperation { if isCancelled { self.finish() } else { - NCNetworking.shared.deleteMetadata(metadata, onlyLocalCache: onlyLocalCache) { errorCode, errorDescription in - if errorCode != 0 { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCNetworking.shared.deleteMetadata(metadata, onlyLocalCache: onlyLocalCache) { error in + if error != .success { + NCContentPresenter.shared.showError(error: error) } self.finish() } @@ -299,16 +299,16 @@ class NCOperationCopyMove: ConcurrentOperation { self.finish() } else { if move { - NCNetworking.shared.moveMetadata(metadata, serverUrlTo: serverUrlTo, overwrite: overwrite) { errorCode, errorDescription in - if errorCode != 0 { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCNetworking.shared.moveMetadata(metadata, serverUrlTo: serverUrlTo, overwrite: overwrite) { error in + if error != .success { + NCContentPresenter.shared.showError(error: error) } self.finish() } } else { - NCNetworking.shared.copyMetadata(metadata, serverUrlTo: serverUrlTo, overwrite: overwrite) { errorCode, errorDescription in - if errorCode != 0 { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCNetworking.shared.copyMetadata(metadata, serverUrlTo: serverUrlTo, overwrite: overwrite) { error in + if error != .success { + NCContentPresenter.shared.showError(error: error) } self.finish() } @@ -344,15 +344,17 @@ class NCOperationSynchronization: ConcurrentOperation { let serverUrl = metadata.serverUrl + "/" + metadata.fileName let directory = NCManageDatabase.shared.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", metadata.account, serverUrl)) - NCCommunication.shared.readFileOrFolder(serverUrlFileName: serverUrl, depth: "0", showHiddenFiles: CCUtility.getShowHiddenFiles()) { account, files, _, errorCode, _ in + NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrl, depth: "0", showHiddenFiles: CCUtility.getShowHiddenFiles()) { account, files, _, error in - if (errorCode == 0) && (directory?.etag != files.first?.etag || self.selector == NCGlobal.shared.selectorDownloadAllFile) { + if (error == .success) && (directory?.etag != files.first?.etag || self.selector == NCGlobal.shared.selectorDownloadAllFile) { - NCCommunication.shared.readFileOrFolder(serverUrlFileName: serverUrl, depth: "1", showHiddenFiles: CCUtility.getShowHiddenFiles(), queue: NCCommunicationCommon.shared.backgroundQueue) { account, files, _, errorCode, _ in + let options = NKRequestOptions(queue: NKCommon.shared.backgroundQueue) - if errorCode == 0 { + NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrl, depth: "1", showHiddenFiles: CCUtility.getShowHiddenFiles(), options: options) { account, files, _, error in - NCManageDatabase.shared.convertNCCommunicationFilesToMetadatas(files, useMetadataFolder: true, account: account) { metadataFolder, _, metadatas in + if error == .success { + + NCManageDatabase.shared.convertNKFilesToMetadatas(files, useMetadataFolder: true, account: account) { metadataFolder, _, metadatas in let metadatasResult = NCManageDatabase.shared.getMetadatas(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND status == %d", account, serverUrl, NCGlobal.shared.metadataStatusNormal)) @@ -389,7 +391,7 @@ class NCOperationSynchronization: ConcurrentOperation { NCManageDatabase.shared.addDirectory(encrypted: metadataFolder.e2eEncrypted, favorite: metadataFolder.favorite, ocId: metadataFolder.ocId, fileId: metadataFolder.fileId, etag: metadataFolder.etag, permissions: metadataFolder.permissions, serverUrl: serverUrl, account: metadataFolder.account) } - } else if errorCode == NCGlobal.shared.errorResourceNotFound && self.metadata.directory { + } else if error.errorCode == NCGlobal.shared.errorResourceNotFound && self.metadata.directory { NCManageDatabase.shared.deleteDirectoryAndSubDirectory(serverUrl: self.metadata.serverUrl, account: self.metadata.account) } @@ -452,7 +454,8 @@ class NCOperationDownloadThumbnail: ConcurrentOperation { if FileManager.default.fileExists(atPath: fileNameIconLocalPath) && FileManager.default.fileExists(atPath: fileNamePreviewLocalPath) { etagResource = metadata.etagResource } - NCCommunication.shared.downloadPreview( + let options = NKRequestOptions(queue: NKCommon.shared.backgroundQueue) + NextcloudKit.shared.downloadPreview( fileNamePathOrFileId: fileNamePath, fileNamePreviewLocalPath: fileNamePreviewLocalPath, widthPreview: NCGlobal.shared.sizePreview, @@ -460,9 +463,9 @@ class NCOperationDownloadThumbnail: ConcurrentOperation { fileNameIconLocalPath: fileNameIconLocalPath, sizeIcon: NCGlobal.shared.sizeIcon, etag: etagResource, - queue: NCCommunicationCommon.shared.backgroundQueue) { _, _, imageIcon, _, etag, errorCode, _ in + options: options) { _, _, imageIcon, _, etag, error in - if errorCode == 0, let imageIcon = imageIcon { + if error == .success, let imageIcon = imageIcon { NCManageDatabase.shared.setMetadataEtagResource(ocId: self.metadata.ocId, etagResource: etag) DispatchQueue.main.async { if self.metadata.ocId == self.cell?.fileObjectId, let filePreviewImageView = self.cell?.filePreviewImageView { @@ -511,16 +514,18 @@ class NCOperationDownloadThumbnailActivity: ConcurrentOperation { self.finish() } else { - NCCommunication.shared.downloadPreview( + let options = NKRequestOptions(queue: NKCommon.shared.backgroundQueue) + + NextcloudKit.shared.downloadPreview( fileNamePathOrFileId: fileNamePathOrFileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, widthPreview: 0, heightPreview: 0, etag: nil, useInternalEndpoint: false, - queue: NCCommunicationCommon.shared.backgroundQueue) { _, imagePreview, _, _, _, errorCode, _ in + options: options) { _, imagePreview, _, _, _, error in - if errorCode == 0, let imagePreview = imagePreview { + if error == .success, let imagePreview = imagePreview { DispatchQueue.main.async { if self.fileId == self.cell?.fileId, let imageView = self.cell?.imageView { UIView.transition(with: imageView, @@ -566,9 +571,12 @@ class NCOperationDownloadAvatar: ConcurrentOperation { if isCancelled { self.finish() } else { - NCCommunication.shared.downloadAvatar(user: user, fileNameLocalPath: fileNameLocalPath, sizeImage: NCGlobal.shared.avatarSize, avatarSizeRounded: NCGlobal.shared.avatarSizeRounded, etag: self.etag, queue: NCCommunicationCommon.shared.backgroundQueue) { _, imageAvatar, _, etag, errorCode, _ in + + let options = NKRequestOptions(queue: NKCommon.shared.backgroundQueue) + + NextcloudKit.shared.downloadAvatar(user: user, fileNameLocalPath: fileNameLocalPath, sizeImage: NCGlobal.shared.avatarSize, avatarSizeRounded: NCGlobal.shared.avatarSizeRounded, etag: self.etag, options: options) { _, imageAvatar, _, etag, error in - if errorCode == 0, let imageAvatar = imageAvatar, let etag = etag { + if error == .success, let imageAvatar = imageAvatar, let etag = etag { NCManageDatabase.shared.addAvatar(fileName: self.fileName, etag: etag) DispatchQueue.main.async { if self.user == self.cell.fileUser, let avatarImageView = self.cellImageView { @@ -585,7 +593,7 @@ class NCOperationDownloadAvatar: ConcurrentOperation { } } } - } else if errorCode == NCGlobal.shared.errorNotModified { + } else if error.errorCode == NCGlobal.shared.errorNotModified { NCManageDatabase.shared.setAvatarLoaded(fileName: self.fileName) } self.finish() @@ -600,9 +608,9 @@ class NCOperationUnifiedSearch: ConcurrentOperation { var collectionViewCommon: NCCollectionViewCommon var metadatas: [tableMetadata] - var searchResult: NCCSearchResult + var searchResult: NKSearchResult - init(collectionViewCommon: NCCollectionViewCommon, metadatas: [tableMetadata], searchResult: NCCSearchResult) { + init(collectionViewCommon: NCCollectionViewCommon, metadatas: [tableMetadata], searchResult: NKSearchResult) { self.collectionViewCommon = collectionViewCommon self.metadatas = metadatas self.searchResult = searchResult diff --git a/iOSClient/Networking/NCService.swift b/iOSClient/Networking/NCService.swift index 6fa223943..f888fdc53 100644 --- a/iOSClient/Networking/NCService.swift +++ b/iOSClient/Networking/NCService.swift @@ -23,7 +23,8 @@ import UIKit import SVGKit -import NCCommunication +import NextcloudKit +import SwiftyJSON class NCService: NSObject { @objc static let shared: NCService = { @@ -43,7 +44,7 @@ class NCService: NSObject { addInternalTypeIdentifier() requestServerStatus() - requestUserProfile() + requestUserProfile() } // MARK: - @@ -51,71 +52,91 @@ class NCService: NSObject { func addInternalTypeIdentifier() { // txt - NCCommunicationCommon.shared.addInternalTypeIdentifier(typeIdentifier: "text/plain", classFile: NCCommunicationCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorText, iconName: NCCommunicationCommon.typeIconFile.document.rawValue, name: "markdown") + NKCommon.shared.addInternalTypeIdentifier(typeIdentifier: "text/plain", classFile: NKCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorText, iconName: NKCommon.typeIconFile.document.rawValue, name: "markdown") // html - NCCommunicationCommon.shared.addInternalTypeIdentifier(typeIdentifier: "text/html", classFile: NCCommunicationCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorText, iconName: NCCommunicationCommon.typeIconFile.document.rawValue, name: "markdown") + NKCommon.shared.addInternalTypeIdentifier(typeIdentifier: "text/html", classFile: NKCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorText, iconName: NKCommon.typeIconFile.document.rawValue, name: "markdown") // markdown - NCCommunicationCommon.shared.addInternalTypeIdentifier(typeIdentifier: "net.daringfireball.markdown", classFile: NCCommunicationCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorText, iconName: NCCommunicationCommon.typeIconFile.document.rawValue, name: "markdown") - NCCommunicationCommon.shared.addInternalTypeIdentifier(typeIdentifier: "text/x-markdown", classFile: NCCommunicationCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorText, iconName: NCCommunicationCommon.typeIconFile.document.rawValue, name: "markdown") + NKCommon.shared.addInternalTypeIdentifier(typeIdentifier: "net.daringfireball.markdown", classFile: NKCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorText, iconName: NKCommon.typeIconFile.document.rawValue, name: "markdown") + NKCommon.shared.addInternalTypeIdentifier(typeIdentifier: "text/x-markdown", classFile: NKCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorText, iconName: NKCommon.typeIconFile.document.rawValue, name: "markdown") // document: text - NCCommunicationCommon.shared.addInternalTypeIdentifier(typeIdentifier: "org.oasis-open.opendocument.text", classFile: NCCommunicationCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorCollabora, iconName: NCCommunicationCommon.typeIconFile.document.rawValue, name: "document") - NCCommunicationCommon.shared.addInternalTypeIdentifier(typeIdentifier: "org.openxmlformats.wordprocessingml.document", classFile: NCCommunicationCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorOnlyoffice, iconName: NCCommunicationCommon.typeIconFile.document.rawValue, name: "document") - NCCommunicationCommon.shared.addInternalTypeIdentifier(typeIdentifier: "com.microsoft.word.doc", classFile: NCCommunicationCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorQuickLook, iconName: NCCommunicationCommon.typeIconFile.document.rawValue, name: "document") - NCCommunicationCommon.shared.addInternalTypeIdentifier(typeIdentifier: "com.apple.iwork.pages.pages", classFile: NCCommunicationCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorQuickLook, iconName: NCCommunicationCommon.typeIconFile.document.rawValue, name: "pages") + NKCommon.shared.addInternalTypeIdentifier(typeIdentifier: "org.oasis-open.opendocument.text", classFile: NKCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorCollabora, iconName: NKCommon.typeIconFile.document.rawValue, name: "document") + NKCommon.shared.addInternalTypeIdentifier(typeIdentifier: "org.openxmlformats.wordprocessingml.document", classFile: NKCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorOnlyoffice, iconName: NKCommon.typeIconFile.document.rawValue, name: "document") + NKCommon.shared.addInternalTypeIdentifier(typeIdentifier: "com.microsoft.word.doc", classFile: NKCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorQuickLook, iconName: NKCommon.typeIconFile.document.rawValue, name: "document") + NKCommon.shared.addInternalTypeIdentifier(typeIdentifier: "com.apple.iwork.pages.pages", classFile: NKCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorQuickLook, iconName: NKCommon.typeIconFile.document.rawValue, name: "pages") // document: sheet - NCCommunicationCommon.shared.addInternalTypeIdentifier(typeIdentifier: "org.oasis-open.opendocument.spreadsheet", classFile: NCCommunicationCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorCollabora, iconName: NCCommunicationCommon.typeIconFile.xls.rawValue, name: "sheet") - NCCommunicationCommon.shared.addInternalTypeIdentifier(typeIdentifier: "org.openxmlformats.spreadsheetml.sheet", classFile: NCCommunicationCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorOnlyoffice, iconName: NCCommunicationCommon.typeIconFile.xls.rawValue, name: "sheet") - NCCommunicationCommon.shared.addInternalTypeIdentifier(typeIdentifier: "com.microsoft.excel.xls", classFile: NCCommunicationCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorQuickLook, iconName: NCCommunicationCommon.typeIconFile.xls.rawValue, name: "sheet") - NCCommunicationCommon.shared.addInternalTypeIdentifier(typeIdentifier: "com.apple.iwork.numbers.numbers", classFile: NCCommunicationCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorQuickLook, iconName: NCCommunicationCommon.typeIconFile.xls.rawValue, name: "numbers") + NKCommon.shared.addInternalTypeIdentifier(typeIdentifier: "org.oasis-open.opendocument.spreadsheet", classFile: NKCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorCollabora, iconName: NKCommon.typeIconFile.xls.rawValue, name: "sheet") + NKCommon.shared.addInternalTypeIdentifier(typeIdentifier: "org.openxmlformats.spreadsheetml.sheet", classFile: NKCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorOnlyoffice, iconName: NKCommon.typeIconFile.xls.rawValue, name: "sheet") + NKCommon.shared.addInternalTypeIdentifier(typeIdentifier: "com.microsoft.excel.xls", classFile: NKCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorQuickLook, iconName: NKCommon.typeIconFile.xls.rawValue, name: "sheet") + NKCommon.shared.addInternalTypeIdentifier(typeIdentifier: "com.apple.iwork.numbers.numbers", classFile: NKCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorQuickLook, iconName: NKCommon.typeIconFile.xls.rawValue, name: "numbers") // document: presentation - NCCommunicationCommon.shared.addInternalTypeIdentifier(typeIdentifier: "org.oasis-open.opendocument.presentation", classFile: NCCommunicationCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorCollabora, iconName: NCCommunicationCommon.typeIconFile.ppt.rawValue, name: "presentation") - NCCommunicationCommon.shared.addInternalTypeIdentifier(typeIdentifier: "org.openxmlformats.presentationml.presentation", classFile: NCCommunicationCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorOnlyoffice, iconName: NCCommunicationCommon.typeIconFile.ppt.rawValue, name: "presentation") - NCCommunicationCommon.shared.addInternalTypeIdentifier(typeIdentifier: "com.microsoft.powerpoint.ppt", classFile: NCCommunicationCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorQuickLook, iconName: NCCommunicationCommon.typeIconFile.ppt.rawValue, name: "presentation") - NCCommunicationCommon.shared.addInternalTypeIdentifier(typeIdentifier: "com.apple.iwork.keynote.key", classFile: NCCommunicationCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorQuickLook, iconName: NCCommunicationCommon.typeIconFile.ppt.rawValue, name: "keynote") + NKCommon.shared.addInternalTypeIdentifier(typeIdentifier: "org.oasis-open.opendocument.presentation", classFile: NKCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorCollabora, iconName: NKCommon.typeIconFile.ppt.rawValue, name: "presentation") + NKCommon.shared.addInternalTypeIdentifier(typeIdentifier: "org.openxmlformats.presentationml.presentation", classFile: NKCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorOnlyoffice, iconName: NKCommon.typeIconFile.ppt.rawValue, name: "presentation") + NKCommon.shared.addInternalTypeIdentifier(typeIdentifier: "com.microsoft.powerpoint.ppt", classFile: NKCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorQuickLook, iconName: NKCommon.typeIconFile.ppt.rawValue, name: "presentation") + NKCommon.shared.addInternalTypeIdentifier(typeIdentifier: "com.apple.iwork.keynote.key", classFile: NKCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorQuickLook, iconName: NKCommon.typeIconFile.ppt.rawValue, name: "keynote") } + // MARK: - + private func requestServerStatus() { - NCCommunication.shared.getServerStatus(serverUrl: appDelegate.urlBase, queue: NCCommunicationCommon.shared.backgroundQueue) { serverProductName, _, versionMajor, _, _, extendedSupport, errorCode, _ in - guard errorCode == 0, extendedSupport == false else { + let options = NKRequestOptions(queue: NKCommon.shared.backgroundQueue) + + NextcloudKit.shared.getServerStatus(serverUrl: appDelegate.urlBase, options: options) { serverProductName, _, versionMajor, _, _, extendedSupport, data, error in + guard error == .success, extendedSupport == false else { return } if serverProductName == "owncloud" { - NCContentPresenter.shared.messageNotification("_warning_", description: "_warning_owncloud_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorInternalError, priority: .max) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_warning_owncloud_") + NCContentPresenter.shared.showWarning(error: error, priority: .max) } else if versionMajor <= NCGlobal.shared.nextcloud_unsupported_version { - NCContentPresenter.shared.messageNotification("_warning_", description: "_warning_unsupported_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorInternalError, priority: .max) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_warning_unsupported_") + NCContentPresenter.shared.showWarning(error: error, priority: .max) } } } + // MARK: - + private func requestUserProfile() { guard !appDelegate.account.isEmpty else { return } - NCCommunication.shared.getUserProfile(queue: NCCommunicationCommon.shared.backgroundQueue) { account, userProfile, errorCode, errorDescription in - guard errorCode == 0, account == self.appDelegate.account else { - NCBrandColor.shared.settingThemingColor(account: account) - if errorCode == 401 || errorCode == 403 { - NCNetworkingCheckRemoteUser.shared.checkRemoteUser(account: account, errorCode: errorCode, errorDescription: errorDescription) + let options = NKRequestOptions(queue: NKCommon.shared.backgroundQueue) + + NextcloudKit.shared.getUserProfile(options: options) { account, userProfile, data, error in + guard error == .success, account == self.appDelegate.account else { + + // Ops the server has Unauthorized + NKCommon.shared.writeLog("[ERROR] The server has response with Unauthorized \(error.errorCode)") + + DispatchQueue.main.async { + if (UIApplication.shared.applicationState == .active) && + (NCNetworking.shared.networkReachability != NKCommon.typeReachability.notReachable) && + (error.errorCode == NCGlobal.shared.errorNCUnauthorized || error.errorCode == NCGlobal.shared.errorUnauthorized || error.errorCode == NCGlobal.shared.errorForbidden) { + + NCBrandColor.shared.settingThemingColor(account: account) + NCNetworkingCheckRemoteUser().checkRemoteUser(account: account, error: error) + } } return } // Update User (+ userProfile.id) & active account & account network guard let tableAccount = NCManageDatabase.shared.setAccountUserProfile(userProfile!) else { - NCContentPresenter.shared.messageNotification("Account", description: "Internal error : account not found on DB", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError, priority: .max) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "Internal error : account not found on DB") + NCContentPresenter.shared.showError(error: error, priority: .max) return } self.appDelegate.settingAccount(tableAccount.account, urlBase: tableAccount.urlBase, user: tableAccount.user, userId: tableAccount.userId, password: CCUtility.getPassword(tableAccount.account)) // Synchronize favorite - NCNetworking.shared.listingFavoritescompletion(selector: NCGlobal.shared.selectorReadFile) { _, _, _, _ in } + NCNetworking.shared.listingFavoritescompletion(selector: NCGlobal.shared.selectorReadFile) { _, _, _ in } // Synchronize Offline self.synchronizeOffline(account: tableAccount.account) @@ -124,10 +145,11 @@ class NCService: NSObject { let fileName = tableAccount.userBaseUrl + "-" + self.appDelegate.user + ".png" let fileNameLocalPath = String(CCUtility.getDirectoryUserData()) + "/" + fileName let etag = NCManageDatabase.shared.getTableAvatar(fileName: fileName)?.etag + let options = NKRequestOptions(queue: NKCommon.shared.backgroundQueue) - NCCommunication.shared.downloadAvatar(user: tableAccount.userId, fileNameLocalPath: fileNameLocalPath, sizeImage: NCGlobal.shared.avatarSize, avatarSizeRounded: NCGlobal.shared.avatarSizeRounded, etag: etag, queue: NCCommunicationCommon.shared.backgroundQueue) { _, _, _, etag, errorCode, _ in - guard let etag = etag, errorCode == 0 else { - if errorCode == NCGlobal.shared.errorNotModified { + NextcloudKit.shared.downloadAvatar(user: tableAccount.userId, fileNameLocalPath: fileNameLocalPath, sizeImage: NCGlobal.shared.avatarSize, avatarSizeRounded: NCGlobal.shared.avatarSizeRounded, etag: etag, options: options) { _, _, _, etag, error in + guard let etag = etag, error == .success else { + if error.errorCode == NCGlobal.shared.errorNotModified { NCManageDatabase.shared.setAvatarLoaded(fileName: fileName) } return @@ -137,18 +159,20 @@ class NCService: NSObject { } self.requestServerCapabilities() + self.requestDashboardWidget() } } + // MARK: - + private func requestServerCapabilities() { guard !appDelegate.account.isEmpty else { return } - NCCommunication.shared.getCapabilities(queue: NCCommunicationCommon.shared.backgroundQueue) { account, data, errorCode, errorDescription in - guard errorCode == 0, let data = data else { + let options = NKRequestOptions(queue: NKCommon.shared.backgroundQueue) + + NextcloudKit.shared.getCapabilities(options: options) { account, data, error in + guard error == .success, let data = data else { NCBrandColor.shared.settingThemingColor(account: account) - if errorCode == 401 || errorCode == 403 { - NCNetworkingCheckRemoteUser.shared.checkRemoteUser(account: account, errorCode: errorCode, errorDescription: errorDescription) - } return } @@ -157,7 +181,7 @@ class NCService: NSObject { // Setup communication if serverVersionMajor > 0 { - NCCommunicationCommon.shared.setup(nextcloudVersion: serverVersionMajor) + NKCommon.shared.setup(nextcloudVersion: serverVersionMajor) } // Theming @@ -171,15 +195,13 @@ class NCService: NSObject { // File Sharing let isFilesSharingEnabled = NCManageDatabase.shared.getCapabilitiesServerBool(account: account, elements: NCElementsJSON.shared.capabilitiesFileSharingApiEnabled, exists: false) if isFilesSharingEnabled { - NCCommunication.shared.readShares(parameters: NCCShareParameter(), queue: NCCommunicationCommon.shared.backgroundQueue) { account, shares, errorCode, errorDescription in - if errorCode == 0 { + NextcloudKit.shared.readShares(parameters: NKShareParameter(), options: options) { account, shares, data, error in + if error == .success { NCManageDatabase.shared.deleteTableShare(account: account) - if shares != nil { - NCManageDatabase.shared.addShare(urlBase: self.appDelegate.urlBase, account: account, shares: shares!) + if let shares = shares, !shares.isEmpty { + NCManageDatabase.shared.addShare(urlBase: self.appDelegate.urlBase, account: account, shares: shares) } self.appDelegate.shares = NCManageDatabase.shared.getTableShares(account: account) - } else { - NCContentPresenter.shared.messageNotification("_share_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) } } } @@ -195,8 +217,9 @@ class NCService: NSObject { // Text direct editor detail if serverVersionMajor >= NCGlobal.shared.nextcloudVersion18 { - NCCommunication.shared.NCTextObtainEditorDetails(queue: NCCommunicationCommon.shared.backgroundQueue) { account, editors, creators, errorCode, _ in - if errorCode == 0 && account == self.appDelegate.account { + let options = NKRequestOptions(queue: NKCommon.shared.backgroundQueue) + NextcloudKit.shared.NCTextObtainEditorDetails(options: options) { account, editors, creators, data, error in + if error == .success && account == self.appDelegate.account { NCManageDatabase.shared.addDirectEditing(account: account, editors: editors, creators: creators) } } @@ -205,8 +228,8 @@ class NCService: NSObject { // External file Server let isExternalSitesServerEnabled = NCManageDatabase.shared.getCapabilitiesServerBool(account: account, elements: NCElementsJSON.shared.capabilitiesExternalSitesExists, exists: true) if isExternalSitesServerEnabled { - NCCommunication.shared.getExternalSite(queue: NCCommunicationCommon.shared.backgroundQueue) { account, externalSites, errorCode, _ in - if errorCode == 0 && account == self.appDelegate.account { + NextcloudKit.shared.getExternalSite(options: options) { account, externalSites, data, error in + if error == .success && account == self.appDelegate.account { NCManageDatabase.shared.deleteExternalSites(account: account) for externalSite in externalSites { NCManageDatabase.shared.addExternalSites(externalSite, account: account) @@ -220,8 +243,8 @@ class NCService: NSObject { // User Status let userStatus = NCManageDatabase.shared.getCapabilitiesServerBool(account: account, elements: NCElementsJSON.shared.capabilitiesUserStatusEnabled, exists: false) if userStatus { - NCCommunication.shared.getUserStatus(queue: NCCommunicationCommon.shared.backgroundQueue) { account, clearAt, icon, message, messageId, messageIsPredefined, status, statusIsUserDefined, userId, errorCode, _ in - if errorCode == 0 && account == self.appDelegate.account && userId == self.appDelegate.userId { + NextcloudKit.shared.getUserStatus(options: options) { account, clearAt, icon, message, messageId, messageIsPredefined, status, statusIsUserDefined, userId, data, error in + if error == .success && account == self.appDelegate.account && userId == self.appDelegate.userId { NCManageDatabase.shared.setAccountUserStatus(userStatusClearAt: clearAt, userStatusIcon: icon, userStatusMessage: message, userStatusMessageId: messageId, userStatusMessageIsPredefined: messageIsPredefined, userStatusStatus: status, userStatusStatusIsUserDefined: statusIsUserDefined, account: account) } } @@ -230,18 +253,43 @@ class NCService: NSObject { // Added UTI for Collabora if let richdocumentsMimetypes = NCManageDatabase.shared.getCapabilitiesServerArray(account: account, elements: NCElementsJSON.shared.capabilitiesRichdocumentsMimetypes) { for mimeType in richdocumentsMimetypes { - NCCommunicationCommon.shared.addInternalTypeIdentifier(typeIdentifier: mimeType, classFile: NCCommunicationCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorCollabora, iconName: NCCommunicationCommon.typeIconFile.document.rawValue, name: "document") + NKCommon.shared.addInternalTypeIdentifier(typeIdentifier: mimeType, classFile: NKCommon.typeClassFile.document.rawValue, editor: NCGlobal.shared.editorCollabora, iconName: NKCommon.typeIconFile.document.rawValue, name: "document") } } // Added UTI for ONLYOFFICE & Text if let directEditingCreators = NCManageDatabase.shared.getDirectEditingCreators(account: account) { for directEditing in directEditingCreators { - NCCommunicationCommon.shared.addInternalTypeIdentifier(typeIdentifier: directEditing.mimetype, classFile: NCCommunicationCommon.typeClassFile.document.rawValue, editor: directEditing.editor, iconName: NCCommunicationCommon.typeIconFile.document.rawValue, name: "document") + NKCommon.shared.addInternalTypeIdentifier(typeIdentifier: directEditing.mimetype, classFile: NKCommon.typeClassFile.document.rawValue, editor: directEditing.editor, iconName: NKCommon.typeIconFile.document.rawValue, name: "document") } } } } + + // MARK: - + + private func requestDashboardWidget() { + + let options = NKRequestOptions(queue: NKCommon.shared.backgroundQueue) + + NextcloudKit.shared.getDashboardWidget(options: options) { account, dashboardWidgets, data, error in + Task { + if error == .success, let dashboardWidgets = dashboardWidgets { + 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) + if error == .success { + NCUtility.shared.convertDataToImage(data: data, size: CGSize(width: 256, height: 256), fileNameToWrite: fileName) + } + } + } + } + } + } + } + + // MARK: - @objc func synchronizeOffline(account: String) { @@ -264,6 +312,4 @@ class NCService: NSObject { NCOperationQueue.shared.synchronizationMetadata(metadata, selector: NCGlobal.shared.selectorDownloadFile) } } - - // MARK: - Thirt Part } diff --git a/iOSClient/Notification/NCNotification.storyboard b/iOSClient/Notification/NCNotification.storyboard index c27fd1a8c..6ac7ae160 100644 --- a/iOSClient/Notification/NCNotification.storyboard +++ b/iOSClient/Notification/NCNotification.storyboard @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19455" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="c26-Us-IIn"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="c26-Us-IIn"> <device id="retina4_7" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19454"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <scenes> @@ -91,6 +91,17 @@ <action selector="touchUpInsideSecondary:" destination="R1c-h5-BOp" eventType="touchUpInside" id="Vy9-uI-sth"/> </connections> </button> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4Ca-NL-V78" userLabel="More"> + <rect key="frame" x="285" y="142" width="80" height="30"/> + <constraints> + <constraint firstAttribute="width" constant="80" id="2cb-3v-up9"/> + <constraint firstAttribute="height" constant="30" id="w4c-JV-GCL"/> + </constraints> + <state key="normal" title="more"/> + <connections> + <action selector="touchUpInsideMore:" destination="R1c-h5-BOp" eventType="touchUpInside" id="tzH-nO-8bt"/> + </connections> + </button> <imageView hidden="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="j3P-Mn-NRk" userLabel="avatar"> <rect key="frame" x="10" y="40" width="25" height="25"/> <constraints> @@ -103,11 +114,13 @@ <constraints> <constraint firstItem="j3P-Mn-NRk" firstAttribute="leading" secondItem="9Bv-1W-yVV" secondAttribute="leading" constant="10" id="05B-JK-v6T"/> <constraint firstAttribute="trailing" secondItem="sMh-G7-FLo" secondAttribute="trailing" constant="10" id="4W9-Xm-fxY"/> + <constraint firstAttribute="bottom" secondItem="4Ca-NL-V78" secondAttribute="bottom" constant="15" id="4nu-oj-CtH"/> <constraint firstItem="9mD-Qe-1wu" firstAttribute="centerY" secondItem="YM1-uH-2Cz" secondAttribute="centerY" id="6VB-EF-GQs"/> <constraint firstItem="sMh-G7-FLo" firstAttribute="top" secondItem="9fz-sr-8Gv" secondAttribute="bottom" constant="5" id="EOH-W7-TBv"/> <constraint firstItem="pg1-7p-7Rz" firstAttribute="leading" secondItem="j3P-Mn-NRk" secondAttribute="trailing" constant="15" id="FHX-rf-Z0E"/> <constraint firstAttribute="trailing" secondItem="9mD-Qe-1wu" secondAttribute="trailing" constant="10" id="L9w-kA-Ypv"/> <constraint firstItem="sMh-G7-FLo" firstAttribute="leading" secondItem="obR-h7-TUC" secondAttribute="trailing" constant="10" id="MZG-Fc-cbL"/> + <constraint firstAttribute="trailing" secondItem="4Ca-NL-V78" secondAttribute="trailing" constant="10" id="RD1-Ox-wZH"/> <constraint firstAttribute="bottom" secondItem="sMh-G7-FLo" secondAttribute="bottom" constant="15" id="RKX-zp-kja"/> <constraint firstItem="9fz-sr-8Gv" firstAttribute="leading" secondItem="9Bv-1W-yVV" secondAttribute="leading" constant="50" id="ZxC-VD-ZtU"/> <constraint firstAttribute="trailing" secondItem="pg1-7p-7Rz" secondAttribute="trailing" constant="10" id="bwL-co-8gM"/> @@ -130,6 +143,7 @@ <outlet property="date" destination="YPu-No-c8x" id="CfW-Pz-jdL"/> <outlet property="icon" destination="YM1-uH-2Cz" id="MPX-ZL-wVR"/> <outlet property="message" destination="9fz-sr-8Gv" id="3Zx-pz-gEK"/> + <outlet property="more" destination="4Ca-NL-V78" id="b8O-Zg-dcf"/> <outlet property="primary" destination="sMh-G7-FLo" id="oyl-c8-sTP"/> <outlet property="primaryWidth" destination="tiI-55-Qu5" id="8H6-cf-vtP"/> <outlet property="remove" destination="9mD-Qe-1wu" id="r1h-mr-5U9"/> diff --git a/iOSClient/Notification/NCNotification.swift b/iOSClient/Notification/NCNotification.swift index b4700778a..8acdc646d 100644 --- a/iOSClient/Notification/NCNotification.swift +++ b/iOSClient/Notification/NCNotification.swift @@ -23,13 +23,13 @@ // import UIKit -import NCCommunication +import NextcloudKit import SwiftyJSON class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmptyDataSetDelegate { let appDelegate = UIApplication.shared.delegate as! AppDelegate - var notifications: [NCCommunicationNotifications] = [] + var notifications: [NKNotifications] = [] var emptyDataSet: NCEmptyDataSet? // MARK: - View Life Cycle @@ -38,13 +38,13 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty super.viewDidLoad() title = NSLocalizedString("_notification_", comment: "") - view.backgroundColor = NCBrandColor.shared.systemBackground + view.backgroundColor = .systemBackground tableView.tableFooterView = UIView() tableView.rowHeight = UITableView.automaticDimension tableView.estimatedRowHeight = 50.0 tableView.allowsSelection = false - tableView.backgroundColor = NCBrandColor.shared.systemBackground + tableView.backgroundColor = .systemBackground // Empty let offset = (self.navigationController?.navigationBar.bounds.height ?? 0) - 20 @@ -55,8 +55,9 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty super.viewWillAppear(animated) appDelegate.activeViewController = self + + navigationController?.setFileAppreance() - // NotificationCenter.default.addObserver(self, selector: #selector(initialize), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitialize), object: nil) } @@ -117,7 +118,7 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty } if let image = image { - cell.icon.image = image.imageColor(NCBrandColor.shared.brandElement) + cell.icon.image = image.withTintColor(NCBrandColor.shared.brandElement, renderingMode: .alwaysOriginal) } else { cell.icon.image = NCUtility.shared.loadImage(named: "bell", color: NCBrandColor.shared.brandElement) } @@ -147,7 +148,7 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty cell.date.text = CCUtility.dateDiff(notification.date as Date) cell.date.textColor = .gray cell.subject.text = notification.subject - cell.subject.textColor = NCBrandColor.shared.label + cell.subject.textColor = .label cell.message.text = notification.message.replacingOccurrences(of: "<br />", with: "\n") cell.message.textColor = .gray @@ -161,14 +162,22 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty cell.primary.layer.backgroundColor = NCBrandColor.shared.brandElement.cgColor cell.primary.setTitleColor(NCBrandColor.shared.brandText, for: .normal) + cell.more.isEnabled = false + cell.more.isHidden = true + cell.more.titleLabel?.font = .systemFont(ofSize: 15) + cell.more.layer.cornerRadius = 15 + cell.more.layer.masksToBounds = true + cell.more.layer.backgroundColor = NCBrandColor.shared.brandElement.cgColor + cell.more.setTitleColor(NCBrandColor.shared.brandText, for: .normal) + cell.secondary.isEnabled = false cell.secondary.isHidden = true cell.secondary.titleLabel?.font = .systemFont(ofSize: 15) cell.secondary.layer.cornerRadius = 15 cell.secondary.layer.masksToBounds = true cell.secondary.layer.borderWidth = 1 - cell.secondary.layer.borderColor = NCBrandColor.shared.systemGray.cgColor - cell.secondary.layer.backgroundColor = NCBrandColor.shared.secondarySystemBackground.cgColor + cell.secondary.layer.borderColor = UIColor.systemGray.cgColor + cell.secondary.layer.backgroundColor = UIColor.secondarySystemBackground.cgColor cell.secondary.setTitleColor(.black, for: .normal) // Action @@ -200,6 +209,11 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty cell.secondary.setTitle(label, for: .normal) } } + } else if jsonActions.count >= 3 { + + cell.more.isEnabled = true + cell.more.isHidden = false + cell.more.setTitle("…", for: .normal) } var buttonWidth = max(cell.primary.intrinsicContentSize.width, cell.secondary.intrinsicContentSize.width) @@ -213,10 +227,10 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty // MARK: - tap Action - func tapRemove(with notification: NCCommunicationNotifications) { + func tapRemove(with notification: NKNotifications) { - NCCommunication.shared.setNotification(serverUrl: nil, idNotification: notification.idNotification , method: "DELETE") { (account, errorCode, errorDescription) in - if errorCode == 0 && account == self.appDelegate.account { + NextcloudKit.shared.setNotification(serverUrl: nil, idNotification: notification.idNotification , method: "DELETE") { (account, error) in + if error == .success && account == self.appDelegate.account { if let index = self.notifications .firstIndex(where: { $0.idNotification == notification.idNotification }) { @@ -225,15 +239,15 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty self.reloadDatasource() - } else if errorCode != 0 { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + } else if error != .success { + NCContentPresenter.shared.showError(error: error) } else { print("[Error] The user has been changed during networking process.") } } } - func tapAction(with notification: NCCommunicationNotifications, label: String) { + func tapAction(with notification: NKNotifications, label: String) { if notification.app == "spreed", let roomToken = notification.objectId.split(separator: "/").first, let talkUrl = URL(string: "nextcloudtalk://open-conversation?server=\(appDelegate.urlBase)&user=\(appDelegate.userId)&withRoomToken=\(roomToken)"), @@ -250,17 +264,17 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty return } - NCCommunication.shared.setNotification(serverUrl: serverUrl, idNotification: 0, method: method) { (account, errorCode, errorDescription) in + NextcloudKit.shared.setNotification(serverUrl: serverUrl, idNotification: 0, method: method) { (account, error) in - if errorCode == 0 && account == self.appDelegate.account { + if error == .success && account == self.appDelegate.account { if let index = self.notifications.firstIndex(where: { $0.idNotification == notification.idNotification }) { self.notifications.remove(at: index) } self.reloadDatasource() - } else if errorCode != 0 { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + } else if error != .success { + NCContentPresenter.shared.showError(error: error) } else { print("[Error] The user has been changed during networking process.") } @@ -268,22 +282,26 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty } // else: Action not found } + func tapMore(with notification: NKNotifications) { + toggleMenu(notification: notification) + } + // MARK: - Load notification networking func getNetwokingNotification() { - NCCommunication.shared.getNotifications { account, notifications, errorCode, _ in + NextcloudKit.shared.getNotifications { account, notifications, data, error in - if errorCode == 0 && account == self.appDelegate.account { + if error == .success && account == self.appDelegate.account { self.notifications.removeAll() let sortedListOfNotifications = (notifications! as NSArray).sortedArray(using: [NSSortDescriptor(key: "date", ascending: false)]) for notification in sortedListOfNotifications { - if let icon = (notification as! NCCommunicationNotifications).icon { + if let icon = (notification as! NKNotifications).icon { NCUtility.shared.convertSVGtoPNGWriteToUserData(svgUrlString: icon, fileName: nil, width: 25, rewrite: false, account: self.appDelegate.account, closure: { _ in }) } - self.notifications.append(notification as! NCCommunicationNotifications) + self.notifications.append(notification as! NKNotifications) } self.reloadDatasource() @@ -304,6 +322,7 @@ class NCNotificationCell: UITableViewCell, NCCellProtocol { @IBOutlet weak var remove: UIButton! @IBOutlet weak var primary: UIButton! @IBOutlet weak var secondary: UIButton! + @IBOutlet weak var more: UIButton! @IBOutlet weak var avatarLeadingMargin: NSLayoutConstraint! @IBOutlet weak var primaryWidth: NSLayoutConstraint! @IBOutlet weak var secondaryWidth: NSLayoutConstraint! @@ -311,7 +330,7 @@ class NCNotificationCell: UITableViewCell, NCCellProtocol { private var user = "" weak var delegate: NCNotificationCellDelegate? - var notification: NCCommunicationNotifications? + var notification: NKNotifications? var fileAvatarImageView: UIImageView? { get { return avatar } @@ -345,9 +364,15 @@ class NCNotificationCell: UITableViewCell, NCCellProtocol { else { return } delegate?.tapAction(with: notification, label: label) } + + @IBAction func touchUpInsideMore(_ sender: Any) { + guard let notification = notification else { return } + delegate?.tapMore(with: notification) + } } protocol NCNotificationCellDelegate: AnyObject { - func tapRemove(with notification: NCCommunicationNotifications) - func tapAction(with notification: NCCommunicationNotifications, label: String) + func tapRemove(with notification: NKNotifications) + func tapAction(with notification: NKNotifications, label: String) + func tapMore(with notification: NKNotifications) } diff --git a/iOSClient/Offline/NCOffline.swift b/iOSClient/Offline/NCOffline.swift index 224f453d1..934bf2bba 100644 --- a/iOSClient/Offline/NCOffline.swift +++ b/iOSClient/Offline/NCOffline.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit class NCOffline: NCCollectionViewCommon { @@ -42,6 +42,12 @@ class NCOffline: NCCollectionViewCommon { emptyDescription = "_tutorial_offline_view_" } + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + + navigationController?.setFileAppreance() + } + // MARK: - DataSource + NC Endpoint override func reloadDataSource(forced: Bool = true) { @@ -96,8 +102,8 @@ class NCOffline: NCCollectionViewCommon { isReloadDataSourceNetworkInProgress = true collectionView?.reloadData() - networkReadFolder(forced: forced) { tableDirectory, metadatas, metadatasUpdate, metadatasDelete, errorCode, _ in - if errorCode == 0 { + networkReadFolder(forced: forced) { tableDirectory, metadatas, metadatasUpdate, metadatasDelete, error in + if error == .success { for metadata in metadatas ?? [] { if !metadata.directory { if NCManageDatabase.shared.isDownloadMetadata(metadata, download: true) { diff --git a/iOSClient/PushNotification/NCPushNotification.m b/iOSClient/PushNotification/NCPushNotification.m index ff9746b26..022ce68c6 100644 --- a/iOSClient/PushNotification/NCPushNotification.m +++ b/iOSClient/PushNotification/NCPushNotification.m @@ -106,13 +106,13 @@ NSString *pushDevicePublicKey = [[NSString alloc] initWithData:pushPublicKey encoding:NSUTF8StringEncoding]; NSString *proxyServerPath = [NCBrandOptions shared].pushNotificationServerProxy; - [[NCCommunication shared] subscribingPushNotificationWithServerUrl:urlBase account:account user:user password:[CCUtility getPassword:account] pushTokenHash:pushTokenHash devicePublicKey:pushDevicePublicKey proxyServerUrl:proxyServerPath customUserAgent:nil addCustomHeaders:nil queue:dispatch_get_main_queue() completionHandler:^(NSString *account, NSString *deviceIdentifier, NSString *signature, NSString *publicKey, NSInteger errorCode, NSString *errorDescription) { - if (errorCode == 0) { + [[NextcloudKit shared] subscribingPushNotificationWithServerUrl:urlBase account:account user:user password:[CCUtility getPassword:account] pushTokenHash:pushTokenHash devicePublicKey:pushDevicePublicKey proxyServerUrl:proxyServerPath customUserAgent:nil addCustomHeaders:nil queue:dispatch_get_main_queue() completion:^(NSString *account, NSString *deviceIdentifier, NSString *signature, NSString *publicKey, NSData *data, NKError *error) { + if (error == NKError.success) { NSString *userAgent = [NSString stringWithFormat:@"%@ (Strict VoIP)", [CCUtility getUserAgent]]; - [[NCCommunication shared] subscribingPushProxyWithProxyServerUrl:proxyServerPath pushToken:self.pushKitToken deviceIdentifier:deviceIdentifier signature:signature publicKey:publicKey userAgent:userAgent queue:dispatch_get_main_queue() completionHandler:^(NSInteger errorCode, NSString *errorDescription) { - if (errorCode == 0) { + [[NextcloudKit shared] subscribingPushProxyWithProxyServerUrl:proxyServerPath pushToken:self.pushKitToken deviceIdentifier:deviceIdentifier signature:signature publicKey:publicKey userAgent:userAgent queue:dispatch_get_main_queue() completion:^(NKError *error) { + if (error == NKError.success) { - [[NCCommunicationCommon shared] writeLog:@"Subscribed to Push Notification server & proxy successfully"]; + [[NKCommon shared] writeLog:@"[INFO] Subscribed to Push Notification server & proxy successfully"]; [CCUtility setPushNotificationToken:account token:self.pushKitToken]; [CCUtility setPushNotificationDeviceIdentifier:account deviceIdentifier:deviceIdentifier]; @@ -132,14 +132,14 @@ NSString *signature = [CCUtility getPushNotificationDeviceIdentifierSignature:account]; NSString *publicKey = [CCUtility getPushNotificationSubscribingPublicKey:account]; - [[NCCommunication shared] unsubscribingPushNotificationWithServerUrl:urlBase account:account user:user password:[CCUtility getPassword:account] customUserAgent:nil addCustomHeaders:nil queue:dispatch_get_main_queue() completionHandler:^(NSString *account, NSInteger errorCode, NSString *errorDescription) { - if (errorCode == 0) { + [[NextcloudKit shared] unsubscribingPushNotificationWithServerUrl:urlBase account:account user:user password:[CCUtility getPassword:account] customUserAgent:nil addCustomHeaders:nil queue:dispatch_get_main_queue() completion:^(NSString *account, NKError *error) { + if (error == NKError.success) { NSString *userAgent = [NSString stringWithFormat:@"%@ (Strict VoIP)", [CCUtility getUserAgent]]; NSString *proxyServerPath = [NCBrandOptions shared].pushNotificationServerProxy; - [[NCCommunication shared] unsubscribingPushProxyWithProxyServerUrl:proxyServerPath deviceIdentifier:deviceIdentifier signature:signature publicKey:publicKey userAgent:userAgent queue:dispatch_get_main_queue() completionHandler:^(NSInteger errorCode, NSString *errorDescription) { - if (errorCode == 0) { + [[NextcloudKit shared] unsubscribingPushProxyWithProxyServerUrl:proxyServerPath deviceIdentifier:deviceIdentifier signature:signature publicKey:publicKey userAgent:userAgent queue:dispatch_get_main_queue() completion:^(NKError *error) { + if (error == NKError.success) { - [[NCCommunicationCommon shared] writeLog:@"Unsubscribed to Push Notification server & proxy successfully."]; + [[NKCommon shared] writeLog:@"[INFO] Unsubscribed to Push Notification server & proxy successfully."]; [CCUtility setPushNotificationPublicKey:account data:nil]; [CCUtility setPushNotificationSubscribingPublicKey:account publicKey:nil]; diff --git a/iOSClient/Recent/NCRecent.swift b/iOSClient/Recent/NCRecent.swift index 717de856e..635e0a313 100644 --- a/iOSClient/Recent/NCRecent.swift +++ b/iOSClient/Recent/NCRecent.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit class NCRecent: NCCollectionViewCommon { @@ -42,6 +42,12 @@ class NCRecent: NCCollectionViewCommon { emptyDescription = "" } + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + + navigationController?.setFileAppreance() + } + // MARK: - DataSource + NC Endpoint override func reloadDataSource(forced: Bool = true) { @@ -138,10 +144,12 @@ class NCRecent: NCCollectionViewCommon { isReloadDataSourceNetworkInProgress = true collectionView?.reloadData() - NCCommunication.shared.searchBodyRequest(serverUrl: appDelegate.urlBase, requestBody: requestBody, showHiddenFiles: CCUtility.getShowHiddenFiles(), queue: NCCommunicationCommon.shared.backgroundQueue) { account, files, errorCode, _ in + let options = NKRequestOptions(queue: NKCommon.shared.backgroundQueue) + + NextcloudKit.shared.searchBodyRequest(serverUrl: appDelegate.urlBase, requestBody: requestBody, showHiddenFiles: CCUtility.getShowHiddenFiles(), options: options) { account, files, data, error in - if errorCode == 0 { - NCManageDatabase.shared.convertNCCommunicationFilesToMetadatas(files, useMetadataFolder: false, account: account) { _, metadatasFolder, metadatas in + if error == .success { + NCManageDatabase.shared.convertNKFilesToMetadatas(files, useMetadataFolder: false, account: account) { _, metadatasFolder, metadatas in // Update sub directories for metadata in metadatasFolder { diff --git a/iOSClient/Rename file/NCRenameFile.storyboard b/iOSClient/Rename file/NCRenameFile.storyboard index a5c66fec5..a9969513b 100644 --- a/iOSClient/Rename file/NCRenameFile.storyboard +++ b/iOSClient/Rename file/NCRenameFile.storyboard @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="V0q-CP-xMJ"> - <device id="retina3_5" orientation="portrait" appearance="light"/> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21225" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="V0q-CP-xMJ"> + <device id="retina6_0" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21207"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="System colors in document resources" minToolsVersion="11.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> @@ -18,20 +18,20 @@ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Rename" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nZr-nE-ths"> - <rect key="frame" x="20" y="15" width="260" height="18"/> + <rect key="frame" x="20" y="62" width="260" height="0.0"/> <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/> <nil key="textColor"/> <nil key="highlightedColor"/> </label> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="t26-3S-4T4"> - <rect key="frame" x="80" y="48" width="140" height="140"/> + <rect key="frame" x="80" y="77" width="140" height="140"/> <constraints> <constraint firstAttribute="width" constant="140" id="PaU-P7-coi"/> <constraint firstAttribute="height" constant="140" id="s6R-ay-3Ui"/> </constraints> </imageView> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FOZ-fs-k7i"> - <rect key="frame" x="210" y="212.5" width="10" height="21"/> + <rect key="frame" x="210" y="241.66666666666666" width="10" height="20.999999999999972"/> <constraints> <constraint firstAttribute="width" constant="10" id="T5K-dj-AdT"/> </constraints> @@ -40,7 +40,7 @@ <nil key="highlightedColor"/> </label> <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Q9G-gl-Fkc"> - <rect key="frame" x="220" y="206" width="60" height="34"/> + <rect key="frame" x="220" y="235" width="60" height="34"/> <constraints> <constraint firstAttribute="width" constant="60" id="6ga-cj-dYT"/> </constraints> @@ -48,7 +48,7 @@ <textInputTraits key="textInputTraits"/> </textField> <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Ny2-wR-rxo"> - <rect key="frame" x="20" y="208" width="190" height="30"/> + <rect key="frame" x="20" y="237" width="190" height="30"/> <constraints> <constraint firstAttribute="height" constant="30" id="dBg-ka-5gB"/> </constraints> @@ -56,21 +56,21 @@ <textInputTraits key="textInputTraits"/> </textField> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7CJ-Q0-ABH" userLabel="SeparatorV"> - <rect key="frame" x="150" y="253.5" width="0.5" height="56.5"/> + <rect key="frame" x="149.66666666666666" y="282.66666666666669" width="0.66666666666665719" height="27.333333333333314"/> <color key="backgroundColor" systemColor="systemGray4Color"/> <constraints> <constraint firstAttribute="width" constant="0.5" id="wU1-tA-NZk"/> </constraints> </view> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ouH-gK-Guv" userLabel="SeparatorH"> - <rect key="frame" x="0.0" y="253" width="300" height="0.5"/> + <rect key="frame" x="0.0" y="282" width="300" height="0.66666666666668561"/> <color key="backgroundColor" systemColor="systemGray4Color"/> <constraints> <constraint firstAttribute="height" constant="0.5" id="2OQ-Mt-Gnh"/> </constraints> </view> <button opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="249" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="W5y-aT-UlI"> - <rect key="frame" x="0.0" y="253.5" width="150" height="56.5"/> + <rect key="frame" x="0.0" y="282.66666666666669" width="150" height="27.333333333333314"/> <fontDescription key="fontDescription" type="system" pointSize="16"/> <state key="normal" title="Cancel"> <color key="titleColor" systemColor="systemBlueColor"/> @@ -80,13 +80,13 @@ </connections> </button> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hcV-V0-eZB"> - <rect key="frame" x="150" y="253.5" width="150" height="56.5"/> + <rect key="frame" x="150" y="282.66666666666669" width="150" height="27.333333333333314"/> <fontDescription key="fontDescription" type="system" pointSize="16"/> <state key="normal" title="Rename"> <color key="titleColor" systemColor="systemBlueColor"/> </state> <connections> - <action selector="rename:" destination="V0q-CP-xMJ" eventType="touchUpInside" id="9tx-AQ-q6X"/> + <action selector="renameFile:" destination="V0q-CP-xMJ" eventType="touchUpInside" id="m9a-mj-q7P"/> </connections> </button> </subviews> diff --git a/iOSClient/Rename file/NCRenameFile.swift b/iOSClient/Rename file/NCRenameFile.swift index c053a772c..1a3627ddf 100644 --- a/iOSClient/Rename file/NCRenameFile.swift +++ b/iOSClient/Rename file/NCRenameFile.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit public protocol NCRenameFileDelegate: AnyObject { func rename(fileName: String, fileNameNew: String) @@ -142,7 +142,7 @@ class NCRenameFile: UIViewController, UITextFieldDelegate { func textFieldShouldReturn(_ textField: UITextField) -> Bool { textField.resignFirstResponder() - rename(textField) + renameFile(textField) return true } @@ -153,7 +153,7 @@ class NCRenameFile: UIViewController, UITextFieldDelegate { dismiss(animated: true) } - @IBAction func rename(_ sender: Any) { + @IBAction func renameFile(_ sender: Any) { var fileNameWithoutExtNew = "" var extNew = "" @@ -233,17 +233,17 @@ class NCRenameFile: UIViewController, UITextFieldDelegate { NCActivityIndicator.shared.start() - NCNetworking.shared.renameMetadata(metadata, fileNameNew: fileNameNew, viewController: self) { errorCode, errorDescription in + NCNetworking.shared.renameMetadata(metadata, fileNameNew: fileNameNew, viewController: self) { error in NCActivityIndicator.shared.stop() - if errorCode == 0 { + if error == .success { self.dismiss(animated: true) } else { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCContentPresenter.shared.showError(error: error) } } } diff --git a/iOSClient/RichWorkspace/NCRichWorkspaceCommon.swift b/iOSClient/RichWorkspace/NCRichWorkspaceCommon.swift index e2576929d..5e9359357 100644 --- a/iOSClient/RichWorkspace/NCRichWorkspaceCommon.swift +++ b/iOSClient/RichWorkspace/NCRichWorkspaceCommon.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit @objc class NCRichWorkspaceCommon: NSObject { @@ -30,8 +30,9 @@ import NCCommunication @objc func createViewerNextcloudText(serverUrl: String, viewController: UIViewController) { - if !NCCommunication.shared.isNetworkReachable() { - NCContentPresenter.shared.messageNotification("_error_", description: "_go_online_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorInternalError) + if !NextcloudKit.shared.isNetworkReachable() { + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_go_online_") + NCContentPresenter.shared.showError(error: error) return } @@ -40,11 +41,11 @@ import NCCommunication NCActivityIndicator.shared.start(backgroundView: viewController.view) let fileNamePath = CCUtility.returnFileNamePath(fromFileName: NCGlobal.shared.fileNameRichWorkspace, serverUrl: serverUrl, urlBase: appDelegate.urlBase, account: appDelegate.account)! - NCCommunication.shared.NCTextCreateFile(fileNamePath: fileNamePath, editorId: directEditingCreator.editor, creatorId: directEditingCreator.identifier, templateId: "") { account, url, errorCode, errorMessage in + NextcloudKit.shared.NCTextCreateFile(fileNamePath: fileNamePath, editorId: directEditingCreator.editor, creatorId: directEditingCreator.identifier, templateId: "") { account, url, data, error in NCActivityIndicator.shared.stop() - if errorCode == 0 && account == self.appDelegate.account { + if error == .success && account == self.appDelegate.account { if let viewerRichWorkspaceWebView = UIStoryboard(name: "NCViewerRichWorkspace", bundle: nil).instantiateViewController(withIdentifier: "NCViewerRichWorkspaceWebView") as? NCViewerRichWorkspaceWebView { @@ -54,17 +55,17 @@ import NCCommunication viewController.present(viewerRichWorkspaceWebView, animated: true, completion: nil) } - } else if errorCode != 0 { - NCContentPresenter.shared.messageNotification("_error_", description: errorMessage, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: errorCode) + } else if error != .success { + NCContentPresenter.shared.showError(error: error) } } } @objc func openViewerNextcloudText(serverUrl: String, viewController: UIViewController) { - if !NCCommunication.shared.isNetworkReachable() { - - NCContentPresenter.shared.messageNotification("_error_", description: "_go_online_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorInternalError) + if !NextcloudKit.shared.isNetworkReachable() { + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_go_online_") + NCContentPresenter.shared.showError(error: error) return } @@ -75,11 +76,11 @@ import NCCommunication NCActivityIndicator.shared.start(backgroundView: viewController.view) let fileNamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, urlBase: appDelegate.urlBase, account: appDelegate.account)! - NCCommunication.shared.NCTextOpenFile(fileNamePath: fileNamePath, editor: "text") { account, url, errorCode, errorMessage in + NextcloudKit.shared.NCTextOpenFile(fileNamePath: fileNamePath, editor: "text") { account, url, data, error in NCActivityIndicator.shared.stop() - if errorCode == 0 && account == self.appDelegate.account { + if error == .success && account == self.appDelegate.account { if let viewerRichWorkspaceWebView = UIStoryboard(name: "NCViewerRichWorkspace", bundle: nil).instantiateViewController(withIdentifier: "NCViewerRichWorkspaceWebView") as? NCViewerRichWorkspaceWebView { @@ -90,8 +91,8 @@ import NCCommunication viewController.present(viewerRichWorkspaceWebView, animated: true, completion: nil) } - } else if errorCode != 0 { - NCContentPresenter.shared.messageNotification("_error_", description: errorMessage, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: errorCode) + } else if error != .success { + NCContentPresenter.shared.showError(error: error) } } diff --git a/iOSClient/RichWorkspace/NCViewerRichWorkspace.swift b/iOSClient/RichWorkspace/NCViewerRichWorkspace.swift index 652005b76..fc9756087 100644 --- a/iOSClient/RichWorkspace/NCViewerRichWorkspace.swift +++ b/iOSClient/RichWorkspace/NCViewerRichWorkspace.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit import MarkdownKit @objc class NCViewerRichWorkspace: UIViewController, UIAdaptivePresentationControllerDelegate { @@ -43,7 +43,7 @@ import MarkdownKit override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = NCBrandColor.shared.systemBackground + view.backgroundColor = .systemBackground presentationController?.delegate = self let closeItem = UIBarButtonItem(title: NSLocalizedString("_back_", comment: ""), style: .plain, target: self, action: #selector(closeItemTapped(_:))) @@ -52,18 +52,18 @@ import MarkdownKit let editItem = UIBarButtonItem(image: UIImage(named: "actionSheetModify"), style: UIBarButtonItem.Style.plain, target: self, action: #selector(editItemAction(_:))) self.navigationItem.rightBarButtonItem = editItem - markdownParser = MarkdownParser(font: UIFont.systemFont(ofSize: 15), color: NCBrandColor.shared.label) + markdownParser = MarkdownParser(font: UIFont.systemFont(ofSize: 15), color: .label) markdownParser.header.font = UIFont.systemFont(ofSize: 25) textView.attributedText = markdownParser.parse(richWorkspaceText) - textViewColor = NCBrandColor.shared.label + textViewColor = .label } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - NCNetworking.shared.readFile(serverUrlFileName: serverUrl) { (account, metadata, errorCode, errorDescription) in + NCNetworking.shared.readFile(serverUrlFileName: serverUrl) { (account, metadata, error) in - if errorCode == 0 && account == self.appDelegate.account { + if error == .success && account == self.appDelegate.account { guard let metadata = metadata else { return } NCManageDatabase.shared.setDirectory(serverUrl: self.serverUrl, richWorkspace: metadata.richWorkspace, account: account) if self.richWorkspaceText != metadata.richWorkspace && metadata.richWorkspace != nil { diff --git a/iOSClient/RichWorkspace/NCViewerRichWorkspaceWebView.swift b/iOSClient/RichWorkspace/NCViewerRichWorkspaceWebView.swift index 9e9d5799e..6e6e177e2 100644 --- a/iOSClient/RichWorkspace/NCViewerRichWorkspaceWebView.swift +++ b/iOSClient/RichWorkspace/NCViewerRichWorkspaceWebView.swift @@ -73,9 +73,7 @@ class NCViewerRichWorkspaceWebView: UIViewController, WKNavigationDelegate, WKSc if message.body as? String == "close" { - if #available(iOS 13.0, *) { - self.presentationController?.delegate?.presentationControllerWillDismiss?(self.presentationController!) - } + self.presentationController?.delegate?.presentationControllerWillDismiss?(self.presentationController!) dismiss(animated: true) { NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterCloseRichWorkspaceWebView, userInfo: nil) diff --git a/iOSClient/ScanDocument/NCScan+CollectionView.swift b/iOSClient/ScanDocument/NCScan+CollectionView.swift index 34290e86f..83185e615 100644 --- a/iOSClient/ScanDocument/NCScan+CollectionView.swift +++ b/iOSClient/ScanDocument/NCScan+CollectionView.swift @@ -23,7 +23,6 @@ import Foundation -@available(iOS 13.0, *) extension NCScan: UICollectionViewDataSource { func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { @@ -46,7 +45,7 @@ extension NCScan: UICollectionViewDataSource { // 72 DPI if imageWidthInPixels > 595 || imageHeightInPixels > 842 { - image = image.resizeImage(size: CGSize(width: 595, height: 842), isAspectRation: true) ?? image + image = image.resizeImage(size: CGSize(width: 595, height: 842)) ?? image } cell.customImageView?.image = image @@ -78,7 +77,7 @@ extension NCScan: UICollectionViewDataSource { // 72 DPI if imageWidthInPixels > 595 || imageHeightInPixels > 842 { - image = image.resizeImage(size: CGSize(width: 595, height: 842), isAspectRation: true) ?? image + image = image.resizeImage(size: CGSize(width: 595, height: 842)) ?? image } cell.customImageView?.image = filter(image: image) @@ -89,7 +88,6 @@ extension NCScan: UICollectionViewDataSource { } } -@available(iOS 13.0, *) extension NCScan: UICollectionViewDragDelegate { func collectionView(_ collectionView: UICollectionView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem] { @@ -148,7 +146,6 @@ extension NCScan: UICollectionViewDragDelegate { } } -@available(iOS 13.0, *) extension NCScan: UICollectionViewDropDelegate { func collectionView(_ collectionView: UICollectionView, canHandle session: UIDropSession) -> Bool { diff --git a/iOSClient/ScanDocument/NCScan.swift b/iOSClient/ScanDocument/NCScan.swift index e015e7d18..0a1e4c863 100755 --- a/iOSClient/ScanDocument/NCScan.swift +++ b/iOSClient/ScanDocument/NCScan.swift @@ -25,7 +25,6 @@ import UIKit import Photos import EasyTipView -@available(iOS 13.0, *) class NCScan: UIViewController, NCScanCellCellDelegate { @IBOutlet weak var collectionViewSource: UICollectionView! @@ -60,33 +59,33 @@ class NCScan: UIViewController, NCScanCellCellDelegate { override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = NCBrandColor.shared.secondarySystemGroupedBackground + view.backgroundColor = .secondarySystemGroupedBackground navigationItem.title = NSLocalizedString("_scanned_images_", comment: "") collectionViewSource.dragInteractionEnabled = true collectionViewSource.dragDelegate = self collectionViewSource.dropDelegate = self - collectionViewSource.backgroundColor = NCBrandColor.shared.secondarySystemGroupedBackground + collectionViewSource.backgroundColor = .secondarySystemGroupedBackground collectionViewDestination.dragInteractionEnabled = true collectionViewDestination.dropDelegate = self collectionViewDestination.dragDelegate = self collectionViewDestination.reorderingCadence = .fast // default value - .immediate - collectionViewDestination.backgroundColor = NCBrandColor.shared.secondarySystemGroupedBackground + collectionViewDestination.backgroundColor = .secondarySystemGroupedBackground cancel.title = NSLocalizedString("_cancel_", comment: "") save.title = NSLocalizedString("_save_", comment: "") labelTitlePDFzone.text = NSLocalizedString("_scan_label_document_zone_", comment: "") - labelTitlePDFzone.backgroundColor = NCBrandColor.shared.systemGray6 - labelTitlePDFzone.textColor = NCBrandColor.shared.label + labelTitlePDFzone.backgroundColor = .systemGray6 + labelTitlePDFzone.textColor = .label segmentControlFilter.setTitle(NSLocalizedString("_filter_original_", comment: ""), forSegmentAt: 0) segmentControlFilter.setTitle(NSLocalizedString("_filter_grayscale_", comment: ""), forSegmentAt: 1) segmentControlFilter.setTitle(NSLocalizedString("_filter_bn_", comment: ""), forSegmentAt: 2) - add.setImage(UIImage(named: "plus")?.image(color: NCBrandColor.shared.label, size: 25), for: .normal) - transferDown.setImage(UIImage(named: "transferDown")?.image(color: NCBrandColor.shared.label, size: 25), for: .normal) + add.setImage(UIImage(named: "plus")?.image(color: .label, size: 25), for: .normal) + transferDown.setImage(UIImage(named: "transferDown")?.image(color: .label, size: 25), for: .normal) let longPressRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(handleLongPressGesture(recognizer:))) collectionViewSource.addGestureRecognizer(longPressRecognizer) @@ -118,17 +117,34 @@ class NCScan: UIViewController, NCScanCellCellDelegate { override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) - // TIP + showTip() + } + + override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { + super.viewWillTransition(to: size, with: coordinator) + + self.tipView?.dismiss() + coordinator.animate(alongsideTransition: nil) { _ in + self.showTip() + } + } + + // MARK: - Tip + + func showTip() { + if !NCManageDatabase.shared.tipExists(NCGlobal.shared.tipNCScanAddImage) { self.tipView?.show(forView: add, withinSuperview: self.view) } } + // MARK: - + override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { super.traitCollectionDidChange(previousTraitCollection) - add.setImage(UIImage(named: "plus")?.image(color: NCBrandColor.shared.label, size: 25), for: .normal) - transferDown.setImage(UIImage(named: "transferDown")?.image(color: NCBrandColor.shared.label, size: 25), for: .normal) + add.setImage(UIImage(named: "plus")?.image(color: .label, size: 25), for: .normal) + transferDown.setImage(UIImage(named: "transferDown")?.image(color: .label, size: 25), for: .normal) } override var canBecomeFirstResponder: Bool { return true } @@ -406,7 +422,6 @@ class NCScan: UIViewController, NCScanCellCellDelegate { } } -@available(iOS 13.0, *) extension NCScan: EasyTipViewDelegate { // TIP diff --git a/iOSClient/Security/NCEndToEndMetadata.swift b/iOSClient/Security/NCEndToEndMetadata.swift index 6c87d431e..fdaa8a4af 100644 --- a/iOSClient/Security/NCEndToEndMetadata.swift +++ b/iOSClient/Security/NCEndToEndMetadata.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit class NCEndToEndMetadata: NSObject { @@ -219,7 +219,7 @@ class NCEndToEndMetadata: NSObject { metadata.fileNameView = encryptedFileAttributes.filename metadata.fileNameWithoutExt = (encryptedFileAttributes.filename as NSString).deletingPathExtension - let results = NCCommunicationCommon.shared.getInternalType(fileName: encryptedFileAttributes.filename, mimeType: metadata.contentType, directory: metadata.directory) + let results = NKCommon.shared.getInternalType(fileName: encryptedFileAttributes.filename, mimeType: metadata.contentType, directory: metadata.directory) metadata.contentType = results.mimeType metadata.iconName = results.iconName diff --git a/iOSClient/Select/NCSelect.swift b/iOSClient/Select/NCSelect.swift index e7c622bce..8b9ce9203 100644 --- a/iOSClient/Select/NCSelect.swift +++ b/iOSClient/Select/NCSelect.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit @objc protocol NCSelectDelegate { @objc func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, items: [Any], overwrite: Bool, copy: Bool, move: Bool) @@ -94,8 +94,8 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, UIAdaptivePresent self.navigationController?.navigationBar.prefersLargeTitles = true self.navigationController?.presentationController?.delegate = self - view.backgroundColor = NCBrandColor.shared.systemBackground - selectCommandViewSelect?.separatorView.backgroundColor = NCBrandColor.shared.separator + view.backgroundColor = .systemBackground + selectCommandViewSelect?.separatorView.backgroundColor = .separator activeAccount = NCManageDatabase.shared.getActiveAccount() @@ -109,7 +109,7 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, UIAdaptivePresent // Footer collectionView.register(UINib(nibName: "NCSectionFooter", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: "sectionFooter") collectionView.alwaysBounceVertical = true - collectionView.backgroundColor = NCBrandColor.shared.systemBackground + collectionView.backgroundColor = .systemBackground listLayout = NCListLayout() gridLayout = NCGridLayout() @@ -419,7 +419,7 @@ extension NCSelect: UICollectionViewDataSource { cell.fileObjectId = metadata.ocId cell.fileUser = metadata.ownerId cell.labelTitle.text = metadata.fileNameView - cell.labelTitle.textColor = NCBrandColor.shared.label + cell.labelTitle.textColor = .label cell.imageSelect.image = nil cell.imageStatus.image = nil @@ -515,7 +515,7 @@ extension NCSelect: UICollectionViewDataSource { cell.fileObjectId = metadata.ocId cell.fileUser = metadata.ownerId cell.labelTitle.text = metadata.fileNameView - cell.labelTitle.textColor = NCBrandColor.shared.label + cell.labelTitle.textColor = .label cell.imageSelect.image = nil cell.imageStatus.image = nil @@ -613,7 +613,7 @@ extension NCSelect: UICollectionViewDataSource { } else { header.labelSection.text = self.dataSource.getSectionValueLocalization(indexPath: indexPath) } - header.labelSection.textColor = NCBrandColor.shared.label + header.labelSection.textColor = .label return header @@ -756,9 +756,9 @@ extension NCSelect { networkInProgress = true collectionView.reloadData() - NCNetworking.shared.readFolder(serverUrl: serverUrl, account: activeAccount.account) { _, _, _, _, _, _, errorCode, errorDescription in - if errorCode != 0 { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCNetworking.shared.readFolder(serverUrl: serverUrl, account: activeAccount.account) { _, _, _, _, _, _, error in + if error != .success { + NCContentPresenter.shared.showError(error: error) } self.networkInProgress = false self.loadDatasource(withLoadFolder: false) @@ -785,7 +785,7 @@ class NCSelectCommandView: UIView { override func awakeFromNib() { separatorHeightConstraint.constant = 0.5 - separatorView.backgroundColor = NCBrandColor.shared.separator + separatorView.backgroundColor = .separator overwriteLabel?.text = NSLocalizedString("_overwrite_", comment: "") diff --git a/iOSClient/Settings/CCAdvanced.m b/iOSClient/Settings/CCAdvanced.m index f9d010122..cd8b8d78b 100755 --- a/iOSClient/Settings/CCAdvanced.m +++ b/iOSClient/Settings/CCAdvanced.m @@ -47,11 +47,11 @@ [form addFormSection:section]; row = [XLFormRowDescriptor formRowDescriptorWithTag:@"showHiddenFiles" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_show_hidden_files_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; if ([CCUtility getShowHiddenFiles]) row.value = @"1"; else row.value = @"0"; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [section addFormRow:row]; // Format Compatibility + Live Photo + Delete asset @@ -61,27 +61,27 @@ section.footerTitle = [NSString stringWithFormat:@"%@\n%@\n%@", NSLocalizedString(@"_format_compatibility_footer_", nil), NSLocalizedString(@"_upload_mov_livephoto_footer_", nil), NSLocalizedString(@"_remove_photo_CameraRoll_desc_", nil)]; row = [XLFormRowDescriptor formRowDescriptorWithTag:@"formatCompatibility" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_format_compatibility_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; if ([CCUtility getFormatCompatibility]) row.value = @"1"; else row.value = @"0"; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [section addFormRow:row]; row = [XLFormRowDescriptor formRowDescriptorWithTag:@"livePhoto" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_upload_mov_livephoto_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; if ([CCUtility getLivePhoto]) row.value = @"1"; else row.value = @"0"; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [section addFormRow:row]; row = [XLFormRowDescriptor formRowDescriptorWithTag:@"removePhotoCameraRoll" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_remove_photo_CameraRoll_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; if ([CCUtility getRemovePhotoCameraRoll]) row.value = @"1"; else row.value = @0; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [section addFormRow:row]; // Section : Files App -------------------------------------------------------------- @@ -94,11 +94,11 @@ // Disable Files App row = [XLFormRowDescriptor formRowDescriptorWithTag:@"disablefilesapp" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_disable_files_app_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; if ([CCUtility getDisableFilesApp]) row.value = @"1"; else row.value = @"0"; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [section addFormRow:row]; } @@ -109,10 +109,10 @@ section.footerTitle = NSLocalizedString(@"_chunk_footer_title_", nil); row = [XLFormRowDescriptor formRowDescriptorWithTag:@"chunk" rowType:XLFormRowDescriptorTypeStepCounter title:NSLocalizedString(@"_chunk_size_mb_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; row.value = [NSString stringWithFormat:@"%ld", CCUtility.getChunkSize]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfigAtConfigure setObject:@YES forKey:@"stepControl.wraps"]; [row.cellConfigAtConfigure setObject:@1 forKey:@"stepControl.stepValue"]; [row.cellConfigAtConfigure setObject:@0 forKey:@"stepControl.minimumValue"]; @@ -128,9 +128,9 @@ section.footerTitle = NSLocalizedString(@"_privacy_footer_", nil); row = [XLFormRowDescriptor formRowDescriptorWithTag:@"crashservice" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_crashservice_title_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:[[UIImage imageNamed:@"crashservice"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; if ([CCUtility getDisableCrashservice]) row.value = @"1"; else row.value = @"0"; @@ -142,49 +142,49 @@ section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_diagnostics_", nil)]; [form addFormSection:section]; - if ([[NSFileManager defaultManager] fileExistsAtPath:NCCommunicationCommon.shared.filenamePathLog] && NCBrandOptions.shared.disable_log == false) { + if ([[NSFileManager defaultManager] fileExistsAtPath:NKCommon.shared.filenamePathLog] && NCBrandOptions.shared.disable_log == false) { row = [XLFormRowDescriptor formRowDescriptorWithTag:@"log" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_view_log_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:[[UIImage imageNamed:@"log"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; row.action.formBlock = ^(XLFormRowDescriptor * sender) { [self deselectFormRow:sender]; - NCViewerQuickLook *viewerQuickLook = [[NCViewerQuickLook alloc] initWith:[NSURL fileURLWithPath:NCCommunicationCommon.shared.filenamePathLog] isEditingEnabled:false metadata:nil]; + NCViewerQuickLook *viewerQuickLook = [[NCViewerQuickLook alloc] initWith:[NSURL fileURLWithPath:NKCommon.shared.filenamePathLog] isEditingEnabled:false metadata:nil]; [self presentViewController:viewerQuickLook animated:YES completion:nil]; }; [section addFormRow:row]; row = [XLFormRowDescriptor formRowDescriptorWithTag:@"clearlog" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_clear_log_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:[[UIImage imageNamed:@"clear"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; row.action.formBlock = ^(XLFormRowDescriptor * sender) { [self deselectFormRow:sender]; - [[NCCommunicationCommon shared] clearFileLog]; + [[NKCommon shared] clearFileLog]; NSInteger logLevel = [CCUtility getLogLevel]; BOOL isSimulatorOrTestFlight = [[NCUtility shared] isSimulatorOrTestFlight]; NSString *versionNextcloudiOS = [NSString stringWithFormat:[NCBrandOptions shared].textCopyrightNextcloudiOS, [[NCUtility shared] getVersionAppWithBuild:true]]; if (isSimulatorOrTestFlight) { - [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"Clear log with level %lu %@ (Simulator / TestFlight)", (unsigned long)logLevel, versionNextcloudiOS]]; + [[NKCommon shared] writeLog:[NSString stringWithFormat:@"[INFO] Clear log with level %lu %@ (Simulator / TestFlight)", (unsigned long)logLevel, versionNextcloudiOS]]; } else { - [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"Clear log with level %lu %@", (unsigned long)logLevel, versionNextcloudiOS]]; + [[NKCommon shared] writeLog:[NSString stringWithFormat:@"[INFO] Clear log with level %lu %@", (unsigned long)logLevel, versionNextcloudiOS]]; } }; [section addFormRow:row]; row = [XLFormRowDescriptor formRowDescriptorWithTag:@"logLevel" rowType:XLFormRowDescriptorTypeSlider title:NSLocalizedString(@"_level_log_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:@(NSTextAlignmentCenter) forKey:@"textLabel.textAlignment"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; NSInteger logLevel = [CCUtility getLogLevel]; row.value = @(logLevel); @@ -195,9 +195,9 @@ } row = [XLFormRowDescriptor formRowDescriptorWithTag:@"capabilities" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_capabilities_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:[[UIImage imageNamed:@"capabilities"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; row.action.formBlock = ^(XLFormRowDescriptor * sender) { @@ -245,8 +245,8 @@ } [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; row.selectorTitle = NSLocalizedString(@"_delete_old_files_", nil); row.selectorOptions = @[[XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:NSLocalizedString(@"_never_", nil)], [XLFormOptionsObject formOptionsObjectWithValue:@(365) displayText:NSLocalizedString(@"_1_year_", nil)], @@ -260,9 +260,9 @@ // Clear cache row = [XLFormRowDescriptor formRowDescriptorWithTag:@"azzeracache" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_clear_cache_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; [row.cellConfig setObject:[[UIImage imageNamed:@"trash"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; row.action.formSelector = @selector(clearCacheRequest:); @@ -276,7 +276,7 @@ // Exit row = [XLFormRowDescriptor formRowDescriptorWithTag:@"esci" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_exit_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; [row.cellConfig setObject:[UIColor redColor] forKey:@"textLabel.textColor"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; @@ -296,9 +296,9 @@ self.title = NSLocalizedString(@"_advanced_", nil); appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; - self.view.backgroundColor = NCBrandColor.shared.systemGroupedBackground; + self.view.backgroundColor = UIColor.systemGroupedBackgroundColor; - self.tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground; + self.tableView.backgroundColor = UIColor.systemGroupedBackgroundColor; [self initializeForm]; [self calculateSize]; @@ -359,7 +359,7 @@ NSInteger levelLog = [[rowDescriptor.value valueData] intValue]; [CCUtility setLogLevel:levelLog]; - [[NCCommunicationCommon shared] setLevelLog:levelLog]; + [[NKCommon shared] setLevelLog:levelLog]; } if ([rowDescriptor.tag isEqualToString:@"chunk"]) { @@ -416,7 +416,7 @@ UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"" message:NSLocalizedString(@"_want_delete_cache_", nil) preferredStyle:UIAlertControllerStyleActionSheet]; [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_yes_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { - [[NCActivityIndicator shared] startActivityWithBackgroundView:nil style: UIActivityIndicatorViewStyleWhiteLarge]; + [[NCActivityIndicator shared] startActivityWithBackgroundView:nil style: UIActivityIndicatorViewStyleLarge]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) { [self clearCache]; }); diff --git a/iOSClient/Settings/CCManageAccount.m b/iOSClient/Settings/CCManageAccount.m index 57ee9a4f2..2d835632a 100644 --- a/iOSClient/Settings/CCManageAccount.m +++ b/iOSClient/Settings/CCManageAccount.m @@ -58,7 +58,7 @@ // Avatar UIImage *avatar = [[NCUtility shared] loadUserImageFor:account.user displayName:account.displayName userBaseUrl:account]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:13.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:avatar forKey:@"imageView.image"]; if (account.active) { @@ -74,10 +74,10 @@ [form addFormSection:section]; row = [XLFormRowDescriptor formRowDescriptorWithTag:@"alias" rowType:XLFormRowDescriptorTypeText]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[[UIImage imageNamed:@"form-textbox"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textField.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textField.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textField.textColor"]; row.value = activeAccount.alias; [section addFormRow:row]; @@ -92,38 +92,37 @@ // New Account nextcloud row = [XLFormRowDescriptor formRowDescriptorWithTag:@"addAccount" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_add_account_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:[[UIImage imageNamed:@"plus"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; row.action.formSelector = @selector(addAccount:); [section addFormRow:row]; } // Set user status - if (@available(iOS 13.0, *)) { - BOOL userStatus = [[NCManageDatabase shared] getCapabilitiesServerBoolWithAccount:activeAccount.account elements:NCElementsJSON.shared.capabilitiesUserStatusEnabled exists:false]; - if (userStatus) { - row = [XLFormRowDescriptor formRowDescriptorWithTag:@"setUserStatus" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_set_user_status_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; - [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:[[UIImage imageNamed:@"userStatusAway"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; - [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; - row.action.formSelector = @selector(setUserStatus:); - if (accounts.count == 0) row.disabled = @YES; - [section addFormRow:row]; - } + + BOOL userStatus = [[NCManageDatabase shared] getCapabilitiesServerBoolWithAccount:activeAccount.account elements:NCElementsJSON.shared.capabilitiesUserStatusEnabled exists:false]; + if (userStatus) { + row = [XLFormRowDescriptor formRowDescriptorWithTag:@"setUserStatus" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_set_user_status_", nil)]; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; + [row.cellConfig setObject:[[UIImage imageNamed:@"userStatusAway"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; + [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; + row.action.formSelector = @selector(setUserStatus:); + if (accounts.count == 0) row.disabled = @YES; + [section addFormRow:row]; } if ([NCBrandOptions shared].disable_multiaccount == NO) { row = [XLFormRowDescriptor formRowDescriptorWithTag:@"accountRequest" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_settings_account_request_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[[UIImage imageNamed:@"users"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; if ([CCUtility getAccountRequest]) row.value = @1; else row.value = @0; [section addFormRow:row]; @@ -136,20 +135,20 @@ [form addFormSection:section]; row = [XLFormRowDescriptor formRowDescriptorWithTag:@"certificateDetails" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_certificate_details_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:[[UIImage imageNamed:@"lock"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; row.action.formSelector = @selector(certificateDetails:); [section addFormRow:row]; row = [XLFormRowDescriptor formRowDescriptorWithTag:@"certificatePNDetails" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_certificate_pn_details_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:[[UIImage imageNamed:@"lock"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; row.action.formSelector = @selector(certificatePNDetails:); [section addFormRow:row]; @@ -161,9 +160,9 @@ // Full Name if ([activeAccount.displayName length] > 0) { row = [XLFormRowDescriptor formRowDescriptorWithTag:@"userfullname" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_full_name_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"detailTextLabel.font"]; [row.cellConfig setObject:[[UIImage imageNamed:@"user"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; row.value = activeAccount.displayName; @@ -173,10 +172,10 @@ // Address if ([activeAccount.address length] > 0) { row = [XLFormRowDescriptor formRowDescriptorWithTag:@"useraddress" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_address_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"detailTextLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:[[UIImage imageNamed:@"address"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; row.value = activeAccount.address; [section addFormRow:row]; @@ -185,10 +184,10 @@ // City + zip if ([activeAccount.city length] > 0) { row = [XLFormRowDescriptor formRowDescriptorWithTag:@"usercity" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_city_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"detailTextLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:[[UIImage imageNamed:@"city"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; row.value = activeAccount.city; if ([activeAccount.zip length] > 0) { @@ -200,10 +199,10 @@ // Country if ([activeAccount.country length] > 0) { row = [XLFormRowDescriptor formRowDescriptorWithTag:@"usercountry" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_country_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"detailTextLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:[[UIImage imageNamed:@"country"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; row.value = [[NSLocale systemLocale] displayNameForKey:NSLocaleCountryCode value:activeAccount.country]; //NSArray *countryCodes = [NSLocale ISOCountryCodes]; @@ -213,10 +212,10 @@ // Phone if ([activeAccount.phone length] > 0) { row = [XLFormRowDescriptor formRowDescriptorWithTag:@"userphone" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_phone_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"detailTextLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:[[UIImage imageNamed:@"phone"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; row.value = activeAccount.phone; [section addFormRow:row]; @@ -225,10 +224,10 @@ // Email if ([activeAccount.email length] > 0) { row = [XLFormRowDescriptor formRowDescriptorWithTag:@"useremail" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_email_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"detailTextLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:[[UIImage imageNamed:@"email"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; row.value = activeAccount.email; [section addFormRow:row]; @@ -237,10 +236,10 @@ // Web if ([activeAccount.website length] > 0) { row = [XLFormRowDescriptor formRowDescriptorWithTag:@"userweb" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_web_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"detailTextLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:[[UIImage imageNamed:@"network"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; row.value = activeAccount.website; [section addFormRow:row]; @@ -249,10 +248,10 @@ // Twitter if ([activeAccount.twitter length] > 0) { row = [XLFormRowDescriptor formRowDescriptorWithTag:@"usertwitter" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_twitter_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"detailTextLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:[[UIImage imageNamed:@"twitter"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; row.value = activeAccount.twitter; [section addFormRow:row]; @@ -267,30 +266,30 @@ // Business Type row = [XLFormRowDescriptor formRowDescriptorWithTag:@"userbusinesstype" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_businesstype_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"detailTextLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:[[UIImage imageNamed:@"businesstype"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; row.value = activeAccount.businessType; [section addFormRow:row]; // Business Size row = [XLFormRowDescriptor formRowDescriptorWithTag:@"userbusinesssize" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_businesssize_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"detailTextLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:[[UIImage imageNamed:@"users"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; row.value = activeAccount.businessSize; [section addFormRow:row]; // Role row = [XLFormRowDescriptor formRowDescriptorWithTag:@"userrole" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_role_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"detailTextLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:[[UIImage imageNamed:@"role"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; if ([activeAccount.role isEqualToString:@"owner"]) row.value = NSLocalizedString(@"_user_owner_", nil); else if ([activeAccount.role isEqualToString:@"employee"]) row.value = NSLocalizedString(@"_user_employee_", nil); @@ -300,10 +299,10 @@ // Company row = [XLFormRowDescriptor formRowDescriptorWithTag:@"usercompany" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_company_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"detailTextLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:[[UIImage imageNamed:@"company"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; row.value = activeAccount.organisation; [section addFormRow:row]; @@ -314,7 +313,7 @@ [form addFormSection:section]; row = [XLFormRowDescriptor formRowDescriptorWithTag:@"trial" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_trial_expired_day_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"detailTextLabel.font"]; [row.cellConfig setObject:[UIColor redColor] forKey:@"textLabel.textColor"]; @@ -330,11 +329,11 @@ // Edit profile row = [XLFormRowDescriptor formRowDescriptorWithTag:@"editUserProfile" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_user_editprofile_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:[[UIImage imageNamed:@"editUserProfile"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; #if defined(HC) row.action.viewControllerClass = [HCEditProfile class]; #endif @@ -359,9 +358,9 @@ self.title = NSLocalizedString(@"_credentials_", nil); appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; - self.view.backgroundColor = NCBrandColor.shared.systemGroupedBackground; + self.view.backgroundColor = UIColor.systemGroupedBackgroundColor; - self.tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground; + self.tableView.backgroundColor = UIColor.systemGroupedBackgroundColor; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(initialize) name:NCGlobal.shared.notificationCenterInitialize object:nil]; @@ -488,12 +487,8 @@ { [self deselectFormRow:sender]; - if (@available(iOS 13.0, *)) { - - UINavigationController *navigationController = [[UIStoryboard storyboardWithName:@"NCUserStatus" bundle:nil] instantiateInitialViewController]; - - [self presentViewController:navigationController animated:YES completion:nil]; - } + UINavigationController *navigationController = [[UIStoryboard storyboardWithName:@"NCUserStatus" bundle:nil] instantiateInitialViewController]; + [self presentViewController:navigationController animated:YES completion:nil]; } #pragma mark - diff --git a/iOSClient/Settings/CCManageAutoUpload.m b/iOSClient/Settings/CCManageAutoUpload.m index a3c9e2c02..9c013c3d9 100644 --- a/iOSClient/Settings/CCManageAutoUpload.m +++ b/iOSClient/Settings/CCManageAutoUpload.m @@ -49,11 +49,11 @@ section.footerTitle = NSLocalizedString(@"_autoupload_description_", nil); row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUpload" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_autoupload_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; if (activeAccount.autoUpload) row.value = @1; else row.value = @0; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [section addFormRow:row]; // Auto Upload Directory @@ -62,11 +62,11 @@ [form addFormSection:section]; row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUploadDirectory" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_autoupload_select_folder_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; row.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; [row.cellConfig setObject:[[UIImage imageNamed:@"foldersOnTop"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; //[row.cellConfig setObject:@(UITableViewCellAccessoryDisclosureIndicator) forKey:@"accessoryType"]; row.action.formSelector = @selector(selectAutomaticUploadFolder); @@ -78,21 +78,21 @@ [form addFormSection:section]; row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUploadImage" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_autoupload_photos_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; row.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; if (activeAccount.autoUploadImage) row.value = @1; else row.value = @0; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [section addFormRow:row]; row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUploadWWAnPhoto" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_wifi_only_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; row.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; if (activeAccount.autoUploadWWAnPhoto) row.value = @1; else row.value = @0; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [section addFormRow:row]; // Auto Upload Video @@ -101,21 +101,21 @@ [form addFormSection:section]; row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUploadVideo" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_autoupload_videos_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; row.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; if (activeAccount.autoUploadVideo) row.value = @1; else row.value = @0; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [section addFormRow:row]; row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUploadWWAnVideo" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_wifi_only_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; row.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; if (activeAccount.autoUploadWWAnVideo) row.value = @1; else row.value = @0; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [section addFormRow:row]; // Auto Upload Full @@ -124,13 +124,13 @@ NSString *title = NSLocalizedString(@"_autoupload_fullphotos_", nil); row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUploadFull" rowType:XLFormRowDescriptorTypeBooleanSwitch title:title]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; row.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; row.value = 0; if (activeAccount.autoUploadFull) row.value = @1; else row.value = @0; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [section addFormRow:row]; // Auto Upload create subfolder @@ -139,12 +139,12 @@ [form addFormSection:section]; row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUploadCreateSubfolder" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_autoupload_create_subfolder_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; row.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; if (activeAccount.autoUploadCreateSubfolder) row.value = @1; else row.value = @0; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [section addFormRow:row]; // Auto Upload file name @@ -153,9 +153,9 @@ [form addFormSection:section]; row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUploadFileName" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_autoupload_filenamemask_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; row.action.viewControllerClass = [NCManageAutoUploadFileName class]; [section addFormRow:row]; @@ -176,9 +176,9 @@ self.title = NSLocalizedString(@"_settings_autoupload_", nil); appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; - self.view.backgroundColor = NCBrandColor.shared.systemGroupedBackground; + self.view.backgroundColor = UIColor.systemGroupedBackgroundColor; - self.tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground; + self.tableView.backgroundColor = UIColor.systemGroupedBackgroundColor; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(initialize) name:NCGlobal.shared.notificationCenterInitialize object:nil]; @@ -396,7 +396,8 @@ if (serverUrl != nil) { if ([serverUrl isEqualToString:[[NCUtilityFileSystem shared] getHomeServerWithAccount:appDelegate.account]]) { - [[NCContentPresenter shared] messageNotification:@"_error_" description:@"_autoupload_error_select_folder_" delay:[[NCGlobal shared] dismissAfterSecond] type:messageTypeError errorCode:NCGlobal.shared.errorInternalError]; + NKError *error = [[NKError alloc] initWithErrorCode:NCGlobal.shared.errorInternalError errorDescription:@"_autoupload_error_select_folder_"]; + [[NCContentPresenter shared] messageNotification:@"_error_" error:error delay:[[NCGlobal shared] dismissAfterSecond] type:messageTypeError]; return; } diff --git a/iOSClient/Settings/NCEndToEndInitialize.swift b/iOSClient/Settings/NCEndToEndInitialize.swift index 737d68097..bfa97cb25 100644 --- a/iOSClient/Settings/NCEndToEndInitialize.swift +++ b/iOSClient/Settings/NCEndToEndInitialize.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit @objc protocol NCEndToEndInitializeDelegate { @@ -53,9 +53,9 @@ class NCEndToEndInitialize: NSObject { func getPublicKey() { - NCCommunication.shared.getE2EECertificate { account, certificate, errorCode, errorDescription in + NextcloudKit.shared.getE2EECertificate { account, certificate, data, error in - if errorCode == 0 && account == self.appDelegate.account { + if error == .success && account == self.appDelegate.account { CCUtility.setEndToEndCertificate(account, certificate: certificate) @@ -64,30 +64,31 @@ class NCEndToEndInitialize: NSObject { // Request PrivateKey chiper to Server self.getPrivateKeyCipher() - } else if errorCode != 0 { + } else if error != .success { - switch errorCode { + switch error.errorCode { case NCGlobal.shared.errorBadRequest: - NCContentPresenter.shared.messageNotification("E2E get publicKey", description: "bad request: unpredictable internal error", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + let error = NKError(errorCode: error.errorCode, errorDescription: "bad request: unpredictable internal error") + NCContentPresenter.shared.messageNotification("E2E get publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) case NCGlobal.shared.errorResourceNotFound: guard let csr = NCEndToEndEncryption.sharedManager().createCSR(self.appDelegate.userId, directory: CCUtility.getDirectoryUserData()) else { - - NCContentPresenter.shared.messageNotification("E2E Csr", description: "Error to create Csr", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + let error = NKError(errorCode: error.errorCode, errorDescription: "Error to create Csr") + NCContentPresenter.shared.messageNotification("E2E Csr", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) return } - NCCommunication.shared.signE2EECertificate(certificate: csr) { account, certificate, errorCode, errorDescription in + NextcloudKit.shared.signE2EECertificate(certificate: csr) { account, certificate, data, error in - if errorCode == 0 && account == self.appDelegate.account { + if error == .success && account == self.appDelegate.account { // TEST publicKey let extractedPublicKey = NCEndToEndEncryption.sharedManager().extractPublicKey(fromCertificate: certificate) if extractedPublicKey != NCEndToEndEncryption.sharedManager().generatedPublicKey { - - NCContentPresenter.shared.messageNotification("E2E sign publicKey", description: "error: the public key is incorrect", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + let error = NKError(errorCode: error.errorCode, errorDescription: "error: the public key is incorrect") + NCContentPresenter.shared.messageNotification("E2E sign publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) } else { @@ -97,27 +98,30 @@ class NCEndToEndInitialize: NSObject { self.getPrivateKeyCipher() } - } else if errorCode != 0 { + } else if error != .success { - switch errorCode { + switch error.errorCode { case NCGlobal.shared.errorBadRequest: - NCContentPresenter.shared.messageNotification("E2E sign publicKey", description: "bad request: unpredictable internal error", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + let error = NKError(errorCode: error.errorCode, errorDescription: "bad request: unpredictable internal error") + NCContentPresenter.shared.messageNotification("E2E sign publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) case NCGlobal.shared.errorConflict: - NCContentPresenter.shared.messageNotification("E2E sign publicKey", description: "conflict: a public key for the user already exists", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + let error = NKError(errorCode: error.errorCode, errorDescription: "conflict: a public key for the user already exists") + NCContentPresenter.shared.messageNotification("E2E sign publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) default: - NCContentPresenter.shared.messageNotification("E2E sign publicKey", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + NCContentPresenter.shared.messageNotification("E2E sign publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) } } } case NCGlobal.shared.errorConflict: - NCContentPresenter.shared.messageNotification("E2E get publicKey", description: "forbidden: the user can't access the public keys", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + let error = NKError(errorCode: error.errorCode, errorDescription: "forbidden: the user can't access the public keys") + NCContentPresenter.shared.messageNotification("E2E get publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) default: - NCContentPresenter.shared.messageNotification("E2E get publicKey", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + NCContentPresenter.shared.messageNotification("E2E get publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) } } } @@ -126,9 +130,9 @@ class NCEndToEndInitialize: NSObject { func getPrivateKeyCipher() { // Request PrivateKey chiper to Server - NCCommunication.shared.getE2EEPrivateKey { account, privateKeyChiper, errorCode, errorDescription in + NextcloudKit.shared.getE2EEPrivateKey { account, privateKeyChiper, data, error in - if errorCode == 0 && account == self.appDelegate.account { + if error == .success && account == self.appDelegate.account { // request Passphrase @@ -143,8 +147,8 @@ class NCEndToEndInitialize: NSObject { let publicKey = CCUtility.getEndToEndCertificate(self.appDelegate.account) guard let privateKey = (NCEndToEndEncryption.sharedManager().decryptPrivateKey(privateKeyChiper, passphrase: passphrase, publicKey: publicKey)) else { - - NCContentPresenter.shared.messageNotification("E2E decrypt privateKey", description: "Serious internal error to decrypt Private Key", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError, priority: .max) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "Serious internal error to decrypt Private Key") + NCContentPresenter.shared.messageNotification("E2E decrypt privateKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) return } @@ -157,9 +161,9 @@ class NCEndToEndInitialize: NSObject { CCUtility.setEndToEndPassphrase(self.appDelegate.account, passphrase: passphrase) // request server publicKey - NCCommunication.shared.getE2EEPublicKey { account, publicKey, errorCode, errorDescription in + NextcloudKit.shared.getE2EEPublicKey { account, publicKey, data, error in - if errorCode == 0 && account == self.appDelegate.account { + if error == .success && account == self.appDelegate.account { CCUtility.setEndToEndPublicKey(account, publicKey: publicKey) @@ -169,21 +173,24 @@ class NCEndToEndInitialize: NSObject { self.delegate?.endToEndInitializeSuccess() - } else if errorCode != 0 { + } else if error != .success { - switch errorCode { + switch error.errorCode { case NCGlobal.shared.errorBadRequest: - NCContentPresenter.shared.messageNotification("E2E Server publicKey", description: "bad request: unpredictable internal error", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + let error = NKError(errorCode: error.errorCode, errorDescription: "bad request: unpredictable internal error") + NCContentPresenter.shared.messageNotification("E2E Server publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) case NCGlobal.shared.errorResourceNotFound: - NCContentPresenter.shared.messageNotification("E2E Server publicKey", description: "Server publickey doesn't exists", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + let error = NKError(errorCode: error.errorCode, errorDescription: "Server publickey doesn't exists") + NCContentPresenter.shared.messageNotification("E2E Server publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) case NCGlobal.shared.errorConflict: - NCContentPresenter.shared.messageNotification("E2E Server publicKey", description: "forbidden: the user can't access the Server publickey", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + let error = NKError(errorCode: error.errorCode, errorDescription: "forbidden: the user can't access the Server publickey") + NCContentPresenter.shared.messageNotification("E2E Server publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) default: - NCContentPresenter.shared.messageNotification("E2E Server publicKey", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + NCContentPresenter.shared.messageNotification("E2E Server publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) } } } @@ -201,12 +208,13 @@ class NCEndToEndInitialize: NSObject { self.appDelegate.window?.rootViewController?.present(alertController, animated: true) - } else if errorCode != 0 { + } else if error != .success { - switch errorCode { + switch error.errorCode { case NCGlobal.shared.errorBadRequest: - NCContentPresenter.shared.messageNotification("E2E get privateKey", description: "bad request: unpredictable internal error", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + let error = NKError(errorCode: error.errorCode, errorDescription: "bad request: unpredictable internal error") + NCContentPresenter.shared.messageNotification("E2E get privateKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) case NCGlobal.shared.errorResourceNotFound: // message @@ -216,81 +224,102 @@ class NCEndToEndInitialize: NSObject { let alertController = UIAlertController(title: NSLocalizedString("_e2e_settings_title_", comment: ""), message: NSLocalizedString(message, comment: ""), preferredStyle: .alert) let OKAction = UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default) { _ in + self.createNewE2EE(e2ePassphrase: e2ePassphrase, error: error, copyPassphrase: false) + } - var privateKeyString: NSString? + let copyAction = UIAlertAction(title: NSLocalizedString("_ok_copy_passphrase_", comment: ""), style: .default) { _ in + self.createNewE2EE(e2ePassphrase: e2ePassphrase, error: error, copyPassphrase: true) + } - guard let privateKeyChiper = NCEndToEndEncryption.sharedManager().encryptPrivateKey(self.appDelegate.userId, directory: CCUtility.getDirectoryUserData(), passphrase: e2ePassphrase, privateKey: &privateKeyString) else { - NCContentPresenter.shared.messageNotification("E2E privateKey", description: "Serious internal error to create PrivateKey chiper", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) - return - } + alertController.addAction(OKAction) + alertController.addAction(copyAction) - // privateKeyChiper - print(privateKeyChiper) + self.appDelegate.window?.rootViewController?.present(alertController, animated: true) - NCCommunication.shared.storeE2EEPrivateKey(privateKey: privateKeyChiper) { account, privateKey, errorCode, errorDescription in + case NCGlobal.shared.errorConflict: + let error = NKError(errorCode: error.errorCode, errorDescription: "forbidden: the user can't access the private key") + NCContentPresenter.shared.messageNotification("E2E get privateKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) - if errorCode == 0 && account == self.appDelegate.account { + default: + NCContentPresenter.shared.messageNotification("E2E get privateKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) + } + } + } + } + + func createNewE2EE(e2ePassphrase: String, error: NKError, copyPassphrase: Bool) { + + var privateKeyString: NSString? - CCUtility.setEndToEndPrivateKey(account, privateKey: privateKeyString! as String) - CCUtility.setEndToEndPassphrase(account, passphrase: e2ePassphrase) + guard let privateKeyChiper = NCEndToEndEncryption.sharedManager().encryptPrivateKey(self.appDelegate.userId, directory: CCUtility.getDirectoryUserData(), passphrase: e2ePassphrase, privateKey: &privateKeyString) else { + let error = NKError(errorCode: error.errorCode, errorDescription: "Serious internal error to create PrivateKey chiper") + NCContentPresenter.shared.messageNotification("E2E privateKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) + return + } - // request server publicKey - NCCommunication.shared.getE2EEPublicKey { account, publicKey, errorCode, errorDescription in + // privateKeyChiper + print(privateKeyChiper) - if errorCode == 0 && account == self.appDelegate.account { + NextcloudKit.shared.storeE2EEPrivateKey(privateKey: privateKeyChiper) { account, privateKey, data, error in - CCUtility.setEndToEndPublicKey(account, publicKey: publicKey) + if error == .success && account == self.appDelegate.account { - // Clear Table - NCManageDatabase.shared.clearTable(tableDirectory.self, account: account) - NCManageDatabase.shared.clearTable(tableE2eEncryption.self, account: account) + CCUtility.setEndToEndPrivateKey(account, privateKey: privateKeyString! as String) + CCUtility.setEndToEndPassphrase(account, passphrase: e2ePassphrase) - self.delegate?.endToEndInitializeSuccess() + // request server publicKey + NextcloudKit.shared.getE2EEPublicKey { account, publicKey, data, error in - } else if errorCode != 0 { + if error == .success && account == self.appDelegate.account { - switch errorCode { + CCUtility.setEndToEndPublicKey(account, publicKey: publicKey) - case NCGlobal.shared.errorBadRequest: - NCContentPresenter.shared.messageNotification("E2E Server publicKey", description: "bad request: unpredictable internal error", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + // Clear Table + NCManageDatabase.shared.clearTable(tableDirectory.self, account: account) + NCManageDatabase.shared.clearTable(tableE2eEncryption.self, account: account) - case NCGlobal.shared.errorResourceNotFound: - NCContentPresenter.shared.messageNotification("E2E Server publicKey", description: "Server publickey doesn't exists", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + if copyPassphrase { + UIPasteboard.general.string = e2ePassphrase + } - case NCGlobal.shared.errorConflict: - NCContentPresenter.shared.messageNotification("E2E Server publicKey", description: "forbidden: the user can't access the Server publickey", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + self.delegate?.endToEndInitializeSuccess() - default: - NCContentPresenter.shared.messageNotification("E2E Server publicKey", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) - } - } - } + } else if error != .success { - } else if errorCode != 0 { + switch error.errorCode { - switch errorCode { + case NCGlobal.shared.errorBadRequest: + let error = NKError(errorCode: error.errorCode, errorDescription: "bad request: unpredictable internal error") + NCContentPresenter.shared.messageNotification("E2E Server publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) - case NCGlobal.shared.errorBadRequest: - NCContentPresenter.shared.messageNotification("E2E store privateKey", description: "bad request: unpredictable internal error", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + case NCGlobal.shared.errorResourceNotFound: + let error = NKError(errorCode: error.errorCode, errorDescription: "Server publickey doesn't exists") + NCContentPresenter.shared.messageNotification("E2E Server publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) - case NCGlobal.shared.errorConflict: - NCContentPresenter.shared.messageNotification("E2E store privateKey", description: "conflict: a private key for the user already exists", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + case NCGlobal.shared.errorConflict: + let error = NKError(errorCode: error.errorCode, errorDescription: "forbidden: the user can't access the Server publickey") + NCContentPresenter.shared.messageNotification("E2E Server publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) - default: - NCContentPresenter.shared.messageNotification("E2E store privateKey", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) - } - } + default: + NCContentPresenter.shared.messageNotification("E2E Server publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) } } + } - alertController.addAction(OKAction) - self.appDelegate.window?.rootViewController?.present(alertController, animated: true) + } else if error != .success { + + switch error.errorCode { + + case NCGlobal.shared.errorBadRequest: + let error = NKError(errorCode: error.errorCode, errorDescription: "bad request: unpredictable internal error") + NCContentPresenter.shared.messageNotification("E2E store privateKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) case NCGlobal.shared.errorConflict: - NCContentPresenter.shared.messageNotification("E2E get privateKey", description: "forbidden: the user can't access the private key", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + let error = NKError(errorCode: error.errorCode, errorDescription: "conflict: a private key for the user already exists") + NCContentPresenter.shared.messageNotification("E2E store privateKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) default: - NCContentPresenter.shared.messageNotification("E2E get privateKey", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max) + NCContentPresenter.shared.messageNotification("E2E store privateKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) } } } diff --git a/iOSClient/Settings/NCManageAutoUploadFileName.swift b/iOSClient/Settings/NCManageAutoUploadFileName.swift index a42f2191c..76a5f4fc9 100644 --- a/iOSClient/Settings/NCManageAutoUploadFileName.swift +++ b/iOSClient/Settings/NCManageAutoUploadFileName.swift @@ -23,6 +23,7 @@ import UIKit import Photos +import NextcloudKit class NCManageAutoUploadFileName: XLFormViewController { @@ -46,10 +47,10 @@ class NCManageAutoUploadFileName: XLFormViewController { row = XLFormRowDescriptor(tag: "maintainOriginalFileName", rowType: XLFormRowDescriptorTypeBooleanSwitch, title: NSLocalizedString("_maintain_original_filename_", comment: "")) row.value = CCUtility.getOriginalFileName(NCGlobal.shared.keyFileNameOriginalAutoUpload) - row.cellConfig["backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground + row.cellConfig["backgroundColor"] = UIColor.secondarySystemGroupedBackground row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label + row.cellConfig["textLabel.textColor"] = UIColor.label section.addFormRow(row) @@ -58,10 +59,10 @@ class NCManageAutoUploadFileName: XLFormViewController { row = XLFormRowDescriptor(tag: "addFileNameType", rowType: XLFormRowDescriptorTypeBooleanSwitch, title: NSLocalizedString("_add_filenametype_", comment: "")) row.value = CCUtility.getFileNameType(NCGlobal.shared.keyFileNameAutoUploadType) row.hidden = "$\("maintainOriginalFileName") == 1" - row.cellConfig["backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground + row.cellConfig["backgroundColor"] = UIColor.secondarySystemGroupedBackground row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label + row.cellConfig["textLabel.textColor"] = UIColor.label section.addFormRow(row) @@ -76,14 +77,14 @@ class NCManageAutoUploadFileName: XLFormViewController { row.value = fileNameMask } row.hidden = "$\("maintainOriginalFileName") == 1" - row.cellConfig["backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground + row.cellConfig["backgroundColor"] = UIColor.secondarySystemGroupedBackground row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textLabel.textColor"] = NCBrandColor.shared.label + row.cellConfig["textLabel.textColor"] = UIColor.label row.cellConfig["textField.textAlignment"] = NSTextAlignment.right.rawValue row.cellConfig["textField.font"] = UIFont.systemFont(ofSize: 15.0) - row.cellConfig["textField.textColor"] = NCBrandColor.shared.label + row.cellConfig["textField.textColor"] = UIColor.label section.addFormRow(row) @@ -92,11 +93,11 @@ class NCManageAutoUploadFileName: XLFormViewController { row = XLFormRowDescriptor(tag: "previewFileName", rowType: XLFormRowDescriptorTypeTextView, title: "") row.height = 180 row.disabled = true - row.cellConfig["backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground + row.cellConfig["backgroundColor"] = UIColor.secondarySystemGroupedBackground - row.cellConfig["textView.backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground + row.cellConfig["textView.backgroundColor"] = UIColor.secondarySystemGroupedBackground row.cellConfig["textView.font"] = UIFont.systemFont(ofSize: 14.0) - row.cellConfig["textView.textColor"] = NCBrandColor.shared.label + row.cellConfig["textView.textColor"] = UIColor.label section.addFormRow(row) @@ -110,9 +111,9 @@ class NCManageAutoUploadFileName: XLFormViewController { super.viewDidLoad() self.title = NSLocalizedString("_mode_filename_", comment: "") - view.backgroundColor = NCBrandColor.shared.systemGroupedBackground + view.backgroundColor = .systemGroupedBackground - tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground + tableView.backgroundColor = .systemGroupedBackground initializeForm() reloadForm() @@ -170,7 +171,8 @@ class NCManageAutoUploadFileName: XLFormViewController { self.reloadFormRow(formRow) - NCContentPresenter.shared.messageNotification("_info_", description: "_forbidden_characters_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorCharactersForbidden) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_forbidden_characters_") + NCContentPresenter.shared.showInfo(error: error) } } diff --git a/iOSClient/Settings/NCManageEndToEndEncryption.m b/iOSClient/Settings/NCManageEndToEndEncryption.m index 147671409..dfe5f6230 100644 --- a/iOSClient/Settings/NCManageEndToEndEncryption.m +++ b/iOSClient/Settings/NCManageEndToEndEncryption.m @@ -48,7 +48,8 @@ NSString *versionE2EE = [[NCManageDatabase shared] getCapabilitiesServerStringWithAccount:appDelegate.account elements:NCElementsJSON.shared.capabilitiesE2EEApiVersion]; if (![versionE2EE isEqual:[[NCGlobal shared] e2eeVersion]] && isE2EEEnabled) { - [[NCContentPresenter shared] messageNotification:@"_error_e2ee_" description:@"_err_e2ee_app_version_" delay:[[NCGlobal shared] dismissAfterSecond] type:messageTypeError errorCode:NCGlobal.shared.errorInternalError]; + NKError *error = [[NKError alloc] initWithErrorCode:NCGlobal.shared.errorInternalError errorDescription:@"_err_e2ee_app_version_"]; + [[NCContentPresenter shared] messageNotification:@"_error_e2ee_" error:error delay:[[NCGlobal shared] dismissAfterSecond] type:messageTypeError]; } if (isE2EEEnabled == NO || ![versionE2EE isEqual:[[NCGlobal shared] e2eeVersion]]) { @@ -62,10 +63,10 @@ [form addFormSection:section]; row = [XLFormRowDescriptor formRowDescriptorWithTag:@"serviceActivated" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_e2e_settings_not_available_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[[UIImage imageNamed:@"closeCircle"] imageWithColor:[UIColor redColor] size:25] forKey:@"imageView.image"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; [section addFormRow:row]; @@ -84,10 +85,10 @@ [form addFormSection:section]; row = [XLFormRowDescriptor formRowDescriptorWithTag:@"serviceActivated" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_e2e_settings_activated_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[[UIImage imageNamed:@"checkmark.circle.fill"] imageWithColor:[UIColor greenColor] size:25] forKey:@"imageView.image"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; [section addFormRow:row]; @@ -98,10 +99,10 @@ // Read Passphrase row = [XLFormRowDescriptor formRowDescriptorWithTag:@"readPassphrase" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_e2e_settings_read_passphrase_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[[UIImage imageNamed:@"e2eReadPassphrase"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; row.action.formSelector = @selector(readPassphrase:); [section addFormRow:row]; @@ -113,10 +114,10 @@ // remove locally Encryption row = [XLFormRowDescriptor formRowDescriptorWithTag:@"removeLocallyEncryption" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_e2e_settings_remove_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[[UIImage imageNamed:@"lock"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; row.action.formSelector = @selector(removeLocallyEncryption:); [section addFormRow:row]; @@ -130,9 +131,9 @@ // Start e2e row = [XLFormRowDescriptor formRowDescriptorWithTag:@"startE2E" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_e2e_settings_start_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; row.action.formSelector = @selector(startE2E:); [section addFormRow:row]; @@ -146,18 +147,18 @@ // Delete publicKey row = [XLFormRowDescriptor formRowDescriptorWithTag:@"deleteCertificate" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"Delete certificate", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; row.action.formSelector = @selector(deleteCertificate:); [section addFormRow:row]; // Delete privateKey row = [XLFormRowDescriptor formRowDescriptorWithTag:@"deletePrivateKey" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"Delete PrivateKey", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; row.action.formSelector = @selector(deletePrivateKey:); [section addFormRow:row]; @@ -175,9 +176,9 @@ self.title = NSLocalizedString(@"_e2e_settings_", nil); appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; - self.view.backgroundColor = NCBrandColor.shared.systemGroupedBackground; + self.view.backgroundColor = UIColor.systemGroupedBackgroundColor; - self.tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground; + self.tableView.backgroundColor = UIColor.systemGroupedBackgroundColor; // E2EE self.endToEndInitialize = [NCEndToEndInitialize new]; @@ -376,11 +377,12 @@ { [self deselectFormRow:sender]; - [[NCCommunication shared] deleteE2EECertificateWithCustomUserAgent:nil addCustomHeaders:nil queue:dispatch_get_main_queue() completionHandler:^(NSString *account, NSInteger errorCode, NSString *errorDescription) { - if (errorCode == 0 && [account isEqualToString:appDelegate.account]) { - [[NCContentPresenter shared] messageNotification:@"E2E delete certificate" description:@"Success" delay:[[NCGlobal shared] dismissAfterSecond] type:messageTypeSuccess errorCode:NCGlobal.shared.errorInternalError]; + [[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" description:errorDescription delay:[[NCGlobal shared] dismissAfterSecond] type:messageTypeError errorCode:errorCode]; + [[NCContentPresenter shared] messageNotification:@"E2E delete certificate" error:error delay:[[NCGlobal shared] dismissAfterSecond] type:messageTypeError]; } }]; } @@ -389,11 +391,12 @@ { [self deselectFormRow:sender]; - [[NCCommunication shared] deleteE2EEPrivateKeyWithCustomUserAgent:nil addCustomHeaders:nil queue:dispatch_get_main_queue() completionHandler:^(NSString *account, NSInteger errorCode, NSString *errorDescription) { - if (errorCode == 0 && [account isEqualToString:appDelegate.account]) { - [[NCContentPresenter shared] messageNotification:@"E2E delete privateKey" description:@"Success" delay:[[NCGlobal shared] dismissAfterSecond] type:messageTypeSuccess errorCode:NCGlobal.shared.errorInternalError]; + [[NextcloudKit shared] deleteE2EEPrivateKeyWithCustomUserAgent: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 privateKey" error:error delay:[[NCGlobal shared] dismissAfterSecond] type:messageTypeSuccess]; } else { - [[NCContentPresenter shared] messageNotification:@"E2E delete privateKey" description:errorDescription delay:[[NCGlobal shared] dismissAfterSecond] type:messageTypeError errorCode:errorCode]; + [[NCContentPresenter shared] messageNotification:@"E2E delete privateKey" error:error delay:[[NCGlobal shared] dismissAfterSecond] type:messageTypeError]; } }]; } diff --git a/iOSClient/Settings/NCSettings.m b/iOSClient/Settings/NCSettings.m index 1f8a6ef4d..5c67ba1c5 100644 --- a/iOSClient/Settings/NCSettings.m +++ b/iOSClient/Settings/NCSettings.m @@ -59,9 +59,9 @@ [form addFormSection:section]; row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUpload" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_settings_autoupload_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:[[UIImage imageNamed:@"autoUpload"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; row.action.viewControllerClass = [CCManageAutoUpload class]; [section addFormRow:row]; @@ -73,49 +73,55 @@ // Lock active YES/NO row = [XLFormRowDescriptor formRowDescriptorWithTag:@"bloccopasscode" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_lock_not_active_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[[UIImage imageNamed:@"lock_open"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; //[row.cellConfig setObject:@(UITableViewCellAccessoryDisclosureIndicator) forKey:@"accessoryType"]; row.action.formSelector = @selector(passcode:); [section addFormRow:row]; // Enable Touch ID row = [XLFormRowDescriptor formRowDescriptorWithTag:@"enableTouchDaceID" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_enable_touch_face_id_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [section addFormRow:row]; // Lock no screen row = [XLFormRowDescriptor formRowDescriptorWithTag:@"notPasscodeAtStart" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_lock_protection_no_screen_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [section addFormRow:row]; // Privacy screen row = [XLFormRowDescriptor formRowDescriptorWithTag:@"privacyScreen" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_privacy_screen_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [section addFormRow:row]; // Section : E2EEncryption -------------------------------------------------------------- - - section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_e2e_settings_title_", nil)]; - [form addFormSection:section]; - - // EndToEnd Encryption - NSString *title = [NSString stringWithFormat:@"%@",NSLocalizedString(@"_e2e_settings_", nil)]; - row = [XLFormRowDescriptor formRowDescriptorWithTag:@"e2eEncryption" rowType:XLFormRowDescriptorTypeButton title:title]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; - [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; - [row.cellConfig setObject:[[UIImage imageNamed:@"lock"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; - row.action.viewControllerClass = [NCManageEndToEndEncryption class]; - - [section addFormRow:row]; - + + BOOL isE2EEEnabled = [[NCManageDatabase shared] getCapabilitiesServerBoolWithAccount:appDelegate.account elements:NCElementsJSON.shared.capabilitiesE2EEEnabled exists:false]; + NSString *versionE2EE = [[NCManageDatabase shared] getCapabilitiesServerStringWithAccount:appDelegate.account elements:NCElementsJSON.shared.capabilitiesE2EEApiVersion]; + + if (isE2EEEnabled == YES && [versionE2EE isEqual:[[NCGlobal shared] e2eeVersion]]) { + + section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_e2e_settings_title_", nil)]; + [form addFormSection:section]; + + // EndToEnd Encryption + NSString *title = [NSString stringWithFormat:@"%@",NSLocalizedString(@"_e2e_settings_", nil)]; + row = [XLFormRowDescriptor formRowDescriptorWithTag:@"e2eEncryption" rowType:XLFormRowDescriptorTypeButton title:title]; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; + [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:[[UIImage imageNamed:@"lock"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; + row.action.viewControllerClass = [NCManageEndToEndEncryption class]; + + [section addFormRow:row]; + } + // Section Advanced ------------------------------------------------- section = [XLFormSectionDescriptor formSection]; @@ -123,9 +129,9 @@ // Advanced row = [XLFormRowDescriptor formRowDescriptorWithTag:@"advanced" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_advanced_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:[[UIImage imageNamed:@"gear"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; row.action.viewControllerClass = [CCAdvanced class]; [section addFormRow:row]; @@ -137,10 +143,10 @@ // Acknowledgements row = [XLFormRowDescriptor formRowDescriptorWithTag:@"buttonLeftAligned" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_acknowledgements_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:[[UIImage imageNamed:@"acknowledgements"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; row.action.formBlock = ^(XLFormRowDescriptor * sender){ [self performSegueWithIdentifier:@"AcknowledgementsSegue" sender:sender]; @@ -152,20 +158,20 @@ // Privacy and Legal Policy row = [XLFormRowDescriptor formRowDescriptorWithTag:@"privacy" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_privacy_legal_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:[[UIImage imageNamed:@"shield.checkerboard"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; row.action.formSelector = @selector(privacy:); [section addFormRow:row]; // Source code row = [XLFormRowDescriptor formRowDescriptorWithTag:@"sourcecode" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_source_code_", nil)]; - row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; - [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:[[UIImage imageNamed:@"gitHub"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"]; row.action.formSelector = @selector(sourceCode:); [section addFormRow:row]; @@ -183,8 +189,8 @@ [super viewDidLoad]; self.title = NSLocalizedString(@"_settings_", nil); - self.view.backgroundColor = NCBrandColor.shared.systemGroupedBackground; - self.tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground; + self.view.backgroundColor = UIColor.systemGroupedBackgroundColor; + self.tableView.backgroundColor = UIColor.systemGroupedBackgroundColor; appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidEnterBackground) name:NCGlobal.shared.notificationCenterApplicationDidEnterBackground object:nil]; @@ -217,6 +223,8 @@ if (passcodeSettingsViewController.view.window != nil) { [passcodeSettingsViewController dismissViewControllerAnimated:true completion:nil]; } + + [[self navigationController] popToRootViewControllerAnimated:false]; } #pragma mark - @@ -406,27 +414,21 @@ - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section { NSString *sectionName; - - switch (section) - { - case 1: { - sectionName = NSLocalizedString(@"_lock_protection_no_screen_footer_", nil); - } - break; - case 4: { + NSInteger numSections = [tableView numberOfSections] - 1; - NSString *versionServer = [[NCManageDatabase shared] getCapabilitiesServerStringWithAccount:appDelegate.account elements:NCElementsJSON.shared.capabilitiesVersionString]; - NSString *themingName = [[NCManageDatabase shared] getCapabilitiesServerStringWithAccount:appDelegate.account elements:NCElementsJSON.shared.capabilitiesThemingName]; - NSString *themingSlogan = [[NCManageDatabase shared] getCapabilitiesServerStringWithAccount:appDelegate.account elements:NCElementsJSON.shared.capabilitiesThemingSlogan]; + if (section == 1) { + sectionName = NSLocalizedString(@"_lock_protection_no_screen_footer_", nil); + } else if (section == numSections) { + NSString *versionServer = [[NCManageDatabase shared] getCapabilitiesServerStringWithAccount:appDelegate.account elements:NCElementsJSON.shared.capabilitiesVersionString]; + NSString *themingName = [[NCManageDatabase shared] getCapabilitiesServerStringWithAccount:appDelegate.account elements:NCElementsJSON.shared.capabilitiesThemingName]; + NSString *themingSlogan = [[NCManageDatabase shared] getCapabilitiesServerStringWithAccount:appDelegate.account elements:NCElementsJSON.shared.capabilitiesThemingSlogan]; - NSString *versionNextcloud = [NSString stringWithFormat:[NCBrandOptions shared].textCopyrightNextcloudServer, versionServer]; - NSString *versionNextcloudiOS = [NSString stringWithFormat:[NCBrandOptions shared].textCopyrightNextcloudiOS, [[NCUtility shared] getVersionAppWithBuild:true]]; + NSString *versionNextcloud = [NSString stringWithFormat:[NCBrandOptions shared].textCopyrightNextcloudServer, versionServer]; + NSString *versionNextcloudiOS = [NSString stringWithFormat:[NCBrandOptions shared].textCopyrightNextcloudiOS, [[NCUtility shared] getVersionAppWithBuild:true]]; - NSString *nameSlogan = [NSString stringWithFormat:@"%@ - %@", themingName, themingSlogan]; - - sectionName = [NSString stringWithFormat:@"\n%@\n\n%@\n%@", versionNextcloudiOS, versionNextcloud, nameSlogan]; - } - break; + NSString *nameSlogan = [NSString stringWithFormat:@"%@ - %@", themingName, themingSlogan]; + + sectionName = [NSString stringWithFormat:@"\n%@\n\n%@\n%@", versionNextcloudiOS, versionNextcloud, nameSlogan]; } return sectionName; } diff --git a/iOSClient/Share/Advanced/NCShareAdvancePermission.swift b/iOSClient/Share/Advanced/NCShareAdvancePermission.swift index 2e0da22c0..f8f023d22 100644 --- a/iOSClient/Share/Advanced/NCShareAdvancePermission.swift +++ b/iOSClient/Share/Advanced/NCShareAdvancePermission.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit import SVGKit import CloudKit @@ -68,10 +68,8 @@ class NCShareAdvancePermission: UITableViewController, NCShareAdvanceFotterDeleg tableView.rowHeight = UITableView.automaticDimension self.setNavigationTitle() self.navigationItem.hidesBackButton = true - if #available(iOS 13.0, *) { - // disbale pull to dimiss - isModalInPresentation = true - } + // disbale pull to dimiss + isModalInPresentation = true } override func viewWillLayoutSubviews() { diff --git a/iOSClient/Share/Advanced/NCShareAdvancePermissionFooter.swift b/iOSClient/Share/Advanced/NCShareAdvancePermissionFooter.swift index 4f72a90c8..3d85540e9 100644 --- a/iOSClient/Share/Advanced/NCShareAdvancePermissionFooter.swift +++ b/iOSClient/Share/Advanced/NCShareAdvancePermissionFooter.swift @@ -41,8 +41,8 @@ class NCShareAdvancePermissionFooter: UIView { buttonCancel.layer.cornerRadius = 25 buttonCancel.layer.masksToBounds = true buttonCancel.layer.borderWidth = 1 - buttonCancel.layer.borderColor = NCBrandColor.shared.systemGray.cgColor - buttonCancel.backgroundColor = NCBrandColor.shared.secondarySystemBackground + buttonCancel.layer.borderColor = UIColor.systemGray.cgColor + buttonCancel.backgroundColor = .secondarySystemBackground buttonCancel.addTarget(self, action: #selector(cancelClicked), for: .touchUpInside) buttonCancel.setTitleColor(.black, for: .normal) diff --git a/iOSClient/Share/Advanced/NCShareAdvancePermissionHeader.swift b/iOSClient/Share/Advanced/NCShareAdvancePermissionHeader.swift index 8ff5828b7..d940f21e8 100644 --- a/iOSClient/Share/Advanced/NCShareAdvancePermissionHeader.swift +++ b/iOSClient/Share/Advanced/NCShareAdvancePermissionHeader.swift @@ -44,8 +44,8 @@ class NCShareAdvancePermissionHeader: UIView { } } fileName.text = metadata.fileNameView - fileName.textColor = NCBrandColor.shared.label - info.textColor = NCBrandColor.shared.secondaryLabel + fileName.textColor = .label + info.textColor = .secondaryLabel info.text = CCUtility.transformedSize(metadata.size) + ", " + CCUtility.dateDiff(metadata.date as Date) } } diff --git a/iOSClient/Share/Advanced/NCShareNewUserAddComment.swift b/iOSClient/Share/Advanced/NCShareNewUserAddComment.swift index 73af68588..8fd435d61 100644 --- a/iOSClient/Share/Advanced/NCShareNewUserAddComment.swift +++ b/iOSClient/Share/Advanced/NCShareNewUserAddComment.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit import SVGKit class NCShareNewUserAddComment: UIViewController, NCShareDetail { diff --git a/iOSClient/Share/NCShare+Helper.swift b/iOSClient/Share/NCShare+Helper.swift index bb108652c..5f76425c7 100644 --- a/iOSClient/Share/NCShare+Helper.swift +++ b/iOSClient/Share/NCShare+Helper.swift @@ -22,10 +22,10 @@ // import UIKit -import NCCommunication +import NextcloudKit extension tableShare: NCTableShareable { } -extension NCCommunicationShare: NCTableShareable { } +extension NKShare: NCTableShareable { } protocol NCTableShareable: AnyObject { var shareType: Int { get set } @@ -83,7 +83,7 @@ class NCTableShareOptions: NCTableShareable { } } - convenience init(sharee: NCCommunicationSharee, metadata: tableMetadata, password: String?) { + convenience init(sharee: NKSharee, metadata: tableMetadata, password: String?) { self.init(shareType: sharee.shareType, metadata: metadata, password: password) self.shareWith = sharee.shareWith } diff --git a/iOSClient/Share/NCShare+NCCellDelegate.swift b/iOSClient/Share/NCShare+NCCellDelegate.swift index 7fa0c1cbc..49209479a 100644 --- a/iOSClient/Share/NCShare+NCCellDelegate.swift +++ b/iOSClient/Share/NCShare+NCCellDelegate.swift @@ -30,12 +30,12 @@ extension NCShare: NCShareLinkCellDelegate, NCShareUserCellDelegate { guard let metadata = self.metadata, let appDelegate = appDelegate else { return } let serverUrlFileName = metadata.serverUrl + "/" + metadata.fileName - NCNetworking.shared.readFile(serverUrlFileName: serverUrlFileName) { _, metadata, errorCode, errorDescription in - if errorCode == 0, let metadata = metadata { + NCNetworking.shared.readFile(serverUrlFileName: serverUrlFileName) { _, metadata, error in + if error == .success, let metadata = metadata { let internalLink = appDelegate.urlBase + "/index.php/f/" + metadata.fileId NCShareCommon.shared.copyLink(link: internalLink, viewController: self, sender: sender) } else { - NCContentPresenter.shared.messageNotification("_share_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCContentPresenter.shared.showError(error: error) } } } diff --git a/iOSClient/Share/NCShare.swift b/iOSClient/Share/NCShare.swift index e9712cfe9..512657fd0 100644 --- a/iOSClient/Share/NCShare.swift +++ b/iOSClient/Share/NCShare.swift @@ -26,7 +26,7 @@ import UIKit import Parchment import DropDown -import NCCommunication +import NextcloudKit import MarqueeLabel class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent { @@ -64,7 +64,7 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = NCBrandColor.shared.systemBackground + view.backgroundColor = .systemBackground viewContainerConstraint.constant = height searchFieldTopConstraint.constant = 10 @@ -74,7 +74,7 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent tableView.dataSource = self tableView.delegate = self tableView.allowsSelection = false - tableView.backgroundColor = NCBrandColor.shared.systemBackground + tableView.backgroundColor = .systemBackground tableView.register(UINib(nibName: "NCShareLinkCell", bundle: nil), forCellReuseIdentifier: "cellLink") tableView.register(UINib(nibName: "NCShareUserCell", bundle: nil), forCellReuseIdentifier: "cellUser") @@ -136,7 +136,7 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent sharedWithYouByNoteImage.image = NCUtility.shared.loadImage(named: "note.text", color: .gray) sharedWithYouByNote.isHidden = false sharedWithYouByNote.text = metadata.note - sharedWithYouByNote.textColor = NCBrandColor.shared.label + sharedWithYouByNote.textColor = .label sharedWithYouByNote.trailingBuffer = sharedWithYouByNote.frame.width } else { sharedWithYouByNoteImage.isHidden = true @@ -149,16 +149,16 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent let fileNameLocalPath = String(CCUtility.getDirectoryUserData()) + "/" + fileName let etag = NCManageDatabase.shared.getTableAvatar(fileName: fileName)?.etag - NCCommunication.shared.downloadAvatar( + NextcloudKit.shared.downloadAvatar( user: metadata.ownerId, fileNameLocalPath: fileNameLocalPath, sizeImage: NCGlobal.shared.avatarSize, avatarSizeRounded: NCGlobal.shared.avatarSizeRounded, - etag: etag) { _, imageAvatar, _, etag, errorCode, _ in - if errorCode == 0, let etag = etag, let imageAvatar = imageAvatar { + etag: etag) { _, imageAvatar, _, etag, error in + if error == .success, let etag = etag, let imageAvatar = imageAvatar { NCManageDatabase.shared.addAvatar(fileName: fileName, etag: etag) self.sharedWithYouByImage.image = imageAvatar - } else if errorCode == NCGlobal.shared.errorNotModified, let imageAvatar = NCManageDatabase.shared.setAvatarLoaded(fileName: fileName) { + } else if error.errorCode == NCGlobal.shared.errorNotModified, let imageAvatar = NCManageDatabase.shared.setAvatarLoaded(fileName: fileName) { self.sharedWithYouByImage.image = imageAvatar } } @@ -216,14 +216,14 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent self.reloadData() } - func getSharees(sharees: [NCCommunicationSharee]?) { + func getSharees(sharees: [NKSharee]?) { guard let sharees = sharees, let appDelegate = appDelegate else { return } dropDown = DropDown() let appearance = DropDown.appearance() - appearance.backgroundColor = NCBrandColor.shared.systemBackground + appearance.backgroundColor = .systemBackground appearance.cornerRadius = 10 appearance.shadowColor = UIColor(white: 0.5, alpha: 1) appearance.shadowOpacity = 0.9 diff --git a/iOSClient/Share/NCShareCommentsCell.swift b/iOSClient/Share/NCShareCommentsCell.swift index ed0ddbced..1deafb798 100644 --- a/iOSClient/Share/NCShareCommentsCell.swift +++ b/iOSClient/Share/NCShareCommentsCell.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit // MARK: - NCShareCommentsCell diff --git a/iOSClient/Share/NCShareCommon.swift b/iOSClient/Share/NCShareCommon.swift index a33b7b2e8..bf45fd96e 100644 --- a/iOSClient/Share/NCShareCommon.swift +++ b/iOSClient/Share/NCShareCommon.swift @@ -75,27 +75,27 @@ class NCShareCommon: NSObject { switch shareType { case SHARE_TYPE_USER: - return UIImage(named: "shareTypeUser")?.imageColor(NCBrandColor.shared.label) + return UIImage(named: "shareTypeUser")?.withTintColor(.label, renderingMode: .alwaysOriginal) case self.SHARE_TYPE_GROUP: - return UIImage(named: "shareTypeGroup")?.imageColor(NCBrandColor.shared.label) + return UIImage(named: "shareTypeGroup")?.withTintColor(.label, renderingMode: .alwaysOriginal) case self.SHARE_TYPE_LINK: - return UIImage(named: "shareTypeLink")?.imageColor(NCBrandColor.shared.label) + return UIImage(named: "shareTypeLink")?.withTintColor(.label, renderingMode: .alwaysOriginal) case self.SHARE_TYPE_EMAIL: - return UIImage(named: "shareTypeEmail")?.imageColor(NCBrandColor.shared.label) + return UIImage(named: "shareTypeEmail")?.withTintColor(.label, renderingMode: .alwaysOriginal) case self.SHARE_TYPE_CONTACT: - return UIImage(named: "shareTypeUser")?.imageColor(NCBrandColor.shared.label) + return UIImage(named: "shareTypeUser")?.withTintColor(.label, renderingMode: .alwaysOriginal) case self.SHARE_TYPE_REMOTE: - return UIImage(named: "shareTypeUser")?.imageColor(NCBrandColor.shared.label) + return UIImage(named: "shareTypeUser")?.withTintColor(.label, renderingMode: .alwaysOriginal) case self.SHARE_TYPE_CIRCLE: - return UIImage(named: "shareTypeCircles")?.imageColor(NCBrandColor.shared.label) + return UIImage(named: "shareTypeCircles")?.withTintColor(.label, renderingMode: .alwaysOriginal) case self.SHARE_TYPE_GUEST: - return UIImage(named: "shareTypeUser")?.imageColor(NCBrandColor.shared.label) + return UIImage(named: "shareTypeUser")?.withTintColor(.label, renderingMode: .alwaysOriginal) case self.SHARE_TYPE_REMOTE_GROUP: - return UIImage(named: "shareTypeGroup")?.imageColor(NCBrandColor.shared.label) + return UIImage(named: "shareTypeGroup")?.withTintColor(.label, renderingMode: .alwaysOriginal) case self.SHARE_TYPE_ROOM: - return UIImage(named: "shareTypeRoom")?.imageColor(NCBrandColor.shared.label) + return UIImage(named: "shareTypeRoom")?.withTintColor(.label, renderingMode: .alwaysOriginal) default: - return UIImage(named: "shareTypeUser")?.imageColor(NCBrandColor.shared.label) + return UIImage(named: "shareTypeUser")?.withTintColor(.label, renderingMode: .alwaysOriginal) } } } diff --git a/iOSClient/Share/NCShareLinkCell.swift b/iOSClient/Share/NCShareLinkCell.swift index fe0624e53..fbe382ad7 100644 --- a/iOSClient/Share/NCShareLinkCell.swift +++ b/iOSClient/Share/NCShareLinkCell.swift @@ -73,7 +73,7 @@ class NCShareLinkCell: UITableViewCell { menuButton.setImage(UIImage(named: menuImageName)?.image(color: .gray, size: 50), for: .normal) } - labelTitle.textColor = NCBrandColor.shared.label + labelTitle.textColor = .label imageItem.image = NCShareCommon.shared.createLinkAvatar(imageName: imageName, colorCircle: imageBGColor) copyButton.setImage(UIImage(named: "shareCopy")?.image(color: .gray, size: 50), for: .normal) } diff --git a/iOSClient/Share/NCShareNetworking.swift b/iOSClient/Share/NCShareNetworking.swift index 80f8f4899..0cd001d79 100644 --- a/iOSClient/Share/NCShareNetworking.swift +++ b/iOSClient/Share/NCShareNetworking.swift @@ -21,7 +21,7 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. import UIKit -import NCCommunication +import NextcloudKit class NCShareNetworking: NSObject { @@ -47,17 +47,17 @@ class NCShareNetworking: NSObject { } let filenamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, urlBase: urlBase, account: metadata.account)! - let parameter = NCCShareParameter(path: filenamePath) - NCCommunication.shared.readShares(parameters: parameter) { account, shares, errorCode, errorDescription in + let parameter = NKShareParameter(path: filenamePath) + NextcloudKit.shared.readShares(parameters: parameter) { account, shares, data, error in if showLoadingIndicator { NCActivityIndicator.shared.stop() } - if errorCode == 0, let shares = shares { + if error == .success, let shares = shares { NCManageDatabase.shared.addShare(urlBase: self.urlBase, account: self.metadata.account, shares: shares) self.appDelegate.shares = NCManageDatabase.shared.getTableShares(account: self.metadata.account) } else { - NCContentPresenter.shared.messageNotification("_share_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError) + NCContentPresenter.shared.showError(error: error) } self.delegate?.readShareCompleted() } @@ -74,9 +74,9 @@ class NCShareNetworking: NSObject { NCActivityIndicator.shared.start(backgroundView: view) let filenamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, urlBase: urlBase, account: metadata.account)! - NCCommunication.shared.createShare(path: filenamePath, shareType: option.shareType, shareWith: option.shareWith, password: option.password, permissions: option.permissions) { (account, share, errorCode, errorDescription) in + NextcloudKit.shared.createShare(path: filenamePath, shareType: option.shareType, shareWith: option.shareWith, password: option.password, permissions: option.permissions) { (account, share, data, error) in NCActivityIndicator.shared.stop() - if errorCode == 0, let share = share { + if error == .success, let share = share { option.idShare = share.idShare NCManageDatabase.shared.addShare(urlBase: self.urlBase, account: self.metadata.account, shares: [share]) self.appDelegate.shares = NCManageDatabase.shared.getTableShares(account: self.metadata.account) @@ -84,7 +84,7 @@ class NCShareNetworking: NSObject { self.updateShare(option: option) } } else { - NCContentPresenter.shared.messageNotification("_share_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError) + NCContentPresenter.shared.showError(error: error) } self.delegate?.shareCompleted() } @@ -92,27 +92,27 @@ class NCShareNetworking: NSObject { func unShare(idShare: Int) { NCActivityIndicator.shared.start(backgroundView: view) - NCCommunication.shared.deleteShare(idShare: idShare) { account, errorCode, errorDescription in + NextcloudKit.shared.deleteShare(idShare: idShare) { account, error in NCActivityIndicator.shared.stop() - if errorCode == 0 { + if error == .success { NCManageDatabase.shared.deleteTableShare(account: account, idShare: idShare) self.delegate?.unShareCompleted() } else { - NCContentPresenter.shared.messageNotification("_share_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError) + NCContentPresenter.shared.showError(error: error) } } } func updateShare(option: NCTableShareable) { NCActivityIndicator.shared.start(backgroundView: view) - NCCommunication.shared.updateShare(idShare: option.idShare, password: option.password, expireDate: option.expDateString, permissions: option.permissions, note: option.note, label: option.label, hideDownload: option.hideDownload) { account, share, errorCode, errorDescription in + NextcloudKit.shared.updateShare(idShare: option.idShare, password: option.password, expireDate: option.expDateString, permissions: option.permissions, note: option.note, label: option.label, hideDownload: option.hideDownload) { account, share, data, error in NCActivityIndicator.shared.stop() - if errorCode == 0, let share = share { + if error == .success, let share = share { NCManageDatabase.shared.addShare(urlBase: self.urlBase, account: self.metadata.account, shares: [share]) self.appDelegate.shares = NCManageDatabase.shared.getTableShares(account: self.metadata.account) self.delegate?.readShareCompleted() } else { - NCContentPresenter.shared.messageNotification("_share_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError) + NCContentPresenter.shared.showError(error: error) self.delegate?.updateShareWithError(idShare: option.idShare) } } @@ -120,12 +120,12 @@ class NCShareNetworking: NSObject { func getSharees(searchString: String) { NCActivityIndicator.shared.start(backgroundView: view) - NCCommunication.shared.searchSharees(search: searchString) { _, sharees, errorCode, errorDescription in + NextcloudKit.shared.searchSharees(search: searchString) { _, sharees, data, error in NCActivityIndicator.shared.stop() - if errorCode == 0 { + if error == .success { self.delegate?.getSharees(sharees: sharees) } else { - NCContentPresenter.shared.messageNotification("_share_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError) + NCContentPresenter.shared.showError(error: error) self.delegate?.getSharees(sharees: nil) } } @@ -137,5 +137,5 @@ protocol NCShareNetworkingDelegate: AnyObject { func shareCompleted() func unShareCompleted() func updateShareWithError(idShare: Int) - func getSharees(sharees: [NCCommunicationSharee]?) + func getSharees(sharees: [NKSharee]?) } diff --git a/iOSClient/Share/NCSharePaging.swift b/iOSClient/Share/NCSharePaging.swift index 5e21aba65..b1c6111a7 100644 --- a/iOSClient/Share/NCSharePaging.swift +++ b/iOSClient/Share/NCSharePaging.swift @@ -24,7 +24,7 @@ import UIKit import Parchment -import NCCommunication +import NextcloudKit import MarqueeLabel protocol NCSharePagingContent { @@ -49,7 +49,7 @@ class NCSharePaging: UIViewController { override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = NCBrandColor.shared.systemBackground + view.backgroundColor = .systemBackground navigationItem.leftBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_close_", comment: ""), style: .done, target: self, action: #selector(exitTapped)) NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(notification:)), name: UIResponder.keyboardWillShowNotification, object: nil) @@ -61,11 +61,11 @@ class NCSharePaging: UIViewController { pagingViewController.activityEnabled = activityEnabled pagingViewController.commentsEnabled = commentsEnabled pagingViewController.sharingEnabled = sharingEnabled - pagingViewController.backgroundColor = NCBrandColor.shared.systemBackground - pagingViewController.menuBackgroundColor = NCBrandColor.shared.systemBackground - pagingViewController.selectedBackgroundColor = NCBrandColor.shared.systemBackground - pagingViewController.textColor = NCBrandColor.shared.label - pagingViewController.selectedTextColor = NCBrandColor.shared.label + pagingViewController.backgroundColor = .systemBackground + pagingViewController.menuBackgroundColor = .systemBackground + pagingViewController.selectedBackgroundColor = .systemBackground + pagingViewController.textColor = .label + pagingViewController.selectedTextColor = .label // Pagination addChild(pagingViewController) @@ -306,7 +306,7 @@ class NCSharePagingView: PagingView { override func setupConstraints() { guard let headerView = Bundle.main.loadNibNamed("NCShareHeaderView", owner: self, options: nil)?.first as? NCShareHeaderView else { return } - headerView.backgroundColor = NCBrandColor.shared.systemBackground + headerView.backgroundColor = .systemBackground headerView.ocId = metadata.ocId if FileManager.default.fileExists(atPath: CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag)) { @@ -322,13 +322,13 @@ class NCSharePagingView: PagingView { headerView.imageView.image = UIImage(named: "file") } } - headerView.path.text = NCUtilityFileSystem.shared.getPath(metadata: metadata, withFileName: true) - headerView.path.textColor = NCBrandColor.shared.label + headerView.path.text = NCUtilityFileSystem.shared.getPath(path: metadata.path, user: metadata.user, fileName: metadata.fileName) + headerView.path.textColor = .label headerView.path.trailingBuffer = headerView.path.frame.width if metadata.favorite { headerView.favorite.setImage(NCUtility.shared.loadImage(named: "star.fill", color: NCBrandColor.shared.yellowFavorite, size: 20), for: .normal) } else { - headerView.favorite.setImage(NCUtility.shared.loadImage(named: "star.fill", color: NCBrandColor.shared.systemGray, size: 20), for: .normal) + headerView.favorite.setImage(NCUtility.shared.loadImage(named: "star.fill", color: .systemGray, size: 20), for: .normal) } headerView.info.text = CCUtility.transformedSize(metadata.size) + ", " + CCUtility.dateDiff(metadata.date as Date) addSubview(headerView) @@ -374,20 +374,21 @@ class NCShareHeaderView: UIView { @IBAction func touchUpInsideFavorite(_ sender: UIButton) { guard let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) else { return } - NCNetworking.shared.favoriteMetadata(metadata) { errorCode, errorDescription in - if errorCode == 0 { + NCNetworking.shared.favoriteMetadata(metadata) { error in + if error == .success { self.favorite.setImage(NCUtility.shared.loadImage( named: "star.fill", - color: metadata.favorite ? NCBrandColor.shared.yellowFavorite : NCBrandColor.shared.systemGray, + color: metadata.favorite ? NCBrandColor.shared.yellowFavorite : .systemGray, size: 20), for: .normal) } else { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCContentPresenter.shared.showError(error: error) } } } @objc func longTap(sender: UIGestureRecognizer) { UIPasteboard.general.string = path.text - NCContentPresenter.shared.messageNotification("", description: "_copied_path_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorNoError) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_copied_path_") + NCContentPresenter.shared.showInfo(error: error) } } diff --git a/iOSClient/Share/NCShareUserCell.swift b/iOSClient/Share/NCShareUserCell.swift index c9eb1957d..30cc6d2e3 100644 --- a/iOSClient/Share/NCShareUserCell.swift +++ b/iOSClient/Share/NCShareUserCell.swift @@ -22,7 +22,7 @@ import UIKit import DropDown -import NCCommunication +import NextcloudKit class NCShareUserCell: UITableViewCell, NCCellProtocol { @@ -56,7 +56,7 @@ class NCShareUserCell: UITableViewCell, NCCellProtocol { selector: #selector(tapAvatarImage))] labelTitle.text = tableShare.shareWithDisplayname - labelTitle.textColor = NCBrandColor.shared.label + labelTitle.textColor = .label isUserInteractionEnabled = true labelQuickStatus.isHidden = false imageDownArrow.isHidden = false @@ -141,7 +141,7 @@ class NCSearchUserDropDownCell: DropDownCell, NCCellProtocol { set { user = newValue ?? "" } } - func setupCell(sharee: NCCommunicationSharee, baseUrl: NCUserBaseUrl) { + func setupCell(sharee: NKSharee, baseUrl: NCUserBaseUrl) { imageItem.image = NCShareCommon.shared.getImageShareType(shareType: sharee.shareType) imageShareeType.image = NCShareCommon.shared.getImageShareType(shareType: sharee.shareType) let status = NCUtility.shared.getUserStatus(userIcon: sharee.userIcon, userStatus: sharee.userStatus, userMessage: sharee.userMessage) @@ -163,17 +163,17 @@ class NCSearchUserDropDownCell: DropDownCell, NCCellProtocol { let fileNameLocalPath = String(CCUtility.getDirectoryUserData()) + "/" + fileName let etag = NCManageDatabase.shared.getTableAvatar(fileName: fileName)?.etag - NCCommunication.shared.downloadAvatar( + NextcloudKit.shared.downloadAvatar( user: sharee.shareWith, fileNameLocalPath: fileNameLocalPath, sizeImage: NCGlobal.shared.avatarSize, avatarSizeRounded: NCGlobal.shared.avatarSizeRounded, - etag: etag) { _, imageAvatar, _, etag, errorCode, _ in + etag: etag) { _, imageAvatar, _, etag, error in - if errorCode == 0, let etag = etag, let imageAvatar = imageAvatar { + if error == .success, let etag = etag, let imageAvatar = imageAvatar { NCManageDatabase.shared.addAvatar(fileName: fileName, etag: etag) self.imageItem.image = imageAvatar - } else if errorCode == NCGlobal.shared.errorNotModified, let imageAvatar = NCManageDatabase.shared.setAvatarLoaded(fileName: fileName) { + } else if error.errorCode == NCGlobal.shared.errorNotModified, let imageAvatar = NCManageDatabase.shared.setAvatarLoaded(fileName: fileName) { self.imageItem.image = imageAvatar } } diff --git a/iOSClient/Shares/NCShares.swift b/iOSClient/Shares/NCShares.swift index 98bcc4a4c..668fc2239 100644 --- a/iOSClient/Shares/NCShares.swift +++ b/iOSClient/Shares/NCShares.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit class NCShares: NCCollectionViewCommon { @@ -42,6 +42,12 @@ class NCShares: NCCollectionViewCommon { emptyDescription = "_tutorial_list_shares_view_" } + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + + navigationController?.setFileAppreance() + } + // MARK: - DataSource + NC Endpoint override func reloadDataSource(forced: Bool = true) { @@ -82,15 +88,16 @@ class NCShares: NCCollectionViewCommon { isReloadDataSourceNetworkInProgress = true collectionView?.reloadData() - // Shares network - NCCommunication.shared.readShares(parameters: NCCShareParameter(), queue: NCCommunicationCommon.shared.backgroundQueue) { account, shares, errorCode, errorDescription in + let options = NKRequestOptions(queue: NKCommon.shared.backgroundQueue) + + NextcloudKit.shared.readShares(parameters: NKShareParameter(), options: options) { account, shares, data, error in DispatchQueue.main.async { self.refreshControl.endRefreshing() self.isReloadDataSourceNetworkInProgress = false } - if errorCode == 0 { + if error == .success { NCManageDatabase.shared.deleteTableShare(account: account) if shares != nil { @@ -103,7 +110,7 @@ class NCShares: NCCollectionViewCommon { DispatchQueue.main.async { self.collectionView?.reloadData() - NCContentPresenter.shared.messageNotification("_share_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCContentPresenter.shared.showError(error: error) } } } diff --git a/iOSClient/Supporting Files/af.lproj/Localizable.strings b/iOSClient/Supporting Files/af.lproj/Localizable.strings Binary files differindex 3df84dd92..9a138fce8 100644 --- a/iOSClient/Supporting Files/af.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/af.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/an.lproj/Localizable.strings b/iOSClient/Supporting Files/an.lproj/Localizable.strings Binary files differindex d3fd64216..e1b8c8f01 100644 --- a/iOSClient/Supporting Files/an.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/an.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/ar.lproj/Localizable.strings b/iOSClient/Supporting Files/ar.lproj/Localizable.strings Binary files differindex 3a559f14b..1c78c6dcc 100644 --- a/iOSClient/Supporting Files/ar.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/ar.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/ast.lproj/Localizable.strings b/iOSClient/Supporting Files/ast.lproj/Localizable.strings Binary files differindex 6d656defb..189dc6e97 100644 --- a/iOSClient/Supporting Files/ast.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/ast.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/az.lproj/Localizable.strings b/iOSClient/Supporting Files/az.lproj/Localizable.strings Binary files differindex ddde73b03..875f6d04d 100644 --- a/iOSClient/Supporting Files/az.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/az.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/be.lproj/Localizable.strings b/iOSClient/Supporting Files/be.lproj/Localizable.strings Binary files differindex 87aa81c67..fd4c1abda 100644 --- a/iOSClient/Supporting Files/be.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/be.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/bg_BG.lproj/Localizable.strings b/iOSClient/Supporting Files/bg_BG.lproj/Localizable.strings Binary files differindex 3486f7163..ed7365921 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/bn_BD.lproj/Localizable.strings b/iOSClient/Supporting Files/bn_BD.lproj/Localizable.strings Binary files differindex b1e15b787..5bfdf340f 100644 --- a/iOSClient/Supporting Files/bn_BD.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/bn_BD.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/br.lproj/Localizable.strings b/iOSClient/Supporting Files/br.lproj/Localizable.strings Binary files differindex 7a5af3733..df7174417 100644 --- a/iOSClient/Supporting Files/br.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/br.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/bs.lproj/Localizable.strings b/iOSClient/Supporting Files/bs.lproj/Localizable.strings Binary files differindex 950c7817f..2db28b4f3 100644 --- a/iOSClient/Supporting Files/bs.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/bs.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/ca.lproj/Localizable.strings b/iOSClient/Supporting Files/ca.lproj/Localizable.strings Binary files differindex 0fbbf7ec2..fe294b838 100644 --- a/iOSClient/Supporting Files/ca.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/ca.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/cs-CZ.lproj/Localizable.strings b/iOSClient/Supporting Files/cs-CZ.lproj/Localizable.strings Binary files differindex 46376b697..7fd86f8ff 100644 --- a/iOSClient/Supporting Files/cs-CZ.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/cs-CZ.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/cy_GB.lproj/Localizable.strings b/iOSClient/Supporting Files/cy_GB.lproj/Localizable.strings Binary files differindex 9e3321858..6dcd96dd8 100644 --- a/iOSClient/Supporting Files/cy_GB.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/cy_GB.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/da.lproj/InfoPlist.strings b/iOSClient/Supporting Files/da.lproj/InfoPlist.strings Binary files differindex 9fe347b0d..de2da6f0a 100644 --- a/iOSClient/Supporting Files/da.lproj/InfoPlist.strings +++ b/iOSClient/Supporting Files/da.lproj/InfoPlist.strings diff --git a/iOSClient/Supporting Files/da.lproj/Localizable.strings b/iOSClient/Supporting Files/da.lproj/Localizable.strings Binary files differindex b8bfff914..161f57870 100644 --- a/iOSClient/Supporting Files/da.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/da.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/de.lproj/Localizable.strings b/iOSClient/Supporting Files/de.lproj/Localizable.strings Binary files differindex 53c6bc10a..5770e34a4 100644 --- a/iOSClient/Supporting Files/de.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/de.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/el.lproj/Localizable.strings b/iOSClient/Supporting Files/el.lproj/Localizable.strings Binary files differindex d1475e4ef..42a3bd61c 100644 --- a/iOSClient/Supporting Files/el.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/el.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/en-GB.lproj/Localizable.strings b/iOSClient/Supporting Files/en-GB.lproj/Localizable.strings Binary files differindex c7354cff0..db5357242 100644 --- a/iOSClient/Supporting Files/en-GB.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/en-GB.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/en.lproj/Localizable.strings b/iOSClient/Supporting Files/en.lproj/Localizable.strings index f84dd74bb..c2230d118 100644 --- a/iOSClient/Supporting Files/en.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/en.lproj/Localizable.strings @@ -587,6 +587,11 @@ "_insert_password_pfd_" = "Secured PDF. Enter password"; "_password_pdf_error_" = "Wrong password"; "_error_download_photobrowser_" = "Error: Unable to download photo"; +"_good_morning_" = "Good morning"; +"_good_day_" = "Good day"; +"_good_afternoon_" = "Good afternoon"; +"_good_evening_" = "Good evening"; +"_good_night_" = "Good night"; // MARK: Share @@ -858,7 +863,7 @@ "_page_" = "Page"; "_this_document_has_%@_pages_" = "This document has %@ pages"; "_invalid_page_" = "Invalid Page"; -"_the_entered_page_number_doesn't_exist_" = "The entered page number doesn't exist"; +"_the_entered_page_number_does_not_exist_" = "The entered page number does not exist"; "_error_something_wrong_" = "Something went wrong"; "_resolution_" = "Resolution"; "_try_download_full_resolution_" = "For more detail try to download the image in full resolution"; @@ -877,8 +882,18 @@ "_ITMS-90076_" = "Due to a change in the Nextcloud application identifier, the settings and password for accessing your cloud are reset, so please re-enter your account data and check your Settings. We are sorry about that."; "_password_not_present_" = "Please re-insert your credentials."; "_copy_passphrase_" = "Copy passphrase"; +"_ok_copy_passphrase_" = "OK and copy passphrase"; "_select_color_" = "Select the color"; "_change_color_" = "Change color"; +"_description_dashboardwidget_" = "Having the Dashboard always at your fingertips has never been easier."; +"_description_fileswidget_" = "View your recent files and use the toolbar to speed up your operations."; +"_description_toolbarwidget_" = "A toolbar to speed up your operations."; +"_no_data_available_" = "No data available"; +"_widget_available_nc25_" = "Widget only available starting with Nextcloud 25"; +"_keep_running_" = "Keep the app running for a better user experience"; +"_recent_activity_" = "Recent activity"; +"_title_lockscreenwidget_" = "Status"; +"_description_lockscreenwidget_" = "Keep an eye on available space and recent activity"; // Video "_select_trace_" = "Select the trace"; diff --git a/iOSClient/Supporting Files/eo.lproj/Localizable.strings b/iOSClient/Supporting Files/eo.lproj/Localizable.strings Binary files differindex 3ff2371f2..2e4e79914 100644 --- a/iOSClient/Supporting Files/eo.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/eo.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/es-419.lproj/Localizable.strings b/iOSClient/Supporting Files/es-419.lproj/Localizable.strings Binary files differindex d485e916b..744a75265 100644 --- a/iOSClient/Supporting Files/es-419.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/es-419.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/es-AR.lproj/Localizable.strings b/iOSClient/Supporting Files/es-AR.lproj/Localizable.strings Binary files differindex a8e9da977..490b47309 100644 --- a/iOSClient/Supporting Files/es-AR.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/es-AR.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/es-CL.lproj/Localizable.strings b/iOSClient/Supporting Files/es-CL.lproj/Localizable.strings Binary files differindex 78b44a6a7..12dfe029a 100644 --- a/iOSClient/Supporting Files/es-CL.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/es-CL.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/es-CO.lproj/Localizable.strings b/iOSClient/Supporting Files/es-CO.lproj/Localizable.strings Binary files differindex 10520162e..a70be0831 100644 --- a/iOSClient/Supporting Files/es-CO.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/es-CO.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/es-CR.lproj/Localizable.strings b/iOSClient/Supporting Files/es-CR.lproj/Localizable.strings Binary files differindex 2327a8895..b8e2207ab 100644 --- a/iOSClient/Supporting Files/es-CR.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/es-CR.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/es-DO.lproj/Localizable.strings b/iOSClient/Supporting Files/es-DO.lproj/Localizable.strings Binary files differindex 6d6faba70..4f89066de 100644 --- a/iOSClient/Supporting Files/es-DO.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/es-DO.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/es-EC.lproj/Localizable.strings b/iOSClient/Supporting Files/es-EC.lproj/Localizable.strings Binary files differindex 0fce9b9d6..c774f01f7 100644 --- a/iOSClient/Supporting Files/es-EC.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/es-EC.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/es-GT.lproj/Localizable.strings b/iOSClient/Supporting Files/es-GT.lproj/Localizable.strings Binary files differindex e87ced038..5ab1c8d28 100644 --- a/iOSClient/Supporting Files/es-GT.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/es-GT.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/es-HN.lproj/Localizable.strings b/iOSClient/Supporting Files/es-HN.lproj/Localizable.strings Binary files differindex 8186a8136..da2f70866 100644 --- a/iOSClient/Supporting Files/es-HN.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/es-HN.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/es-MX.lproj/Localizable.strings b/iOSClient/Supporting Files/es-MX.lproj/Localizable.strings Binary files differindex 80bb4f3e0..9f7fa42c3 100644 --- a/iOSClient/Supporting Files/es-MX.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/es-MX.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/es-NI.lproj/Localizable.strings b/iOSClient/Supporting Files/es-NI.lproj/Localizable.strings Binary files differindex aa04ba273..9d335d874 100644 --- a/iOSClient/Supporting Files/es-NI.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/es-NI.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/es-PA.lproj/Localizable.strings b/iOSClient/Supporting Files/es-PA.lproj/Localizable.strings Binary files differindex aa04ba273..9d335d874 100644 --- a/iOSClient/Supporting Files/es-PA.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/es-PA.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/es-PE.lproj/Localizable.strings b/iOSClient/Supporting Files/es-PE.lproj/Localizable.strings Binary files differindex aa04ba273..9d335d874 100644 --- a/iOSClient/Supporting Files/es-PE.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/es-PE.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/es-PR.lproj/Localizable.strings b/iOSClient/Supporting Files/es-PR.lproj/Localizable.strings Binary files differindex aa04ba273..9d335d874 100644 --- a/iOSClient/Supporting Files/es-PR.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/es-PR.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/es-PY.lproj/Localizable.strings b/iOSClient/Supporting Files/es-PY.lproj/Localizable.strings Binary files differindex 78a6dfe64..d8f262a34 100644 --- a/iOSClient/Supporting Files/es-PY.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/es-PY.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/es-SV.lproj/Localizable.strings b/iOSClient/Supporting Files/es-SV.lproj/Localizable.strings Binary files differindex 2327a8895..b8e2207ab 100644 --- a/iOSClient/Supporting Files/es-SV.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/es-SV.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/es-UY.lproj/Localizable.strings b/iOSClient/Supporting Files/es-UY.lproj/Localizable.strings Binary files differindex 648c1bfd2..65892d241 100644 --- a/iOSClient/Supporting Files/es-UY.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/es-UY.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/es.lproj/Localizable.strings b/iOSClient/Supporting Files/es.lproj/Localizable.strings Binary files differindex 81c975079..2688cd26e 100644 --- a/iOSClient/Supporting Files/es.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/es.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/et_EE.lproj/Localizable.strings b/iOSClient/Supporting Files/et_EE.lproj/Localizable.strings Binary files differindex 500385980..862c5d5a4 100644 --- a/iOSClient/Supporting Files/et_EE.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/et_EE.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/eu.lproj/Localizable.strings b/iOSClient/Supporting Files/eu.lproj/Localizable.strings Binary files differindex e2f07ea15..b5fc9a00e 100644 --- a/iOSClient/Supporting Files/eu.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/eu.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/fa.lproj/Localizable.strings b/iOSClient/Supporting Files/fa.lproj/Localizable.strings Binary files differindex ab95ee920..98dac602f 100644 --- a/iOSClient/Supporting Files/fa.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/fa.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/fi-FI.lproj/Localizable.strings b/iOSClient/Supporting Files/fi-FI.lproj/Localizable.strings Binary files differindex 5f85dd01e..1d0f51131 100644 --- a/iOSClient/Supporting Files/fi-FI.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/fi-FI.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/fo.lproj/Localizable.strings b/iOSClient/Supporting Files/fo.lproj/Localizable.strings Binary files differindex cdf672e8e..43f6713c2 100644 --- a/iOSClient/Supporting Files/fo.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/fo.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/fr.lproj/Localizable.strings b/iOSClient/Supporting Files/fr.lproj/Localizable.strings Binary files differindex b1f5fac31..104a348a8 100644 --- a/iOSClient/Supporting Files/fr.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/fr.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/gd.lproj/Localizable.strings b/iOSClient/Supporting Files/gd.lproj/Localizable.strings Binary files differindex f8f8cdeea..1aed668aa 100644 --- a/iOSClient/Supporting Files/gd.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/gd.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/gl.lproj/Localizable.strings b/iOSClient/Supporting Files/gl.lproj/Localizable.strings Binary files differindex c327907ec..5a465544a 100644 --- a/iOSClient/Supporting Files/gl.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/gl.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/he.lproj/Localizable.strings b/iOSClient/Supporting Files/he.lproj/Localizable.strings Binary files differindex 6d0a0c4a1..14c593393 100644 --- a/iOSClient/Supporting Files/he.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/he.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/hi_IN.lproj/Localizable.strings b/iOSClient/Supporting Files/hi_IN.lproj/Localizable.strings Binary files differindex 247442d61..b9ced7e14 100644 --- a/iOSClient/Supporting Files/hi_IN.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/hi_IN.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/hr.lproj/Localizable.strings b/iOSClient/Supporting Files/hr.lproj/Localizable.strings Binary files differindex 4b63bf841..8a19c4e1b 100644 --- a/iOSClient/Supporting Files/hr.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/hr.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/hsb.lproj/Localizable.strings b/iOSClient/Supporting Files/hsb.lproj/Localizable.strings Binary files differindex f78460495..cca796eec 100644 --- a/iOSClient/Supporting Files/hsb.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/hsb.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/hu.lproj/Localizable.strings b/iOSClient/Supporting Files/hu.lproj/Localizable.strings Binary files differindex 4f89ce455..08c1142fd 100644 --- a/iOSClient/Supporting Files/hu.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/hu.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/hy.lproj/Localizable.strings b/iOSClient/Supporting Files/hy.lproj/Localizable.strings Binary files differindex 216b401ca..7aafd9845 100644 --- a/iOSClient/Supporting Files/hy.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/hy.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/ia.lproj/Localizable.strings b/iOSClient/Supporting Files/ia.lproj/Localizable.strings Binary files differindex 6162c207d..b590d932a 100644 --- a/iOSClient/Supporting Files/ia.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/ia.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/id.lproj/Localizable.strings b/iOSClient/Supporting Files/id.lproj/Localizable.strings Binary files differindex bd636dbc8..cac6d526c 100644 --- a/iOSClient/Supporting Files/id.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/id.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/ig.lproj/Localizable.strings b/iOSClient/Supporting Files/ig.lproj/Localizable.strings Binary files differindex 665802506..24da63500 100644 --- a/iOSClient/Supporting Files/ig.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/ig.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/is.lproj/Localizable.strings b/iOSClient/Supporting Files/is.lproj/Localizable.strings Binary files differindex 5781f3c66..f8976eb0f 100644 --- a/iOSClient/Supporting Files/is.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/is.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/it.lproj/Localizable.strings b/iOSClient/Supporting Files/it.lproj/Localizable.strings Binary files differindex 2ad412712..bf5a71971 100644 --- a/iOSClient/Supporting Files/it.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/it.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/ja-JP.lproj/Localizable.strings b/iOSClient/Supporting Files/ja-JP.lproj/Localizable.strings Binary files differindex 050fc708f..0292b6862 100644 --- a/iOSClient/Supporting Files/ja-JP.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/ja-JP.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/ka-GE.lproj/Localizable.strings b/iOSClient/Supporting Files/ka-GE.lproj/Localizable.strings Binary files differindex a11aa6464..8fa8b6000 100644 --- a/iOSClient/Supporting Files/ka-GE.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/ka-GE.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/ka.lproj/Localizable.strings b/iOSClient/Supporting Files/ka.lproj/Localizable.strings Binary files differindex 1ee274fe4..0a8e42b84 100644 --- a/iOSClient/Supporting Files/ka.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/ka.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/kab.lproj/Localizable.strings b/iOSClient/Supporting Files/kab.lproj/Localizable.strings Binary files differindex 9ada0f194..664aead6b 100644 --- a/iOSClient/Supporting Files/kab.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/kab.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/km.lproj/Localizable.strings b/iOSClient/Supporting Files/km.lproj/Localizable.strings Binary files differindex d79335d22..a774ab28c 100644 --- a/iOSClient/Supporting Files/km.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/km.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/kn.lproj/Localizable.strings b/iOSClient/Supporting Files/kn.lproj/Localizable.strings Binary files differindex e48d62f23..5f3ba140e 100644 --- a/iOSClient/Supporting Files/kn.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/kn.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/ko.lproj/Localizable.strings b/iOSClient/Supporting Files/ko.lproj/Localizable.strings Binary files differindex 34ed136ee..5b9e49e31 100644 --- a/iOSClient/Supporting Files/ko.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/ko.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/la.lproj/Localizable.strings b/iOSClient/Supporting Files/la.lproj/Localizable.strings Binary files differindex 8793cbccc..34c0df1ec 100644 --- a/iOSClient/Supporting Files/la.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/la.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/lb.lproj/Localizable.strings b/iOSClient/Supporting Files/lb.lproj/Localizable.strings Binary files differindex 1f4600d8d..34b1e5230 100644 --- a/iOSClient/Supporting Files/lb.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/lb.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/lo.lproj/Localizable.strings b/iOSClient/Supporting Files/lo.lproj/Localizable.strings Binary files differindex 4f1fd5b63..01e2620fc 100644 --- a/iOSClient/Supporting Files/lo.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/lo.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/lt_LT.lproj/Localizable.strings b/iOSClient/Supporting Files/lt_LT.lproj/Localizable.strings Binary files differindex b307faffa..4ecd37496 100644 --- a/iOSClient/Supporting Files/lt_LT.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/lt_LT.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/lv.lproj/Localizable.strings b/iOSClient/Supporting Files/lv.lproj/Localizable.strings Binary files differindex d880e1b18..97851d71d 100644 --- a/iOSClient/Supporting Files/lv.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/lv.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/mk.lproj/Localizable.strings b/iOSClient/Supporting Files/mk.lproj/Localizable.strings Binary files differindex 9b9671bb9..018982953 100644 --- a/iOSClient/Supporting Files/mk.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/mk.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/mn.lproj/Localizable.strings b/iOSClient/Supporting Files/mn.lproj/Localizable.strings Binary files differindex 43ca4b313..6c431fd5a 100644 --- a/iOSClient/Supporting Files/mn.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/mn.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/mr.lproj/Localizable.strings b/iOSClient/Supporting Files/mr.lproj/Localizable.strings Binary files differindex 5d886216d..e9cc00a41 100644 --- a/iOSClient/Supporting Files/mr.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/mr.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/ms_MY.lproj/Localizable.strings b/iOSClient/Supporting Files/ms_MY.lproj/Localizable.strings Binary files differindex f083b1caa..2516257c7 100644 --- a/iOSClient/Supporting Files/ms_MY.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/ms_MY.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/my.lproj/Localizable.strings b/iOSClient/Supporting Files/my.lproj/Localizable.strings Binary files differindex fa4d74606..3f02a258b 100644 --- a/iOSClient/Supporting Files/my.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/my.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/nb-NO.lproj/InfoPlist.strings b/iOSClient/Supporting Files/nb-NO.lproj/InfoPlist.strings Binary files differindex b58e1cf05..9c919771b 100644 --- a/iOSClient/Supporting Files/nb-NO.lproj/InfoPlist.strings +++ b/iOSClient/Supporting Files/nb-NO.lproj/InfoPlist.strings diff --git a/iOSClient/Supporting Files/nb-NO.lproj/Localizable.strings b/iOSClient/Supporting Files/nb-NO.lproj/Localizable.strings Binary files differindex 8032ad8a1..2a59d46b5 100644 --- a/iOSClient/Supporting Files/nb-NO.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/nb-NO.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/ne.lproj/Localizable.strings b/iOSClient/Supporting Files/ne.lproj/Localizable.strings Binary files differindex d09db6e67..76e448634 100644 --- a/iOSClient/Supporting Files/ne.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/ne.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/nl.lproj/Localizable.strings b/iOSClient/Supporting Files/nl.lproj/Localizable.strings Binary files differindex 09ffdf118..8ad5ca0f3 100644 --- a/iOSClient/Supporting Files/nl.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/nl.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/nn_NO.lproj/Localizable.strings b/iOSClient/Supporting Files/nn_NO.lproj/Localizable.strings Binary files differindex 056056e47..85bd4b47d 100644 --- a/iOSClient/Supporting Files/nn_NO.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/nn_NO.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/oc.lproj/Localizable.strings b/iOSClient/Supporting Files/oc.lproj/Localizable.strings Binary files differindex ffff72c9e..80a0a515c 100644 --- a/iOSClient/Supporting Files/oc.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/oc.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/pl.lproj/Localizable.strings b/iOSClient/Supporting Files/pl.lproj/Localizable.strings Binary files differindex 7e825a0b3..1797947dc 100644 --- a/iOSClient/Supporting Files/pl.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/pl.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/ps.lproj/Localizable.strings b/iOSClient/Supporting Files/ps.lproj/Localizable.strings Binary files differindex 131f275cb..fa35b201b 100644 --- a/iOSClient/Supporting Files/ps.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/ps.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/pt-BR.lproj/Localizable.strings b/iOSClient/Supporting Files/pt-BR.lproj/Localizable.strings Binary files differindex c7a7c4ccf..7ee7931dd 100644 --- a/iOSClient/Supporting Files/pt-BR.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/pt-BR.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/pt-PT.lproj/Localizable.strings b/iOSClient/Supporting Files/pt-PT.lproj/Localizable.strings Binary files differindex 2f1b88e76..f0d1c8376 100644 --- a/iOSClient/Supporting Files/pt-PT.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/pt-PT.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/ro.lproj/Localizable.strings b/iOSClient/Supporting Files/ro.lproj/Localizable.strings Binary files differindex 37d2ee8ef..08e7cd9fb 100644 --- a/iOSClient/Supporting Files/ro.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/ro.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/ru.lproj/Localizable.strings b/iOSClient/Supporting Files/ru.lproj/Localizable.strings Binary files differindex e21871bca..a5b13079e 100644 --- a/iOSClient/Supporting Files/ru.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/ru.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/sc.lproj/Localizable.strings b/iOSClient/Supporting Files/sc.lproj/Localizable.strings Binary files differindex aa41dbdc3..05ae29eee 100644 --- a/iOSClient/Supporting Files/sc.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/sc.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/si.lproj/Localizable.strings b/iOSClient/Supporting Files/si.lproj/Localizable.strings Binary files differindex 237faf080..d55f196a3 100644 --- a/iOSClient/Supporting Files/si.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/si.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/sk-SK.lproj/Localizable.strings b/iOSClient/Supporting Files/sk-SK.lproj/Localizable.strings Binary files differindex 31f1f216f..db33cd898 100644 --- a/iOSClient/Supporting Files/sk-SK.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/sk-SK.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/sl.lproj/Localizable.strings b/iOSClient/Supporting Files/sl.lproj/Localizable.strings Binary files differindex 6c1177a65..fa26273f2 100644 --- a/iOSClient/Supporting Files/sl.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/sl.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/sq.lproj/Localizable.strings b/iOSClient/Supporting Files/sq.lproj/Localizable.strings Binary files differindex 13caa4aa2..98613fd07 100644 --- a/iOSClient/Supporting Files/sq.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/sq.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/sr.lproj/Localizable.strings b/iOSClient/Supporting Files/sr.lproj/Localizable.strings Binary files differindex 997484f4b..dce54aa2b 100644 --- a/iOSClient/Supporting Files/sr.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/sr.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/sr@latin.lproj/Localizable.strings b/iOSClient/Supporting Files/sr@latin.lproj/Localizable.strings Binary files differindex 2217bf456..7cdacac8a 100644 --- a/iOSClient/Supporting Files/sr@latin.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/sr@latin.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/sv.lproj/Localizable.strings b/iOSClient/Supporting Files/sv.lproj/Localizable.strings Binary files differindex 600e64cd0..83402457d 100644 --- a/iOSClient/Supporting Files/sv.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/sv.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/sw.lproj/Localizable.strings b/iOSClient/Supporting Files/sw.lproj/Localizable.strings Binary files differindex 247442d61..b9ced7e14 100644 --- a/iOSClient/Supporting Files/sw.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/sw.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/ta.lproj/Localizable.strings b/iOSClient/Supporting Files/ta.lproj/Localizable.strings Binary files differindex 81406f1e6..733e296e4 100644 --- a/iOSClient/Supporting Files/ta.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/ta.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/th_TH.lproj/Localizable.strings b/iOSClient/Supporting Files/th_TH.lproj/Localizable.strings Binary files differindex 8cb1e7c06..1b1ff3bfa 100644 --- a/iOSClient/Supporting Files/th_TH.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/th_TH.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/tk.lproj/Localizable.strings b/iOSClient/Supporting Files/tk.lproj/Localizable.strings Binary files differindex 637b5dc7b..8976dc7d9 100644 --- a/iOSClient/Supporting Files/tk.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/tk.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/tr.lproj/Localizable.strings b/iOSClient/Supporting Files/tr.lproj/Localizable.strings Binary files differindex 8710d9dd1..fae13eb54 100644 --- a/iOSClient/Supporting Files/tr.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/tr.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/ug.lproj/Localizable.strings b/iOSClient/Supporting Files/ug.lproj/Localizable.strings Binary files differindex 6e0e7a60c..2d3de2a31 100644 --- a/iOSClient/Supporting Files/ug.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/ug.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/uk.lproj/Localizable.strings b/iOSClient/Supporting Files/uk.lproj/Localizable.strings Binary files differindex 7ce540bc0..5dd7f1f22 100644 --- a/iOSClient/Supporting Files/uk.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/uk.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/ur_PK.lproj/Localizable.strings b/iOSClient/Supporting Files/ur_PK.lproj/Localizable.strings Binary files differindex 6aedccf51..6d03423d0 100644 --- a/iOSClient/Supporting Files/ur_PK.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/ur_PK.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/uz.lproj/Localizable.strings b/iOSClient/Supporting Files/uz.lproj/Localizable.strings Binary files differindex 65ebd5bc2..b9ced7e14 100644 --- a/iOSClient/Supporting Files/uz.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/uz.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/vi.lproj/Localizable.strings b/iOSClient/Supporting Files/vi.lproj/Localizable.strings Binary files differindex 75e46841a..145f606a8 100644 --- a/iOSClient/Supporting Files/vi.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/vi.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/zh-Hans.lproj/Localizable.strings b/iOSClient/Supporting Files/zh-Hans.lproj/Localizable.strings Binary files differindex 78e566523..9cacf6f5c 100644 --- a/iOSClient/Supporting Files/zh-Hans.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/zh-Hans.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/zh-Hant-TW.lproj/Localizable.strings b/iOSClient/Supporting Files/zh-Hant-TW.lproj/Localizable.strings Binary files differindex 1f4de1585..91b0e17b6 100644 --- a/iOSClient/Supporting Files/zh-Hant-TW.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/zh-Hant-TW.lproj/Localizable.strings diff --git a/iOSClient/Supporting Files/zh_HK.lproj/Localizable.strings b/iOSClient/Supporting Files/zh_HK.lproj/Localizable.strings Binary files differindex f343c077d..fa9f526ee 100644 --- a/iOSClient/Supporting Files/zh_HK.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/zh_HK.lproj/Localizable.strings diff --git a/iOSClient/Transfers/NCTransferCell.swift b/iOSClient/Transfers/NCTransferCell.swift index acbf1fdca..624e63673 100755 --- a/iOSClient/Transfers/NCTransferCell.swift +++ b/iOSClient/Transfers/NCTransferCell.swift @@ -96,7 +96,7 @@ class NCTransferCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellP longPressedGestureMore.delaysTouchesBegan = true buttonMore.addGestureRecognizer(longPressedGestureMore) - separator.backgroundColor = NCBrandColor.shared.separator + separator.backgroundColor = .separator separatorHeightConstraint.constant = 0.5 labelTitle.text = "" diff --git a/iOSClient/Transfers/NCTransfers.swift b/iOSClient/Transfers/NCTransfers.swift index c56324a46..f2b603144 100644 --- a/iOSClient/Transfers/NCTransfers.swift +++ b/iOSClient/Transfers/NCTransfers.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit class NCTransfers: NCCollectionViewCommon, NCTransferCellDelegate { @@ -52,6 +52,12 @@ class NCTransfers: NCCollectionViewCommon, NCTransferCellDelegate { self.navigationItem.title = titleCurrentFolder } + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + + navigationController?.setFileAppreance() + } + override func setNavigationItem() { self.navigationItem.rightBarButtonItem = nil self.navigationItem.leftBarButtonItem = nil @@ -128,9 +134,8 @@ class NCTransfers: NCCollectionViewCommon, NCTransferCellDelegate { guard let metadata = metadataTemp else { return } guard appDelegate.account == metadata.account else { return } - guard let networkingProcessUpload = appDelegate.networkingProcessUpload else { return } - networkingProcessUpload.extractFiles(from: metadata) { metadatas in + NCUtility.shared.extractFiles(from: metadata) { metadatas in for metadata in metadatas { if let metadata = NCManageDatabase.shared.setMetadataStatus(ocId: metadata.ocId, status: NCGlobal.shared.metadataStatusInUpload) { NCNetworking.shared.upload(metadata: metadata) @@ -154,7 +159,6 @@ class NCTransfers: NCCollectionViewCommon, NCTransferCellDelegate { // MARK: - Collection View - @available(iOS 13.0, *) override func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? { return nil } @@ -175,53 +179,29 @@ class NCTransfers: NCCollectionViewCommon, NCTransferCellDelegate { cell.fileObjectId = metadata.ocId cell.fileUser = metadata.ownerId cell.indexPath = indexPath - cell.imageItem.image = NCBrandColor.cacheImages.file cell.imageItem.backgroundColor = nil - cell.labelTitle.text = metadata.fileNameView - cell.labelTitle.textColor = NCBrandColor.shared.label - + cell.labelTitle.textColor = .label let serverUrlHome = NCUtilityFileSystem.shared.getHomeServer(account: metadata.account) var pathText = metadata.serverUrl.replacingOccurrences(of: serverUrlHome, with: "") if pathText == "" { pathText = "/" } cell.labelPath.text = pathText - cell.setButtonMore(named: NCGlobal.shared.buttonMoreStop, image: NCBrandColor.cacheImages.buttonStop) - cell.progressView.progress = 0.0 - - let filePath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)! - let iconImagePath = CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag)! - - if FileManager().fileExists(atPath: iconImagePath) { - cell.imageItem.image = UIImage(contentsOfFile:iconImagePath) - } else if metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue, FileManager().fileExists(atPath: filePath) { - if let image = UIImage(contentsOfFile: filePath), let image = image.resizeImage(size: CGSize(width: NCGlobal.shared.sizeIcon, height: NCGlobal.shared.sizeIcon), isAspectRation: true), let data = image.jpegData(compressionQuality: 0.5) { - do { - try data.write(to: URL.init(fileURLWithPath: iconImagePath), options: .atomic) - cell.imageItem.image = image - } catch { } - } - } else if metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue, FileManager().fileExists(atPath: filePath) { - if let image = NCUtility.shared.imageFromVideo(url: URL(fileURLWithPath: filePath), at: 0), let image = image.resizeImage(size: CGSize(width: NCGlobal.shared.sizeIcon, height: NCGlobal.shared.sizeIcon), isAspectRation: true), let data = image.jpegData(compressionQuality: 0.5) { - do { - try data.write(to: URL.init(fileURLWithPath: iconImagePath), options: .atomic) - cell.imageItem.image = image - } catch { } - } - } else { + if let image = NCUtility.shared.createFilePreviewImage(ocId: metadata.ocId, etag: metadata.etag, fileNameView: metadata.fileNameView, classFile: metadata.classFile, status: metadata.status, createPreviewMedia: true) { + cell.imageItem.image = image + } else if !metadata.iconName.isEmpty { cell.imageItem.image = UIImage(named: metadata.iconName) + } else { + cell.imageItem.image = UIImage(named: "file") } - cell.labelInfo.text = CCUtility.dateDiff(metadata.date as Date) + " · " + CCUtility.transformedSize(metadata.size) - if metadata.status == NCGlobal.shared.metadataStatusDownloading || metadata.status == NCGlobal.shared.metadataStatusUploading { cell.progressView.isHidden = false } else { cell.progressView.isHidden = true } - // Write status on Label Info switch metadata.status { case NCGlobal.shared.metadataStatusWaitDownload: @@ -260,13 +240,11 @@ class NCTransfers: NCCollectionViewCommon, NCTransferCellDelegate { if self.appDelegate.account != metadata.account { cell.labelInfo.text = NSLocalizedString("_waiting_for_", comment: "") + " " + NSLocalizedString("_user_", comment: "").lowercased() + " \(metadata.userId) " + NSLocalizedString("_in_", comment: "") + " \(metadata.urlBase)" } - let isWiFi = NCNetworking.shared.networkReachability == NCCommunicationCommon.typeReachability.reachableEthernetOrWiFi + let isWiFi = NCNetworking.shared.networkReachability == NKCommon.typeReachability.reachableEthernetOrWiFi if metadata.session == NCNetworking.shared.sessionIdentifierBackgroundWWan && !isWiFi { cell.labelInfo.text = NSLocalizedString("_waiting_for_", comment: "") + " " + NSLocalizedString("_reachable_wifi_", comment: "") } - cell.accessibilityLabel = metadata.fileNameView + ", " + (cell.labelInfo.text ?? "") - // Remove last separator if collectionView.numberOfItems(inSection: indexPath.section) == indexPath.row + 1 { cell.separator.isHidden = true diff --git a/iOSClient/Trash/Cell/NCTrashListCell+NCTrashCellProtocol.swift b/iOSClient/Trash/Cell/NCTrashListCell+NCTrashCellProtocol.swift index 2b8c1a982..07520cc84 100644 --- a/iOSClient/Trash/Cell/NCTrashListCell+NCTrashCellProtocol.swift +++ b/iOSClient/Trash/Cell/NCTrashListCell+NCTrashCellProtocol.swift @@ -70,7 +70,7 @@ class NCTrashListCell: UICollectionViewCell, NCTrashCellProtocol { imageItem.layer.cornerRadius = 6 imageItem.layer.masksToBounds = true - separator.backgroundColor = NCBrandColor.shared.separator + separator.backgroundColor = .separator separatorHeightConstraint.constant = 0.5 } @@ -138,7 +138,7 @@ extension NCTrashCellProtocol where Self: UICollectionViewCell { mutating func setupCellUI(tableTrash: tableTrash, image: UIImage?) { self.objectId = tableTrash.fileId self.labelTitle.text = tableTrash.trashbinFileName - self.labelTitle.textColor = NCBrandColor.shared.label + self.labelTitle.textColor = .label if self is NCTrashListCell { self.labelInfo?.text = CCUtility.dateDiff(tableTrash.date as Date) } else { diff --git a/iOSClient/Trash/NCTrash.swift b/iOSClient/Trash/NCTrash.swift index 9c8ccd16b..7a451135f 100644 --- a/iOSClient/Trash/NCTrash.swift +++ b/iOSClient/Trash/NCTrash.swift @@ -25,7 +25,7 @@ import Realm import UIKit -import NCCommunication +import NextcloudKit class NCTrash: UIViewController, NCSelectableNavigationView, NCTrashListCellDelegate, NCSectionHeaderMenuDelegate, NCEmptyDataSetDelegate, NCGridCellDelegate { @@ -53,7 +53,7 @@ class NCTrash: UIViewController, NCSelectableNavigationView, NCTrashListCellDele override func viewDidLoad() { - view.backgroundColor = NCBrandColor.shared.systemBackground + view.backgroundColor = .systemBackground self.navigationController?.navigationBar.prefersLargeTitles = true // Cell @@ -65,7 +65,7 @@ class NCTrash: UIViewController, NCSelectableNavigationView, NCTrashListCellDele collectionView.register(UINib(nibName: "NCSectionFooter", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: "sectionFooter") collectionView.alwaysBounceVertical = true - collectionView.backgroundColor = NCBrandColor.shared.systemBackground + collectionView.backgroundColor = .systemBackground listLayout = NCListLayout() gridLayout = NCGridLayout() @@ -85,7 +85,8 @@ class NCTrash: UIViewController, NCSelectableNavigationView, NCTrashListCellDele appDelegate.activeViewController = self - self.navigationItem.title = titleCurrentFolder + navigationController?.setFileAppreance() + navigationItem.title = titleCurrentFolder layoutForView = NCUtility.shared.getLayoutForView(key: NCGlobal.shared.layoutViewTrash, serverUrl: "", sort: "date", ascending: false, titleButtonHeader: "_sorted_by_date_more_recent_") gridLayout.itemForLine = CGFloat(layoutForView?.itemForLine ?? 3) @@ -275,12 +276,14 @@ extension NCTrash { @objc func loadListingTrash() { - NCCommunication.shared.listingTrash(showHiddenFiles: false, queue: NCCommunicationCommon.shared.backgroundQueue) { account, items, errorCode, errorDescription in + let options = NKRequestOptions(queue: NKCommon.shared.backgroundQueue) + + NextcloudKit.shared.listingTrash(showHiddenFiles: false, options: options) { account, items, data, error in DispatchQueue.main.async { self.refreshControl.endRefreshing() } - guard errorCode == 0, account == self.appDelegate.account, let trashPath = self.getTrashPath() else { - NCContentPresenter.shared.showError(description: errorDescription, errorCode: errorCode) + guard error == .success, account == self.appDelegate.account, let trashPath = self.getTrashPath() else { + NCContentPresenter.shared.showError(error: error) return } @@ -297,10 +300,10 @@ extension NCTrash { let fileNameFrom = tableTrash.filePath + tableTrash.fileName let fileNameTo = appDelegate.urlBase + "/" + NCUtilityFileSystem.shared.getWebDAV(account: appDelegate.account) + "/trashbin/" + appDelegate.userId + "/restore/" + tableTrash.fileName - NCCommunication.shared.moveFileOrFolder(serverUrlFileNameSource: fileNameFrom, serverUrlFileNameDestination: fileNameTo, overwrite: true) { account, errorCode, errorDescription in + NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: fileNameFrom, serverUrlFileNameDestination: fileNameTo, overwrite: true) { account, error in - guard errorCode == 0, account == self.appDelegate.account else { - NCContentPresenter.shared.showError(description: errorDescription, errorCode: errorCode) + guard error == .success, account == self.appDelegate.account else { + NCContentPresenter.shared.showError(error: error) return } @@ -313,10 +316,10 @@ extension NCTrash { let serverUrlFileName = appDelegate.urlBase + "/" + NCUtilityFileSystem.shared.getWebDAV(account: appDelegate.account) + "/trashbin/" + appDelegate.userId + "/trash" - NCCommunication.shared.deleteFileOrFolder(serverUrlFileName) { account, errorCode, errorDescription in + NextcloudKit.shared.deleteFileOrFolder(serverUrlFileName) { account, error in - guard errorCode == 0, account == self.appDelegate.account else { - NCContentPresenter.shared.showError(description: errorDescription, errorCode: errorCode) + guard error == .success, account == self.appDelegate.account else { + NCContentPresenter.shared.showError(error: error) return } @@ -330,10 +333,10 @@ extension NCTrash { guard let tableTrash = NCManageDatabase.shared.getTrashItem(fileId: fileId, account: appDelegate.account) else { return } let serverUrlFileName = tableTrash.filePath + tableTrash.fileName - NCCommunication.shared.deleteFileOrFolder(serverUrlFileName) { account, errorCode, errorDescription in + NextcloudKit.shared.deleteFileOrFolder(serverUrlFileName) { account, error in - guard errorCode == 0, account == self.appDelegate.account else { - NCContentPresenter.shared.showError(description: errorDescription, errorCode: errorCode) + guard error == .success, account == self.appDelegate.account else { + NCContentPresenter.shared.showError(error: error) return } @@ -347,7 +350,7 @@ extension NCTrash { let fileNamePreviewLocalPath = CCUtility.getDirectoryProviderStoragePreviewOcId(tableTrash.fileId, etag: tableTrash.fileName)! let fileNameIconLocalPath = CCUtility.getDirectoryProviderStorageIconOcId(tableTrash.fileId, etag: tableTrash.fileName)! - NCCommunication.shared.downloadPreview( + NextcloudKit.shared.downloadPreview( fileNamePathOrFileId: tableTrash.fileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, widthPreview: NCGlobal.shared.sizePreview, @@ -355,8 +358,8 @@ extension NCTrash { fileNameIconLocalPath: fileNameIconLocalPath, sizeIcon: NCGlobal.shared.sizeIcon, etag: nil, - endpointTrashbin: true) { account, _, imageIcon, _, _, errorCode, _ in - guard errorCode == 0, let imageIcon = imageIcon, account == self.appDelegate.account, + endpointTrashbin: true) { account, _, imageIcon, _, _, error in + guard error == .success, let imageIcon = imageIcon, account == self.appDelegate.account, let cell = self.collectionView.cellForItem(at: indexPath) else { return } if let cell = cell as? NCTrashListCell { cell.imageItem.image = imageIcon diff --git a/iOSClient/UserStatus/NCUserStatus.swift b/iOSClient/UserStatus/NCUserStatus.swift index 5312cac52..136b0e7ce 100644 --- a/iOSClient/UserStatus/NCUserStatus.swift +++ b/iOSClient/UserStatus/NCUserStatus.swift @@ -24,10 +24,9 @@ import UIKit import Foundation -import NCCommunication +import NextcloudKit import DropDown -@available(iOS 13.0, *) class NCUserStatus: UIViewController { @IBOutlet weak var buttonCancel: UIBarButtonItem! @@ -63,7 +62,7 @@ class NCUserStatus: UIViewController { @IBOutlet weak var clearStatusMessageButton: UIButton! @IBOutlet weak var setStatusMessageButton: UIButton! - private var statusPredefinedStatuses: [NCCommunicationUserStatus] = [] + private var statusPredefinedStatuses: [NKUserStatus] = [] private var clearAtTimestamp: Double = 0 // Unix Timestamp representing the time to clear the status @@ -77,62 +76,62 @@ class NCUserStatus: UIViewController { self.navigationItem.title = NSLocalizedString("_online_status_", comment: "") - view.backgroundColor = NCBrandColor.shared.systemBackground - tableView.backgroundColor = NCBrandColor.shared.systemBackground + view.backgroundColor = .systemBackground + tableView.backgroundColor = .systemBackground buttonCancel.title = NSLocalizedString("_close_", comment: "") onlineButton.layer.cornerRadius = 10 onlineButton.layer.masksToBounds = true - onlineButton.backgroundColor = NCBrandColor.shared.systemGray5 + onlineButton.backgroundColor = .systemGray5 let onLine = NCUtility.shared.getUserStatus(userIcon: nil, userStatus: "online", userMessage: nil) onlineImage.image = onLine.onlineStatus onlineLabel.text = onLine.statusMessage - onlineLabel.textColor = NCBrandColor.shared.label + onlineLabel.textColor = .label awayButton.layer.cornerRadius = 10 awayButton.layer.masksToBounds = true - awayButton.backgroundColor = NCBrandColor.shared.systemGray5 + awayButton.backgroundColor = .systemGray5 let away = NCUtility.shared.getUserStatus(userIcon: nil, userStatus: "away", userMessage: nil) awayImage.image = away.onlineStatus awayLabel.text = away.statusMessage - awayLabel.textColor = NCBrandColor.shared.label + awayLabel.textColor = .label dndButton.layer.cornerRadius = 10 dndButton.layer.masksToBounds = true - dndButton.backgroundColor = NCBrandColor.shared.systemGray5 + dndButton.backgroundColor = .systemGray5 let dnd = NCUtility.shared.getUserStatus(userIcon: nil, userStatus: "dnd", userMessage: nil) dndImage.image = dnd.onlineStatus dndLabel.text = dnd.statusMessage - dndLabel.textColor = NCBrandColor.shared.label + dndLabel.textColor = .label dndDescrLabel.text = dnd.descriptionMessage dndDescrLabel.textColor = .darkGray invisibleButton.layer.cornerRadius = 10 invisibleButton.layer.masksToBounds = true - invisibleButton.backgroundColor = NCBrandColor.shared.systemGray5 + invisibleButton.backgroundColor = .systemGray5 let invisible = NCUtility.shared.getUserStatus(userIcon: nil, userStatus: "invisible", userMessage: nil) invisibleImage.image = invisible.onlineStatus invisibleLabel.text = invisible.statusMessage - invisibleLabel.textColor = NCBrandColor.shared.label + invisibleLabel.textColor = .label invisibleDescrLabel.text = invisible.descriptionMessage invisibleDescrLabel.textColor = .darkGray statusMessageLabel.text = NSLocalizedString("_status_message_", comment: "") - statusMessageLabel.textColor = NCBrandColor.shared.label + statusMessageLabel.textColor = .label statusMessageEmojiTextField.delegate = self - statusMessageEmojiTextField.backgroundColor = NCBrandColor.shared.systemGray5 + statusMessageEmojiTextField.backgroundColor = .systemGray5 statusMessageTextField.delegate = self statusMessageTextField.placeholder = NSLocalizedString("_status_message_placehorder_", comment: "") - statusMessageTextField.textColor = NCBrandColor.shared.label + statusMessageTextField.textColor = .label tableView.tableFooterView = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.size.width, height: 1)) tableView.separatorStyle = UITableViewCell.SeparatorStyle.none clearStatusMessageAfterLabel.text = NSLocalizedString("_clear_status_message_after_", comment: "") - clearStatusMessageAfterLabel.textColor = NCBrandColor.shared.label + clearStatusMessageAfterLabel.textColor = .label clearStatusMessageAfterText.layer.cornerRadius = 5 clearStatusMessageAfterText.layer.masksToBounds = true @@ -155,9 +154,9 @@ class NCUserStatus: UIViewController { clearStatusMessageButton.layer.masksToBounds = true clearStatusMessageButton.layer.borderWidth = 0.5 clearStatusMessageButton.layer.borderColor = UIColor.darkGray.cgColor - clearStatusMessageButton.backgroundColor = NCBrandColor.shared.systemGray5 + clearStatusMessageButton.backgroundColor = .systemGray5 clearStatusMessageButton.setTitle(NSLocalizedString("_clear_status_message_", comment: ""), for: .normal) - clearStatusMessageButton.setTitleColor(NCBrandColor.shared.label, for: .normal) + clearStatusMessageButton.setTitleColor(.label, for: .normal) setStatusMessageButton.layer.cornerRadius = 20 setStatusMessageButton.layer.masksToBounds = true @@ -171,20 +170,20 @@ class NCUserStatus: UIViewController { override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) - NCCommunication.shared.getUserStatus { account, clearAt, icon, message, messageId, messageIsPredefined, status, statusIsUserDefined, _, errorCode, _ in + NextcloudKit.shared.getUserStatus { account, clearAt, icon, message, messageId, messageIsPredefined, status, statusIsUserDefined, _, data, error in - if errorCode == 0 { + if error == .success { NCManageDatabase.shared.setAccountUserStatus(userStatusClearAt: clearAt, userStatusIcon: icon, userStatusMessage: message, userStatusMessageId: messageId, userStatusMessageIsPredefined: messageIsPredefined, userStatusStatus: status, userStatusStatusIsUserDefined: statusIsUserDefined, account: account) } } } - func dismissIfError(_ errorCode: Int, errorDescription: String) { - if errorCode != 0 && errorCode != NCGlobal.shared.errorResourceNotFound { + func dismissIfError(_ error: NKError) { + if error != .success && error.errorCode != NCGlobal.shared.errorResourceNotFound { DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { self.dismiss(animated: true) { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCContentPresenter.shared.showError(error: error) } } } @@ -207,8 +206,8 @@ class NCUserStatus: UIViewController { self.invisibleButton.layer.borderWidth = 0 self.invisibleButton.layer.borderColor = nil - NCCommunication.shared.setUserStatus(status: "online") { _, errorCode, errorDescription in - self.dismissIfError(errorCode, errorDescription: errorDescription) + NextcloudKit.shared.setUserStatus(status: "online") { _, error in + self.dismissIfError(error) } } @@ -223,8 +222,8 @@ class NCUserStatus: UIViewController { self.invisibleButton.layer.borderWidth = 0 self.invisibleButton.layer.borderColor = nil - NCCommunication.shared.setUserStatus(status: "away") { _, errorCode, errorDescription in - self.dismissIfError(errorCode, errorDescription: errorDescription) + NextcloudKit.shared.setUserStatus(status: "away") { _, error in + self.dismissIfError(error) } } @@ -239,8 +238,8 @@ class NCUserStatus: UIViewController { self.invisibleButton.layer.borderWidth = 0 self.invisibleButton.layer.borderColor = nil - NCCommunication.shared.setUserStatus(status: "dnd") { _, errorCode, errorDescription in - self.dismissIfError(errorCode, errorDescription: errorDescription) + NextcloudKit.shared.setUserStatus(status: "dnd") { _, error in + self.dismissIfError(error) } } @@ -255,8 +254,8 @@ class NCUserStatus: UIViewController { self.invisibleButton.layer.borderWidth = self.borderWidthButton self.invisibleButton.layer.borderColor = self.borderColorButton - NCCommunication.shared.setUserStatus(status: "invisible") { _, errorCode, errorDescription in - self.dismissIfError(errorCode, errorDescription: errorDescription) + NextcloudKit.shared.setUserStatus(status: "invisible") { _, error in + self.dismissIfError(error) } } @@ -308,10 +307,10 @@ class NCUserStatus: UIViewController { @IBAction func actionClearStatusMessage(_ sender: UIButton) { - NCCommunication.shared.clearMessage { _, errorCode, errorDescription in + NextcloudKit.shared.clearMessage { _, error in - if errorCode != 0 { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + if error != .success { + NCContentPresenter.shared.showError(error: error) } self.dismiss(animated: true) @@ -322,10 +321,10 @@ class NCUserStatus: UIViewController { guard let message = statusMessageTextField.text else { return } - NCCommunication.shared.setCustomMessageUserDefined(statusIcon: statusMessageEmojiTextField.text, message: message, clearAt: clearAtTimestamp) { _, errorCode, errorDescription in + NextcloudKit.shared.setCustomMessageUserDefined(statusIcon: statusMessageEmojiTextField.text, message: message, clearAt: clearAtTimestamp) { _, error in - if errorCode != 0 { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + if error != .success { + NCContentPresenter.shared.showError(error: error) } self.dismiss(animated: true) @@ -336,9 +335,9 @@ class NCUserStatus: UIViewController { func getStatus() { - NCCommunication.shared.getUserStatus { _, clearAt, icon, message, _, _, status, _, _, errorCode, errorDescription in + NextcloudKit.shared.getUserStatus { _, clearAt, icon, message, _, _, status, _, _, data, error in - if errorCode == 0 || errorCode == NCGlobal.shared.errorResourceNotFound { + if error == .success || error.errorCode == NCGlobal.shared.errorResourceNotFound { if icon != nil { self.statusMessageEmojiTextField.text = icon @@ -369,9 +368,9 @@ class NCUserStatus: UIViewController { print("No status") } - NCCommunication.shared.getUserStatusPredefinedStatuses { _, userStatuses, errorCode, errorDescription in + NextcloudKit.shared.getUserStatusPredefinedStatuses { _, userStatuses, data, error in - if errorCode == 0 { + if error == .success { if let userStatuses = userStatuses { self.statusPredefinedStatuses = userStatuses @@ -380,12 +379,12 @@ class NCUserStatus: UIViewController { self.tableView.reloadData() } - self.dismissIfError(errorCode, errorDescription: errorDescription) + self.dismissIfError(error) } } - self.dismissIfError(errorCode, errorDescription: errorDescription) + self.dismissIfError(error) } } @@ -476,7 +475,6 @@ class NCUserStatus: UIViewController { } } -@available(iOS 13.0, *) extension NCUserStatus: UITextFieldDelegate { func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { @@ -501,10 +499,8 @@ extension NCUserStatus: UITextFieldDelegate { } } -@available(iOS 13.0, *) class emojiTextField: UITextField { - // required for iOS 13 override var textInputContextIdentifier: String? { "" } // return non-nil to show the Emoji keyboard ¯\_(ツ)_/¯ override var textInputMode: UITextInputMode? { @@ -543,7 +539,6 @@ class emojiTextField: UITextField { } } -@available(iOS 13.0, *) extension NCUserStatus: UITableViewDelegate { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { @@ -557,11 +552,11 @@ extension NCUserStatus: UITableViewDelegate { if let messageId = status.id { - NCCommunication.shared.setCustomMessagePredefined(messageId: messageId, clearAt: 0) { _, errorCode, errorDescription in + NextcloudKit.shared.setCustomMessagePredefined(messageId: messageId, clearAt: 0) { _, error in cell.isSelected = false - if errorCode == 0 { + if error == .success { let clearAtTimestampString = self.getPredefinedClearStatusText(clearAt: status.clearAt, clearAtTime: status.clearAtTime, clearAtType: status.clearAtType) @@ -571,13 +566,12 @@ extension NCUserStatus: UITableViewDelegate { self.clearAtTimestamp = self.getClearAt(clearAtTimestampString) } - self.dismissIfError(errorCode, errorDescription: errorDescription) + self.dismissIfError(error) } } } } -@available(iOS 13.0, *) extension NCUserStatus: UITableViewDataSource { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { diff --git a/iOSClient/Utility/CCUtility.h b/iOSClient/Utility/CCUtility.h index 96ed5e538..82193eb15 100644 --- a/iOSClient/Utility/CCUtility.h +++ b/iOSClient/Utility/CCUtility.h @@ -180,9 +180,6 @@ + (BOOL)getRemovePhotoCameraRoll; + (void)setRemovePhotoCameraRoll:(BOOL)set; -+ (BOOL)getPresentErrorITMS90076; -+ (void)setPresentErrorITMS90076:(BOOL)set; - + (BOOL)getPlayerPlay; + (void)setPlayerPlay:(BOOL)set; diff --git a/iOSClient/Utility/CCUtility.m b/iOSClient/Utility/CCUtility.m index 089365bf0..47a3144cd 100644 --- a/iOSClient/Utility/CCUtility.m +++ b/iOSClient/Utility/CCUtility.m @@ -723,17 +723,6 @@ [UICKeyChainStore setString:sSet forKey:@"removePhotoCameraRoll" service:NCGlobal.shared.serviceShareKeyChain]; } -+ (BOOL)getPresentErrorITMS90076 -{ - return [[UICKeyChainStore stringForKey:@"errorITMS90076" service:NCGlobal.shared.serviceShareKeyChain] boolValue]; -} - -+ (void)setPresentErrorITMS90076:(BOOL)set -{ - NSString *sSet = (set) ? @"true" : @"false"; - [UICKeyChainStore setString:sSet forKey:@"errorITMS90076" service:NCGlobal.shared.serviceShareKeyChain]; -} - + (BOOL)getPlayerPlay { return [[UICKeyChainStore stringForKey:@"playerPlay" service:NCGlobal.shared.serviceShareKeyChain] boolValue]; @@ -1044,14 +1033,6 @@ [CCUtility addSkipBackupAttributeToItemAtURL:[[CCUtility getDirectoryGroup] URLByAppendingPathComponent:NCGlobal.shared.appDatabaseNextcloud]]; [CCUtility addSkipBackupAttributeToItemAtURL:[[CCUtility getDirectoryGroup] URLByAppendingPathComponent:NCGlobal.shared.appScan]]; [CCUtility addSkipBackupAttributeToItemAtURL:[[CCUtility getDirectoryGroup] URLByAppendingPathComponent:NCGlobal.shared.appUserData]]; - - #ifdef DEBUG - NSLog(@"[LOG] Copy DB on Documents directory"); - NSString *atPathDB = [NSString stringWithFormat:@"%@/nextcloud.realm", [[dirGroup URLByAppendingPathComponent:[[NCGlobal shared] appDatabaseNextcloud]] path]]; - NSString *toPathDB = [NSString stringWithFormat:@"%@/nextcloud.realm", [CCUtility getDirectoryDocuments]]; - [[NSFileManager defaultManager] removeItemAtPath:toPathDB error:nil]; - [[NSFileManager defaultManager] copyItemAtPath:atPathDB toPath:toPathDB error:nil]; - #endif } + (NSURL *)getDirectoryGroup diff --git a/iOSClient/Utility/NCActivityIndicator.swift b/iOSClient/Utility/NCActivityIndicator.swift index 8af4760e3..e10f5e644 100644 --- a/iOSClient/Utility/NCActivityIndicator.swift +++ b/iOSClient/Utility/NCActivityIndicator.swift @@ -38,7 +38,7 @@ class NCActivityIndicator: NSObject { start(backgroundView: backgroundView, style: style) } - func start(backgroundView: UIView? = nil, bottom: CGFloat? = nil, top: CGFloat? = nil, style: UIActivityIndicatorView.Style = .whiteLarge) { + func start(backgroundView: UIView? = nil, bottom: CGFloat? = nil, top: CGFloat? = nil, style: UIActivityIndicatorView.Style = .large) { if self.activityIndicator != nil { stop() } @@ -47,7 +47,7 @@ class NCActivityIndicator: NSObject { self.activityIndicator = UIActivityIndicatorView(style: style) guard let activityIndicator = self.activityIndicator, self.viewBackgroundActivityIndicator == nil else { return } - activityIndicator.color = NCBrandColor.shared.label + activityIndicator.color = .label activityIndicator.hidesWhenStopped = true activityIndicator.translatesAutoresizingMaskIntoConstraints = false diff --git a/iOSClient/Utility/NCAskAuthorization.swift b/iOSClient/Utility/NCAskAuthorization.swift index 1d02f9d1e..eae76ff6f 100644 --- a/iOSClient/Utility/NCAskAuthorization.swift +++ b/iOSClient/Utility/NCAskAuthorization.swift @@ -40,7 +40,9 @@ class NCAskAuthorization: NSObject { case AVAudioSession.RecordPermission.denied: let alert = UIAlertController(title: NSLocalizedString("_error_", comment: ""), message: NSLocalizedString("_err_permission_microphone_", comment: ""), preferredStyle: .alert) alert.addAction(UIAlertAction(title: NSLocalizedString("_open_settings_", comment: ""), style: .default, handler: { _ in + #if !EXTENSION UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!) + #endif completion(false) })) alert.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .cancel, handler: { _ in @@ -76,7 +78,9 @@ class NCAskAuthorization: NSObject { case PHAuthorizationStatus.denied, PHAuthorizationStatus.limited, PHAuthorizationStatus.restricted: let alert = UIAlertController(title: NSLocalizedString("_error_", comment: ""), message: NSLocalizedString("_err_permission_photolibrary_", comment: ""), preferredStyle: .alert) alert.addAction(UIAlertAction(title: NSLocalizedString("_open_settings_", comment: ""), style: .default, handler: { _ in + #if !EXTENSION UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!) + #endif completion(false) })) alert.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .cancel, handler: { _ in @@ -90,9 +94,9 @@ class NCAskAuthorization: NSObject { isRequesting = true PHPhotoLibrary.requestAuthorization { allowed in self.isRequesting = false - DispatchQueue.main.async { - (UIApplication.shared.delegate as? AppDelegate)?.hidePrivacyProtectionWindow() - } + #if !EXTENSION + DispatchQueue.main.async { (UIApplication.shared.delegate as? AppDelegate)?.hidePrivacyProtectionWindow() } + #endif DispatchQueue.main.async { if allowed == PHAuthorizationStatus.authorized { completion(true) @@ -107,4 +111,22 @@ class NCAskAuthorization: NSObject { break } } + + #if !EXTENSION + func checkBackgroundRefreshStatus() { + switch UIApplication.shared.backgroundRefreshStatus { + case .available: + print("Background fetch is enabled") + case .denied: + print("Background fetch is explicitly disabled") + // Redirect user to Settings page only once; Respect user's choice is important + UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!) + case .restricted: + // Should not redirect user to Settings since he / she cannot toggle the settings + print("Background fetch is restricted, e.g. under parental control") + default: + print("Unknown property") + } + } + #endif } diff --git a/iOSClient/Utility/NCContentPresenter.swift b/iOSClient/Utility/NCContentPresenter.swift index 79061d600..8365da0c4 100644 --- a/iOSClient/Utility/NCContentPresenter.swift +++ b/iOSClient/Utility/NCContentPresenter.swift @@ -24,6 +24,7 @@ import SwiftEntryKit import UIKit import CFNetwork +import NextcloudKit class NCContentPresenter: NSObject { @objc static let shared: NCContentPresenter = { @@ -62,35 +63,51 @@ class NCContentPresenter: NSObject { // MARK: - Message - @objc func showError(description: String, errorCode: Int = NCGlobal.shared.errorGeneric) { + func showError(error: NKError, priority: EKAttributes.Precedence.Priority = .normal) { messageNotification( - "_error_", description: description, + "_error_", + error: error, delay: NCGlobal.shared.dismissAfterSecond, type: .error, - errorCode: errorCode) + priority: priority) } - @objc func messageNotification(_ title: String, description: String?, delay: TimeInterval, type: messageType, errorCode: Int) { - messageNotification(title, description: description, delay: delay, type: type, errorCode: errorCode, priority: .normal, dropEnqueuedEntries: false) + func showInfo(error: NKError, priority: EKAttributes.Precedence.Priority = .normal) { + messageNotification( + "_info_", + error: error, + delay: NCGlobal.shared.dismissAfterSecond, + type: .info, + priority: priority) + } + + func showWarning(error: NKError, priority: EKAttributes.Precedence.Priority = .normal) { + messageNotification( + "_warning_", + error: error, + delay: NCGlobal.shared.dismissAfterSecond, + type: .info, + priority: priority) + } + + @objc func messageNotification(_ title: String, error: NKError, delay: TimeInterval, type: messageType) { + messageNotification(title, error: error, delay: delay, type: type, priority: .normal, dropEnqueuedEntries: false) } - func messageNotification(_ title: String, description: String?, delay: TimeInterval, type: messageType, errorCode: Int, priority: EKAttributes.Precedence.Priority = .normal, dropEnqueuedEntries: Bool = false) { + func messageNotification(_ title: String, error: NKError, delay: TimeInterval, type: messageType, priority: EKAttributes.Precedence.Priority = .normal, dropEnqueuedEntries: Bool = false) { // No notification message for: - if errorCode == -999 { return } // Cancelled transfer - else if errorCode == 200 { return } // Transfer stopped - else if errorCode == 207 { return } // WebDAV multistatus - else if errorCode == NCGlobal.shared.errorNoError && type == messageType.error { return } + if error.errorCode == NSURLErrorCancelled || error.errorCode == NCGlobal.shared.errorRequestExplicityCancelled { return } // Cancelled transfer + else if error == .success && type == messageType.error { return } DispatchQueue.main.async { - switch errorCode { + switch error.errorCode { case Int(CFNetworkErrors.cfurlErrorNotConnectedToInternet.rawValue): let image = UIImage(named: "networkInProgress")!.image(color: .white, size: 20) self.noteTop(text: NSLocalizedString(title, comment: ""), image: image, color: .lightGray, delay: delay, priority: .max) default: - guard var description = description else { return } - if description.trimmingCharacters(in: .whitespacesAndNewlines) == "" { return } - description = NSLocalizedString(description, comment: "") + if error.errorDescription.trimmingCharacters(in: .whitespacesAndNewlines) == "" { return } + let description = NSLocalizedString(error.errorDescription, comment: "") self.flatTop(title: NSLocalizedString(title, comment: ""), description: description, delay: delay, imageName: nil, type: type, priority: priority, dropEnqueuedEntries: dropEnqueuedEntries) } } diff --git a/iOSClient/Utility/NCUtility+Image.swift b/iOSClient/Utility/NCUtility+Image.swift index ae79f54db..1cd3bdc37 100644 --- a/iOSClient/Utility/NCUtility+Image.swift +++ b/iOSClient/Utility/NCUtility+Image.swift @@ -23,7 +23,7 @@ import UIKit import SVGKit -import NCCommunication +import NextcloudKit extension NCUtility { func getImageMetadata(_ metadata: tableMetadata, for size: CGFloat) -> UIImage? { @@ -32,7 +32,7 @@ extension NCUtility { return image } - if metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue && !metadata.hasPreview { + if metadata.classFile == NKCommon.typeClassFile.video.rawValue && !metadata.hasPreview { NCUtility.shared.createImageFrom(fileNameView: metadata.fileNameView, ocId: metadata.ocId, etag: metadata.etag, classFile: metadata.classFile) } @@ -42,9 +42,9 @@ extension NCUtility { } } - if metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue { + if metadata.classFile == NKCommon.typeClassFile.video.rawValue { return UIImage(named: "noPreviewVideo")?.image(color: .gray, size: size) - } else if metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue { + } else if metadata.classFile == NKCommon.typeClassFile.audio.rawValue { return UIImage(named: "noPreviewAudio")?.image(color: .gray, size: size) } else { return UIImage(named: "noPreview")?.image(color: .gray, size: size) @@ -55,7 +55,7 @@ extension NCUtility { let ext = CCUtility.getExtension(metadata.fileNameView) var image: UIImage? - if CCUtility.fileProviderStorageExists(metadata) && metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue { + if CCUtility.fileProviderStorageExists(metadata) && metadata.classFile == NKCommon.typeClassFile.image.rawValue { let previewPath = CCUtility.getDirectoryProviderStoragePreviewOcId(metadata.ocId, etag: metadata.etag)! let imagePath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)! diff --git a/iOSClient/Utility/NCUtility.swift b/iOSClient/Utility/NCUtility.swift index a2fb5c331..005bb2d22 100644 --- a/iOSClient/Utility/NCUtility.swift +++ b/iOSClient/Utility/NCUtility.swift @@ -24,7 +24,7 @@ import UIKit import SVGKit import KTVHTTPCache -import NCCommunication +import NextcloudKit import PDFKit import Accelerate import CoreMedia @@ -107,9 +107,9 @@ class NCUtility: NSObject { if !FileManager.default.fileExists(atPath: imageNamePath) || rewrite == true { - NCCommunication.shared.downloadContent(serverUrl: iconURL.absoluteString) { _, data, errorCode, _ in + NextcloudKit.shared.downloadContent(serverUrl: iconURL.absoluteString) { _, data, error in - if errorCode == 0 && data != nil { + if error == .success && data != nil { if let image = UIImage(data: data!) { @@ -379,6 +379,53 @@ class NCUtility: NSObject { // MARK: - + func extractFiles(from metadata: tableMetadata, completition: @escaping (_ metadatas: [tableMetadata]) -> Void) { + + let chunckSize = CCUtility.getChunkSize() * 1000000 + var metadatas: [tableMetadata] = [] + let metadataSource = tableMetadata.init(value: metadata) + + guard !metadata.isExtractFile else { return completition([metadataSource]) } + guard !metadataSource.assetLocalIdentifier.isEmpty else { + let filePath = CCUtility.getDirectoryProviderStorageOcId(metadataSource.ocId, fileNameView: metadataSource.fileName)! + metadataSource.size = NCUtilityFileSystem.shared.getFileSize(filePath: filePath) + let results = NKCommon.shared.getInternalType(fileName: metadataSource.fileNameView, mimeType: metadataSource.contentType, directory: false) + metadataSource.contentType = results.mimeType + metadataSource.iconName = results.iconName + metadataSource.classFile = results.classFile + if let date = NCUtilityFileSystem.shared.getFileCreationDate(filePath: filePath) { metadataSource.creationDate = date } + if let date = NCUtilityFileSystem.shared.getFileModificationDate(filePath: filePath) { metadataSource.date = date } + metadataSource.chunk = chunckSize != 0 && metadata.size > chunckSize + metadataSource.e2eEncrypted = CCUtility.isFolderEncrypted(metadata.serverUrl, e2eEncrypted: metadata.e2eEncrypted, account: metadata.account, urlBase: metadata.urlBase) + metadataSource.isExtractFile = true + if let metadata = NCManageDatabase.shared.addMetadata(metadataSource) { + metadatas.append(metadata) + } + return completition(metadatas) + } + + extractImageVideoFromAssetLocalIdentifier(metadata: metadataSource, modifyMetadataForUpload: true) { metadata, fileNamePath, returnError in + if let metadata = metadata, let fileNamePath = fileNamePath, !returnError { + metadatas.append(metadata) + let toPath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)! + NCUtilityFileSystem.shared.moveFile(atPath: fileNamePath, toPath: toPath) + } else { + return completition(metadatas) + } + let fetchAssets = PHAsset.fetchAssets(withLocalIdentifiers: [metadataSource.assetLocalIdentifier], options: nil) + if metadataSource.livePhoto, fetchAssets.count > 0 { + NCUtility.shared.createMetadataLivePhotoFromMetadata(metadataSource, asset: fetchAssets.firstObject) { metadata in + if let metadata = metadata, let metadata = NCManageDatabase.shared.addMetadata(metadata) { + metadatas.append(metadata) + } + completition(metadatas) + } + } else { + completition(metadatas) + } + } + } + func extractImageVideoFromAssetLocalIdentifier(metadata: tableMetadata, modifyMetadataForUpload: Bool, completion: @escaping (_ metadata: tableMetadata?, _ fileNamePath: String?, _ error: Bool) -> ()) { var fileNamePath: String? @@ -429,7 +476,11 @@ class NCUtility: NSObject { let options = PHImageRequestOptions() options.isNetworkAccessAllowed = true - options.deliveryMode = PHImageRequestOptionsDeliveryMode.highQualityFormat + if compatibilityFormat { + options.deliveryMode = .opportunistic + } else { + options.deliveryMode = .highQualityFormat + } options.isSynchronous = true if extensionAsset == "DNG" { options.version = PHImageRequestOptionsVersion.original @@ -439,7 +490,7 @@ class NCUtility: NSObject { if error != nil { return callCompletion(error: true) } } - PHImageManager.default().requestImageData(for: asset, options: options) { data, dataUI, orientation, info in + PHImageManager.default().requestImageDataAndOrientation(for: asset, options: options) { data, dataUI, orientation, info in guard var data = data else { return callCompletion(error: true) } if compatibilityFormat { guard let ciImage = CIImage.init(data: data), let colorSpace = ciImage.colorSpace, let dataJPEG = CIContext().jpegRepresentation(of: ciImage, colorSpace: colorSpace) else { return callCompletion(error: true) } @@ -510,7 +561,7 @@ class NCUtility: NSObject { PHAssetResourceManager.default().writeData(for: videoResource, toFile: URL(fileURLWithPath: fileNamePath), options: nil) { error in if error != nil { return completion(nil) } let metadataLivePhoto = NCManageDatabase.shared.createMetadata(account: metadata.account, user: metadata.user, userId: metadata.userId, fileName: fileName, fileNameView: fileName, ocId: ocId, serverUrl: metadata.serverUrl, urlBase: metadata.urlBase, url: "", contentType: "", isLivePhoto: true) - metadataLivePhoto.classFile = NCCommunicationCommon.typeClassFile.video.rawValue + metadataLivePhoto.classFile = NKCommon.typeClassFile.video.rawValue metadataLivePhoto.e2eEncrypted = metadata.e2eEncrypted metadataLivePhoto.isExtractFile = true metadataLivePhoto.session = metadata.session @@ -544,7 +595,7 @@ class NCUtility: NSObject { } func imageFromVideo(url: URL, at time: TimeInterval, completion: @escaping (UIImage?) -> Void) { - DispatchQueue.global(qos: .background).async { + DispatchQueue.global().async { let asset = AVURLAsset(url: url) let assetIG = AVAssetImageGenerator(asset: asset) @@ -576,19 +627,19 @@ class NCUtility: NSObject { let fileNamePathIcon = CCUtility.getDirectoryProviderStorageIconOcId(ocId, etag: etag)! if CCUtility.fileProviderStorageSize(ocId, fileNameView: fileNameView) > 0 && FileManager().fileExists(atPath: fileNamePathPreview) && FileManager().fileExists(atPath: fileNamePathIcon) { return } - if classFile != NCCommunicationCommon.typeClassFile.image.rawValue && classFile != NCCommunicationCommon.typeClassFile.video.rawValue { return } + if classFile != NKCommon.typeClassFile.image.rawValue && classFile != NKCommon.typeClassFile.video.rawValue { return } - if classFile == NCCommunicationCommon.typeClassFile.image.rawValue { + if classFile == NKCommon.typeClassFile.image.rawValue { originalImage = UIImage(contentsOfFile: fileNamePath) - scaleImagePreview = originalImage?.resizeImage(size: CGSize(width: NCGlobal.shared.sizePreview, height: NCGlobal.shared.sizePreview), isAspectRation: false) - scaleImageIcon = originalImage?.resizeImage(size: CGSize(width: NCGlobal.shared.sizeIcon, height: NCGlobal.shared.sizeIcon), isAspectRation: false) + scaleImagePreview = originalImage?.resizeImage(size: CGSize(width: NCGlobal.shared.sizePreview, height: NCGlobal.shared.sizePreview)) + scaleImageIcon = originalImage?.resizeImage(size: CGSize(width: NCGlobal.shared.sizeIcon, height: NCGlobal.shared.sizeIcon)) try? scaleImagePreview?.jpegData(compressionQuality: 0.7)?.write(to: URL(fileURLWithPath: fileNamePathPreview)) try? scaleImageIcon?.jpegData(compressionQuality: 0.7)?.write(to: URL(fileURLWithPath: fileNamePathIcon)) - } else if classFile == NCCommunicationCommon.typeClassFile.video.rawValue { + } else if classFile == NKCommon.typeClassFile.video.rawValue { let videoPath = NSTemporaryDirectory()+"tempvideo.mp4" NCUtilityFileSystem.shared.linkItem(atPath: fileNamePath, toPath: videoPath) @@ -617,21 +668,16 @@ class NCUtility: NSObject { var image: UIImage? - if #available(iOS 13.0, *) { - // see https://stackoverflow.com/questions/71764255 - let sfSymbolName = imageName.replacingOccurrences(of: "_", with: ".") - if let symbolConfiguration = symbolConfiguration { - image = UIImage(systemName: sfSymbolName, withConfiguration: symbolConfiguration as? UIImage.Configuration)?.imageColor(color) - } else { - image = UIImage(systemName: sfSymbolName)?.imageColor(color) - } - if image == nil { - image = UIImage(named: imageName)?.image(color: color, size: size) - } + // see https://stackoverflow.com/questions/71764255 + let sfSymbolName = imageName.replacingOccurrences(of: "_", with: ".") + if let symbolConfiguration = symbolConfiguration { + image = UIImage(systemName: sfSymbolName, withConfiguration: symbolConfiguration as? UIImage.Configuration)?.withTintColor(color, renderingMode: .alwaysOriginal) } else { + image = UIImage(systemName: sfSymbolName)?.withTintColor(color, renderingMode: .alwaysOriginal) + } + if image == nil { image = UIImage(named: imageName)?.image(color: color, size: size) } - if let image = image { return image } @@ -654,12 +700,9 @@ class NCUtility: NSObject { } func getDefaultUserIcon() -> UIImage { - if #available(iOS 13.0, *) { - let config = UIImage.SymbolConfiguration(pointSize: 30) - return NCUtility.shared.loadImage(named: "person.crop.circle", symbolConfiguration: config) - } else { - return NCUtility.shared.loadImage(named: "person.crop.circle", size: 30) - } + + let config = UIImage.SymbolConfiguration(pointSize: 30) + return NCUtility.shared.loadImage(named: "person.crop.circle", symbolConfiguration: config) } @objc func createAvatar(image: UIImage, size: CGFloat) -> UIImage { @@ -803,44 +846,24 @@ class NCUtility: NSObject { func colorNavigationController(_ navigationController: UINavigationController?, backgroundColor: UIColor, titleColor: UIColor, tintColor: UIColor?, withoutShadow: Bool) { - if #available(iOS 13.0, *) { - - // iOS 14, 15 - let appearance = UINavigationBarAppearance() - appearance.titleTextAttributes = [.foregroundColor: titleColor] - appearance.largeTitleTextAttributes = [.foregroundColor: titleColor] + let appearance = UINavigationBarAppearance() + appearance.titleTextAttributes = [.foregroundColor: titleColor] + appearance.largeTitleTextAttributes = [.foregroundColor: titleColor] - if withoutShadow { - appearance.shadowColor = .clear - appearance.shadowImage = UIImage() - } - - if let tintColor = tintColor { - navigationController?.navigationBar.tintColor = tintColor - } - - navigationController?.view.backgroundColor = backgroundColor - navigationController?.navigationBar.barTintColor = titleColor - navigationController?.navigationBar.standardAppearance = appearance - navigationController?.navigationBar.compactAppearance = appearance - navigationController?.navigationBar.scrollEdgeAppearance = appearance - - } else { - - navigationController?.navigationBar.isTranslucent = true - navigationController?.navigationBar.barTintColor = backgroundColor - - if withoutShadow { - navigationController?.navigationBar.shadowImage = UIImage() - navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) - } + if withoutShadow { + appearance.shadowColor = .clear + appearance.shadowImage = UIImage() + } - let titleDict: NSDictionary = [NSAttributedString.Key.foregroundColor: titleColor] - navigationController?.navigationBar.titleTextAttributes = titleDict as? [NSAttributedString.Key: Any] - if let tintColor = tintColor { - navigationController?.navigationBar.tintColor = tintColor - } + if let tintColor = tintColor { + navigationController?.navigationBar.tintColor = tintColor } + + navigationController?.view.backgroundColor = backgroundColor + navigationController?.navigationBar.barTintColor = titleColor + navigationController?.navigationBar.standardAppearance = appearance + navigationController?.navigationBar.compactAppearance = appearance + navigationController?.navigationBar.scrollEdgeAppearance = appearance } func getEncondingDataType(data: Data) -> String.Encoding? { @@ -942,4 +965,56 @@ class NCUtility: NSObject { let emailPred = NSPredicate(format:"SELF MATCHES %@", emailRegEx) return emailPred.evaluate(with: email) } + + func createFilePreviewImage(ocId: String, etag: String, fileNameView: String, classFile: String, status: Int, createPreviewMedia: Bool) -> UIImage? { + + var imagePreview: UIImage? + let filePath = CCUtility.getDirectoryProviderStorageOcId(ocId, fileNameView: fileNameView)! + let iconImagePath = CCUtility.getDirectoryProviderStorageIconOcId(ocId, etag: etag)! + + if FileManager().fileExists(atPath: iconImagePath) { + imagePreview = UIImage(contentsOfFile: iconImagePath) + } else if !createPreviewMedia { + return nil + } else if createPreviewMedia && status >= NCGlobal.shared.metadataStatusNormal && classFile == NKCommon.typeClassFile.image.rawValue && FileManager().fileExists(atPath: filePath) { + if let image = UIImage(contentsOfFile: filePath), let image = image.resizeImage(size: CGSize(width: NCGlobal.shared.sizeIcon, height: NCGlobal.shared.sizeIcon)), let data = image.jpegData(compressionQuality: 0.5) { + do { + try data.write(to: URL.init(fileURLWithPath: iconImagePath), options: .atomic) + imagePreview = image + } catch { } + } + } else if createPreviewMedia && status >= NCGlobal.shared.metadataStatusNormal && classFile == NKCommon.typeClassFile.video.rawValue && FileManager().fileExists(atPath: filePath) { + if let image = NCUtility.shared.imageFromVideo(url: URL(fileURLWithPath: filePath), at: 0), let image = image.resizeImage(size: CGSize(width: NCGlobal.shared.sizeIcon, height: NCGlobal.shared.sizeIcon)), let data = image.jpegData(compressionQuality: 0.5) { + do { + try data.write(to: URL.init(fileURLWithPath: iconImagePath), options: .atomic) + imagePreview = image + } catch { } + } + } + + return imagePreview + } + + @discardableResult + func convertDataToImage(data: Data?, size:CGSize, fileNameToWrite: String?) -> UIImage? { + + guard let data = data else { return nil } + var returnImage: UIImage? + + if let image = UIImage(data: data), let image = image.resizeImage(size: size) { + returnImage = image + } else if let image = SVGKImage(data: data) { + image.size = size + returnImage = image.uiImage + } else { + print("error") + } + if let fileName = fileNameToWrite, let image = returnImage { + do { + let fileNamePath: String = CCUtility.getDirectoryUserData() + "/" + fileName + ".png" + try image.pngData()?.write(to: URL(fileURLWithPath: fileNamePath), options: .atomic) + } catch { } + } + return returnImage + } } diff --git a/iOSClient/Utility/NCUtilityFileSystem.swift b/iOSClient/Utility/NCUtilityFileSystem.swift index 9dedc0951..3870afc51 100644 --- a/iOSClient/Utility/NCUtilityFileSystem.swift +++ b/iOSClient/Utility/NCUtilityFileSystem.swift @@ -165,10 +165,12 @@ class NCUtilityFileSystem: NSObject { return home } - @objc func getPath(metadata: tableMetadata, withFileName: Bool) -> String { + @objc func getPath(path: String, user: String, fileName: String? = nil) -> String { - var path = metadata.path.replacingOccurrences(of: "/remote.php/dav/files/"+metadata.user, with: "") - if withFileName { path += metadata.fileName } + var path = path.replacingOccurrences(of: "/remote.php/dav/files/" + user, with: "") + if let fileName = fileName { + path += fileName + } return path } diff --git a/iOSClient/Utility/ParallelWorker.swift b/iOSClient/Utility/ParallelWorker.swift index c8bf7a917..3fc51c5c7 100644 --- a/iOSClient/Utility/ParallelWorker.swift +++ b/iOSClient/Utility/ParallelWorker.swift @@ -56,8 +56,13 @@ class ParallelWorker { hud.detailTextLabel.text = NSLocalizedString("_tap_to_cancel_", comment: "") hud.tapOnHUDViewBlock = { hud in self.isCancelled = true - // Cancel all download - NCNetworking.shared.cancelAllDownloadTransfer() + // Cancel all download / upload + for uploadRequest in NCNetworking.shared.uploadRequest { + uploadRequest.value.cancel() + } + for downloadRequest in NCNetworking.shared.downloadRequest { + downloadRequest.value.cancel() + } hud.dismiss() } self.hud = hud diff --git a/iOSClient/Viewer/NCViewer.swift b/iOSClient/Viewer/NCViewer.swift index af4c7b3cc..691c7537b 100644 --- a/iOSClient/Viewer/NCViewer.swift +++ b/iOSClient/Viewer/NCViewer.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit import QuickLook class NCViewer: NSObject { @@ -42,10 +42,25 @@ class NCViewer: NSObject { self.metadatas = metadatas var editor = editor - var xxxxxxx = NCCommunicationCommon.shared.getInternalTypeIdentifier(typeIdentifier: metadata.contentType) + var xxxxxxx = NKCommon.shared.getInternalTypeIdentifier(typeIdentifier: metadata.contentType) // URL - if metadata.classFile == NCCommunicationCommon.typeClassFile.url.rawValue { + if metadata.classFile == NKCommon.typeClassFile.url.rawValue { + + // nextcloudtalk://open-conversation?server={serverURL}&user={userId}&withRoomToken={roomToken} + if metadata.name == NCGlobal.shared.talkName { + let pathComponents = metadata.url.components(separatedBy: "/") + if pathComponents.contains("call") { + let talkComponents = pathComponents.last?.components(separatedBy: "#") + if let roomToken = talkComponents?.first { + let urlString = "nextcloudtalk://open-conversation?server=\(appDelegate.urlBase)&user=\(appDelegate.userId)&withRoomToken=\(roomToken)" + if let url = URL(string: urlString), UIApplication.shared.canOpenURL(url) { + UIApplication.shared.open(url) + return + } + } + } + } if let url = URL(string: metadata.url) { UIApplication.shared.open(url) @@ -54,7 +69,7 @@ class NCViewer: NSObject { } // IMAGE AUDIO VIDEO - if metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue { + if metadata.classFile == NKCommon.typeClassFile.image.rawValue || metadata.classFile == NKCommon.typeClassFile.audio.rawValue || metadata.classFile == NKCommon.typeClassFile.video.rawValue { if let navigationController = viewController.navigationController { @@ -75,7 +90,7 @@ class NCViewer: NSObject { } // DOCUMENTS - if metadata.classFile == NCCommunicationCommon.typeClassFile.document.rawValue { + if metadata.classFile == NKCommon.typeClassFile.document.rawValue { // PDF if metadata.contentType == "application/pdf" || metadata.contentType == "com.adobe.pdf" { @@ -97,16 +112,16 @@ class NCViewer: NSObject { let availableRichDocument = NCUtility.shared.isRichDocument(metadata) // RichDocument: Collabora - if (isRichDocument || (availableRichDocument && editors.count == 0)) && NCCommunication.shared.isNetworkReachable() { + if (isRichDocument || (availableRichDocument && editors.count == 0)) && NextcloudKit.shared.isNetworkReachable() { if metadata.url == "" { NCActivityIndicator.shared.start(backgroundView: viewController.view) - NCCommunication.shared.createUrlRichdocuments(fileID: metadata.fileId) { account, url, errorCode, errorDescription in + NextcloudKit.shared.createUrlRichdocuments(fileID: metadata.fileId) { account, url, data, error in NCActivityIndicator.shared.stop() - if errorCode == 0 && account == self.appDelegate.account && url != nil { + if error == .success && account == self.appDelegate.account && url != nil { if let navigationController = viewController.navigationController { @@ -119,9 +134,9 @@ class NCViewer: NSObject { navigationController.pushViewController(viewController, animated: true) } - } else if errorCode != 0 { + } else if error != .success { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCContentPresenter.shared.showError(error: error) } } @@ -143,7 +158,7 @@ class NCViewer: NSObject { } // DirectEditing: Nextcloud Text - OnlyOffice - if editors.count > 0 && NCCommunication.shared.isNetworkReachable() { + if editors.count > 0 && NextcloudKit.shared.isNetworkReachable() { if editor == "" { if editors.contains(NCGlobal.shared.editorText) { @@ -157,21 +172,21 @@ class NCViewer: NSObject { if metadata.url == "" { - var customUserAgent: String? let fileNamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, urlBase: metadata.urlBase, account: metadata.account)! + var options = NKRequestOptions() if editor == NCGlobal.shared.editorOnlyoffice { - customUserAgent = NCUtility.shared.getCustomUserAgentOnlyOffice() + options = NKRequestOptions(customUserAgent: NCUtility.shared.getCustomUserAgentOnlyOffice()) } else { - customUserAgent = NCUtility.shared.getCustomUserAgentNCText() + options = NKRequestOptions(customUserAgent: NCUtility.shared.getCustomUserAgentNCText()) } NCActivityIndicator.shared.start(backgroundView: viewController.view) - NCCommunication.shared.NCTextOpenFile(fileNamePath: fileNamePath, editor: editor, customUserAgent: customUserAgent) { account, url, errorCode, errorMessage in + NextcloudKit.shared.NCTextOpenFile(fileNamePath: fileNamePath, editor: editor, options: options) { account, url, data, error in NCActivityIndicator.shared.stop() - if errorCode == 0 && account == self.appDelegate.account && url != nil { + if error == .success && account == self.appDelegate.account && url != nil { if let navigationController = viewController.navigationController { @@ -185,9 +200,9 @@ class NCViewer: NSObject { navigationController.pushViewController(viewController, animated: true) } - } else if errorCode != 0 { + } else if error != .success { - NCContentPresenter.shared.messageNotification("_error_", description: errorMessage, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCContentPresenter.shared.showError(error: error) } } @@ -207,8 +222,8 @@ class NCViewer: NSObject { } } else { - - NCContentPresenter.shared.messageNotification("_error_", description: "_editor_unknown_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_editor_unknown_") + NCContentPresenter.shared.showError(error: error) } return @@ -236,17 +251,17 @@ extension NCViewer: NCSelectDelegate { if let serverUrl = serverUrl { let metadata = items[0] as! tableMetadata if move { - NCNetworking.shared.moveMetadata(metadata, serverUrlTo: serverUrl, overwrite: overwrite) { errorCode, errorDescription in - if errorCode != 0 { + NCNetworking.shared.moveMetadata(metadata, serverUrlTo: serverUrl, overwrite: overwrite) { error in + if error != .success { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCContentPresenter.shared.showError(error: error) } } } else if copy { - NCNetworking.shared.copyMetadata(metadata, serverUrlTo: serverUrl, overwrite: overwrite) { errorCode, errorDescription in - if errorCode != 0 { + NCNetworking.shared.copyMetadata(metadata, serverUrlTo: serverUrl, overwrite: overwrite) { error in + if error != .success { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCContentPresenter.shared.showError(error: error) } } } diff --git a/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayer.swift b/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayer.swift index 4d3ed9cfd..fce146909 100644 --- a/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayer.swift +++ b/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayer.swift @@ -22,7 +22,7 @@ // import Foundation -import NCCommunication +import NextcloudKit import UIKit import AVFoundation import MediaPlayer @@ -121,7 +121,7 @@ class NCPlayer: NSObject { if metadata.livePhoto { player?.isMuted = false - } else if metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue { + } else if metadata.classFile == NKCommon.typeClassFile.audio.rawValue { player?.isMuted = CCUtility.getAudioMute() } else { player?.isMuted = CCUtility.getAudioMute() @@ -174,7 +174,7 @@ class NCPlayer: NSObject { self.videoLayer!.frame = self.imageVideoContainer?.bounds ?? .zero self.videoLayer!.videoGravity = .resizeAspect - if self.metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue { + if self.metadata.classFile == NKCommon.typeClassFile.video.rawValue { self.imageVideoContainer?.layer.addSublayer(self.videoLayer!) self.imageVideoContainer?.playerLayer = self.videoLayer self.imageVideoContainer?.metadata = self.metadata @@ -211,9 +211,11 @@ class NCPlayer: NSObject { } #endif if let title = error?.localizedDescription, let description = error?.localizedFailureReason { - NCContentPresenter.shared.messageNotification(title, description: description, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorGeneric, priority: .max) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: description) + NCContentPresenter.shared.messageNotification(title, error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max) } else { - NCContentPresenter.shared.messageNotification("_error_", description: "_error_something_wrong_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorGeneric, priority: .max) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_error_something_wrong_") + NCContentPresenter.shared.showError(error: error, priority: .max) } } break @@ -315,7 +317,7 @@ class NCPlayer: NSObject { @objc func applicationDidEnterBackground(_ notification: NSNotification) { - if metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue, let playerToolBar = self.playerToolBar { + if metadata.classFile == NKCommon.typeClassFile.video.rawValue, let playerToolBar = self.playerToolBar { if !playerToolBar.isPictureInPictureActive() { playerPause() } @@ -364,7 +366,7 @@ class NCPlayer: NSObject { func saveTime(_ time: CMTime) { - if metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue { return } + if metadata.classFile == NKCommon.typeClassFile.audio.rawValue { return } NCManageDatabase.shared.addVideoTime(metadata: metadata, time: time, durationTime: nil) generatorImagePreview() @@ -379,7 +381,7 @@ class NCPlayer: NSObject { @objc func generatorImagePreview() { - guard let time = player?.currentTime(), !metadata.livePhoto, metadata.classFile != NCCommunicationCommon.typeClassFile.audio.rawValue else { return } + guard let time = player?.currentTime(), !metadata.livePhoto, metadata.classFile != NKCommon.typeClassFile.audio.rawValue else { return } var image: UIImage? @@ -433,14 +435,14 @@ class NCPlayer: NSObject { downloadRequest?.cancel() } - NCCommunication.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath) { request in + NextcloudKit.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath) { request in downloadRequest = request } taskHandler: { task in // task } progressHandler: { progress in hud.progress = Float(progress.fractionCompleted) - } completionHandler: { _, _, _, _, _, error, _, _ in - if error == nil { + } completionHandler: { _, _, _, _, _, afError, error in + if afError == nil { NCManageDatabase.shared.addLocalFile(metadata: self.metadata) let urlVideo = NCKTVHTTPCache.shared.getVideoURL(metadata: self.metadata) if let url = urlVideo.url { diff --git a/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift b/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift index b266024f4..24212b7ec 100644 --- a/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift +++ b/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift @@ -22,7 +22,7 @@ // import Foundation -import NCCommunication +import NextcloudKit import CoreMedia import UIKit import AVKit @@ -116,11 +116,7 @@ class NCPlayerToolBar: UIView { backButton.setImage(NCUtility.shared.loadImage(named: "gobackward.10", color: .lightGray), for: .normal) backButton.isEnabled = false - if #available(iOS 13.0, *) { - playButton.setImage(NCUtility.shared.loadImage(named: "play.fill", color: .lightGray, symbolConfiguration: UIImage.SymbolConfiguration(pointSize: 30)), for: .normal) - } else { - playButton.setImage(NCUtility.shared.loadImage(named: "play.fill", color: .lightGray, size: 30), for: .normal) - } + playButton.setImage(NCUtility.shared.loadImage(named: "play.fill", color: .lightGray, symbolConfiguration: UIImage.SymbolConfiguration(pointSize: 30)), for: .normal) playButton.isEnabled = false forwardButton.setImage(NCUtility.shared.loadImage(named: "goforward.10", color: .lightGray), for: .normal) @@ -179,7 +175,7 @@ class NCPlayerToolBar: UIView { // PIP if let pipButton = pipButton { - if metadata?.classFile == NCCommunicationCommon.typeClassFile.video.rawValue && AVPictureInPictureController.isPictureInPictureSupported() { + if metadata?.classFile == NKCommon.typeClassFile.video.rawValue && AVPictureInPictureController.isPictureInPictureSupported() { pipButton.setImage(NCUtility.shared.loadImage(named: "pip.enter", color: .white), for: .normal) pipButton.isEnabled = true } else { @@ -197,11 +193,7 @@ class NCPlayerToolBar: UIView { labelLeftTime.text = "-" + NCUtility.shared.stringFromTime(ncplayer.durationTime - time) // BACK - if #available(iOS 13.0, *) { - backButton.setImage(NCUtility.shared.loadImage(named: "gobackward.10", color: .white), for: .normal) - } else { - backButton.setImage(NCUtility.shared.loadImage(named: "gobackward.10", color: .white, size: 30), for: .normal) - } + backButton.setImage(NCUtility.shared.loadImage(named: "gobackward.10", color: .white), for: .normal) backButton.isEnabled = true // PLAY @@ -211,19 +203,11 @@ class NCPlayerToolBar: UIView { MPNowPlayingInfoCenter.default().nowPlayingInfo?[MPNowPlayingInfoPropertyPlaybackRate] = 0 } let namedPlay = ncplayer.isPlay() ? "pause.fill" : "play.fill" - if #available(iOS 13.0, *) { - playButton.setImage(NCUtility.shared.loadImage(named: namedPlay, color: .white, symbolConfiguration: UIImage.SymbolConfiguration(pointSize: 30)), for: .normal) - } else { - playButton.setImage(NCUtility.shared.loadImage(named: namedPlay, color: .white, size: 30), for: .normal) - } + playButton.setImage(NCUtility.shared.loadImage(named: namedPlay, color: .white, symbolConfiguration: UIImage.SymbolConfiguration(pointSize: 30)), for: .normal) playButton.isEnabled = true // FORWARD - if #available(iOS 13.0, *) { - forwardButton.setImage(NCUtility.shared.loadImage(named: "goforward.10", color: .white), for: .normal) - } else { - forwardButton.setImage(NCUtility.shared.loadImage(named: "goforward.10", color: .white, size: 30), for: .normal) - } + forwardButton.setImage(NCUtility.shared.loadImage(named: "goforward.10", color: .white), for: .normal) forwardButton.isEnabled = true } @@ -280,7 +264,7 @@ class NCPlayerToolBar: UIView { public func show(enableTimerAutoHide: Bool = false) { guard let metadata = self.metadata, ncplayer != nil, !metadata.livePhoto else { return } - if metadata.classFile != NCCommunicationCommon.typeClassFile.video.rawValue && metadata.classFile != NCCommunicationCommon.typeClassFile.audio.rawValue { return } + if metadata.classFile != NKCommon.typeClassFile.video.rawValue && metadata.classFile != NKCommon.typeClassFile.audio.rawValue { return } #if MFFFLIB if MFFF.shared.existsMFFFSession(url: URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView))) { diff --git a/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCSubtitle/NCSubtitlePlayer.swift b/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCSubtitle/NCSubtitlePlayer.swift index 3955fe8b5..fa345fa50 100644 --- a/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCSubtitle/NCSubtitlePlayer.swift +++ b/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCSubtitle/NCSubtitlePlayer.swift @@ -25,6 +25,7 @@ import Foundation import AVKit +import NextcloudKit extension NCPlayer { @@ -134,7 +135,8 @@ extension NCPlayer { } } if all.count != existing.count { - NCContentPresenter.shared.messageNotification("_info_", description: "_subtitle_not_dowloaded_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorNoError) + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_subtitle_not_dowloaded_") + NCContentPresenter.shared.showInfo(error: error) } self.setSubtitleToolbarIcon(subtitleUrls: subtitleUrls) self.hideSubtitle() @@ -153,8 +155,8 @@ extension NCPlayer { NotificationCenter.default.addObserver(self, selector: #selector(deviceRotated(_:)), name: UIDevice.orientationDidChangeNotification, object: nil) } - func loadText(filePath: URL, _ completion:@escaping (_ contents: String?) -> Void) { - DispatchQueue.global(qos: .background).async { + func loadText(filePath: URL, _ completion: @escaping (_ contents: String?) -> Void) { + DispatchQueue.global().async { guard let data = try? Data(contentsOf: filePath), let encoding = NCUtility.shared.getEncondingDataType(data: data) else { return diff --git a/iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift b/iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift index 824c82972..d8afe6169 100644 --- a/iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift +++ b/iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift @@ -23,7 +23,7 @@ import UIKit import SVGKit -import NCCommunication +import NextcloudKit import EasyTipView import SwiftUI @@ -97,7 +97,7 @@ class NCViewerMedia: UIViewController { statusLabel.text = "" } - if metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue { + if metadata.classFile == NKCommon.typeClassFile.video.rawValue || metadata.classFile == NKCommon.typeClassFile.audio.rawValue { playerToolBar = Bundle.main.loadNibNamed("NCPlayerToolBar", owner: self, options: nil)?.first as? NCPlayerToolBar if let playerToolBar = playerToolBar { @@ -147,7 +147,7 @@ class NCViewerMedia: UIViewController { viewerMediaPage?.navigationController?.navigationBar.prefersLargeTitles = false viewerMediaPage?.navigationItem.title = metadata.fileNameView - if metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue, let viewerMediaPage = self.viewerMediaPage { + if metadata.classFile == NKCommon.typeClassFile.image.rawValue, let viewerMediaPage = self.viewerMediaPage { viewerMediaPage.currentScreenMode = viewerMediaPage.saveScreenModeImage if viewerMediaPage.modifiedOcId.contains(metadata.ocId) { viewerMediaPage.modifiedOcId.removeAll(where: { $0 == metadata.ocId }) @@ -169,10 +169,10 @@ class NCViewerMedia: UIViewController { viewerMediaPage?.navigationController?.setNavigationBarHidden(false, animated: true) - NCUtility.shared.colorNavigationController(viewerMediaPage?.navigationController, backgroundColor: NCBrandColor.shared.systemBackground, titleColor: NCBrandColor.shared.label, tintColor: nil, withoutShadow: false) + NCUtility.shared.colorNavigationController(viewerMediaPage?.navigationController, backgroundColor: .systemBackground, titleColor: .label, tintColor: nil, withoutShadow: false) - viewerMediaPage?.view.backgroundColor = NCBrandColor.shared.systemBackground - viewerMediaPage?.textColor = NCBrandColor.shared.label + viewerMediaPage?.view.backgroundColor = .systemBackground + viewerMediaPage?.textColor = .label viewerMediaPage?.progressView.isHidden = false } } @@ -180,22 +180,19 @@ class NCViewerMedia: UIViewController { override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) - if metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue { + if metadata.classFile == NKCommon.typeClassFile.video.rawValue || metadata.classFile == NKCommon.typeClassFile.audio.rawValue { if let ncplayer = self.ncplayer { ncplayer.openAVPlayer() self.viewerMediaPage?.updateCommandCenter(ncplayer: ncplayer, metadata: self.metadata) } - } else if metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue { + } else if metadata.classFile == NKCommon.typeClassFile.image.rawValue { viewerMediaPage?.clearCommandCenter() } - // TIP - if !NCManageDatabase.shared.tipExists(NCGlobal.shared.tipNCViewerMediaDetailView), let view = self.navigationController?.navigationBar { - self.tipView?.show(forView: view) - } + showTip() NotificationCenter.default.addObserver(self, selector: #selector(openDetail(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterOpenMediaDetail), object: nil) } @@ -210,7 +207,6 @@ class NCViewerMedia: UIViewController { super.viewWillTransition(to: size, with: coordinator) self.tipView?.dismiss() - coordinator.animate(alongsideTransition: { context in // back to the original size self.scrollView.zoom(to: CGRect(x: 0, y: 0, width: self.scrollView.bounds.width, height: self.scrollView.bounds.height), animated: false) @@ -220,7 +216,18 @@ class NCViewerMedia: UIViewController { self.openDetail() } } - }) { _ in } + }, completion: { context in + self.showTip() + }) + } + + // MARK: - Tip + + func showTip() { + + if !NCManageDatabase.shared.tipExists(NCGlobal.shared.tipNCViewerMediaDetailView), let view = self.navigationController?.navigationBar { + self.tipView?.show(forView: view) + } } // MARK: - Image @@ -235,16 +242,16 @@ class NCViewerMedia: UIViewController { func loadImage(metadata: tableMetadata) { // Download image - if !CCUtility.fileProviderStorageExists(metadata) && metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue && metadata.session == "" { + if !CCUtility.fileProviderStorageExists(metadata) && metadata.classFile == NKCommon.typeClassFile.image.rawValue && metadata.session == "" { if metadata.livePhoto { let fileName = (metadata.fileNameView as NSString).deletingPathExtension + ".mov" if let metadata = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameView LIKE[c] %@", metadata.account, metadata.serverUrl, fileName)), !CCUtility.fileProviderStorageExists(metadata) { - NCNetworking.shared.download(metadata: metadata, selector: "") { _ in } + NCNetworking.shared.download(metadata: metadata, selector: "") { _, _ in } } } - NCNetworking.shared.download(metadata: metadata, selector: "") { _ in + NCNetworking.shared.download(metadata: metadata, selector: "") { _, _ in let image = getImageMetadata(metadata) if self.metadata.ocId == metadata.ocId && self.imageVideoContainer.layer.sublayers?.count == nil { self.image = image @@ -266,7 +273,7 @@ class NCViewerMedia: UIViewController { return image } - if metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue && !metadata.hasPreview { + if metadata.classFile == NKCommon.typeClassFile.video.rawValue && !metadata.hasPreview { NCUtility.shared.createImageFrom(fileNameView: metadata.fileNameView, ocId: metadata.ocId, etag: metadata.etag, classFile: metadata.classFile) } @@ -276,9 +283,9 @@ class NCViewerMedia: UIViewController { } } - if metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue { + if metadata.classFile == NKCommon.typeClassFile.video.rawValue { return UIImage(named: "noPreviewVideo")!.image(color: .gray, size: view.frame.width) - } else if metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue { + } else if metadata.classFile == NKCommon.typeClassFile.audio.rawValue { return UIImage(named: "noPreviewAudio")!.image(color: .gray, size: view.frame.width) } else { return UIImage(named: "noPreview")!.image(color: .gray, size: view.frame.width) @@ -290,7 +297,7 @@ class NCViewerMedia: UIViewController { let ext = CCUtility.getExtension(metadata.fileNameView) var image: UIImage? - if CCUtility.fileProviderStorageExists(metadata) && metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue { + if CCUtility.fileProviderStorageExists(metadata) && metadata.classFile == NKCommon.typeClassFile.image.rawValue { let previewPath = CCUtility.getDirectoryProviderStoragePreviewOcId(metadata.ocId, etag: metadata.etag)! let imagePath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)! @@ -332,7 +339,7 @@ class NCViewerMedia: UIViewController { if detailView.isShow() { return } // NO ZOOM for Audio - if metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue { return } + if metadata.classFile == NKCommon.typeClassFile.audio.rawValue { return } let pointInView = gestureRecognizer.location(in: self.imageVideoContainer) var newZoomScale = self.scrollView.maximumZoomScale @@ -443,7 +450,9 @@ extension NCViewerMedia { let ratioH = self.imageVideoContainer.frame.height / image.size.height let ratio = ratioW < ratioH ? ratioW : ratioH let imageHeight = image.size.height * ratio - self.imageViewConstraint = self.detailView.frame.height - ((self.view.frame.height - imageHeight) / 2) + self.view.safeAreaInsets.bottom + let VideoContainerHeight = self.imageVideoContainer.frame.height * ratio + let height = max(imageHeight, VideoContainerHeight) + self.imageViewConstraint = self.detailView.frame.height - ((self.view.frame.height - height) / 2) + self.view.safeAreaInsets.bottom if self.imageViewConstraint < 0 { self.imageViewConstraint = 0 } } @@ -474,7 +483,7 @@ extension NCViewerMedia { } scrollView.pinchGestureRecognizer?.isEnabled = true - if metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue && !metadata.livePhoto && ncplayer?.player?.timeControlStatus == .paused { + if metadata.classFile == NKCommon.typeClassFile.video.rawValue && !metadata.livePhoto && ncplayer?.player?.timeControlStatus == .paused { NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterShowPlayerToolBar, userInfo: ["ocId": metadata.ocId, "enableTimerAutoHide": false]) } } @@ -534,7 +543,7 @@ extension NCViewerMedia: NCViewerMediaDetailViewDelegate { func downloadFullResolution() { closeDetail() - NCNetworking.shared.download(metadata: metadata, selector: NCGlobal.shared.selectorOpenDetail) { _ in } + NCNetworking.shared.download(metadata: metadata, selector: NCGlobal.shared.selectorOpenDetail) { _, _ in } } } diff --git a/iOSClient/Viewer/NCViewerMedia/NCViewerMediaDetailView.swift b/iOSClient/Viewer/NCViewerMedia/NCViewerMediaDetailView.swift index 5bccecde7..94b0d1573 100644 --- a/iOSClient/Viewer/NCViewerMedia/NCViewerMediaDetailView.swift +++ b/iOSClient/Viewer/NCViewerMedia/NCViewerMediaDetailView.swift @@ -23,7 +23,7 @@ import UIKit import MapKit -import NCCommunication +import NextcloudKit typealias NCImageMetadata = (latitude: Double, longitude: Double, location: String?, date: Date?, lensModel: String?) @@ -59,7 +59,7 @@ class NCViewerMediaDetailView: UIView { override func awakeFromNib() { super.awakeFromNib() - separator.backgroundColor = NCBrandColor.shared.separator + separator.backgroundColor = .separator sizeLabel.text = "" sizeValue.text = "" dateLabel.text = "" @@ -141,12 +141,12 @@ class NCViewerMediaDetailView: UIView { dateValue.textColor = textColor // Dimension / Duration - if metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue { + if metadata.classFile == NKCommon.typeClassFile.image.rawValue { if let image = image { dimLabel.text = NSLocalizedString("_resolution_", comment: "") dimValue.text = "\(Int(image.size.width)) x \(Int(image.size.height))" } - } else if metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue { + } else if metadata.classFile == NKCommon.typeClassFile.video.rawValue || metadata.classFile == NKCommon.typeClassFile.audio.rawValue { if let durationTime = NCManageDatabase.shared.getVideoDurationTime(metadata: metadata) { self.dimLabel.text = NSLocalizedString("_duration_", comment: "") self.dimValue.text = NCUtility.shared.stringFromTime(durationTime) @@ -162,7 +162,7 @@ class NCViewerMediaDetailView: UIView { } // Message - if metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue && !CCUtility.fileProviderStorageExists(metadata) && metadata.session.isEmpty { + if metadata.classFile == NKCommon.typeClassFile.image.rawValue && !CCUtility.fileProviderStorageExists(metadata) && metadata.session.isEmpty { messageButton.setTitle(NSLocalizedString("_try_download_full_resolution_", comment: ""), for: .normal) messageButton.isHidden = false } else { diff --git a/iOSClient/Viewer/NCViewerMedia/NCViewerMediaPage.swift b/iOSClient/Viewer/NCViewerMedia/NCViewerMediaPage.swift index 9ca9f6140..ad23a1725 100644 --- a/iOSClient/Viewer/NCViewerMedia/NCViewerMediaPage.swift +++ b/iOSClient/Viewer/NCViewerMedia/NCViewerMediaPage.swift @@ -22,7 +22,7 @@ // import UIKit -import NCCommunication +import NextcloudKit import MediaPlayer class NCViewerMediaPage: UIViewController { @@ -51,7 +51,7 @@ class NCViewerMediaPage: UIViewController { var panGestureRecognizer: UIPanGestureRecognizer! var singleTapGestureRecognizer: UITapGestureRecognizer! var longtapGestureRecognizer: UILongPressGestureRecognizer! - var textColor: UIColor = NCBrandColor.shared.label + var textColor: UIColor = .label var playCommand: Any? var pauseCommand: Any? var skipForwardCommand: Any? @@ -64,7 +64,7 @@ class NCViewerMediaPage: UIViewController { override func viewDidLoad() { super.viewDidLoad() - navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "more")!.image(color: NCBrandColor.shared.label, size: 25), style: .plain, target: self, action: #selector(self.openMenuMore)) + navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "more")!.image(color: .label, size: 25), style: .plain, target: self, action: #selector(self.openMenuMore)) singleTapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(didSingleTapWith(gestureRecognizer:))) panGestureRecognizer = UIPanGestureRecognizer(target: self, action: #selector(didPanWith(gestureRecognizer:))) @@ -187,9 +187,9 @@ class NCViewerMediaPage: UIViewController { currentViewController.playerToolBar?.show(enableTimerAutoHide: enableTimerAutoHide) } - NCUtility.shared.colorNavigationController(navigationController, backgroundColor: NCBrandColor.shared.systemBackground, titleColor: NCBrandColor.shared.label, tintColor: nil, withoutShadow: false) - view.backgroundColor = NCBrandColor.shared.systemBackground - textColor = NCBrandColor.shared.label + NCUtility.shared.colorNavigationController(navigationController, backgroundColor: .systemBackground, titleColor: .label, tintColor: nil, withoutShadow: false) + view.backgroundColor = .systemBackground + textColor = .label } else { @@ -204,7 +204,7 @@ class NCViewerMediaPage: UIViewController { currentScreenMode = mode - if currentViewController.metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue { + if currentViewController.metadata.classFile == NKCommon.typeClassFile.image.rawValue { saveScreenModeImage = mode } @@ -249,8 +249,8 @@ class NCViewerMediaPage: UIViewController { guard let userInfo = notification.userInfo as NSDictionary?, let ocId = userInfo["ocId"] as? String, - let errorCode = userInfo["errorCode"] as? Int, - errorCode == 0, + let error = userInfo["error"] as? NKError, + error == .success, let index = metadatas.firstIndex(where: {$0.ocId == ocId}), let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) else { @@ -368,7 +368,7 @@ class NCViewerMediaPage: UIViewController { } // VIDEO / AUDIO () () - if metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue { + if metadata.classFile == NKCommon.typeClassFile.video.rawValue || metadata.classFile == NKCommon.typeClassFile.audio.rawValue { MPRemoteCommandCenter.shared().skipForwardCommand.isEnabled = true skipForwardCommand = MPRemoteCommandCenter.shared().skipForwardCommand.addTarget { event in diff --git a/iOSClient/Viewer/NCViewerNextcloudText/NCViewerNextcloudText.swift b/iOSClient/Viewer/NCViewerNextcloudText/NCViewerNextcloudText.swift index f6e1ae548..9b7335c57 100644 --- a/iOSClient/Viewer/NCViewerNextcloudText/NCViewerNextcloudText.swift +++ b/iOSClient/Viewer/NCViewerNextcloudText/NCViewerNextcloudText.swift @@ -44,7 +44,7 @@ class NCViewerNextcloudText: UIViewController, WKNavigationDelegate, WKScriptMes override func viewDidLoad() { super.viewDidLoad() - navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "more")!.image(color: NCBrandColor.shared.label, size: 25), style: .plain, target: self, action: #selector(self.openMenuMore)) + navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "more")!.image(color: .label, size: 25), style: .plain, target: self, action: #selector(self.openMenuMore)) navigationController?.navigationBar.prefersLargeTitles = false navigationItem.title = metadata.fileNameView diff --git a/iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift b/iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift index 76ec451d7..751dcd0bc 100644 --- a/iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift +++ b/iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift @@ -24,6 +24,7 @@ import UIKit import PDFKit import EasyTipView +import NextcloudKit class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate { @@ -44,6 +45,7 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate { private let thumbnailViewWidth: CGFloat = 80 private let thumbnailPadding: CGFloat = 2 private let animateDuration: TimeInterval = 0.3 + private let pageViewtopAnchor: CGFloat = UIDevice.current.userInterfaceIdiom == .phone ? 10 : 30 private var defaultBackgroundColor: UIColor = .clear @@ -63,30 +65,23 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate { filePath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)! pdfDocument = PDFDocument(url: URL(fileURLWithPath: filePath)) let pageCount = CGFloat(pdfDocument?.pageCount ?? 0) - if #available(iOS 13.0, *) { - defaultBackgroundColor = pdfView.backgroundColor - } else { - defaultBackgroundColor = .lightGray - } + defaultBackgroundColor = pdfView.backgroundColor view.backgroundColor = defaultBackgroundColor - navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "more")!.image(color: NCBrandColor.shared.label, size: 25), style: .plain, target: self, action: #selector(self.openMenuMore)) + navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "more")!.image(color: .label, size: 25), style: .plain, target: self, action: #selector(self.openMenuMore)) navigationItem.title = metadata.fileNameView // PDF VIEW - if UIDevice.current.userInterfaceIdiom == .phone { - pdfView = PDFView(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: view.frame.height)) - } else { - pdfView = PDFView(frame: CGRect(x: 0, y: 0, width: view.frame.width-thumbnailViewWidth, height: view.frame.height)) - } + pdfView = PDFView(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: view.frame.height)) pdfView.autoresizingMask = [.flexibleWidth, .flexibleHeight, .flexibleTopMargin, .flexibleLeftMargin] pdfView.document = pdfDocument pdfView.autoScales = true pdfView.displayMode = .singlePageContinuous pdfView.displayDirection = .vertical - pdfView.maxScaleFactor = 4.0 - pdfView.minScaleFactor = pdfView.scaleFactorForSizeToFit + //pdfView.maxScaleFactor = 4.0 + //pdfView.minScaleFactor = pdfView.scaleFactorForSizeToFit + pdfView.usePageViewController(true) view.addSubview(pdfView) // PDF THUMBNAIL @@ -109,11 +104,8 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate { pdfThumbnailView.layoutMode = .vertical pdfThumbnailView.thumbnailSize = CGSize(width: thumbnailViewHeight, height: thumbnailViewHeight) pdfThumbnailView.backgroundColor = .clear - if UIDevice.current.userInterfaceIdiom == .phone { - self.pdfThumbnailScrollView.isHidden = true - } else { - self.pdfThumbnailScrollView.isHidden = false - } + + pdfThumbnailScrollView.isHidden = true pdfThumbnailScrollView.addSubview(pdfThumbnailView) NSLayoutConstraint.activate([ @@ -136,13 +128,13 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate { pageView.translatesAutoresizingMaskIntoConstraints = false pageView.layer.cornerRadius = 10 - pageView.backgroundColor = NCBrandColor.shared.systemBackground.withAlphaComponent( + pageView.backgroundColor = .systemBackground.withAlphaComponent( UIAccessibility.isReduceTransparencyEnabled ? 1 : 0.5 ) view.addSubview(pageView) NSLayoutConstraint.activate([ - pageView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 10), + pageView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: pageViewtopAnchor), pageView.heightAnchor.constraint(equalToConstant: 30), pageView.leftAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leftAnchor, constant: 10) ]) @@ -151,7 +143,7 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate { pageViewLabel.translatesAutoresizingMaskIntoConstraints = false pageViewLabel.textAlignment = .center - pageViewLabel.textColor = NCBrandColor.shared.label + pageViewLabel.textColor = .label pageView.addSubview(pageViewLabel) NSLayoutConstraint.activate([ @@ -200,25 +192,22 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate { NotificationCenter.default.addObserver(self, selector: #selector(handlePageChange), name: Notification.Name.PDFViewPageChanged, object: nil) // Tip - if UIDevice.current.userInterfaceIdiom == .phone && !NCManageDatabase.shared.tipExists(NCGlobal.shared.tipNCViewerPDFThumbnail){ + var preferences = EasyTipView.Preferences() + preferences.drawing.foregroundColor = .white + preferences.drawing.backgroundColor = NCBrandColor.shared.nextcloud + preferences.drawing.textAlignment = .left + preferences.drawing.arrowPosition = .right + preferences.drawing.cornerRadius = 10 - var preferences = EasyTipView.Preferences() - preferences.drawing.foregroundColor = .white - preferences.drawing.backgroundColor = NCBrandColor.shared.nextcloud - preferences.drawing.textAlignment = .left - preferences.drawing.arrowPosition = .right - preferences.drawing.cornerRadius = 10 + preferences.positioning.bubbleInsets.right = UIApplication.shared.keyWindow?.safeAreaInsets.right ?? 0 - preferences.positioning.bubbleInsets.right = UIApplication.shared.keyWindow?.safeAreaInsets.right ?? 0 + preferences.animating.dismissTransform = CGAffineTransform(translationX: 0, y: 100) + preferences.animating.showInitialTransform = CGAffineTransform(translationX: 0, y: -100) + preferences.animating.showInitialAlpha = 0 + preferences.animating.showDuration = 1.5 + preferences.animating.dismissDuration = 1.5 - preferences.animating.dismissTransform = CGAffineTransform(translationX: 0, y: 100) - preferences.animating.showInitialTransform = CGAffineTransform(translationX: 0, y: -100) - preferences.animating.showInitialAlpha = 0 - preferences.animating.showDuration = 1.5 - preferences.animating.dismissDuration = 1.5 - - tipView = EasyTipView(text: NSLocalizedString("_tip_pdf_thumbnails_", comment: ""), preferences: preferences, delegate: self) - } + tipView = EasyTipView(text: NSLocalizedString("_tip_pdf_thumbnails_", comment: ""), preferences: preferences, delegate: self) setConstraints() handlePageChange() @@ -227,7 +216,7 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate { override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) - self.tipView?.show(forView: self.pdfThumbnailScrollView, withinSuperview: self.view) + showTip() } @objc func viewUnload() { @@ -238,15 +227,13 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate { override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { super.viewWillTransition(to: size, with: coordinator) + tipView?.dismiss() coordinator.animate(alongsideTransition: { context in - if UIDevice.current.userInterfaceIdiom == .phone { - // Close - self.tipView?.dismiss() - self.pdfThumbnailScrollViewTrailingAnchor?.constant = self.thumbnailViewWidth + (UIApplication.shared.keyWindow?.safeAreaInsets.right ?? 0) - self.pdfThumbnailScrollView.isHidden = true - } + self.pdfThumbnailScrollViewTrailingAnchor?.constant = self.thumbnailViewWidth + (UIApplication.shared.keyWindow?.safeAreaInsets.right ?? 0) + self.pdfThumbnailScrollView.isHidden = true }, completion: { context in self.setConstraints() + self.showTip() }) } @@ -265,6 +252,15 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate { NotificationCenter.default.removeObserver(self, name: Notification.Name.PDFViewPageChanged, object: nil) } + // MARK: - Tip + + func showTip() { + + if !NCManageDatabase.shared.tipExists(NCGlobal.shared.tipNCViewerPDFThumbnail) { + self.tipView?.show(forView: self.pdfThumbnailScrollView, withinSuperview: self.view) + } + } + // MARK: - NotificationCenter @objc func uploadStartFile(_ notification: NSNotification) { @@ -286,14 +282,14 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate { serverUrl == self.metadata.serverUrl, let fileName = userInfo["fileName"] as? String, fileName == self.metadata.fileName, - let errorCode = userInfo["errorCode"] as? Int + let error = userInfo["error"] as? NKError else { return } NCActivityIndicator.shared.stop() - if errorCode == 0 { + if error == .success { pdfDocument = PDFDocument(url: URL(fileURLWithPath: filePath)) pdfView.document = pdfDocument pdfView.layoutDocumentView() @@ -408,24 +404,22 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate { @objc func gestureOpenPdfThumbnail(_ recognizer: UIScreenEdgePanGestureRecognizer) { guard let pdfDocument = pdfView.document, !pdfDocument.isLocked else { return } - if UIDevice.current.userInterfaceIdiom == .phone && self.pdfThumbnailScrollView.isHidden { - if let tipView = self.tipView { - tipView.dismiss() - NCManageDatabase.shared.addTip(NCGlobal.shared.tipNCViewerPDFThumbnail) - self.tipView = nil - } - self.pdfThumbnailScrollView.isHidden = false - self.pdfThumbnailScrollViewWidthAnchor?.constant = thumbnailViewWidth + (UIApplication.shared.keyWindow?.safeAreaInsets.right ?? 0) - UIView.animate(withDuration: animateDuration, animations: { - self.pdfThumbnailScrollViewTrailingAnchor?.constant = 0 - self.view.layoutIfNeeded() - }) + if let tipView = self.tipView { + tipView.dismiss() + NCManageDatabase.shared.addTip(NCGlobal.shared.tipNCViewerPDFThumbnail) + self.tipView = nil } + self.pdfThumbnailScrollView.isHidden = false + self.pdfThumbnailScrollViewWidthAnchor?.constant = thumbnailViewWidth + (UIApplication.shared.keyWindow?.safeAreaInsets.right ?? 0) + UIView.animate(withDuration: animateDuration, animations: { + self.pdfThumbnailScrollViewTrailingAnchor?.constant = 0 + self.view.layoutIfNeeded() + }) } @objc func gestureClosePdfThumbnail(_ recognizer: UIScreenEdgePanGestureRecognizer) { - if recognizer.state == .recognized && UIDevice.current.userInterfaceIdiom == .phone && !self.pdfThumbnailScrollView.isHidden { + if recognizer.state == .recognized && !self.pdfThumbnailScrollView.isHidden { UIView.animate(withDuration: animateDuration) { self.pdfThumbnailScrollViewTrailingAnchor?.constant = self.thumbnailViewWidth + (UIApplication.shared.keyWindow?.safeAreaInsets.right ?? 0) self.view.layoutIfNeeded() @@ -442,16 +436,11 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate { let widthThumbnail = thumbnailViewWidth + (UIApplication.shared.keyWindow?.safeAreaInsets.right ?? 0) UIView.animate(withDuration: animateDuration, animations: { - if UIDevice.current.userInterfaceIdiom == .phone { - // Close - self.pdfThumbnailScrollView.isHidden = true - self.pdfThumbnailScrollViewTrailingAnchor?.constant = widthThumbnail - self.pdfThumbnailScrollViewWidthAnchor?.constant = widthThumbnail - } else { - // Open - self.pdfThumbnailScrollViewTrailingAnchor?.constant = 0 - self.pdfThumbnailScrollViewWidthAnchor?.constant = widthThumbnail - } + // Close + self.pdfThumbnailScrollView.isHidden = true + self.pdfThumbnailScrollViewTrailingAnchor?.constant = widthThumbnail + self.pdfThumbnailScrollViewWidthAnchor?.constant = widthThumbnail + self.view.layoutIfNeeded() self.pdfView.autoScales = true }) @@ -498,7 +487,7 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate { pdfSelection.pages.forEach { page in let highlight = PDFAnnotation(bounds: pdfSelection.bounds(for: page), forType: .highlight, withProperties: nil) highlight.endLineStyle = .square - highlight.color = NCBrandColor.shared.annotationColor + highlight.color = .systemBlue page.addAnnotation(highlight) } if let page = pdfSelection.pages.first { @@ -518,7 +507,7 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate { } } else { let alertController = UIAlertController(title: NSLocalizedString("_invalid_page_", comment: ""), - message: NSLocalizedString("_the_entered_page_number_doesn't_exist_", comment: ""), + message: NSLocalizedString("_the_entered_page_number_does_not_exist_", comment: ""), preferredStyle: .alert) alertController.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default, handler: nil)) self.present(alertController, animated: true, completion: nil) diff --git a/iOSClient/Viewer/NCViewerPDF/NCViewerPDFSearch.swift b/iOSClient/Viewer/NCViewerPDF/NCViewerPDFSearch.swift index 99be8ffe1..50a156672 100644 --- a/iOSClient/Viewer/NCViewerPDF/NCViewerPDFSearch.swift +++ b/iOSClient/Viewer/NCViewerPDF/NCViewerPDFSearch.swift @@ -91,7 +91,7 @@ class NCViewerPDFSearch: UITableViewController, UISearchBarDelegate, PDFDocument let nsRange = NSString(string: extendSelection.string!).range(of: pdfSelection.string!, options: String.CompareOptions.caseInsensitive) if nsRange.location != NSNotFound { - let attributedSubString = NSAttributedString(string: NSString(string: extendSelection.string!).substring(with: nsRange), attributes: [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 17), NSAttributedString.Key.foregroundColor : NCBrandColor.shared.annotationColor]) + let attributedSubString = NSAttributedString(string: NSString(string: extendSelection.string!).substring(with: nsRange), attributes: [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 17), NSAttributedString.Key.foregroundColor : UIColor.systemBlue]) let attributedString = NSMutableAttributedString(string: extendSelection.string!) attributedString.replaceCharacters(in: nsRange, with: attributedSubString) cell.searchResultTextLabel.attributedText = attributedString diff --git a/iOSClient/Viewer/NCViewerProviderContextMenu.swift b/iOSClient/Viewer/NCViewerProviderContextMenu.swift index 58727b470..7dbc86030 100644 --- a/iOSClient/Viewer/NCViewerProviderContextMenu.swift +++ b/iOSClient/Viewer/NCViewerProviderContextMenu.swift @@ -23,7 +23,7 @@ import UIKit import AVFoundation -import NCCommunication +import NextcloudKit import SVGKit class NCViewerProviderContextMenu: UIViewController { @@ -64,7 +64,7 @@ class NCViewerProviderContextMenu: UIViewController { } else { // ICON - if let image = UIImage(named: metadata.iconName)?.resizeImage(size: CGSize(width: sizeIcon*2, height: sizeIcon*2), isAspectRation: true) { + if let image = UIImage(named: metadata.iconName)?.resizeImage(size: CGSize(width: sizeIcon*2, height: sizeIcon*2)) { imageView.image = image imageView.frame = resize(CGSize(width: sizeIcon, height: sizeIcon)) @@ -80,7 +80,7 @@ class NCViewerProviderContextMenu: UIViewController { } // VIEW IMAGE - if metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue && CCUtility.fileProviderStorageExists(metadata) { + if metadata.classFile == NKCommon.typeClassFile.image.rawValue && CCUtility.fileProviderStorageExists(metadata) { viewImage(metadata: metadata) } @@ -90,22 +90,22 @@ class NCViewerProviderContextMenu: UIViewController { } // VIEW VIDEO - if metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue && CCUtility.fileProviderStorageExists(metadata) { + if metadata.classFile == NKCommon.typeClassFile.video.rawValue && CCUtility.fileProviderStorageExists(metadata) { viewVideo(metadata: metadata) } // PLAY SOUND - if metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue && CCUtility.fileProviderStorageExists(metadata) { + if metadata.classFile == NKCommon.typeClassFile.audio.rawValue && CCUtility.fileProviderStorageExists(metadata) { playSound(metadata: metadata) } // AUTO DOWNLOAD VIDEO / AUDIO - // if !CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView) && (metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue || metadata.contentType == "application/pdf") { - if !CCUtility.fileProviderStorageExists(metadata) && (metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue) { + // if !CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView) && (metadata.classFile == NKCommon.typeClassFile.video.rawValue || metadata.classFile == NKCommon.typeClassFile.audio.rawValue || metadata.contentType == "application/pdf") { + if !CCUtility.fileProviderStorageExists(metadata) && (metadata.classFile == NKCommon.typeClassFile.video.rawValue || metadata.classFile == NKCommon.typeClassFile.audio.rawValue) { var maxDownload: UInt64 = 0 - if NCNetworking.shared.networkReachability == NCCommunicationCommon.typeReachability.reachableCellular { + if NCNetworking.shared.networkReachability == NKCommon.typeReachability.reachableCellular { maxDownload = NCGlobal.shared.maxAutoDownloadCellular } else { maxDownload = NCGlobal.shared.maxAutoDownload @@ -186,20 +186,20 @@ class NCViewerProviderContextMenu: UIViewController { guard let userInfo = notification.userInfo as NSDictionary?, let ocId = userInfo["ocId"] as? String, - let errorCode = userInfo["errorCode"] as? Int, + let error = userInfo["error"] as? NKError, let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) else { return } - if errorCode == 0 && metadata.ocId == self.metadata?.ocId { - if metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue { + if error == .success && metadata.ocId == self.metadata?.ocId { + if metadata.classFile == NKCommon.typeClassFile.image.rawValue { viewImage(metadata: metadata) - } else if metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue { + } else if metadata.classFile == NKCommon.typeClassFile.video.rawValue { viewVideo(metadata: metadata) - } else if metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue { + } else if metadata.classFile == NKCommon.typeClassFile.audio.rawValue { playSound(metadata: metadata) } } - if errorCode == 0 && metadata.ocId == self.metadataLivePhoto?.ocId { + if error == .success && metadata.ocId == self.metadataLivePhoto?.ocId { viewVideo(metadata: metadata) } if ocId == self.metadata?.ocId || ocId == self.metadataLivePhoto?.ocId { diff --git a/iOSClient/Viewer/NCViewerQuickLook/NCViewerQuickLook.swift b/iOSClient/Viewer/NCViewerQuickLook/NCViewerQuickLook.swift index 95f3ea68b..aaa9725f3 100644 --- a/iOSClient/Viewer/NCViewerQuickLook/NCViewerQuickLook.swift +++ b/iOSClient/Viewer/NCViewerQuickLook/NCViewerQuickLook.swift @@ -25,7 +25,7 @@ import UIKit import QuickLook -import NCCommunication +import NextcloudKit @objc class NCViewerQuickLook: QLPreviewController { @@ -67,11 +67,8 @@ import NCCommunication guard isEditingEnabled else { return } if metadata?.livePhoto == true { - NCContentPresenter.shared.messageNotification( - "", description: "_message_disable_overwrite_livephoto_", - delay: NCGlobal.shared.dismissAfterSecond, - type: NCContentPresenter.messageType.info, - errorCode: NCGlobal.shared.errorCharactersForbidden) + let error = NKError(errorCode: NCGlobal.shared.errorCharactersForbidden, errorDescription: "_message_disable_overwrite_livephoto_") + NCContentPresenter.shared.showInfo(error: error) } } @@ -117,7 +114,6 @@ extension NCViewerQuickLook: QLPreviewControllerDataSource, QLPreviewControllerD previewItems[index] } - @available(iOS 13.0, *) func previewController(_ controller: QLPreviewController, editingModeFor previewItem: QLPreviewItem) -> QLPreviewItemEditingMode { return isEditingEnabled ? .createCopy : .disabled } @@ -157,7 +153,7 @@ extension NCViewerQuickLook: QLPreviewControllerDataSource, QLPreviewControllerD } metadataForUpload.size = size metadataForUpload.status = NCGlobal.shared.metadataStatusWaitUpload - (UIApplication.shared.delegate as? AppDelegate)?.networkingProcessUpload?.createProcessUploads(metadatas: [metadataForUpload]) + (UIApplication.shared.delegate as? AppDelegate)?.networkingProcessUpload?.createProcessUploads(metadatas: [metadataForUpload], completion: { _ in }) } func previewController(_ controller: QLPreviewController, didSaveEditedCopyOf previewItem: QLPreviewItem, at modifiedContentsURL: URL) { diff --git a/iOSClient/Viewer/NCViewerRichdocument/NCViewerRichdocument.swift b/iOSClient/Viewer/NCViewerRichdocument/NCViewerRichdocument.swift index cbc7e9663..8842af5ae 100644 --- a/iOSClient/Viewer/NCViewerRichdocument/NCViewerRichdocument.swift +++ b/iOSClient/Viewer/NCViewerRichdocument/NCViewerRichdocument.swift @@ -23,7 +23,7 @@ import UIKit import WebKit -import NCCommunication +import NextcloudKit class NCViewerRichdocument: UIViewController, WKNavigationDelegate, WKScriptMessageHandler, NCSelectDelegate { @@ -86,7 +86,7 @@ class NCViewerRichdocument: UIViewController, WKNavigationDelegate, WKScriptMess NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil) // - navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "more")!.image(color: NCBrandColor.shared.label, size: 25), style: .plain, target: self, action: #selector(self.openMenuMore)) + navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "more")!.image(color: .label, size: 25), style: .plain, target: self, action: #selector(self.openMenuMore)) navigationItem.hidesBackButton = true navigationController?.navigationBar.prefersLargeTitles = false @@ -194,17 +194,17 @@ class NCViewerRichdocument: UIViewController, WKNavigationDelegate, WKScriptMess NCActivityIndicator.shared.start(backgroundView: view) - NCCommunication.shared.download(serverUrlFileName: url, fileNameLocalPath: fileNameLocalPath, requestHandler: { _ in + NextcloudKit.shared.download(serverUrlFileName: url, fileNameLocalPath: fileNameLocalPath, requestHandler: { _ in }, taskHandler: { _ in }, progressHandler: { _ in - }, completionHandler: { account, _, _, _, allHeaderFields, error, errorCode, errorDescription in + }, completionHandler: { account, _, _, _, allHeaderFields, afError, error in NCActivityIndicator.shared.stop() - if errorCode == 0 && account == self.metadata.account { + if error == .success && account == self.metadata.account { var item = fileNameLocalPath @@ -234,7 +234,7 @@ class NCViewerRichdocument: UIViewController, WKNavigationDelegate, WKScriptMess } } else { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode) + NCContentPresenter.shared.showError(error: error) } }) } @@ -284,12 +284,12 @@ class NCViewerRichdocument: UIViewController, WKNavigationDelegate, WKScriptMess let path = CCUtility.returnFileNamePath(fromFileName: metadata!.fileName, serverUrl: serverUrl!, urlBase: appDelegate.urlBase, account: metadata!.account)! - NCCommunication.shared.createAssetRichdocuments(path: path) { account, url, errorCode, errorDescription in - if errorCode == 0 && account == self.appDelegate.account { + NextcloudKit.shared.createAssetRichdocuments(path: path) { account, url, data, error in + if error == .success && account == self.appDelegate.account { let functionJS = "OCA.RichDocuments.documentsMain.postAsset('\(metadata!.fileNameView)', '\(url!)')" self.webView.evaluateJavaScript(functionJS, completionHandler: { _, _ in }) - } else if errorCode != 0 { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError) + } else if error != .success { + NCContentPresenter.shared.showError(error: error) } else { print("[LOG] It has been changed user during networking process, error.") } @@ -301,12 +301,12 @@ class NCViewerRichdocument: UIViewController, WKNavigationDelegate, WKScriptMess let path = CCUtility.returnFileNamePath(fromFileName: metadata!.fileName, serverUrl: serverUrl!, urlBase: appDelegate.urlBase, account: metadata!.account)! - NCCommunication.shared.createAssetRichdocuments(path: path) { account, url, errorCode, errorDescription in - if errorCode == 0 && account == self.appDelegate.account { + NextcloudKit.shared.createAssetRichdocuments(path: path) { account, url, data, error in + if error == .success && account == self.appDelegate.account { let functionJS = "OCA.RichDocuments.documentsMain.postAsset('\(metadata.fileNameView)', '\(url!)')" self.webView.evaluateJavaScript(functionJS, completionHandler: { _, _ in }) - } else if errorCode != 0 { - NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError) + } else if error != .success { + NCContentPresenter.shared.showError(error: error) } else { print("[LOG] It has been changed user during networking process, error.") } diff --git a/widget.png b/widget.png Binary files differnew file mode 100644 index 000000000..1ebeace89 --- /dev/null +++ b/widget.png |