Skip to content

Commit

Permalink
Align with develop
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Bert <[email protected]>
  • Loading branch information
[email protected] authored and [email protected] committed Oct 14, 2024
1 parent cf07f2e commit 71f4c46
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 24 deletions.
23 changes: 0 additions & 23 deletions OpenHABCore/Sources/OpenHABCore/Util/NetworkConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,6 @@ public class NetworkConnection {
}
}

public static func tracker(openHABRootUrl: String) async throws -> DataResponse<Data, AFError> {
if let url = Endpoint.tracker(openHABRootUrl: openHABRootUrl).url {
return await load(from: url)
} else {
throw AFError.invalidURL(url: openHABRootUrl)
}
}

public static func notification(urlString: String,
completionHandler: @escaping (DataResponse<Data, AFError>) -> Void) {
if let notificationsUrl = Endpoint.notification(prefsURL: urlString).url {
Expand Down Expand Up @@ -230,21 +222,6 @@ public class NetworkConnection {
task.resume()
}

// @available(*, renamed: "load(from:timeout:)")
// static func load(from url: URL, timeout: Double? = nil, completionHandler: @escaping (DataResponse<Data, AFError>) -> Void) {
// Task {
// let result = await load(from: url, timeout: timeout)
// completionHandler(result)
// }
// }

static func load(from url: URL, timeout: Double? = nil) async -> DataResponse<Data, AFError> {
var request = URLRequest(url: url)
request.timeoutInterval = timeout ?? 10.0
os_log("Firing request", log: .viewCycle, type: .debug)
return await NetworkConnection.shared.manager.request(request).validate().serializingData(automaticallyCancelling: true).response
}

public func assignDelegates(serverDelegate: ServerCertificateManagerDelegate?, clientDelegate: ClientCertificateManagerDelegate) {
serverCertificateManager.delegate = serverDelegate
clientCertificateManager.delegate = clientDelegate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Alamofire
import Foundation
import os.log

public protocol ServerCertificateManagerDelegate: AnyObject {
public protocol ServerCertificateManagerDelegate: NSObjectProtocol {
// delegate should ask user for a decision on what to do with invalid certificate
func evaluateServerTrust(_ policy: ServerCertificateManager?, summary certificateSummary: String?, forDomain domain: String?)
// certificate received from openHAB doesn't match our record, ask user for a decision
Expand Down

0 comments on commit 71f4c46

Please sign in to comment.