-
Notifications
You must be signed in to change notification settings - Fork 9
Make NextcloudKit Swift 6 compatible #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
20c8a53
17b6db7
d9be8df
8021bd7
14e92d5
77ce436
b510247
41d681d
13dc02b
8d0b1a1
78ec1da
c96853a
d1dd28d
7e6bb08
a026b49
2454e0e
39f9dc3
22c2d40
1f2c2f2
c15bdac
0d3f5bb
0a90663
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| // SPDX-FileCopyrightText: Nextcloud GmbH | ||
| // SPDX-FileCopyrightText: 2025 Claudio Cambra <[email protected]> | ||
| // SPDX-License-Identifier: GPL-3.0-or-later | ||
|
|
||
| import Foundation | ||
|
|
||
| extension NSLock { | ||
| @discardableResult | ||
| func perform<T>(_ block: () throws -> T) rethrows -> T { | ||
| lock() | ||
| defer { unlock() } | ||
| return try block() | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ | |
| import SwiftyXMLParser | ||
|
|
||
| class NKDataFileXML: NSObject { | ||
| let nkCommonInstance: NKCommon | ||
| var nkCommonInstance: NKCommon | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why change to vars here?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @claucambra could you please elaborate on this :)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for missing this! This is a var because NKCommon is now a struct (to make it more easily Sendable) and we use functions that mutate the struct instance (mainly getInternalType, which modifies the cache) |
||
| let requestBodyComments = | ||
| """ | ||
| <?xml version=\"1.0\" encoding=\"UTF-8\"?> | ||
|
|
@@ -297,7 +297,7 @@ | |
| return xml["ocs", "data", "apppassword"].text | ||
| } | ||
|
|
||
| func convertDataFile(xmlData: Data, nkSession: NKSession, showHiddenFiles: Bool, includeHiddenFiles: [String]) -> [NKFile] { | ||
| var files: [NKFile] = [] | ||
| let rootFiles = "/" + nkSession.dav + "/files/" | ||
| guard let baseUrl = self.nkCommonInstance.getHostName(urlString: nkSession.urlBase) else { | ||
|
|
@@ -307,7 +307,7 @@ | |
| let elements = xml["d:multistatus", "d:response"] | ||
|
|
||
| for element in elements { | ||
| let file = NKFile() | ||
| var file = NKFile() | ||
| if let href = element["d:href"].text { | ||
| var fileNamePath = href | ||
| if href.last == "/" { | ||
|
|
@@ -577,7 +577,7 @@ | |
| file.downloadLimits.append(NKDownloadLimit(count: count, limit: limit, token: token)) | ||
| } | ||
|
|
||
| let results = self.nkCommonInstance.getInternalType(fileName: file.fileName, mimeType: file.contentType, directory: file.directory, account: nkSession.account) | ||
| var results = self.nkCommonInstance.getInternalType(fileName: file.fileName, mimeType: file.contentType, directory: file.directory, account: nkSession.account) | ||
|
|
||
| file.contentType = results.mimeType | ||
| file.iconName = results.iconName | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.