Skip to content

Commit d659a17

Browse files
committed
fix(file-provider): Updated API calls NextcloudKit dependency to breaking changes in 7.3.3
Signed-off-by: Iva Horn <iva.horn@nextcloud.com>
1 parent d5c21d7 commit d659a17

8 files changed

Lines changed: 38 additions & 48 deletions

File tree

Nextcloud Desktop Client.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

shell_integration/MacOSX/NextcloudFileProviderKit/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ let package = Package(
2121
],
2222
dependencies: [
2323
.package(url: "https://github.com/nextcloud/NextcloudCapabilitiesKit.git", from: "2.5.0"),
24-
.package(url: "https://github.com/nextcloud/NextcloudKit", from: "7.2.3"),
24+
.package(url: "https://github.com/nextcloud/NextcloudKit", from: "7.3.3"),
2525
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.55.0"),
2626
.package(url: "https://github.com/realm/realm-swift.git", from: "20.0.4"),
2727
.package(url: "https://github.com/apple/swift-nio.git", from: "2.0.0")

shell_integration/MacOSX/NextcloudFileProviderKit/Sources/NextcloudFileProviderKit/Extension/FileProviderExtension.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ import OSLog
502502

503503
// MARK: - Helper functions
504504

505-
func signalEnumerator(completionHandler: @escaping (_ error: Error?) -> Void) {
505+
func signalEnumerator(completionHandler: @Sendable @escaping (_ error: Error?) -> Void) {
506506
guard let manager else {
507507
logger.error("Cannot get file provider manager for domain. Cannot signal enumerator.")
508508
return

shell_integration/MacOSX/NextcloudFileProviderKit/Sources/NextcloudFileProviderKit/Interface/NextcloudKit+RemoteInterface.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,17 @@ extension NextcloudKit: RemoteInterface {
6060
requestHandler: requestHandler,
6161
taskHandler: taskHandler,
6262
progressHandler: progressHandler
63-
) { account, ocId, etag, date, size, response, nkError in
63+
) { account, response, nkError in
64+
let allHeaderFields = response?.response?.allHeaderFields
65+
let ocId = self.nkCommonInstance.findHeader("oc-fileid", allHeaderFields: allHeaderFields)
66+
let etag = self.nkCommonInstance.normalizedETag(self.nkCommonInstance.findHeader("oc-etag", allHeaderFields: allHeaderFields))
67+
let date = self.nkCommonInstance.findHeader("date", allHeaderFields: allHeaderFields)?.parsedDate(using: "EEE, dd MMM y HH:mm:ss zzz")
68+
var size: Int64 = 0
69+
70+
if let value = allHeaderFields?["Content-Length"] as? String {
71+
size = Int64(value) ?? 0
72+
}
73+
6474
continuation.resume(returning: (
6575
account,
6676
ocId,

shell_integration/MacOSX/NextcloudFileProviderKit/Sources/NextcloudFileProviderKit/Interface/RemoteInterface.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,7 @@ public protocol RemoteInterface: Sendable {
8686
progressHandler: @escaping (_ progress: Progress) -> Void
8787
) async -> (
8888
account: String,
89-
etag: String?,
90-
date: Date?,
91-
length: Int64,
92-
headers: [AnyHashable: any Sendable]?,
93-
afError: AFError?,
89+
response: AFDownloadResponse<URL?>?,
9490
nkError: NKError
9591
)
9692

shell_integration/MacOSX/NextcloudFileProviderKit/Sources/NextcloudFileProviderKit/Item/Item+Fetch.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public extension Item {
6666
} else {
6767
let identifier = NSFileProviderItemIdentifier(metadata.ocId)
6868

69-
let (_, _, _, _, _, _, error) = await remoteInterface.downloadAsync(
69+
let (_, _, error) = await remoteInterface.downloadAsync(
7070
serverUrlFileName: remotePath,
7171
fileNameLocalPath: childLocalPath,
7272
account: account.ncKitAccount,
@@ -176,7 +176,7 @@ public extension Item {
176176
}
177177

178178
} else {
179-
let (_, _, _, _, _, _, error) = await remoteInterface.downloadAsync(
179+
let (_, _, error) = await remoteInterface.downloadAsync(
180180
serverUrlFileName: serverUrlFileName,
181181
fileNameLocalPath: localPath.path,
182182
account: account.ncKitAccount,

shell_integration/MacOSX/NextcloudFileProviderKit/Sources/NextcloudFileProviderKitMocks/TestableRemoteInterface.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,10 @@ public struct TestableRemoteInterface: RemoteInterface, @unchecked Sendable {
9696
progressHandler _: @escaping (_ progress: Progress) -> Void
9797
) async -> (
9898
account: String,
99-
etag: String?,
100-
date: Date?,
101-
length: Int64,
102-
headers: [AnyHashable: any Sendable]?,
103-
afError: AFError?,
99+
response: AFDownloadResponse<URL?>?,
104100
nkError: NKError
105101
) {
106-
("", nil, nil, 0, nil, nil, .invalidResponseError)
102+
("", nil, .invalidResponseError)
107103
}
108104

109105
public func enumerate(

shell_integration/MacOSX/NextcloudFileProviderKit/Tests/Interface/MockRemoteInterface.swift

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,23 +1034,19 @@ public class MockRemoteInterface: RemoteInterface, @unchecked Sendable {
10341034
progressHandler _: @escaping (_ progress: Progress) -> Void = { _ in }
10351035
) async -> (
10361036
account: String,
1037-
etag: String?,
1038-
date: Date?,
1039-
length: Int64,
1040-
headers: [AnyHashable: any Sendable]?,
1041-
afError: AFError?,
1037+
response: AFDownloadResponse<URL?>?,
10421038
nkError: NKError
10431039
) {
10441040
guard let serverUrlFileName = serverUrlFileName as? String ?? (serverUrlFileName as? URL)?.absoluteString else {
1045-
return (account, nil, nil, 0, nil, nil, .urlError)
1041+
return (account, nil, .urlError)
10461042
}
10471043

10481044
guard let account = mockedAccounts[account] else {
1049-
return (account, nil, nil, 0, nil, nil, .urlError)
1045+
return (account, nil, .urlError)
10501046
}
10511047

10521048
guard let item = item(remotePath: serverUrlFileName, account: account.ncKitAccount) else {
1053-
return (account.ncKitAccount, nil, nil, 0, nil, nil, .urlError)
1049+
return (account.ncKitAccount, nil, .urlError)
10541050
}
10551051

10561052
let localUrl = URL(fileURLWithPath: fileNameLocalPath)
@@ -1066,18 +1062,10 @@ public class MockRemoteInterface: RemoteInterface, @unchecked Sendable {
10661062
}
10671063
} catch {
10681064
print("Could not write item data: \(error)")
1069-
return (account.ncKitAccount, nil, nil, 0, nil, nil, .urlError)
1065+
return (account.ncKitAccount, nil, .urlError)
10701066
}
10711067

1072-
return (
1073-
account.ncKitAccount,
1074-
item.versionIdentifier,
1075-
item.creationDate as Date,
1076-
item.size,
1077-
nil,
1078-
nil,
1079-
.success
1080-
)
1068+
return (account.ncKitAccount, nil, .success)
10811069
}
10821070

10831071
public func enumerate(

0 commit comments

Comments
 (0)