@rodrigo7/react-native-beacons-manager 1.0.0 → 1.0.2

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/.eslintrc.js ADDED
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: '@react-native',
4
+ };
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = "ReactNativeBeaconsManager"
3
- s.version = "1.0.0"
3
+ s.version = "1.0.1"
4
4
  s.summary = "React-Native library for detecting beacons (iOS and Android)"
5
5
  s.homepage = "https://github.com/rodrigo-nexudus/react-native-beacons-manager#readme"
6
6
  s.license = { :type => "MIT" }
File without changes
@@ -0,0 +1,2 @@
1
+ #Thu Aug 03 10:59:04 BST 2023
2
+ gradle.version=8.0.1
File without changes
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="GradleSettings">
4
+ <option name="linkedExternalProjectsSettings">
5
+ <GradleProjectSettings>
6
+ <option name="testRunner" value="GRADLE" />
7
+ <option name="distributionType" value="DEFAULT_WRAPPED" />
8
+ <option name="externalProjectPath" value="$PROJECT_DIR$" />
9
+ </GradleProjectSettings>
10
+ </option>
11
+ </component>
12
+ </project>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ExternalStorageConfigurationManager" enabled="true" />
4
+ <component name="ProjectRootManager" version="2" project-jdk-name="Embedded JDK" project-jdk-type="JavaSDK">
5
+ <output url="file://$PROJECT_DIR$/build/classes" />
6
+ </component>
7
+ <component name="ProjectType">
8
+ <option name="id" value="Android" />
9
+ </component>
10
+ </project>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
5
+ </component>
6
+ </project>
package/android/.project CHANGED
@@ -1,7 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <projectDescription>
3
- <name>android</name>
4
- <comment>Project android created by Buildship.</comment>
3
+ <name>react-native-beacons-manager</name>
5
4
  <projects>
6
5
  </projects>
7
6
  <buildSpec>
@@ -1,30 +1,30 @@
1
1
  buildscript {
2
2
  repositories {
3
3
  google()
4
- jcenter()
4
+ mavenCentral()
5
5
  }
6
6
 
7
7
  dependencies {
8
- classpath 'com.android.tools.build:gradle:3.5.3'
8
+ classpath("com.android.tools.build:gradle:8.1.0")
9
9
  }
10
10
  }
11
11
 
12
12
  apply plugin: 'com.android.library'
13
13
 
14
-
15
- def DEFAULT_COMPILE_SDK_VERSION = 28
16
- def DEFAULT_BUILD_TOOLS_VERSION = "28.0.3"
17
- def DEFAULT_TARGET_SDK_VERSION = 23
14
+ def DEFAULT_COMPILE_SDK_VERSION = 33
15
+ def DEFAULT_BUILD_TOOLS_VERSION = "33.0.0"
16
+ def DEFAULT_TARGET_SDK_VERSION = 33
18
17
 
19
18
  android {
20
19
  compileSdkVersion project.hasProperty('compileSdkVersion') ? project.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
21
20
  buildToolsVersion project.hasProperty('buildToolsVersion') ? project.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION
22
21
 
23
22
  defaultConfig {
23
+ namespace 'com.mackentoch.beaconsandroid'
24
24
  minSdkVersion 16
25
25
  targetSdkVersion project.hasProperty('targetSdkVersion') ? project.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
26
- versionCode 1
27
- versionName "1.0"
26
+ versionCode 2
27
+ versionName "1.0.2"
28
28
  }
29
29
  }
30
30
 
@@ -103,6 +103,6 @@ repositories {
103
103
  dependencies {
104
104
  //noinspection GradleDynamicVersion
105
105
  implementation fileTree(dir: 'libs', include: ['*.jar'])
106
- implementation 'com.facebook.react:react-native:0.67.2'
106
+ implementation 'com.facebook.react:react-native:0.72.3'
107
107
  implementation 'org.altbeacon:android-beacon-library:2.19.6'
108
108
  }
@@ -0,0 +1,8 @@
1
+ ## This file must *NOT* be checked into Version Control Systems,
2
+ # as it contains information specific to your local configuration.
3
+ #
4
+ # Location of the SDK. This is only used by Gradle.
5
+ # For customization when using a Version Control System, please read the
6
+ # header note.
7
+ #Thu Aug 03 10:59:00 BST 2023
8
+ sdk.dir=/Users/nexudus/Library/Android/sdk
@@ -1,4 +1,4 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.mackentoch.beaconsandroid">
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
2
  <uses-permission android:name="android.permission.BLUETOOTH"/>
3
3
  <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
4
4
  <uses-permission android:name="android.permission.BLUETOOTH_SCAN"/>
@@ -54,10 +54,6 @@ public class BeaconsAndroidModule extends ReactContextBaseJavaModule {
54
54
  this.mBeaconManager = BeaconManager.getInstanceForApplication(mApplicationContext);
55
55
  this.mBeaconManager.addRangeNotifier(mRangeNotifier);
56
56
  this.mBeaconManager.addMonitorNotifier(mMonitorNotifier);
57
- // need to bind at instantiation so that service loads (to test more)
58
- //mBeaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("m:0-3=4c000215,i:4-19,i:20-21,i:22-23,p:24-24"));
59
-
60
- //mBeaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
61
57
  }
62
58
 
63
59
  @Override
@@ -83,27 +79,11 @@ public class BeaconsAndroidModule extends ReactContextBaseJavaModule {
83
79
  Beacon.setHardwareEqualityEnforced(e.booleanValue());
84
80
  }
85
81
 
86
- /*public void bindManager() {
87
- if (!mBeaconManager.isBound(this)) {
88
- Log.d(LOG_TAG, "BeaconsAndroidModule - bindManager: ");
89
- mBeaconManager.bind(this);
90
- }
91
- }*/
92
-
93
- /*public void unbindManager() {
94
- if (mBeaconManager.isBound(this)) {
95
- Log.d(LOG_TAG, "BeaconsAndroidModule - unbindManager: ");
96
- mBeaconManager.unbind(this);
97
- }
98
- }*/
99
-
100
82
  @ReactMethod
101
83
  public void addParser(String parser, Callback resolve, Callback reject) {
102
84
  try {
103
85
  Log.d(LOG_TAG, "BeaconsAndroidModule - addParser: " + parser);
104
- //unbindManager();
105
86
  mBeaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout(parser));
106
- //bindManager();
107
87
  resolve.invoke();
108
88
  } catch (Exception e) {
109
89
  reject.invoke(e.getMessage());
@@ -114,9 +94,7 @@ public class BeaconsAndroidModule extends ReactContextBaseJavaModule {
114
94
  public void removeParser(String parser, Callback resolve, Callback reject) {
115
95
  try {
116
96
  Log.d(LOG_TAG, "BeaconsAndroidModule - removeParser: " + parser);
117
- //unbindManager();
118
97
  mBeaconManager.getBeaconParsers().remove(new BeaconParser().setBeaconLayout(parser));
119
- //bindManager();
120
98
  resolve.invoke();
121
99
  } catch (Exception e) {
122
100
  reject.invoke(e.getMessage());
@@ -126,13 +104,11 @@ public class BeaconsAndroidModule extends ReactContextBaseJavaModule {
126
104
  @ReactMethod
127
105
  public void addParsersListToDetection(ReadableArray parsers, Callback resolve, Callback reject) {
128
106
  try {
129
- //unbindManager();
130
107
  for (int i = 0; i < parsers.size(); i++) {
131
108
  String parser = parsers.getString(i);
132
109
  Log.d(LOG_TAG, "addParsersListToDetection - add parser: " + parser);
133
110
  mBeaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout(parser));
134
111
  }
135
- //bindManager();
136
112
  resolve.invoke(parsers);
137
113
  } catch (Exception e) {
138
114
  reject.invoke(e.getMessage());
@@ -142,13 +118,11 @@ public class BeaconsAndroidModule extends ReactContextBaseJavaModule {
142
118
  @ReactMethod
143
119
  public void removeParsersListToDetection(ReadableArray parsers, Callback resolve, Callback reject) {
144
120
  try {
145
- //unbindManager();
146
121
  for (int i = 0; i < parsers.size(); i++) {
147
122
  String parser = parsers.getString(i);
148
123
  Log.d(LOG_TAG, "removeParsersListToDetection - remove parser: " + parser);
149
124
  mBeaconManager.getBeaconParsers().remove(new BeaconParser().setBeaconLayout(parser));
150
125
  }
151
- //bindManager();
152
126
  resolve.invoke(parsers);
153
127
  } catch (Exception e) {
154
128
  reject.invoke(e.getMessage());
@@ -208,7 +182,7 @@ public class BeaconsAndroidModule extends ReactContextBaseJavaModule {
208
182
  for (Region region: mBeaconManager.getMonitoredRegions()) {
209
183
  WritableMap map = new WritableNativeMap();
210
184
  map.putString("identifier", region.getUniqueId());
211
- map.putString("uuid", region.getId1().toString());
185
+ map.putString("uuid", region.getId1() != null ? region.getId1().toString() : "");
212
186
  map.putInt("major", region.getId2() != null ? region.getId2().toInt() : 0);
213
187
  map.putInt("minor", region.getId3() != null ? region.getId3().toInt() : 0);
214
188
  array.pushMap(map);
@@ -228,36 +202,6 @@ public class BeaconsAndroidModule extends ReactContextBaseJavaModule {
228
202
  callback.invoke(array);
229
203
  }
230
204
 
231
- /***********************************************************************************************
232
- * BeaconConsumer
233
- **********************************************************************************************/
234
- /*@Override
235
- public void onBeaconServiceConnect() {
236
- Log.v(LOG_TAG, "onBeaconServiceConnect");
237
-
238
- // deprecated since v2.9 (see github: https://github.com/AltBeacon/android-beacon-library/releases/tag/2.9)
239
- // mBeaconManager.setMonitorNotifier(mMonitorNotifier);
240
- // mBeaconManager.setRangeNotifier(mRangeNotifier);
241
- mBeaconManager.addMonitorNotifier(mMonitorNotifier);
242
- mBeaconManager.addRangeNotifier(mRangeNotifier);
243
- sendEvent(mReactContext, "beaconServiceConnected", null);
244
- }
245
-
246
- @Override
247
- public Context getApplicationContext() {
248
- return mApplicationContext;
249
- }
250
-
251
- @Override
252
- public void unbindService(ServiceConnection serviceConnection) {
253
- mApplicationContext.unbindService(serviceConnection);
254
- }
255
-
256
- @Override
257
- public boolean bindService(Intent intent, ServiceConnection serviceConnection, int i) {
258
- return mApplicationContext.bindService(intent, serviceConnection, i);
259
- }*/
260
-
261
205
  /***********************************************************************************************
262
206
  * Monitoring
263
207
  **********************************************************************************************/
@@ -271,7 +215,6 @@ public class BeaconsAndroidModule extends ReactContextBaseJavaModule {
271
215
  String.valueOf(minor).equals("-1") ? "" : String.valueOf(minor),
272
216
  String.valueOf(major).equals("-1") ? "" : String.valueOf(major)
273
217
  );
274
- //mBeaconManager.startMonitoringBeaconsInRegion(region);
275
218
  mBeaconManager.startMonitoring(region);
276
219
  resolve.invoke();
277
220
  } catch (Exception e) {
@@ -441,6 +384,7 @@ public class BeaconsAndroidModule extends ReactContextBaseJavaModule {
441
384
  }
442
385
 
443
386
  private Region createRegion(String regionId, String beaconUuid) {
387
+ Log.d(LOG_TAG, "Creating following region - Region Id: " + regionId + ", Beacon UUID: " + beaconUuid);
444
388
  Identifier id1 = (beaconUuid == null) ? null : Identifier.parse(beaconUuid);
445
389
  return new Region(regionId, id1, null, null);
446
390
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rodrigo7/react-native-beacons-manager",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "React-Native library for detecting beacons (iOS and Android)",
5
5
  "keywords": [
6
6
  "react-native",
@@ -47,16 +47,18 @@
47
47
  "license": "MIT",
48
48
  "nativePackage": true,
49
49
  "devDependencies": {
50
- "babel-cli": "^6.24.1",
51
- "babel-eslint": "^7.2.3",
52
- "eslint": "^4.4.1",
53
- "eslint-plugin-flowtype": "^2.35.0",
54
- "eslint-plugin-react": "^7.2.0",
55
- "eslint-plugin-react-native": "^3.0.1",
56
- "flow-bin": "^0.85.0",
57
- "prop-types": "^15.5.10",
58
- "react": "^15.4.2",
59
- "react-native": "^0.61.5"
50
+ "@babel/core": "^7.20.0",
51
+ "@babel/preset-env": "^7.20.0",
52
+ "@babel/runtime": "^7.20.0",
53
+ "eslint": "^8.19.0",
54
+ "@react-native/eslint-config": "^0.72.2",
55
+ "@react-native/metro-config": "^0.72.9",
56
+ "@tsconfig/react-native": "^3.0.0",
57
+ "metro-react-native-babel-preset": "0.76.7",
58
+ "prettier": "^2.4.1",
59
+ "typescript": "4.8.4",
60
+ "react": "^18.2.0",
61
+ "react-native": "^0.72.3"
60
62
  },
61
63
  "peerDependencies": {
62
64
  "react": ">=15.4.2",
package/tsconfig.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "@tsconfig/react-native/tsconfig.json"
3
+ }
@@ -1,4 +1,4 @@
1
- declare module '@rodrigo77777/react-native-beacons-manager' {
1
+ declare module '@rodrigo7/react-native-beacons-manager' {
2
2
 
3
3
  class Beacons {
4
4
  ///////////////////////////////////////////////////////
@@ -140,35 +140,32 @@ declare module '@rodrigo77777/react-native-beacons-manager' {
140
140
  const beacons: Beacons;
141
141
  export default beacons;
142
142
 
143
- declare namespace Beacons {
144
- export interface BeaconRegion {
145
- identifier: string,
146
- uuid: string,
147
- minor?: number,
148
- major?: number
149
- }
150
-
151
- export type AuthorizationStatus =
152
- | 'authorizedAlways'
153
- | 'authorizedWhenInUse'
154
- | 'denied'
155
- | 'notDetermined'
156
- | 'restricted';
157
-
158
- export type Beacon = {
159
- distance: number;
160
- major: number;
161
- minor: number;
162
- proximity: 'immediate' | 'near' | 'far';
163
- rssi: number;
164
- uuid: string;
165
- }
166
-
167
- export type BeaconRangingResponse = {
168
- beacons: Beacon[];
169
- identifier: string;
170
- uuid: string;
171
- }
143
+ export interface BeaconRegion {
144
+ identifier: string,
145
+ uuid: string,
146
+ minor?: number,
147
+ major?: number
148
+ }
149
+
150
+ export type AuthorizationStatus =
151
+ | 'authorizedAlways'
152
+ | 'authorizedWhenInUse'
153
+ | 'denied'
154
+ | 'notDetermined'
155
+ | 'restricted';
156
+
157
+ export type Beacon = {
158
+ distance: number;
159
+ major: number;
160
+ minor: number;
161
+ proximity: 'immediate' | 'near' | 'far';
162
+ rssi: number;
163
+ uuid: string;
164
+ }
172
165
 
166
+ export type BeaconRangingResponse = {
167
+ beacons: Beacon[];
168
+ identifier: string;
169
+ uuid: string;
173
170
  }
174
171
  }
package/typings.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "@rodrigo77777/react-native-beacons-manager",
2
+ "name": "@rodrigo7/react-native-beacons-manager",
3
3
  "dependencies": {},
4
4
  "globalDependencies": {
5
- "node": "registry:dt/node#7.0.0+20170322231424"
5
+ "node": "registry:dt/node"
6
6
  }
7
7
  }