Skip to content

Commit 0d08a4c

Browse files
Version 6.0.1 (#125)
1 parent c3e1b3e commit 0d08a4c

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

Sources/NextcloudKit/NKCommon.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public protocol NextcloudKitDelegate: AnyObject, Sendable {
1818

1919
func networkReachabilityObserver(_ typeReachability: NKCommon.TypeReachability)
2020

21+
func request<Value>(_ request: DataRequest, didParseResponse response: AFDataResponse<Value>)
22+
2123
func downloadProgress(_ progress: Float, totalBytes: Int64, totalBytesExpected: Int64, fileName: String, serverUrl: String, session: URLSession, task: URLSessionTask)
2224
func uploadProgress(_ progress: Float, totalBytes: Int64, totalBytesExpected: Int64, fileName: String, serverUrl: String, session: URLSession, task: URLSessionTask)
2325

@@ -27,6 +29,23 @@ public protocol NextcloudKitDelegate: AnyObject, Sendable {
2729
func uploadComplete(fileName: String, serverUrl: String, ocId: String?, etag: String?, date: Date?, size: Int64, task: URLSessionTask, error: NKError)
2830
}
2931

32+
public extension NextcloudKitDelegate {
33+
func authenticationChallenge(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { }
34+
func urlSessionDidFinishEvents(forBackgroundURLSession session: URLSession) { }
35+
36+
func networkReachabilityObserver(_ typeReachability: NKCommon.TypeReachability) { }
37+
38+
func request<Value>(_ request: DataRequest, didParseResponse response: AFDataResponse<Value>) { }
39+
40+
func downloadProgress(_ progress: Float, totalBytes: Int64, totalBytesExpected: Int64, fileName: String, serverUrl: String, session: URLSession, task: URLSessionTask) { }
41+
func uploadProgress(_ progress: Float, totalBytes: Int64, totalBytesExpected: Int64, fileName: String, serverUrl: String, session: URLSession, task: URLSessionTask) { }
42+
43+
func downloadingFinish(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL) { }
44+
45+
func downloadComplete(fileName: String, serverUrl: String, etag: String?, date: Date?, dateLastModified: Date?, length: Int64, task: URLSessionTask, error: NKError) { }
46+
func uploadComplete(fileName: String, serverUrl: String, ocId: String?, etag: String?, date: Date?, size: Int64, task: URLSessionTask, error: NKError) { }
47+
}
48+
3049
public struct NKCommon: Sendable {
3150
public var nksessions = ThreadSafeArray<NKSession>()
3251
public var delegate: NextcloudKitDelegate?

Sources/NextcloudKit/NKMonitor.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ final class NKMonitor: EventMonitor, Sendable {
2626
}
2727

2828
func request<Value>(_ request: DataRequest, didParseResponse response: AFDataResponse<Value>) {
29+
nkCommonInstance.delegate?.request(request, didParseResponse: response)
30+
2931
if let statusCode = response.response?.statusCode {
3032

3133
//

0 commit comments

Comments
 (0)