munim-bluetooth 0.3.18 → 0.3.19

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.
@@ -95,34 +95,47 @@ class HybridMunimBluetooth: HybridMunimBluetoothSpec {
95
95
 
96
96
  var advertisingData: [String: Any] = [:]
97
97
 
98
- // Service UUIDs
98
+ // Service UUIDs - ALLOWED
99
99
  if !options.serviceUUIDs.isEmpty {
100
100
  let uuids = options.serviceUUIDs.compactMap { CBUUID(string: $0) }
101
101
  advertisingData[CBAdvertisementDataServiceUUIDsKey] = uuids
102
102
  NSLog("[MunimBluetooth] Advertising service UUIDs: %@", options.serviceUUIDs)
103
103
  }
104
104
 
105
- // Local name
105
+ // Local name - ALLOWED
106
106
  if let localName = options.localName {
107
107
  advertisingData[CBAdvertisementDataLocalNameKey] = localName
108
108
  NSLog("[MunimBluetooth] Advertising local name: %@", localName)
109
109
  }
110
110
 
111
- // Manufacturer data
112
- if let manufacturerData = options.manufacturerData,
113
- let data = hexStringToData(manufacturerData) {
114
- advertisingData[CBAdvertisementDataManufacturerDataKey] = data
115
- NSLog("[MunimBluetooth] Advertising manufacturer data: %@ bytes", String(data.count))
111
+ // Manufacturer data - NOT ALLOWED by iOS for peripheral advertising
112
+ // This can only be included when you're a central scanning for peripherals
113
+ if options.manufacturerData != nil {
114
+ NSLog("[MunimBluetooth] ⚠️ WARNING: Manufacturer data cannot be advertised on iOS")
115
+ NSLog("[MunimBluetooth] iOS only allows localName and serviceUUIDs in peripheral advertisements")
116
+ // Don't add it to advertisingData - it will cause a warning/error
116
117
  }
117
118
 
118
- // Advertising data
119
+ // Advertising data types - Most are NOT ALLOWED
119
120
  if let advertisingDataTypes = options.advertisingData {
120
- processAdvertisingData(advertisingDataTypes, into: &advertisingData)
121
+ // Only process allowed fields
122
+ if let completeLocalName = advertisingDataTypes.completeLocalName {
123
+ advertisingData[CBAdvertisementDataLocalNameKey] = completeLocalName
124
+ NSLog("[MunimBluetooth] Using complete local name from advertising data: %@", completeLocalName)
125
+ }
126
+
127
+ // Warn about unsupported fields
128
+ if advertisingDataTypes.txPowerLevel != nil {
129
+ NSLog("[MunimBluetooth] ⚠️ WARNING: txPowerLevel cannot be set in peripheral advertisements on iOS")
130
+ }
131
+ if advertisingDataTypes.flags != nil {
132
+ NSLog("[MunimBluetooth] ⚠️ WARNING: flags cannot be set in peripheral advertisements on iOS")
133
+ }
121
134
  }
122
135
 
123
136
  currentAdvertisingData = options.advertisingData
124
137
 
125
- NSLog("[MunimBluetooth] Starting advertising with data: %@", advertisingData)
138
+ NSLog("[MunimBluetooth] Starting advertising with allowed data: %@", advertisingData)
126
139
  peripheralManager.startAdvertising(advertisingData)
127
140
  }
128
141
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "munim-bluetooth",
3
- "version": "0.3.18",
3
+ "version": "0.3.19",
4
4
  "description": "A comprehensive React Native library for all your Bluetooth Low Energy (BLE) needs, supporting both peripheral and central roles with Expo support",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/module/index.js",