@capacitor-community/bluetooth-le 6.1.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -48,10 +48,19 @@ func dataToString(_ data: Data) -> String {
48
48
  }
49
49
 
50
50
  func stringToData(_ dataString: String) -> Data {
51
- let hexValues = dataString.split(separator: " ")
52
- var data = Data(capacity: hexValues.count)
53
- for hex in hexValues {
54
- data.append(UInt8(hex, radix: 16)!)
51
+ guard dataString.count % 2 == 0 else {
52
+ fatalError("Input string must have an even length, not \(dataString.count)")
53
+ }
54
+ var data = Data(capacity: dataString.count / 2)
55
+ for i in stride(from: 0, to: dataString.count, by: 2) {
56
+ let start = dataString.index(dataString.startIndex, offsetBy: i)
57
+ let end = dataString.index(start, offsetBy: 2)
58
+ let hexPair = dataString[start..<end]
59
+ if let byte = UInt8(hexPair, radix: 16) {
60
+ data.append(byte)
61
+ } else {
62
+ fatalError("Invalid hexadecimal value: \(hexPair)")
63
+ }
55
64
  }
56
65
  return data
57
66
  }
@@ -496,7 +496,7 @@ public class BluetoothLe: CAPPlugin {
496
496
  }
497
497
 
498
498
  private func getDisplayStrings() -> [String: String] {
499
- let configDisplayStrings = getConfigValue("displayStrings") as? [String: String] ?? [String: String]()
499
+ let configDisplayStrings = getConfig().getObject("displayStrings") as? [String: String] ?? [String: String]()
500
500
  var displayStrings = [String: String]()
501
501
  displayStrings["noDeviceFound"] = configDisplayStrings["noDeviceFound"] ?? "No device found"
502
502
  displayStrings["availableDevices"] = configDisplayStrings["availableDevices"] ?? "Available devices"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor-community/bluetooth-le",
3
- "version": "6.1.0",
3
+ "version": "7.0.0",
4
4
  "description": "Capacitor plugin for Bluetooth Low Energy ",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -8,7 +8,7 @@
8
8
  "unpkg": "dist/plugin.js",
9
9
  "scripts": {
10
10
  "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
11
- "verify:ios": "set -o pipefail && cd ios && pod install && xcodebuild clean build test -workspace Plugin.xcworkspace -scheme Plugin -destination \"platform=iOS Simulator,name=iPhone 15\" | xcpretty && cd ..",
11
+ "verify:ios": "set -o pipefail && cd ios && pod install && xcodebuild clean build test -workspace Plugin.xcworkspace -scheme Plugin -destination \"platform=iOS Simulator,name=iPhone 16\" | xcpretty && cd ..",
12
12
  "verify:android": "cd android && ./gradlew clean build test && cd ..",
13
13
  "verify:web": "npm run test:coverage && npm run build",
14
14
  "lint": "npm run eslint && npm run prettier -- --check && npm run lint:ios",
@@ -20,7 +20,7 @@
20
20
  "swiftlint": "node-swiftlint",
21
21
  "docgen": "docgen --api BleClientInterface --output-readme README.md --output-json dist/docs.json",
22
22
  "postdocgen": "prettier README.md --write",
23
- "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
23
+ "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
24
24
  "clean": "rimraf ./dist",
25
25
  "watch": "tsc --watch",
26
26
  "prepublishOnly": "npm run build",
@@ -38,28 +38,28 @@
38
38
  "@types/web-bluetooth": "^0.0.20"
39
39
  },
40
40
  "devDependencies": {
41
- "@capacitor/android": "^6.0.0",
42
- "@capacitor/cli": "^6.0.0",
43
- "@capacitor/core": "^6.0.0",
44
- "@capacitor/docgen": "0.2.0",
45
- "@capacitor/ios": "^6.0.0",
41
+ "@capacitor/android": "^7.0.0",
42
+ "@capacitor/cli": "^7.0.0",
43
+ "@capacitor/core": "^7.0.0",
44
+ "@capacitor/docgen": "^0.3.0",
45
+ "@capacitor/ios": "^7.0.0",
46
46
  "@ionic/eslint-config": "^0.4.0",
47
- "@ionic/prettier-config": "^2.0.0",
48
- "@ionic/swiftlint-config": "^1.1.2",
47
+ "@ionic/prettier-config": "^4.0.0",
48
+ "@ionic/swiftlint-config": "^2.0.0",
49
49
  "@types/jest": "^29.2.5",
50
- "eslint": "^8.31.0",
50
+ "eslint": "^8.57.0",
51
51
  "jest": "^29.3.1",
52
52
  "jest-environment-jsdom": "^29.3.1",
53
- "prettier": "^2.8.1",
54
- "rimraf": "^3.0.2",
55
- "rollup": "^2.79.1",
53
+ "prettier": "^3.4.2",
54
+ "rimraf": "^6.0.1",
55
+ "rollup": "^4.30.1",
56
56
  "standard-version": "^9.5.0",
57
- "swiftlint": "^1.0.1",
57
+ "swiftlint": "^2.0.0",
58
58
  "ts-jest": "^29.0.3",
59
59
  "typescript": "~4.9.4"
60
60
  },
61
61
  "peerDependencies": {
62
- "@capacitor/core": "^6.0.0"
62
+ "@capacitor/core": ">=7.0.0"
63
63
  },
64
64
  "files": [
65
65
  "android/src/main/",
@@ -95,7 +95,7 @@
95
95
  "url": "https://github.com/capacitor-community/bluetooth-le/issues"
96
96
  },
97
97
  "volta": {
98
- "node": "20.12.2",
99
- "npm": "10.7.0"
98
+ "node": "22.13.1",
99
+ "npm": "11.0.0"
100
100
  }
101
101
  }