diff --git a/Examples/AblyPush/AblyPushExample/AblyHelper.swift b/Examples/AblyPush/AblyPushExample/AblyHelper.swift index f40d33ce8..67431ea94 100644 --- a/Examples/AblyPush/AblyPushExample/AblyHelper.swift +++ b/Examples/AblyPush/AblyPushExample/AblyHelper.swift @@ -8,7 +8,7 @@ class AblyHelper: NSObject, ObservableObject { private var locationManager: CLLocationManager! - private(set) var realtime: ARTRealtime! + private(set) var realtime: Realtime! private let key = "" // Your API Key from your app's dashboard @@ -16,7 +16,7 @@ class AblyHelper: NSObject, ObservableObject { var locationDeviceToken: String? - var activatePushCallback: ((String?, String?, ARTErrorInfo?) -> ())? + var activatePushCallback: ((String?, String?, ErrorInfo?) -> ())? @Published var isSubscribedToExampleChannel1 = false @Published var isSubscribedToExampleChannel2 = false @@ -27,10 +27,10 @@ class AblyHelper: NSObject, ObservableObject { guard key != "" else { preconditionFailure("Obtain your API key at https://ably.com/accounts/") } - let options = ARTClientOptions(key: key) + let options = ClientOptions(key: key) options.clientId = "basic-apns-example" options.pushRegistererDelegate = self - self.realtime = ARTRealtime(options: options) + self.realtime = Realtime(options: options) UNUserNotificationCenter.current().delegate = self locationManager = CLLocationManager() locationManager.delegate = self @@ -40,7 +40,7 @@ class AblyHelper: NSObject, ObservableObject { extension AblyHelper { - func activatePush(_ callback: @escaping (String?, String?, ARTErrorInfo?) -> ()) { + func activatePush(_ callback: @escaping (String?, String?, ErrorInfo?) -> ()) { Self.requestUserNotificationAuthorization() realtime.push.activate() activatePushCallback = callback @@ -49,10 +49,10 @@ extension AblyHelper { func activateLocationPush() { locationManager.startMonitoringLocationPushes { deviceToken, error in guard error == nil else { - return ARTPush.didFailToRegisterForLocationNotificationsWithError(error!, realtime: self.realtime) + return Push.didFailToRegisterForLocationNotificationsWithError(error!, realtime: self.realtime) } self.locationDeviceToken = deviceToken!.deviceTokenString - ARTPush.didRegisterForLocationNotifications(withDeviceToken: deviceToken!, realtime: self.realtime) + Push.didRegisterForLocationNotifications(withDeviceToken: deviceToken!, realtime: self.realtime) } } @@ -68,7 +68,7 @@ extension AblyHelper { } } - func getDeviceDetails(_ callback: @escaping (ARTDeviceDetails?, ARTErrorInfo?) -> ()) { + func getDeviceDetails(_ callback: @escaping (DeviceDetails?, ErrorInfo?) -> ()) { realtime.push.admin.deviceRegistrations.get(realtime.device.id, callback: callback) } @@ -93,7 +93,7 @@ extension AblyHelper { } func sendPushToChannel(_ channel: Channel) { - let message = ARTMessage(name: "example", data: "rest data") + let message = Message(name: "example", data: "rest data") message.extras = [ "push": [ "notification": [ @@ -105,7 +105,7 @@ extension AblyHelper { "baz": "qux" ] ] - ] as any ARTJsonCompatible + ] as any JsonCompatible realtime.channels.get(channel.rawValue).publish([message]) { error in if let error { @@ -151,9 +151,9 @@ extension AblyHelper { } } -extension AblyHelper: ARTPushRegistererDelegate { +extension AblyHelper: PushRegistererDelegate { - func didActivateAblyPush(_ error: ARTErrorInfo?) { + func didActivateAblyPush(_ error: ErrorInfo?) { print("Push activation: \(error?.localizedDescription ?? "Success")") activatePushCallback?(defaultDeviceToken, locationDeviceToken, error) activateLocationPush() @@ -162,14 +162,14 @@ extension AblyHelper: ARTPushRegistererDelegate { } } - func didDeactivateAblyPush(_ error: ARTErrorInfo?) { + func didDeactivateAblyPush(_ error: ErrorInfo?) { print("Push deactivation: \(error?.localizedDescription ?? "Success")") if error == nil { isPushActivated = false } } - func didUpdateAblyPush(_ error: ARTErrorInfo?) { + func didUpdateAblyPush(_ error: ErrorInfo?) { print("Push update: \(error?.localizedDescription ?? "Success")") activatePushCallback?(defaultDeviceToken, locationDeviceToken, error) } diff --git a/Examples/AblyPush/AblyPushExample/ContentView.swift b/Examples/AblyPush/AblyPushExample/ContentView.swift index 1881b4806..3adfd7e57 100644 --- a/Examples/AblyPush/AblyPushExample/ContentView.swift +++ b/Examples/AblyPush/AblyPushExample/ContentView.swift @@ -5,13 +5,13 @@ struct ContentView: View { @StateObject private var ablyHelper = AblyHelper.shared @State var showDeviceDetailsAlert = false - @State var deviceDetails: ARTDeviceDetails? - @State var deviceDetailsError: ARTErrorInfo? + @State var deviceDetails: DeviceDetails? + @State var deviceDetailsError: ErrorInfo? @State var showDeviceTokensAlert = false @State var defaultDeviceToken: String? @State var locationDeviceToken: String? - @State var deviceTokensError: ARTErrorInfo? + @State var deviceTokensError: ErrorInfo? var body: some View { NavigationView { diff --git a/Examples/SPM/Tests/SPMTests/SPMTests.swift b/Examples/SPM/Tests/SPMTests/SPMTests.swift index 98c2ac8c2..f6de446ec 100644 --- a/Examples/SPM/Tests/SPMTests/SPMTests.swift +++ b/Examples/SPM/Tests/SPMTests/SPMTests.swift @@ -3,8 +3,8 @@ final class SPMTests: XCTestCase { func ablyInitTest() { - let clientOptions = ARTClientOptions() - let _ = ARTRest(options: clientOptions) - let _ = ARTRealtime(options: clientOptions) + let clientOptions = ClientOptions() + let _ = Rest(options: clientOptions) + let _ = Realtime(options: clientOptions) } } diff --git a/Examples/Tests/Tests.xcodeproj/project.pbxproj b/Examples/Tests/Tests.xcodeproj/project.pbxproj index 9fa8e6d58..8f1c912d4 100644 --- a/Examples/Tests/Tests.xcodeproj/project.pbxproj +++ b/Examples/Tests/Tests.xcodeproj/project.pbxproj @@ -483,6 +483,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = Tests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = io.ably.Tests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -496,6 +497,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = Tests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = io.ably.Tests; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/Examples/Tests/TestsTests/TestsTests.swift b/Examples/Tests/TestsTests/TestsTests.swift index d932d186c..d1d9f4b48 100644 --- a/Examples/Tests/TestsTests/TestsTests.swift +++ b/Examples/Tests/TestsTests/TestsTests.swift @@ -12,7 +12,7 @@ import Ably class TestsTests: XCTestCase { - let options: ARTClientOptions! = nil + let options: ClientOptions! = nil func testAblyWorks() { var responseData: Data? @@ -46,9 +46,9 @@ class TestsTests: XCTestCase { return } - let options = ARTClientOptions(key: key as String) + let options = ClientOptions(key: key as String) options.environment = "sandbox" - let client = ARTRealtime(options: options) + let client = Realtime(options: options) let receiveExpectation = self.expectation(description: "message received") @@ -63,9 +63,9 @@ class TestsTests: XCTestCase { self.waitForExpectations(timeout: 10, handler: nil) let backgroundRealtimeExpectation = self.expectation(description: "Realtime in a Background Queue") - var realtime: ARTRealtime! //strong reference + var realtime: Realtime! //strong reference URLSession.shared.dataTask(with: URL(string: "https://ably.io")!) { _,_,_ in - realtime = ARTRealtime(key: key as String) + realtime = Realtime(key: key as String) realtime.channels.get("foo").attach { _ in do { backgroundRealtimeExpectation.fulfill() } } @@ -73,9 +73,9 @@ class TestsTests: XCTestCase { self.waitForExpectations(timeout: 10, handler: nil) let backgroundRestExpectation = self.expectation(description: "Rest in a Background Queue") - var rest: ARTRest! //strong reference + var rest: Rest! //strong reference URLSession.shared.dataTask(with: URL(string: "https://ably.io")!) { _,_,_ in - rest = ARTRest(key: key as String) + rest = Rest(key: key as String) rest.channels.get("foo").history { result, error in do { backgroundRestExpectation.fulfill() } } diff --git a/Source/ARTURLSessionServerTrust.m b/Source/ARTURLSessionServerTrust.m index 4505864cd..e0bb54a66 100644 --- a/Source/ARTURLSessionServerTrust.m +++ b/Source/ARTURLSessionServerTrust.m @@ -13,11 +13,8 @@ - (instancetype)init:(dispatch_queue_t)queue { if (self = [super init]) { _queue = queue; NSURLSessionConfiguration *config = [NSURLSessionConfiguration ephemeralSessionConfiguration]; -#if TARGET_OS_MACCATALYST // if (@available(iOS 13.0, macCatalyst 13.0, ... doesn't help - config.TLSMinimumSupportedProtocolVersion = tls_protocol_version_TLSv12; -#else + config.TLSMinimumSupportedProtocolVersion = tls_protocol_version_TLSv12; -#endif _session = [NSURLSession sessionWithConfiguration:config delegate:self delegateQueue:nil]; } return self; diff --git a/Test/Tests/RestClientTests.swift b/Test/Tests/RestClientTests.swift index 493f1cfdb..98dc9c341 100644 --- a/Test/Tests/RestClientTests.swift +++ b/Test/Tests/RestClientTests.swift @@ -278,18 +278,16 @@ class RestClientTests: XCTestCase { func test__024__RestClient__logging__should_accept_a_custom_logger() throws { let test = Test() - enum InterceptedLogger { + enum InterceptedLog { static var interceptedLog: (String, LogLevel) = ("", .none) } class MyLogger: Log { - override func log(_ message: String, with level: LogLevel) { - // Default implementation or can be abstract - InterceptedLogger.interceptedLog = (message, level) + InterceptedLog.interceptedLog = (message, level) } - static var interceptedLog: (String, LogLevel) = ("", .none) + static var interceptedLog: (String, LogLevel) = InterceptedLog.interceptedLog }