Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/nextcloud/NextcloudCapabilitiesKit.git", from: "2.5.0"),
.package(url: "https://github.com/nextcloud/NextcloudKit", from: "7.2.3"),
.package(url: "https://github.com/nextcloud/NextcloudKit", from: "7.3.3"),
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.55.0"),
.package(url: "https://github.com/realm/realm-swift.git", from: "20.0.4"),
.package(url: "https://github.com/apple/swift-nio.git", from: "2.0.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ import OSLog

// MARK: - Helper functions

func signalEnumerator(completionHandler: @escaping (_ error: Error?) -> Void) {
func signalEnumerator(completionHandler: @Sendable @escaping (_ error: Error?) -> Void) {
guard let manager else {
logger.error("Cannot get file provider manager for domain. Cannot signal enumerator.")
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,17 @@ extension NextcloudKit: RemoteInterface {
requestHandler: requestHandler,
taskHandler: taskHandler,
progressHandler: progressHandler
) { account, ocId, etag, date, size, response, nkError in
) { account, response, nkError in
let allHeaderFields = response?.response?.allHeaderFields
let ocId = self.nkCommonInstance.findHeader("oc-fileid", allHeaderFields: allHeaderFields)
let etag = self.nkCommonInstance.normalizedETag(self.nkCommonInstance.findHeader("oc-etag", allHeaderFields: allHeaderFields))
let date = self.nkCommonInstance.findHeader("date", allHeaderFields: allHeaderFields)?.parsedDate(using: "EEE, dd MMM y HH:mm:ss zzz")
var size: Int64 = 0

if let value = allHeaderFields?["Content-Length"] as? String {
size = Int64(value) ?? 0
}
Comment thread
i2h3 marked this conversation as resolved.

continuation.resume(returning: (
account,
ocId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,7 @@ public protocol RemoteInterface: Sendable {
progressHandler: @escaping (_ progress: Progress) -> Void
) async -> (
account: String,
etag: String?,
date: Date?,
length: Int64,
headers: [AnyHashable: any Sendable]?,
afError: AFError?,
response: AFDownloadResponse<URL?>?,
nkError: NKError
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public extension Item {
} else {
let identifier = NSFileProviderItemIdentifier(metadata.ocId)

let (_, _, _, _, _, _, error) = await remoteInterface.downloadAsync(
let (_, _, error) = await remoteInterface.downloadAsync(
serverUrlFileName: remotePath,
fileNameLocalPath: childLocalPath,
account: account.ncKitAccount,
Expand Down Expand Up @@ -176,7 +176,7 @@ public extension Item {
}

} else {
let (_, _, _, _, _, _, error) = await remoteInterface.downloadAsync(
let (_, _, error) = await remoteInterface.downloadAsync(
serverUrlFileName: serverUrlFileName,
fileNameLocalPath: localPath.path,
account: account.ncKitAccount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,10 @@ public struct TestableRemoteInterface: RemoteInterface, @unchecked Sendable {
progressHandler _: @escaping (_ progress: Progress) -> Void
) async -> (
account: String,
etag: String?,
date: Date?,
length: Int64,
headers: [AnyHashable: any Sendable]?,
afError: AFError?,
response: AFDownloadResponse<URL?>?,
nkError: NKError
) {
("", nil, nil, 0, nil, nil, .invalidResponseError)
("", nil, .invalidResponseError)
}

public func enumerate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1034,23 +1034,19 @@ public class MockRemoteInterface: RemoteInterface, @unchecked Sendable {
progressHandler _: @escaping (_ progress: Progress) -> Void = { _ in }
) async -> (
account: String,
etag: String?,
date: Date?,
length: Int64,
headers: [AnyHashable: any Sendable]?,
afError: AFError?,
response: AFDownloadResponse<URL?>?,
nkError: NKError
) {
guard let serverUrlFileName = serverUrlFileName as? String ?? (serverUrlFileName as? URL)?.absoluteString else {
return (account, nil, nil, 0, nil, nil, .urlError)
return (account, nil, .urlError)
}

guard let account = mockedAccounts[account] else {
return (account, nil, nil, 0, nil, nil, .urlError)
return (account, nil, .urlError)
}

guard let item = item(remotePath: serverUrlFileName, account: account.ncKitAccount) else {
return (account.ncKitAccount, nil, nil, 0, nil, nil, .urlError)
return (account.ncKitAccount, nil, .urlError)
}

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

return (
account.ncKitAccount,
item.versionIdentifier,
item.creationDate as Date,
item.size,
nil,
nil,
.success
)
return (account.ncKitAccount, nil, .success)
}

public func enumerate(
Expand Down
Loading