From 1cc0cf712978464b71d8e4c85c18736b974940b9 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Sat, 11 Mar 2023 01:44:25 +0100 Subject: [PATCH] Fix compatibility with latest NextloudKit version TypeClassFile in NKCommon Signed-off-by: Claudio Cambra --- .../FileProviderExt/FileProviderExtension.swift | 2 +- .../FileProviderExt/NextcloudFilesDatabaseManager.swift | 4 ++-- .../FileProviderExt/NextcloudFilesDatabaseTables.swift | 6 +++--- .../NextcloudIntegration.xcodeproj/project.pbxproj | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension.swift index d7093598a..351d6f4b7 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension.swift +++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension.swift @@ -90,7 +90,7 @@ class FileProviderExtension: NSObject, NSFileProviderReplicatedExtension, NKComm metadata.fileName = "root" metadata.fileNameView = "root" metadata.serverUrl = ncAccount.serverUrl - metadata.classFile = NKCommon.typeClassFile.directory.rawValue + metadata.classFile = NKCommon.TypeClassFile.directory.rawValue completionHandler(FileProviderItem(metadata: metadata, parentItemIdentifier: NSFileProviderItemIdentifier.rootContainer, ncKit: ncKit), nil) return Progress() diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/NextcloudFilesDatabaseManager.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/NextcloudFilesDatabaseManager.swift index 8c759db22..496bcf087 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/NextcloudFilesDatabaseManager.swift +++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/NextcloudFilesDatabaseManager.swift @@ -665,8 +665,8 @@ class NextcloudFilesDatabaseManager : NSObject { 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 == NKCommon.typeClassFile.unknow.rawValue { - metadata.classFile = NKCommon.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 as Date diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/NextcloudFilesDatabaseTables.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/NextcloudFilesDatabaseTables.swift index 1672998fc..3faeae1e6 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/NextcloudFilesDatabaseTables.swift +++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/NextcloudFilesDatabaseTables.swift @@ -149,7 +149,7 @@ class NextcloudItemMetadataTable: Object { if isDocumentViewableOnly { return false } - if ["application/pdf", "com.adobe.pdf"].contains(contentType) || contentType.hasPrefix("text/") || classFile == NKCommon.typeClassFile.image.rawValue { + if ["application/pdf", "com.adobe.pdf"].contains(contentType) || contentType.hasPrefix("text/") || classFile == NKCommon.TypeClassFile.image.rawValue { return true } return false @@ -157,7 +157,7 @@ class NextcloudItemMetadataTable: Object { var isDocumentViewableOnly: Bool { return sharePermissionsCollaborationServices == SharePermissions.readShare.rawValue && - classFile == NKCommon.typeClassFile.document.rawValue + classFile == NKCommon.TypeClassFile.document.rawValue } var isCopyableInPasteboard: Bool { @@ -168,7 +168,7 @@ class NextcloudItemMetadataTable: Object { if directory || isDocumentViewableOnly { return false } - return contentType == "com.adobe.pdf" || contentType == "application/pdf" || classFile == NKCommon.typeClassFile.image.rawValue + return contentType == "com.adobe.pdf" || contentType == "application/pdf" || classFile == NKCommon.TypeClassFile.image.rawValue } var isSettableOnOffline: Bool { diff --git a/shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.pbxproj b/shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.pbxproj index 8ebaa4924..2570a0b49 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.pbxproj +++ b/shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.pbxproj @@ -1181,7 +1181,7 @@ isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/nextcloud/NextcloudKit"; requirement = { - branch = "work/unsharedify-nckit"; + branch = "develop"; kind = branch; }; }; -- 2.30.2