react-native-ble-nitro 1.0.0-beta.4 → 1.0.0-beta.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-ble-nitro",
3
- "version": "1.0.0-beta.4",
3
+ "version": "1.0.0-beta.5",
4
4
  "description": "High-performance React Native BLE library built on Nitro Modules - drop-in replacement for react-native-ble-plx",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1,4 +1,43 @@
1
- import withBleNitro, { withBleNitroAndroid, withBleNitroIOS } from './withBleNitro.js';
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.withBleNitroIOS = exports.withBleNitroAndroid = exports.withBleNitro = void 0;
37
+ const withBleNitro_js_1 = __importStar(require("./withBleNitro.js"));
38
+ exports.withBleNitro = withBleNitro_js_1.default;
39
+ Object.defineProperty(exports, "withBleNitroAndroid", { enumerable: true, get: function () { return withBleNitro_js_1.withBleNitroAndroid; } });
40
+ Object.defineProperty(exports, "withBleNitroIOS", { enumerable: true, get: function () { return withBleNitro_js_1.withBleNitroIOS; } });
2
41
  /**
3
42
  * Expo Config Plugin for react-native-ble-nitro
4
43
  *
@@ -23,7 +62,6 @@ import withBleNitro, { withBleNitroAndroid, withBleNitroIOS } from './withBleNit
23
62
  * ```
24
63
  */
25
64
  const plugin = (config, props) => {
26
- return withBleNitro(config, props || {});
65
+ return (0, withBleNitro_js_1.default)(config, props || {});
27
66
  };
28
- export default plugin;
29
- export { withBleNitro, withBleNitroAndroid, withBleNitroIOS };
67
+ exports.default = plugin;
@@ -1,4 +1,7 @@
1
- import { AndroidConfig, WarningAggregator, withAndroidManifest, withInfoPlist, } from '@expo/config-plugins';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withBleNitroIOS = exports.withBleNitroAndroid = void 0;
4
+ const config_plugins_1 = require("@expo/config-plugins");
2
5
  const BLUETOOTH_PERMISSIONS = [
3
6
  'android.permission.BLUETOOTH',
4
7
  'android.permission.BLUETOOTH_ADMIN',
@@ -10,12 +13,12 @@ const BLUETOOTH_PERMISSIONS_API_31 = [
10
13
  'android.permission.BLUETOOTH_ADVERTISE',
11
14
  'android.permission.BLUETOOTH_CONNECT',
12
15
  ];
13
- export const withBleNitroAndroid = (config, props = {}) => {
16
+ const withBleNitroAndroid = (config, props = {}) => {
14
17
  const { isBackgroundEnabled = false, neverForLocation = false } = props;
15
- return withAndroidManifest(config, (config) => {
18
+ return (0, config_plugins_1.withAndroidManifest)(config, (config) => {
16
19
  const androidManifest = config.modResults;
17
20
  // Add required permissions
18
- AndroidConfig.Permissions.ensurePermissions(config.modResults, [
21
+ config_plugins_1.AndroidConfig.Permissions.ensurePermissions(config.modResults, [
19
22
  ...BLUETOOTH_PERMISSIONS,
20
23
  ...BLUETOOTH_PERMISSIONS_API_31,
21
24
  ]);
@@ -48,9 +51,10 @@ export const withBleNitroAndroid = (config, props = {}) => {
48
51
  return config;
49
52
  });
50
53
  };
51
- export const withBleNitroIOS = (config, props = {}) => {
54
+ exports.withBleNitroAndroid = withBleNitroAndroid;
55
+ const withBleNitroIOS = (config, props = {}) => {
52
56
  const { modes, bluetoothAlwaysPermission = 'Allow $(PRODUCT_NAME) to connect to bluetooth devices' } = props;
53
- return withInfoPlist(config, (config) => {
57
+ return (0, config_plugins_1.withInfoPlist)(config, (config) => {
54
58
  // Add NSBluetoothAlwaysUsageDescription
55
59
  if (bluetoothAlwaysPermission !== false) {
56
60
  config.modResults.NSBluetoothAlwaysUsageDescription = bluetoothAlwaysPermission;
@@ -70,18 +74,19 @@ export const withBleNitroIOS = (config, props = {}) => {
70
74
  return config;
71
75
  });
72
76
  };
77
+ exports.withBleNitroIOS = withBleNitroIOS;
73
78
  const withBleNitro = (config, props = {}) => {
74
79
  // Validate props
75
80
  if (props.neverForLocation && !props.isBackgroundEnabled) {
76
- WarningAggregator.addWarningForPlatform('android', 'react-native-ble-nitro', 'neverForLocation is set to true but isBackgroundEnabled is false. ' +
81
+ config_plugins_1.WarningAggregator.addWarningForPlatform('android', 'react-native-ble-nitro', 'neverForLocation is set to true but isBackgroundEnabled is false. ' +
77
82
  'This might cause issues with BLE scanning on some Android devices.');
78
83
  }
79
84
  if (props.modes && props.modes.some(mode => !['peripheral', 'central'].includes(mode))) {
80
- WarningAggregator.addWarningForPlatform('ios', 'react-native-ble-nitro', 'Invalid background mode specified. Only "peripheral" and "central" are supported.');
85
+ config_plugins_1.WarningAggregator.addWarningForPlatform('ios', 'react-native-ble-nitro', 'Invalid background mode specified. Only "peripheral" and "central" are supported.');
81
86
  }
82
87
  // Apply platform-specific configurations
83
- config = withBleNitroAndroid(config, props);
84
- config = withBleNitroIOS(config, props);
88
+ config = (0, exports.withBleNitroAndroid)(config, props);
89
+ config = (0, exports.withBleNitroIOS)(config, props);
85
90
  return config;
86
91
  };
87
- export default withBleNitro;
92
+ exports.default = withBleNitro;