react-native-ble-manager 12.0.0 → 12.1.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.
package/README.md
CHANGED
|
@@ -15,11 +15,11 @@ The library is a simple connection with the OS APIs, the BLE stack should be sta
|
|
|
15
15
|
|
|
16
16
|
## Requirements
|
|
17
17
|
|
|
18
|
-
RN 0.76+
|
|
18
|
+
RN 0.76+ only the new architecture is supported
|
|
19
19
|
|
|
20
|
-
RN 0.60-0.75 supported until 11.5.X
|
|
21
|
-
RN 0.40-0.59 supported until 6.7.X
|
|
22
|
-
RN 0.30-0.39 supported until 2.4.3
|
|
20
|
+
RN 0.60-0.75 supported until 11.5.X
|
|
21
|
+
RN 0.40-0.59 supported until 6.7.X
|
|
22
|
+
RN 0.30-0.39 supported until 2.4.3
|
|
23
23
|
|
|
24
24
|
## Supported Platforms
|
|
25
25
|
|
|
@@ -82,4 +82,4 @@ A react-native project is needed to generate the code via *codegen*.
|
|
|
82
82
|
|
|
83
83
|
#### Generate iOS code
|
|
84
84
|
- in the example folder generate the ios project from expo: `npx expo prebuild --platform ios`
|
|
85
|
-
- the codegen run during the first build, if you need to run it again use `pod install` in the ios folder
|
|
85
|
+
- the codegen run during the first build, if you need to run it again use `pod install` in the ios folder
|
package/package.json
CHANGED
package/plugin/build/withBLE.js
CHANGED
|
@@ -8,7 +8,7 @@ const withBluetoothPermissions_1 = require("./withBluetoothPermissions");
|
|
|
8
8
|
*/
|
|
9
9
|
const withBLE = (config, props = {}) => {
|
|
10
10
|
const _props = props || {};
|
|
11
|
-
const
|
|
11
|
+
const isBleRequired = _props.isBleRequired ?? false;
|
|
12
12
|
const neverForLocation = _props.neverForLocation ?? false;
|
|
13
13
|
const companionDeviceEnabled = _props.companionDeviceEnabled ?? false;
|
|
14
14
|
// iOS
|
|
@@ -20,7 +20,7 @@ const withBLE = (config, props = {}) => {
|
|
|
20
20
|
'android.permission.BLUETOOTH_CONNECT', // since Android SDK 31
|
|
21
21
|
]);
|
|
22
22
|
config = (0, withBLEAndroidManifest_1.withBLEAndroidManifest)(config, {
|
|
23
|
-
|
|
23
|
+
isBleRequired,
|
|
24
24
|
neverForLocation,
|
|
25
25
|
companionDeviceEnabled,
|
|
26
26
|
});
|
|
@@ -7,7 +7,7 @@ exports.addConnectPermissionToManifest = addConnectPermissionToManifest;
|
|
|
7
7
|
exports.addCompanionPermissionToManifest = addCompanionPermissionToManifest;
|
|
8
8
|
exports.addBLEHardwareFeatureToManifest = addBLEHardwareFeatureToManifest;
|
|
9
9
|
const config_plugins_1 = require("expo/config-plugins");
|
|
10
|
-
const withBLEAndroidManifest = (config, {
|
|
10
|
+
const withBLEAndroidManifest = (config, { isBleRequired, neverForLocation, companionDeviceEnabled }) => {
|
|
11
11
|
return (0, config_plugins_1.withAndroidManifest)(config, config => {
|
|
12
12
|
config.modResults = addLocationPermissionToManifest(config.modResults, neverForLocation);
|
|
13
13
|
config.modResults = addScanPermissionToManifest(config.modResults, neverForLocation);
|
|
@@ -15,7 +15,7 @@ const withBLEAndroidManifest = (config, { isBackgroundEnabled, neverForLocation,
|
|
|
15
15
|
if (companionDeviceEnabled) {
|
|
16
16
|
config.modResults = addCompanionPermissionToManifest(config.modResults);
|
|
17
17
|
}
|
|
18
|
-
if (
|
|
18
|
+
if (isBleRequired) {
|
|
19
19
|
config.modResults = addBLEHardwareFeatureToManifest(config.modResults);
|
|
20
20
|
}
|
|
21
21
|
return config;
|
|
@@ -107,7 +107,7 @@ function addCompanionPermissionToManifest(androidManifest) {
|
|
|
107
107
|
}
|
|
108
108
|
return androidManifest;
|
|
109
109
|
}
|
|
110
|
-
// Add this line if your application always requires BLE. More info can be found on: https://developer.android.com/
|
|
110
|
+
// Add this line if your application always requires BLE. More info can be found on: https://developer.android.com/develop/connectivity/bluetooth/bt-permissions
|
|
111
111
|
function addBLEHardwareFeatureToManifest(androidManifest) {
|
|
112
112
|
// Add `<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>` to the AndroidManifest.xml
|
|
113
113
|
if (!Array.isArray(androidManifest.manifest['uses-feature'])) {
|