react-native-geofence-manager 0.1.0-beta.2 → 0.1.0-beta.3

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.
@@ -5,5 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _reactNative = require("react-native");
8
- var _default = exports.default = _reactNative.TurboModuleRegistry.getEnforcing('GeofenceManager');
8
+ const NativeModule = _reactNative.TurboModuleRegistry.get('GeofenceManager');
9
+ if (!NativeModule) {
10
+ console.warn('react-native-geofence-manager: Native module not found. Make sure you rebuilt the app after installing the package.');
11
+ }
12
+ var _default = exports.default = NativeModule;
9
13
  //# sourceMappingURL=NativeGeofenceManager.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"..\\..\\src","sources":["NativeGeofenceManager.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAqE,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAqBtDC,gCAAmB,CAACC,YAAY,CAAO,iBAAiB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","NativeModule","TurboModuleRegistry","get","console","warn","_default","exports","default"],"sourceRoot":"..\\..\\src","sources":["NativeGeofenceManager.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAqBA,MAAMC,YAAY,GAAGC,gCAAmB,CAACC,GAAG,CAAO,iBAAiB,CAAC;AAErE,IAAI,CAACF,YAAY,EAAE;EACjBG,OAAO,CAACC,IAAI,CACV,qHACF,CAAC;AACH;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcP,YAAY","ignoreList":[]}
@@ -9,14 +9,19 @@ var _reactNative = require("react-native");
9
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
10
  const emitter = new _reactNative.NativeEventEmitter(_NativeGeofenceManager.default);
11
11
  const MAX_REGIONS = 100;
12
+ const notLinkedError = () => Promise.reject(new Error('react-native-geofence-manager: Native module not linked. Rebuild your app.'));
12
13
  const GeofenceManager = exports.GeofenceManager = {
13
14
  start: (regions, options) => {
15
+ if (!_NativeGeofenceManager.default) return notLinkedError();
14
16
  if (regions.length > MAX_REGIONS) {
15
17
  return Promise.reject(new Error(`Limite máximo de ${MAX_REGIONS} regiões excedido. Recebido: ${regions.length}`));
16
18
  }
17
19
  return _NativeGeofenceManager.default.start(regions, options ?? {});
18
20
  },
19
- stop: _NativeGeofenceManager.default.stop,
21
+ stop: () => {
22
+ if (!_NativeGeofenceManager.default) return notLinkedError();
23
+ return _NativeGeofenceManager.default.stop();
24
+ },
20
25
  onEnter: cb => emitter.addListener('onEnter', cb),
21
26
  onExit: cb => emitter.addListener('onExit', cb),
22
27
  onDwell: cb => emitter.addListener('onDwell', cb),
@@ -1 +1 @@
1
- {"version":3,"names":["_NativeGeofenceManager","_interopRequireDefault","require","_reactNative","e","__esModule","default","emitter","NativeEventEmitter","NativeGeofence","MAX_REGIONS","GeofenceManager","exports","start","regions","options","length","Promise","reject","Error","stop","onEnter","cb","addListener","onExit","onDwell","registerBackgroundHandler","handler","Platform","OS","AppRegistry","registerHeadlessTask"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,YAAA,GAAAD,OAAA;AAAyE,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEzE,MAAMG,OAAO,GAAG,IAAIC,+BAAkB,CAACC,8BAAqB,CAAC;AAE7D,MAAMC,WAAW,GAAG,GAAG;AAmBhB,MAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG;EAC7BE,KAAK,EAAEA,CAACC,OAAiB,EAAEC,OAAyB,KAAoB;IACtE,IAAID,OAAO,CAACE,MAAM,GAAGN,WAAW,EAAE;MAChC,OAAOO,OAAO,CAACC,MAAM,CACnB,IAAIC,KAAK,CACP,oBAAoBT,WAAW,gCAAgCI,OAAO,CAACE,MAAM,EAC/E,CACF,CAAC;IACH;IACA,OAAOP,8BAAc,CAACI,KAAK,CAACC,OAAO,EAAEC,OAAO,IAAI,CAAC,CAAC,CAAC;EACrD,CAAC;EAEDK,IAAI,EAAEX,8BAAc,CAACW,IAAI;EAEzBC,OAAO,EAAGC,EAAyC,IACjDf,OAAO,CAACgB,WAAW,CAAC,SAAS,EAAED,EAAS,CAAC;EAE3CE,MAAM,EAAGF,EAAyC,IAChDf,OAAO,CAACgB,WAAW,CAAC,QAAQ,EAAED,EAAS,CAAC;EAE1CG,OAAO,EAAGH,EAAyC,IACjDf,OAAO,CAACgB,WAAW,CAAC,SAAS,EAAED,EAAS,CAAC;EAE3CI,yBAAyB,EAAGC,OAAkC,IAAW;IACvE,IAAIC,qBAAQ,CAACC,EAAE,KAAK,SAAS,EAAE;MAC7B;IACF;IACAC,wBAAW,CAACC,oBAAoB,CAAC,sBAAsB,EAAE,MAAMJ,OAAO,CAAC;EACzE;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_NativeGeofenceManager","_interopRequireDefault","require","_reactNative","e","__esModule","default","emitter","NativeEventEmitter","NativeGeofence","MAX_REGIONS","notLinkedError","Promise","reject","Error","GeofenceManager","exports","start","regions","options","length","stop","onEnter","cb","addListener","onExit","onDwell","registerBackgroundHandler","handler","Platform","OS","AppRegistry","registerHeadlessTask"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,YAAA,GAAAD,OAAA;AAAyE,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEzE,MAAMG,OAAO,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9 @@
1
1
  "use strict";
2
2
 
3
3
  import { TurboModuleRegistry } from 'react-native';
4
- export default TurboModuleRegistry.getEnforcing('GeofenceManager');
4
+ const NativeModule = TurboModuleRegistry.get('GeofenceManager');
5
+ if (!NativeModule) {
6
+ console.warn('react-native-geofence-manager: Native module not found. Make sure you rebuilt the app after installing the package.');
7
+ }
8
+ export default NativeModule;
5
9
  //# sourceMappingURL=NativeGeofenceManager.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"..\\..\\src","sources":["NativeGeofenceManager.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;AAqBpE,eAAeA,mBAAmB,CAACC,YAAY,CAAO,iBAAiB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["TurboModuleRegistry","NativeModule","get","console","warn"],"sourceRoot":"..\\..\\src","sources":["NativeGeofenceManager.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;AAqBpE,MAAMC,YAAY,GAAGD,mBAAmB,CAACE,GAAG,CAAO,iBAAiB,CAAC;AAErE,IAAI,CAACD,YAAY,EAAE;EACjBE,OAAO,CAACC,IAAI,CACV,qHACF,CAAC;AACH;AAEA,eAAeH,YAAY","ignoreList":[]}
@@ -4,14 +4,19 @@ import NativeGeofence from './NativeGeofenceManager';
4
4
  import { AppRegistry, NativeEventEmitter, Platform } from 'react-native';
5
5
  const emitter = new NativeEventEmitter(NativeGeofence);
6
6
  const MAX_REGIONS = 100;
7
+ const notLinkedError = () => Promise.reject(new Error('react-native-geofence-manager: Native module not linked. Rebuild your app.'));
7
8
  export const GeofenceManager = {
8
9
  start: (regions, options) => {
10
+ if (!NativeGeofence) return notLinkedError();
9
11
  if (regions.length > MAX_REGIONS) {
10
12
  return Promise.reject(new Error(`Limite máximo de ${MAX_REGIONS} regiões excedido. Recebido: ${regions.length}`));
11
13
  }
12
14
  return NativeGeofence.start(regions, options ?? {});
13
15
  },
14
- stop: NativeGeofence.stop,
16
+ stop: () => {
17
+ if (!NativeGeofence) return notLinkedError();
18
+ return NativeGeofence.stop();
19
+ },
15
20
  onEnter: cb => emitter.addListener('onEnter', cb),
16
21
  onExit: cb => emitter.addListener('onExit', cb),
17
22
  onDwell: cb => emitter.addListener('onDwell', cb),
@@ -1 +1 @@
1
- {"version":3,"names":["NativeGeofence","AppRegistry","NativeEventEmitter","Platform","emitter","MAX_REGIONS","GeofenceManager","start","regions","options","length","Promise","reject","Error","stop","onEnter","cb","addListener","onExit","onDwell","registerBackgroundHandler","handler","OS","registerHeadlessTask"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,cAAc,MAGd,yBAAyB;AAChC,SAASC,WAAW,EAAEC,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAExE,MAAMC,OAAO,GAAG,IAAIF,kBAAkB,CAACF,cAAqB,CAAC;AAE7D,MAAMK,WAAW,GAAG,GAAG;AAmBvB,OAAO,MAAMC,eAAe,GAAG;EAC7BC,KAAK,EAAEA,CAACC,OAAiB,EAAEC,OAAyB,KAAoB;IACtE,IAAID,OAAO,CAACE,MAAM,GAAGL,WAAW,EAAE;MAChC,OAAOM,OAAO,CAACC,MAAM,CACnB,IAAIC,KAAK,CACP,oBAAoBR,WAAW,gCAAgCG,OAAO,CAACE,MAAM,EAC/E,CACF,CAAC;IACH;IACA,OAAOV,cAAc,CAACO,KAAK,CAACC,OAAO,EAAEC,OAAO,IAAI,CAAC,CAAC,CAAC;EACrD,CAAC;EAEDK,IAAI,EAAEd,cAAc,CAACc,IAAI;EAEzBC,OAAO,EAAGC,EAAyC,IACjDZ,OAAO,CAACa,WAAW,CAAC,SAAS,EAAED,EAAS,CAAC;EAE3CE,MAAM,EAAGF,EAAyC,IAChDZ,OAAO,CAACa,WAAW,CAAC,QAAQ,EAAED,EAAS,CAAC;EAE1CG,OAAO,EAAGH,EAAyC,IACjDZ,OAAO,CAACa,WAAW,CAAC,SAAS,EAAED,EAAS,CAAC;EAE3CI,yBAAyB,EAAGC,OAAkC,IAAW;IACvE,IAAIlB,QAAQ,CAACmB,EAAE,KAAK,SAAS,EAAE;MAC7B;IACF;IACArB,WAAW,CAACsB,oBAAoB,CAAC,sBAAsB,EAAE,MAAMF,OAAO,CAAC;EACzE;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["NativeGeofence","AppRegistry","NativeEventEmitter","Platform","emitter","MAX_REGIONS","notLinkedError","Promise","reject","Error","GeofenceManager","start","regions","options","length","stop","onEnter","cb","addListener","onExit","onDwell","registerBackgroundHandler","handler","OS","registerHeadlessTask"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,cAAc,MAGd,yBAAyB;AAChC,SAASC,WAAW,EAAEC,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAExE,MAAMC,OAAO,GAAG,IAAIF,kBAAkB,CAACF,cAAqB,CAAC;AAE7D,MAAMK,WAAW,GAAG,GAAG;AAmBvB,MAAMC,cAAc,GAAGA,CAAA,KACrBC,OAAO,CAACC,MAAM,CACZ,IAAIC,KAAK,CACP,4EACF,CACF,CAAC;AAEH,OAAO,MAAMC,eAAe,GAAG;EAC7BC,KAAK,EAAEA,CAACC,OAAiB,EAAEC,OAAyB,KAAoB;IACtE,IAAI,CAACb,cAAc,EAAE,OAAOM,cAAc,CAAC,CAAC;IAC5C,IAAIM,OAAO,CAACE,MAAM,GAAGT,WAAW,EAAE;MAChC,OAAOE,OAAO,CAACC,MAAM,CACnB,IAAIC,KAAK,CACP,oBAAoBJ,WAAW,gCAAgCO,OAAO,CAACE,MAAM,EAC/E,CACF,CAAC;IACH;IACA,OAAOd,cAAc,CAACW,KAAK,CAACC,OAAO,EAAEC,OAAO,IAAI,CAAC,CAAC,CAAC;EACrD,CAAC;EAEDE,IAAI,EAAEA,CAAA,KAAqB;IACzB,IAAI,CAACf,cAAc,EAAE,OAAOM,cAAc,CAAC,CAAC;IAC5C,OAAON,cAAc,CAACe,IAAI,CAAC,CAAC;EAC9B,CAAC;EAEDC,OAAO,EAAGC,EAAyC,IACjDb,OAAO,CAACc,WAAW,CAAC,SAAS,EAAED,EAAS,CAAC;EAE3CE,MAAM,EAAGF,EAAyC,IAChDb,OAAO,CAACc,WAAW,CAAC,QAAQ,EAAED,EAAS,CAAC;EAE1CG,OAAO,EAAGH,EAAyC,IACjDb,OAAO,CAACc,WAAW,CAAC,SAAS,EAAED,EAAS,CAAC;EAE3CI,yBAAyB,EAAGC,OAAkC,IAAW;IACvE,IAAInB,QAAQ,CAACoB,EAAE,KAAK,SAAS,EAAE;MAC7B;IACF;IACAtB,WAAW,CAACuB,oBAAoB,CAAC,sBAAsB,EAAE,MAAMF,OAAO,CAAC;EACzE;AACF,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"NativeGeofenceManager.d.ts","sourceRoot":"","sources":["../../../src/NativeGeofenceManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,MAAM,MAAM,GAAG;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;;AAED,wBAAyE"}
1
+ {"version":3,"file":"NativeGeofenceManager.d.ts","sourceRoot":"","sources":["../../../src/NativeGeofenceManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,MAAM,MAAM,GAAG;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;wBAU8B,IAAI;AAAnC,wBAAoC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAuB,EACrB,KAAK,MAAM,EACX,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AAOjC,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;IACxC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC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AAE,mBAAmB,KAAK,IAAI;kBAGpC,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI;yCAGd,yBAAyB,KAAG,IAAI;CAMtE,CAAC;AAEF,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-geofence-manager",
3
- "version": "0.1.0-beta.2",
3
+ "version": "0.1.0-beta.3",
4
4
  "description": "Robust manager for your geofencing areas.",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/module/index.js",
@@ -0,0 +1,11 @@
1
+ module.exports = {
2
+ dependency: {
3
+ platforms: {
4
+ android: {
5
+ componentDescriptors: [],
6
+ cmakeListsPath: undefined,
7
+ },
8
+ ios: {},
9
+ },
10
+ },
11
+ };
@@ -19,4 +19,12 @@ export interface Spec extends TurboModule {
19
19
  stop(): Promise<void>;
20
20
  }
21
21
 
22
- export default TurboModuleRegistry.getEnforcing<Spec>('GeofenceManager');
22
+ const NativeModule = TurboModuleRegistry.get<Spec>('GeofenceManager');
23
+
24
+ if (!NativeModule) {
25
+ console.warn(
26
+ 'react-native-geofence-manager: Native module not found. Make sure you rebuilt the app after installing the package.'
27
+ );
28
+ }
29
+
30
+ export default NativeModule as Spec;
package/src/index.tsx CHANGED
@@ -25,8 +25,16 @@ export type GeofenceEvent = {
25
25
 
26
26
  export type GeofenceBackgroundHandler = (event: GeofenceEvent) => Promise<void>;
27
27
 
28
+ const notLinkedError = () =>
29
+ Promise.reject(
30
+ new Error(
31
+ 'react-native-geofence-manager: Native module not linked. Rebuild your app.'
32
+ )
33
+ );
34
+
28
35
  export const GeofenceManager = {
29
36
  start: (regions: Region[], options?: GeofenceOptions): Promise<void> => {
37
+ if (!NativeGeofence) return notLinkedError();
30
38
  if (regions.length > MAX_REGIONS) {
31
39
  return Promise.reject(
32
40
  new Error(
@@ -37,7 +45,10 @@ export const GeofenceManager = {
37
45
  return NativeGeofence.start(regions, options ?? {});
38
46
  },
39
47
 
40
- stop: NativeGeofence.stop,
48
+ stop: (): Promise<void> => {
49
+ if (!NativeGeofence) return notLinkedError();
50
+ return NativeGeofence.stop();
51
+ },
41
52
 
42
53
  onEnter: (cb: (region: GeofenceEventRegion) => void) =>
43
54
  emitter.addListener('onEnter', cb as any),