Skip to content
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

chore: Update @ionic/eslint-config to avoid install warnings #693

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ios/Plugin/Device.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Device: NSObject, CBPeripheralDelegate {
typealias Callback = (_ success: Bool, _ value: String) -> Void

private var peripheral: CBPeripheral!
private var callbackMap = ThreadSafeDictionary<String,Callback>()
private var callbackMap = ThreadSafeDictionary<String, Callback>()
private var timeoutMap = [String: DispatchWorkItem]()
private var servicesCount = 0
private var servicesDiscovered = 0
Expand Down
4 changes: 2 additions & 2 deletions ios/Plugin/DeviceManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class DeviceManager: NSObject, CBCentralManagerDelegate {

if shouldShowDeviceList {
DispatchQueue.main.async { [weak self] in
self?.alertController?.addAction(UIAlertAction(title: device.getName() ?? "Unknown", style: UIAlertAction.Style.default, handler: { (_) -> Void in
self?.alertController?.addAction(UIAlertAction(title: device.getName() ?? "Unknown", style: UIAlertAction.Style.default, handler: { (_) in
log("Selected device")
self?.stopScan()
self?.resolve("startScanning", device.getId())
Expand All @@ -180,7 +180,7 @@ class DeviceManager: NSObject, CBCentralManagerDelegate {
func showDeviceList() {
DispatchQueue.main.async { [weak self] in
self?.alertController = UIAlertController(title: self?.displayStrings["scanning"], message: nil, preferredStyle: UIAlertController.Style.alert)
self?.alertController?.addAction(UIAlertAction(title: self?.displayStrings["cancel"], style: UIAlertAction.Style.cancel, handler: { (_) -> Void in
self?.alertController?.addAction(UIAlertAction(title: self?.displayStrings["cancel"], style: UIAlertAction.Style.cancel, handler: { (_) in
log("Cancelled request device.")
self?.stopScan()
self?.reject("startScanning", "requestDevice cancelled.")
Expand Down
40 changes: 20 additions & 20 deletions ios/Plugin/Plugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class BluetoothLe: CAPPlugin {
}

@objc func initialize(_ call: CAPPluginCall) {
self.deviceManager = DeviceManager(self.bridge?.viewController, self.displayStrings, {(success, message) -> Void in
self.deviceManager = DeviceManager(self.bridge?.viewController, self.displayStrings, {(success, message) in
if success {
call.resolve()
} else {
Expand Down Expand Up @@ -51,7 +51,7 @@ public class BluetoothLe: CAPPlugin {

@objc func startEnabledNotifications(_ call: CAPPluginCall) {
guard let deviceManager = self.getDeviceManager(call) else { return }
deviceManager.registerStateReceiver({(enabled) -> Void in
deviceManager.registerStateReceiver({(enabled) in
self.notifyListeners("onEnabledChanged", data: ["value": enabled])
})
call.resolve()
Expand Down Expand Up @@ -117,7 +117,7 @@ public class BluetoothLe: CAPPlugin {
namePrefix,
false,
true,
30, {(success, message) -> Void in
30, {(success, message) in
// selected a device
if success {
guard let device = deviceManager.getDevice(message) else {
Expand All @@ -130,7 +130,7 @@ public class BluetoothLe: CAPPlugin {
} else {
call.reject(message)
}
}, {(_, _, _) -> Void in
}, {(_, _, _) in

}
)
Expand All @@ -150,13 +150,13 @@ public class BluetoothLe: CAPPlugin {
namePrefix,
allowDuplicates,
false,
nil, {(success, message) -> Void in
nil, {(success, message) in
if success {
call.resolve()
} else {
call.reject(message)
}
}, {(device, advertisementData, rssi) -> Void in
}, {(device, advertisementData, rssi) in
self.deviceMap[device.getId()] = device
let data = self.getScanResult(device, advertisementData, rssi)
self.notifyListeners("onScanResult", data: data)
Expand Down Expand Up @@ -218,19 +218,19 @@ public class BluetoothLe: CAPPlugin {
guard self.getDeviceManager(call) != nil else { return }
guard let device = self.getDevice(call, checkConnection: false) else { return }
let timeout = self.getTimeout(call, defaultTimeout: CONNECTION_TIMEOUT)
device.setOnConnected(timeout, {(success, message) -> Void in
device.setOnConnected(timeout, {(success, message) in
if success {
// only resolve after service discovery
call.resolve()
} else {
call.reject(message)
}
})
self.deviceManager?.setOnDisconnected(device, {(_, _) -> Void in
self.deviceManager?.setOnDisconnected(device, {(_, _) in
let key = "disconnected|\(device.getId())"
self.notifyListeners(key, data: nil)
})
self.deviceManager?.connect(device, timeout, {(success, message) -> Void in
self.deviceManager?.connect(device, timeout, {(success, message) in
if success {
log("Connected to peripheral. Waiting for service discovery.")
} else {
Expand All @@ -252,7 +252,7 @@ public class BluetoothLe: CAPPlugin {
guard self.getDeviceManager(call) != nil else { return }
guard let device = self.getDevice(call, checkConnection: false) else { return }
let timeout = self.getTimeout(call)
self.deviceManager?.disconnect(device, timeout, {(success, message) -> Void in
self.deviceManager?.disconnect(device, timeout, {(success, message) in
if success {
call.resolve()
} else {
Expand Down Expand Up @@ -308,7 +308,7 @@ public class BluetoothLe: CAPPlugin {
guard self.getDeviceManager(call) != nil else { return }
guard let device = self.getDevice(call) else { return }
let timeout = self.getTimeout(call)
device.discoverServices(timeout, {(success, value) -> Void in
device.discoverServices(timeout, {(success, value) in
if success {
call.resolve()
} else {
Expand All @@ -333,7 +333,7 @@ public class BluetoothLe: CAPPlugin {
guard self.getDeviceManager(call) != nil else { return }
guard let device = self.getDevice(call) else { return }
let timeout = self.getTimeout(call)
device.readRssi(timeout, {(success, value) -> Void in
device.readRssi(timeout, {(success, value) in
if success {
call.resolve([
"value": value
Expand All @@ -349,7 +349,7 @@ public class BluetoothLe: CAPPlugin {
guard let device = self.getDevice(call) else { return }
guard let characteristic = self.getCharacteristic(call) else { return }
let timeout = self.getTimeout(call)
device.read(characteristic.0, characteristic.1, timeout, {(success, value) -> Void in
device.read(characteristic.0, characteristic.1, timeout, {(success, value) in
if success {
call.resolve([
"value": value
Expand All @@ -375,7 +375,7 @@ public class BluetoothLe: CAPPlugin {
characteristic.1,
value,
writeType,
timeout, {(success, value) -> Void in
timeout, {(success, value) in
if success {
call.resolve()
} else {
Expand All @@ -399,7 +399,7 @@ public class BluetoothLe: CAPPlugin {
characteristic.1,
value,
writeType,
timeout, {(success, value) -> Void in
timeout, {(success, value) in
if success {
call.resolve()
} else {
Expand All @@ -417,7 +417,7 @@ public class BluetoothLe: CAPPlugin {
descriptor.0,
descriptor.1,
descriptor.2,
timeout, {(success, value) -> Void in
timeout, {(success, value) in
if success {
call.resolve([
"value": value
Expand All @@ -442,7 +442,7 @@ public class BluetoothLe: CAPPlugin {
descriptor.1,
descriptor.2,
value,
timeout, {(success, value) -> Void in
timeout, {(success, value) in
if success {
call.resolve()
} else {
Expand All @@ -459,11 +459,11 @@ public class BluetoothLe: CAPPlugin {
device.setNotifications(
characteristic.0,
characteristic.1,
true, {(_, value) -> Void in
true, {(_, value) in
let key = "notification|\(device.getId())|\(characteristic.0.uuidString.lowercased())|\(characteristic.1.uuidString.lowercased())"
self.notifyListeners(key, data: ["value": value])
},
timeout, {(success, value) -> Void in
timeout, {(success, value) in
if success {
call.resolve()
} else {
Expand All @@ -482,7 +482,7 @@ public class BluetoothLe: CAPPlugin {
characteristic.1,
false,
nil,
timeout, {(success, value) -> Void in
timeout, {(success, value) in
if success {
call.resolve()
} else {
Expand Down
Loading
Loading