Skip to content

Commit 0a1a70f

Browse files
committed
Merge branch 'develop'
2 parents b23d88b + 1df87f6 commit 0a1a70f

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

CoreBluetoothMock/Classes/CBMCentralManager.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ open class CBMCentralManager: NSObject {
9090
/// This method returns the value set as `CBMCentralManagerMock.simulateAuthorization`
9191
/// or, if set to `nil`, the native result returned by `CBCentralManager`.
9292
@available(iOS, introduced: 13.0, deprecated: 13.1)
93+
@available(macOS, introduced: 10.15)
94+
@available(tvOS, introduced: 13.0, deprecated: 13.1)
95+
@available(watchOS, introduced: 6.0, deprecated: 6.1)
9396
open var authorization: CBMManagerAuthorization {
9497
if let rawValue = CBMCentralManagerMock.bluetoothAuthorization,
9598
let authotization = CBMManagerAuthorization(rawValue: rawValue) {
@@ -112,7 +115,7 @@ open class CBMCentralManager: NSObject {
112115
/// - Note:
113116
/// This method returns the value set as `CBMCentralManagerMock.simulateAuthorization`
114117
/// or, if set to `nil`, the native result returned by `CBCentralManager`.
115-
@available(iOS 13.1, *)
118+
@available(iOS 13.1, macOS 10.15, tvOS 13.1, watchOS 6.1, *)
116119
open class var authorization: CBMManagerAuthorization {
117120
if let rawValue = CBMCentralManagerMock.bluetoothAuthorization,
118121
let authotization = CBMManagerAuthorization(rawValue: rawValue) {

CoreBluetoothMock/Classes/CBMCentralManagerMock.swift

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ open class CBMCentralManagerMock: CBMCentralManager {
195195
/// Simulates the current authorization state of a Core Bluetooth manager.
196196
///
197197
/// When set to `nil` (default), the native value is returned.
198-
@available(iOS 13.0, *)
198+
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)
199199
public static func simulateAuthorization(_ authorization: CBMManagerAuthorization) {
200200
bluetoothAuthorization = authorization.rawValue
201201
}
@@ -457,6 +457,9 @@ open class CBMCentralManagerMock: CBMCentralManager {
457457
}
458458

459459
@available(iOS, introduced: 13.0, deprecated: 13.1)
460+
@available(macOS, introduced: 10.15)
461+
@available(tvOS, introduced: 13.0, deprecated: 13.1)
462+
@available(watchOS, introduced: 6.0, deprecated: 6.1)
460463
open override var authorization: CBMManagerAuthorization {
461464
if let rawValue = CBMCentralManagerMock.bluetoothAuthorization,
462465
let authotization = CBMManagerAuthorization(rawValue: rawValue) {
@@ -467,7 +470,7 @@ open class CBMCentralManagerMock: CBMCentralManager {
467470
}
468471
}
469472

470-
@available(iOS 13.1, *)
473+
@available(iOS 13.1, macOS 10.15, tvOS 13.1, watchOS 6.1, *)
471474
open override class var authorization: CBMManagerAuthorization {
472475
if let rawValue = CBMCentralManagerMock.bluetoothAuthorization,
473476
let authotization = CBMManagerAuthorization(rawValue: rawValue) {
@@ -705,10 +708,12 @@ open class CBMCentralManagerMock: CBMCentralManager {
705708
+ peripheralsConnectedByOtherApps
706709
}
707710

708-
@available(iOS 13.0, *)
711+
#if !os(macOS)
712+
@available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)
709713
open override func registerForConnectionEvents(options: [CBMConnectionEventMatchingOption : Any]? = nil) {
710714
fatalError("Mock connection events are not implemented")
711715
}
716+
#endif
712717

713718
fileprivate func ensurePoweredOn() -> Bool {
714719
guard state == .poweredOn else {
@@ -736,7 +741,7 @@ open class CBMPeripheralMock: CBMPeer, CBMPeripheral {
736741
/// Size of the outgoing buffer. Only this many packets
737742
/// can be written without response in a loop, without
738743
/// waiting for `canSendWriteWithoutResponse`.
739-
private let bufferSize = 20
744+
private let bufferSize = 20
740745
/// The supervision timeout is a time after which a device realizes
741746
/// that a connected peer has disconnected, had there been no signal
742747
/// from it.
@@ -747,7 +752,7 @@ open class CBMPeripheralMock: CBMPeer, CBMPeripheral {
747752

748753
/// A flag set to <i>true</i> when the device was scanned
749754
/// at least once.
750-
fileprivate var wasScanned: Bool = false
755+
fileprivate var wasScanned: Bool = false
751756
/// A flag set to <i>true</i> when the device was connected
752757
/// and iOS had chance to read device name.
753758
fileprivate var wasConnected: Bool = false

CoreBluetoothMock/Classes/CBMCentralManagerNative.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,14 @@ public class CBMCentralManagerNative: CBMCentralManager {
140140
}
141141

142142
@available(iOS, introduced: 13.0, deprecated: 13.1)
143+
@available(macOS, introduced: 10.15)
144+
@available(tvOS, introduced: 13.0, deprecated: 13.1)
145+
@available(watchOS, introduced: 6.0, deprecated: 6.1)
143146
public override var authorization: CBMManagerAuthorization {
144147
return manager.authorization
145148
}
146149

147-
@available(iOS 13.1, *)
150+
@available(iOS 13.1, macOS 10.15, tvOS 13.1, watchOS 6.1, *)
148151
public override class var authorization: CBMManagerAuthorization {
149152
return CBCentralManager.authorization
150153
}

0 commit comments

Comments
 (0)