react-native-steerpath-smart-map 1.29.5 → 2.0.0-alpha.1
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 +66 -0
- package/.prettierrc +7 -0
- package/CHANGELOG.md +35 -0
- package/README.md +7 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNEventKeys.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartGeofenceManager.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartLocationManager.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapManager.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapModule.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapPackage.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapPackage.kt +28 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapView.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapViewManager.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/Utils.class +0 -0
- package/android/build.gradle +22 -33
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartLocationManager.java +22 -14
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapManager.java +9 -31
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapPackage.java +11 -9
- package/android/src/main/java/com/steerpath/rnsmartmap/Utils.java +36 -36
- package/ios/RNSmartLocationManager.m +28 -3
- package/ios/RNSmartMapManager.m +10 -22
- package/lib/commonjs/SmartLocationManager.js +50 -0
- package/lib/commonjs/SmartLocationManager.js.map +1 -0
- package/lib/commonjs/SmartLocationManager.web.js +11 -0
- package/lib/commonjs/SmartLocationManager.web.js.map +1 -0
- package/lib/commonjs/SmartMapManager.js +59 -0
- package/lib/commonjs/SmartMapManager.js.map +1 -0
- package/lib/commonjs/SmartMapManager.web.js +24 -0
- package/lib/commonjs/SmartMapManager.web.js.map +1 -0
- package/lib/commonjs/index.js +28 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/module/SmartLocationManager.js +46 -0
- package/lib/module/SmartLocationManager.js.map +1 -0
- package/lib/module/SmartLocationManager.web.js +7 -0
- package/lib/module/SmartLocationManager.web.js.map +1 -0
- package/lib/module/SmartMapManager.js +54 -0
- package/lib/module/SmartMapManager.js.map +1 -0
- package/lib/module/SmartMapManager.web.js +20 -0
- package/lib/module/SmartMapManager.web.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/SmartLocationManager.d.ts +19 -0
- package/lib/typescript/SmartLocationManager.d.ts.map +1 -0
- package/{dist → lib/typescript}/SmartLocationManager.web.d.ts +1 -0
- package/lib/typescript/SmartLocationManager.web.d.ts.map +1 -0
- package/{dist → lib/typescript}/SmartMapManager.d.ts +13 -15
- package/lib/typescript/SmartMapManager.d.ts.map +1 -0
- package/lib/typescript/SmartMapManager.web.d.ts +8 -0
- package/lib/typescript/SmartMapManager.web.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +5 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/package.json +38 -13
- package/react-native-steerpath-smart-map.podspec +15 -12
- package/src/SmartLocationManager.ts +25 -9
- package/src/SmartMapManager.ts +12 -19
- package/src/SmartMapManager.web.ts +3 -24
- package/src/index.ts +3 -4
- package/tsconfig.json +14 -9
- package/.eslintrc.json +0 -81
- package/android/bin/.project +0 -34
- package/android/bin/.settings/org.eclipse.buildship.core.prefs +0 -13
- package/android/bin/README.md +0 -14
- package/android/bin/build.gradle +0 -59
- package/android/bin/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/bin/gradle/wrapper/gradle-wrapper.properties +0 -6
- package/android/bin/gradlew +0 -172
- package/android/bin/gradlew.bat +0 -84
- package/android/bin/src/main/AndroidManifest.xml +0 -4
- package/android/src/main/java/com/steerpath/rnsmartmap/RNEventKeys.java +0 -29
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartGeofenceManager.java +0 -103
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapModule.java +0 -284
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapView.java +0 -470
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapViewManager.java +0 -307
- package/dist/SmartGeofenceManager.d.ts +0 -17
- package/dist/SmartGeofenceManager.js +0 -61
- package/dist/SmartGeofenceManager.web.d.ts +0 -9
- package/dist/SmartGeofenceManager.web.js +0 -10
- package/dist/SmartLocationManager.d.ts +0 -11
- package/dist/SmartLocationManager.js +0 -22
- package/dist/SmartLocationManager.web.js +0 -4
- package/dist/SmartMapEventManager.web.d.ts +0 -5
- package/dist/SmartMapEventManager.web.js +0 -10
- package/dist/SmartMapManager.js +0 -53
- package/dist/SmartMapManager.web.d.ts +0 -12
- package/dist/SmartMapManager.web.js +0 -33
- package/dist/SmartMapView.d.ts +0 -3
- package/dist/SmartMapView.js +0 -294
- package/dist/SmartMapView.web.d.ts +0 -3
- package/dist/SmartMapView.web.js +0 -270
- package/dist/SmartMapViewProps.d.ts +0 -267
- package/dist/SmartMapViewProps.js +0 -76
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -5
- package/dist/internalUtils.d.ts +0 -1
- package/dist/internalUtils.js +0 -5
- package/ios/RCTConvert+SmartMapView.h +0 -35
- package/ios/RCTConvert+SmartMapView.m +0 -295
- package/ios/RNSmartGeofenceManager.h +0 -24
- package/ios/RNSmartGeofenceManager.m +0 -110
- package/ios/RNSmartMapUserTaskEventManager.h +0 -19
- package/ios/RNSmartMapUserTaskEventManager.m +0 -46
- package/ios/RNSmartMapView.h +0 -37
- package/ios/RNSmartMapView.m +0 -21
- package/ios/RNSmartMapViewManager.h +0 -27
- package/ios/RNSmartMapViewManager.m +0 -608
- package/package-lock.json +0 -6570
- package/src/SmartGeofenceManager.ts +0 -94
- package/src/SmartGeofenceManager.web.ts +0 -11
- package/src/SmartMapEventManager.web.ts +0 -13
- package/src/SmartMapView.tsx +0 -377
- package/src/SmartMapView.web.tsx +0 -342
- package/src/SmartMapViewProps.ts +0 -338
- package/src/internalUtils.ts +0 -5
- package/src/typings/steerpath-smart-sdk.d.ts +0 -5
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SmartLocationManager = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
const {
|
|
9
|
+
RNSmartLocationManager
|
|
10
|
+
} = _reactNative.NativeModules;
|
|
11
|
+
const smartLocationManagerEmitter = new _reactNative.NativeEventEmitter(RNSmartLocationManager);
|
|
12
|
+
function createSmartLocationManager() {
|
|
13
|
+
let eventListenerRegistered = false;
|
|
14
|
+
let eventListener;
|
|
15
|
+
let locationInterval = null;
|
|
16
|
+
return {
|
|
17
|
+
addLocationChangedListener(listener) {
|
|
18
|
+
if (!eventListenerRegistered && smartLocationManagerEmitter) {
|
|
19
|
+
eventListenerRegistered = true;
|
|
20
|
+
eventListener = smartLocationManagerEmitter.addListener('locationChanged', _payload => {
|
|
21
|
+
// listener(payload);
|
|
22
|
+
});
|
|
23
|
+
// Old-bridge for sending events was not working anymore, so using polling as a workaround, until we move to new architecture
|
|
24
|
+
locationInterval = setInterval(async () => {
|
|
25
|
+
const location = await RNSmartLocationManager.getLocation();
|
|
26
|
+
listener(location);
|
|
27
|
+
}, 1000);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
removeLocationChangedListener() {
|
|
31
|
+
eventListenerRegistered = false;
|
|
32
|
+
eventListener.remove();
|
|
33
|
+
if (locationInterval) {
|
|
34
|
+
clearInterval(locationInterval);
|
|
35
|
+
locationInterval = null;
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* Mostly for internal use. Fetches user's current location once.
|
|
40
|
+
* Using this as a workaround for locationChanged event emitter not working with old bridge.
|
|
41
|
+
*
|
|
42
|
+
* @returns user's current location.
|
|
43
|
+
*/
|
|
44
|
+
getLocation() {
|
|
45
|
+
return RNSmartLocationManager.getLocation();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const SmartLocationManager = exports.SmartLocationManager = createSmartLocationManager();
|
|
50
|
+
//# sourceMappingURL=SmartLocationManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","RNSmartLocationManager","NativeModules","smartLocationManagerEmitter","NativeEventEmitter","createSmartLocationManager","eventListenerRegistered","eventListener","locationInterval","addLocationChangedListener","listener","addListener","_payload","setInterval","location","getLocation","removeLocationChangedListener","remove","clearInterval","SmartLocationManager","exports"],"sourceRoot":"../../src","sources":["SmartLocationManager.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAM;EAAEC;AAAuB,CAAC,GAAGC,0BAAa;AAEhD,MAAMC,2BAA2B,GAAG,IAAIC,+BAAkB,CAACH,sBAAsB,CAAC;AAMlF,SAASI,0BAA0BA,CAAA,EAAG;EACpC,IAAIC,uBAAuB,GAAG,KAAK;EACnC,IAAIC,aAAkC;EACtC,IAAIC,gBAAuC,GAAG,IAAI;EAClD,OAAO;IACLC,0BAA0BA,CACxBC,QAES,EACT;MACA,IAAI,CAACJ,uBAAuB,IAAIH,2BAA2B,EAAE;QAC3DG,uBAAuB,GAAG,IAAI;QAC9BC,aAAa,GAAGJ,2BAA2B,CAACQ,WAAW,CAAC,iBAAiB,EAAGC,QAA0B,IAAK;UACzG;QAAA,CACD,CAAC;QACF;QACAJ,gBAAgB,GAAGK,WAAW,CAAC,YAAY;UACzC,MAAMC,QAAQ,GAAG,MAAMb,sBAAsB,CAACc,WAAW,CAAC,CAAC;UAC3DL,QAAQ,CAACI,QAAQ,CAAC;QACpB,CAAC,EAAE,IAAI,CAAC;MACV;IACF,CAAC;IACDE,6BAA6BA,CAAA,EAAG;MAC9BV,uBAAuB,GAAG,KAAK;MAC/BC,aAAa,CAACU,MAAM,CAAC,CAAC;MACtB,IAAIT,gBAAgB,EAAE;QACpBU,aAAa,CAACV,gBAAgB,CAAC;QAC/BA,gBAAgB,GAAG,IAAI;MACzB;IACF,CAAC;IACD;AACJ;AACA;AACA;AACA;AACA;IACIO,WAAWA,CAAA,EAA8B;MACvC,OAAOd,sBAAsB,CAACc,WAAW,CAAC,CAAC;IAC7C;EACF,CAAC;AACH;AAEO,MAAMI,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAGd,0BAA0B,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SmartLocationManager = void 0;
|
|
7
|
+
const SmartLocationManager = exports.SmartLocationManager = {
|
|
8
|
+
addListener() {},
|
|
9
|
+
removeListener() {}
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=SmartLocationManager.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SmartLocationManager","exports","addListener","removeListener"],"sourceRoot":"../../src","sources":["SmartLocationManager.web.ts"],"mappings":";;;;;;AAAO,MAAMA,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAG;EAClCE,WAAWA,CAAA,EAAE,CAAC,CAAC;EACfC,cAAcA,CAAA,EAAE,CAAC;AACnB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SmartMapManager = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
/* eslint-disable prefer-destructuring */
|
|
9
|
+
|
|
10
|
+
const RNSmartMapManager = _reactNative.NativeModules.RNSmartMapManager;
|
|
11
|
+
const SmartMapManager = exports.SmartMapManager = {
|
|
12
|
+
start(apiKey) {
|
|
13
|
+
RNSmartMapManager.start(apiKey);
|
|
14
|
+
},
|
|
15
|
+
startWithConfig(config) {
|
|
16
|
+
if (_reactNative.Platform.OS === "web") {
|
|
17
|
+
throw new Error("Not implemented");
|
|
18
|
+
}
|
|
19
|
+
let {
|
|
20
|
+
configFilePath
|
|
21
|
+
} = config;
|
|
22
|
+
const {
|
|
23
|
+
configString
|
|
24
|
+
} = config;
|
|
25
|
+
if (configFilePath && configFilePath.startsWith("file://")) {
|
|
26
|
+
// iOS only accept the path like this: /var/something/file.json
|
|
27
|
+
configFilePath = configFilePath.substring(7);
|
|
28
|
+
}
|
|
29
|
+
RNSmartMapManager.startWithConfig({
|
|
30
|
+
apiKey: config.apiKey,
|
|
31
|
+
configFilePath,
|
|
32
|
+
configString
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* Share user location by setting transmit options and show live updates on map by setting receive options.
|
|
37
|
+
*
|
|
38
|
+
* Leave transmit out of the config if you don't want to share location and receive out if you don't want updates to map.
|
|
39
|
+
*
|
|
40
|
+
* @param config
|
|
41
|
+
*/
|
|
42
|
+
loginToLive(config) {
|
|
43
|
+
RNSmartMapManager.loginToLive(config);
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* Stop sharing user location and receiving live updates. Call loginToLive to start again.
|
|
47
|
+
*/
|
|
48
|
+
logoutFromLive() {
|
|
49
|
+
RNSmartMapManager.logoutFromLive();
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @returns Native (iOS/Android) Smart SDK version as a string
|
|
54
|
+
*/
|
|
55
|
+
fetchVersion() {
|
|
56
|
+
return RNSmartMapManager.fetchVersion();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=SmartMapManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","RNSmartMapManager","NativeModules","SmartMapManager","exports","start","apiKey","startWithConfig","config","Platform","OS","Error","configFilePath","configString","startsWith","substring","loginToLive","logoutFromLive","fetchVersion"],"sourceRoot":"../../src","sources":["SmartMapManager.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AADA;;AAQA,MAAMC,iBAAiB,GAAGC,0BAAa,CAACD,iBAAiB;AAoBlD,MAAME,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG;EAC7BE,KAAKA,CAACC,MAAc,EAAQ;IAC1BL,iBAAiB,CAACI,KAAK,CAACC,MAAM,CAAC;EACjC,CAAC;EACDC,eAAeA,CAACC,MAAiB,EAAQ;IACvC,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;MACzB,MAAM,IAAIC,KAAK,CAAC,iBAAiB,CAAC;IACpC;IACA,IAAI;MAAEC;IAAe,CAAC,GAAGJ,MAAM;IAC/B,MAAM;MAAEK;IAAa,CAAC,GAAGL,MAAM;IAE/B,IAAII,cAAc,IAAIA,cAAc,CAACE,UAAU,CAAC,SAAS,CAAC,EAAE;MAC1D;MACAF,cAAc,GAAGA,cAAc,CAACG,SAAS,CAAC,CAAC,CAAC;IAC9C;IAEAd,iBAAiB,CAACM,eAAe,CAAC;MAChCD,MAAM,EAAEE,MAAM,CAACF,MAAM;MACrBM,cAAc;MACdC;IACF,CAAC,CAAC;EACJ,CAAC;EACD;AACF;AACA;AACA;AACA;AACA;AACA;EACEG,WAAWA,CAACR,MAAkB,EAAQ;IACpCP,iBAAiB,CAACe,WAAW,CAACR,MAAM,CAAC;EACvC,CAAC;EACD;AACF;AACA;EACES,cAAcA,CAAA,EAAS;IACrBhB,iBAAiB,CAACgB,cAAc,CAAC,CAAC;EACpC,CAAC;EACD;AACF;AACA;AACA;EACEC,YAAYA,CAAA,EAAoB;IAC9B,OAAOjB,iBAAiB,CAACiB,YAAY,CAAC,CAAC;EACzC;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SmartMapManager = void 0;
|
|
7
|
+
const SmartMapManager = exports.SmartMapManager = {
|
|
8
|
+
start() {
|
|
9
|
+
// No web implementation
|
|
10
|
+
},
|
|
11
|
+
startWithConfig() {
|
|
12
|
+
// No web implementation
|
|
13
|
+
},
|
|
14
|
+
loginToLive() {
|
|
15
|
+
// No web implementation
|
|
16
|
+
},
|
|
17
|
+
logoutFromLive() {
|
|
18
|
+
// No web implementation
|
|
19
|
+
},
|
|
20
|
+
fetchVersion() {
|
|
21
|
+
// No web implementation
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=SmartMapManager.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SmartMapManager","exports","start","startWithConfig","loginToLive","logoutFromLive","fetchVersion"],"sourceRoot":"../../src","sources":["SmartMapManager.web.ts"],"mappings":";;;;;;AAAO,MAAMA,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG;EAC7BE,KAAKA,CAAA,EAAS;IACZ;EAAA,CACD;EACDC,eAAeA,CAAA,EAAQ;IACpB;EAAA,CACF;EACDC,WAAWA,CAAA,EAAS;IAClB;EAAA,CACD;EACDC,cAAcA,CAAA,EAAS;IACrB;EAAA,CACD;EACDC,YAAYA,CAAA,EAAS;IACnB;EAAA;AAEJ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _SmartMapManager = require("./SmartMapManager");
|
|
7
|
+
Object.keys(_SmartMapManager).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _SmartMapManager[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _SmartMapManager[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _SmartLocationManager = require("./SmartLocationManager");
|
|
18
|
+
Object.keys(_SmartLocationManager).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _SmartLocationManager[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _SmartLocationManager[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_SmartMapManager","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_SmartLocationManager"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,gBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,gBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,gBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,qBAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,qBAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,qBAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,qBAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NativeModules, NativeEventEmitter } from "react-native";
|
|
4
|
+
const {
|
|
5
|
+
RNSmartLocationManager
|
|
6
|
+
} = NativeModules;
|
|
7
|
+
const smartLocationManagerEmitter = new NativeEventEmitter(RNSmartLocationManager);
|
|
8
|
+
function createSmartLocationManager() {
|
|
9
|
+
let eventListenerRegistered = false;
|
|
10
|
+
let eventListener;
|
|
11
|
+
let locationInterval = null;
|
|
12
|
+
return {
|
|
13
|
+
addLocationChangedListener(listener) {
|
|
14
|
+
if (!eventListenerRegistered && smartLocationManagerEmitter) {
|
|
15
|
+
eventListenerRegistered = true;
|
|
16
|
+
eventListener = smartLocationManagerEmitter.addListener('locationChanged', _payload => {
|
|
17
|
+
// listener(payload);
|
|
18
|
+
});
|
|
19
|
+
// Old-bridge for sending events was not working anymore, so using polling as a workaround, until we move to new architecture
|
|
20
|
+
locationInterval = setInterval(async () => {
|
|
21
|
+
const location = await RNSmartLocationManager.getLocation();
|
|
22
|
+
listener(location);
|
|
23
|
+
}, 1000);
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
removeLocationChangedListener() {
|
|
27
|
+
eventListenerRegistered = false;
|
|
28
|
+
eventListener.remove();
|
|
29
|
+
if (locationInterval) {
|
|
30
|
+
clearInterval(locationInterval);
|
|
31
|
+
locationInterval = null;
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* Mostly for internal use. Fetches user's current location once.
|
|
36
|
+
* Using this as a workaround for locationChanged event emitter not working with old bridge.
|
|
37
|
+
*
|
|
38
|
+
* @returns user's current location.
|
|
39
|
+
*/
|
|
40
|
+
getLocation() {
|
|
41
|
+
return RNSmartLocationManager.getLocation();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export const SmartLocationManager = createSmartLocationManager();
|
|
46
|
+
//# sourceMappingURL=SmartLocationManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeModules","NativeEventEmitter","RNSmartLocationManager","smartLocationManagerEmitter","createSmartLocationManager","eventListenerRegistered","eventListener","locationInterval","addLocationChangedListener","listener","addListener","_payload","setInterval","location","getLocation","removeLocationChangedListener","remove","clearInterval","SmartLocationManager"],"sourceRoot":"../../src","sources":["SmartLocationManager.ts"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,kBAAkB,QAA6B,cAAc;AAErF,MAAM;EAAEC;AAAuB,CAAC,GAAGF,aAAa;AAEhD,MAAMG,2BAA2B,GAAG,IAAIF,kBAAkB,CAACC,sBAAsB,CAAC;AAMlF,SAASE,0BAA0BA,CAAA,EAAG;EACpC,IAAIC,uBAAuB,GAAG,KAAK;EACnC,IAAIC,aAAkC;EACtC,IAAIC,gBAAuC,GAAG,IAAI;EAClD,OAAO;IACLC,0BAA0BA,CACxBC,QAES,EACT;MACA,IAAI,CAACJ,uBAAuB,IAAIF,2BAA2B,EAAE;QAC3DE,uBAAuB,GAAG,IAAI;QAC9BC,aAAa,GAAGH,2BAA2B,CAACO,WAAW,CAAC,iBAAiB,EAAGC,QAA0B,IAAK;UACzG;QAAA,CACD,CAAC;QACF;QACAJ,gBAAgB,GAAGK,WAAW,CAAC,YAAY;UACzC,MAAMC,QAAQ,GAAG,MAAMX,sBAAsB,CAACY,WAAW,CAAC,CAAC;UAC3DL,QAAQ,CAACI,QAAQ,CAAC;QACpB,CAAC,EAAE,IAAI,CAAC;MACV;IACF,CAAC;IACDE,6BAA6BA,CAAA,EAAG;MAC9BV,uBAAuB,GAAG,KAAK;MAC/BC,aAAa,CAACU,MAAM,CAAC,CAAC;MACtB,IAAIT,gBAAgB,EAAE;QACpBU,aAAa,CAACV,gBAAgB,CAAC;QAC/BA,gBAAgB,GAAG,IAAI;MACzB;IACF,CAAC;IACD;AACJ;AACA;AACA;AACA;AACA;IACIO,WAAWA,CAAA,EAA8B;MACvC,OAAOZ,sBAAsB,CAACY,WAAW,CAAC,CAAC;IAC7C;EACF,CAAC;AACH;AAEA,OAAO,MAAMI,oBAAoB,GAAGd,0BAA0B,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SmartLocationManager","addListener","removeListener"],"sourceRoot":"../../src","sources":["SmartLocationManager.web.ts"],"mappings":";;AAAA,OAAO,MAAMA,oBAAoB,GAAG;EAClCC,WAAWA,CAAA,EAAE,CAAC,CAAC;EACfC,cAAcA,CAAA,EAAE,CAAC;AACnB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable prefer-destructuring */
|
|
4
|
+
import { NativeModules, Platform } from "react-native";
|
|
5
|
+
const RNSmartMapManager = NativeModules.RNSmartMapManager;
|
|
6
|
+
export const SmartMapManager = {
|
|
7
|
+
start(apiKey) {
|
|
8
|
+
RNSmartMapManager.start(apiKey);
|
|
9
|
+
},
|
|
10
|
+
startWithConfig(config) {
|
|
11
|
+
if (Platform.OS === "web") {
|
|
12
|
+
throw new Error("Not implemented");
|
|
13
|
+
}
|
|
14
|
+
let {
|
|
15
|
+
configFilePath
|
|
16
|
+
} = config;
|
|
17
|
+
const {
|
|
18
|
+
configString
|
|
19
|
+
} = config;
|
|
20
|
+
if (configFilePath && configFilePath.startsWith("file://")) {
|
|
21
|
+
// iOS only accept the path like this: /var/something/file.json
|
|
22
|
+
configFilePath = configFilePath.substring(7);
|
|
23
|
+
}
|
|
24
|
+
RNSmartMapManager.startWithConfig({
|
|
25
|
+
apiKey: config.apiKey,
|
|
26
|
+
configFilePath,
|
|
27
|
+
configString
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* Share user location by setting transmit options and show live updates on map by setting receive options.
|
|
32
|
+
*
|
|
33
|
+
* Leave transmit out of the config if you don't want to share location and receive out if you don't want updates to map.
|
|
34
|
+
*
|
|
35
|
+
* @param config
|
|
36
|
+
*/
|
|
37
|
+
loginToLive(config) {
|
|
38
|
+
RNSmartMapManager.loginToLive(config);
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* Stop sharing user location and receiving live updates. Call loginToLive to start again.
|
|
42
|
+
*/
|
|
43
|
+
logoutFromLive() {
|
|
44
|
+
RNSmartMapManager.logoutFromLive();
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @returns Native (iOS/Android) Smart SDK version as a string
|
|
49
|
+
*/
|
|
50
|
+
fetchVersion() {
|
|
51
|
+
return RNSmartMapManager.fetchVersion();
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=SmartMapManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","RNSmartMapManager","SmartMapManager","start","apiKey","startWithConfig","config","OS","Error","configFilePath","configString","startsWith","substring","loginToLive","logoutFromLive","fetchVersion"],"sourceRoot":"../../src","sources":["SmartMapManager.ts"],"mappings":";;AAAA;AACA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAOtD,MAAMC,iBAAiB,GAAGF,aAAa,CAACE,iBAAiB;AAoBzD,OAAO,MAAMC,eAAe,GAAG;EAC7BC,KAAKA,CAACC,MAAc,EAAQ;IAC1BH,iBAAiB,CAACE,KAAK,CAACC,MAAM,CAAC;EACjC,CAAC;EACDC,eAAeA,CAACC,MAAiB,EAAQ;IACvC,IAAIN,QAAQ,CAACO,EAAE,KAAK,KAAK,EAAE;MACzB,MAAM,IAAIC,KAAK,CAAC,iBAAiB,CAAC;IACpC;IACA,IAAI;MAAEC;IAAe,CAAC,GAAGH,MAAM;IAC/B,MAAM;MAAEI;IAAa,CAAC,GAAGJ,MAAM;IAE/B,IAAIG,cAAc,IAAIA,cAAc,CAACE,UAAU,CAAC,SAAS,CAAC,EAAE;MAC1D;MACAF,cAAc,GAAGA,cAAc,CAACG,SAAS,CAAC,CAAC,CAAC;IAC9C;IAEAX,iBAAiB,CAACI,eAAe,CAAC;MAChCD,MAAM,EAAEE,MAAM,CAACF,MAAM;MACrBK,cAAc;MACdC;IACF,CAAC,CAAC;EACJ,CAAC;EACD;AACF;AACA;AACA;AACA;AACA;AACA;EACEG,WAAWA,CAACP,MAAkB,EAAQ;IACpCL,iBAAiB,CAACY,WAAW,CAACP,MAAM,CAAC;EACvC,CAAC;EACD;AACF;AACA;EACEQ,cAAcA,CAAA,EAAS;IACrBb,iBAAiB,CAACa,cAAc,CAAC,CAAC;EACpC,CAAC;EACD;AACF;AACA;AACA;EACEC,YAAYA,CAAA,EAAoB;IAC9B,OAAOd,iBAAiB,CAACc,YAAY,CAAC,CAAC;EACzC;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export const SmartMapManager = {
|
|
4
|
+
start() {
|
|
5
|
+
// No web implementation
|
|
6
|
+
},
|
|
7
|
+
startWithConfig() {
|
|
8
|
+
// No web implementation
|
|
9
|
+
},
|
|
10
|
+
loginToLive() {
|
|
11
|
+
// No web implementation
|
|
12
|
+
},
|
|
13
|
+
logoutFromLive() {
|
|
14
|
+
// No web implementation
|
|
15
|
+
},
|
|
16
|
+
fetchVersion() {
|
|
17
|
+
// No web implementation
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=SmartMapManager.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SmartMapManager","start","startWithConfig","loginToLive","logoutFromLive","fetchVersion"],"sourceRoot":"../../src","sources":["SmartMapManager.web.ts"],"mappings":";;AAAA,OAAO,MAAMA,eAAe,GAAG;EAC7BC,KAAKA,CAAA,EAAS;IACZ;EAAA,CACD;EACDC,eAAeA,CAAA,EAAQ;IACpB;EAAA,CACF;EACDC,WAAWA,CAAA,EAAS;IAClB;EAAA,CACD;EACDC,cAAcA,CAAA,EAAS;IACrB;EAAA,CACD;EACDC,YAAYA,CAAA,EAAS;IACnB;EAAA;AAEJ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,cAAc,mBAAmB;AACjC,cAAc,wBAAwB","ignoreList":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type LocationResponse = {
|
|
2
|
+
latitude: number;
|
|
3
|
+
longitude: number;
|
|
4
|
+
buildingRef: string | null;
|
|
5
|
+
floorIndex: number;
|
|
6
|
+
accuracyM: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const SmartLocationManager: {
|
|
9
|
+
addLocationChangedListener(listener: (data: LocationResponse) => void): void;
|
|
10
|
+
removeLocationChangedListener(): void;
|
|
11
|
+
/**
|
|
12
|
+
* Mostly for internal use. Fetches user's current location once.
|
|
13
|
+
* Using this as a workaround for locationChanged event emitter not working with old bridge.
|
|
14
|
+
*
|
|
15
|
+
* @returns user's current location.
|
|
16
|
+
*/
|
|
17
|
+
getLocation(): Promise<LocationResponse>;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=SmartLocationManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmartLocationManager.d.ts","sourceRoot":"","sources":["../../src/SmartLocationManager.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CACvG,CAAA;AA4CD,eAAO,MAAM,oBAAoB;yCApCjB,CACR,IAAI,EAAE,gBAAgB,KACnB,IAAI;;IAsBX;;;;;OAKG;mBACY,OAAO,CAAC,gBAAgB,CAAC;CAMoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmartLocationManager.web.d.ts","sourceRoot":"","sources":["../../src/SmartLocationManager.web.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB;;;CAGhC,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export
|
|
1
|
+
export type ConfigSDK = {
|
|
2
|
+
apiKey: string;
|
|
3
|
+
configFilePath?: string | null;
|
|
4
|
+
configString?: string | null;
|
|
5
|
+
};
|
|
6
|
+
export type LiveConfig = {
|
|
7
7
|
transmit?: {
|
|
8
8
|
id: string;
|
|
9
9
|
password: string;
|
|
@@ -19,15 +19,10 @@ export interface LiveConfig {
|
|
|
19
19
|
showsThisDevice?: boolean;
|
|
20
20
|
groups?: string[];
|
|
21
21
|
};
|
|
22
|
-
}
|
|
22
|
+
};
|
|
23
23
|
export declare const SmartMapManager: {
|
|
24
24
|
start(apiKey: string): void;
|
|
25
25
|
startWithConfig(config: ConfigSDK): void;
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @deprecated Use loginToLive instead.
|
|
29
|
-
*/
|
|
30
|
-
setLiveConfig(config: LiveConfig | null): void;
|
|
31
26
|
/**
|
|
32
27
|
* Share user location by setting transmit options and show live updates on map by setting receive options.
|
|
33
28
|
*
|
|
@@ -40,7 +35,10 @@ export declare const SmartMapManager: {
|
|
|
40
35
|
* Stop sharing user location and receiving live updates. Call loginToLive to start again.
|
|
41
36
|
*/
|
|
42
37
|
logoutFromLive(): void;
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
* @returns Native (iOS/Android) Smart SDK version as a string
|
|
41
|
+
*/
|
|
42
|
+
fetchVersion(): Promise<string>;
|
|
45
43
|
};
|
|
46
|
-
|
|
44
|
+
//# sourceMappingURL=SmartMapManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmartMapManager.d.ts","sourceRoot":"","sources":["../../src/SmartMapManager.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAA;AAID,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,EAAE;QACT,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAClB,SAAS,CAAC,EAAE;YACV,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;YACnB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;YACrB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;SACpB,CAAC;KACH,CAAC;IACF,OAAO,CAAC,EAAE;QACR,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;CACH,CAAA;AAED,eAAO,MAAM,eAAe;kBACZ,MAAM,GAAG,IAAI;4BAGH,SAAS,GAAG,IAAI;IAkBxC;;;;;;OAMG;wBACiB,UAAU,GAAG,IAAI;IAGrC;;OAEG;sBACe,IAAI;IAGtB;;;OAGG;oBACa,OAAO,CAAC,MAAM,CAAC;CAGhC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmartMapManager.web.d.ts","sourceRoot":"","sources":["../../src/SmartMapManager.web.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe;aACjB,IAAI;uBAGM,IAAI;mBAGR,IAAI;sBAGD,IAAI;oBAGN,IAAI;CAGrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,wBAAwB,CAAA;AACtC,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9D,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-steerpath-smart-map",
|
|
3
3
|
"title": "React Native Steerpath Smart Map",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0-alpha.1",
|
|
5
5
|
"description": "Steerpath SmartMapView for React Native",
|
|
6
|
-
"main": "
|
|
6
|
+
"main": "./lib/module/index.js",
|
|
7
|
+
"types": "./lib/typescript/index.d.ts",
|
|
8
|
+
"react-native": "./src/index.ts",
|
|
9
|
+
"source": "./src/index.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./lib/typescript/index.d.ts",
|
|
13
|
+
"import": "./lib/module/index.js",
|
|
14
|
+
"require": "./lib/commonjs/index.js",
|
|
15
|
+
"default": "./lib/module/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./src/*": "./src/*",
|
|
18
|
+
"./package.json": "./package.json"
|
|
19
|
+
},
|
|
7
20
|
"scripts": {
|
|
8
21
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
-
"
|
|
22
|
+
"prepare": "bob build"
|
|
10
23
|
},
|
|
11
24
|
"repository": {
|
|
12
25
|
"type": "git",
|
|
@@ -23,18 +36,30 @@
|
|
|
23
36
|
"license": "MIT",
|
|
24
37
|
"licenseFilename": "LICENSE",
|
|
25
38
|
"readmeFilename": "README.md",
|
|
26
|
-
"dependencies": {
|
|
27
|
-
"steerpath-smart-sdk": "^2.3.0"
|
|
28
|
-
},
|
|
29
39
|
"peerDependencies": {
|
|
30
|
-
"react": "
|
|
31
|
-
"react-native": ">=0.
|
|
40
|
+
"react": ">=18.2.0",
|
|
41
|
+
"react-native": ">=0.71.0"
|
|
32
42
|
},
|
|
33
43
|
"devDependencies": {
|
|
34
|
-
"@types/react": "^
|
|
35
|
-
"@types/react-native": "^0.
|
|
36
|
-
"react": "
|
|
37
|
-
"react-native": "
|
|
38
|
-
"
|
|
44
|
+
"@types/react": "^18.2.0",
|
|
45
|
+
"@types/react-native": "^0.73.0",
|
|
46
|
+
"react": "19.1.0",
|
|
47
|
+
"react-native": "0.81.5",
|
|
48
|
+
"react-native-builder-bob": "^0.30.0",
|
|
49
|
+
"typescript": "^5.7.0"
|
|
50
|
+
},
|
|
51
|
+
"react-native-builder-bob": {
|
|
52
|
+
"source": "src",
|
|
53
|
+
"output": "lib",
|
|
54
|
+
"targets": [
|
|
55
|
+
"commonjs",
|
|
56
|
+
[
|
|
57
|
+
"module",
|
|
58
|
+
{
|
|
59
|
+
"esm": true
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"typescript"
|
|
63
|
+
]
|
|
39
64
|
}
|
|
40
65
|
}
|
|
@@ -6,21 +6,24 @@ Pod::Spec.new do |s|
|
|
|
6
6
|
s.name = "react-native-steerpath-smart-map"
|
|
7
7
|
s.version = package["version"]
|
|
8
8
|
s.summary = package["description"]
|
|
9
|
-
s.description =
|
|
10
|
-
|
|
11
|
-
DESC
|
|
12
|
-
s.homepage = "https://github.com/github_account/react-native-steerpath-smart-map-sdk"
|
|
9
|
+
s.description = package["description"]
|
|
10
|
+
s.homepage = "https://github.com/steerpath/react-native-steerpath-smart-map"
|
|
13
11
|
s.license = "MIT"
|
|
14
12
|
# s.license = { :type => "MIT", :file => "FILE_LICENSE" }
|
|
15
|
-
s.authors = { "
|
|
16
|
-
s.
|
|
17
|
-
s.source = { :git => "https://github.com/
|
|
18
|
-
|
|
19
|
-
s.source_files = "ios/**/*.{h,m,swift}"
|
|
13
|
+
s.authors = { "Steerpath" => "support@steerpath.com" }
|
|
14
|
+
s.platforms = { :ios => "15.1" } # Updated syntax
|
|
15
|
+
s.source = { :git => "https://github.com/steerpath/react-native-steerpath-smart-map.git", :tag => "#{s.version}" }
|
|
16
|
+
|
|
20
17
|
s.requires_arc = true
|
|
21
18
|
|
|
22
|
-
s.
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
20
|
+
|
|
21
|
+
s.dependency "React-Core"
|
|
22
|
+
s.dependency 'SteerpathSmartSDK', '~> 2.0.0'
|
|
23
|
+
|
|
24
|
+
if respond_to?(:install_modules_dependencies)
|
|
25
|
+
install_modules_dependencies(s)
|
|
26
|
+
end
|
|
27
|
+
|
|
25
28
|
end
|
|
26
29
|
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { NativeModules, NativeEventEmitter, EmitterSubscription } from "react-native";
|
|
2
2
|
|
|
3
|
-
const RNSmartLocationManager = NativeModules
|
|
3
|
+
const { RNSmartLocationManager } = NativeModules;
|
|
4
4
|
|
|
5
|
-
const smartLocationManagerEmitter = new NativeEventEmitter(
|
|
6
|
-
RNSmartLocationManager
|
|
7
|
-
);
|
|
5
|
+
const smartLocationManagerEmitter = new NativeEventEmitter(RNSmartLocationManager);
|
|
8
6
|
|
|
9
7
|
export type LocationResponse = {
|
|
10
8
|
latitude: number, longitude: number, buildingRef: string | null, floorIndex: number, accuracyM: number
|
|
@@ -13,23 +11,41 @@ export type LocationResponse = {
|
|
|
13
11
|
function createSmartLocationManager() {
|
|
14
12
|
let eventListenerRegistered = false;
|
|
15
13
|
let eventListener: EmitterSubscription;
|
|
16
|
-
|
|
14
|
+
let locationInterval: NodeJS.Timeout | null = null;
|
|
17
15
|
return {
|
|
18
16
|
addLocationChangedListener(
|
|
19
17
|
listener: (
|
|
20
18
|
data: LocationResponse
|
|
21
19
|
) => void
|
|
22
20
|
) {
|
|
23
|
-
if (!eventListenerRegistered) {
|
|
24
|
-
eventListenerRegistered = true;
|
|
25
|
-
eventListener = smartLocationManagerEmitter.addListener('locationChanged', (
|
|
26
|
-
listener(payload);
|
|
21
|
+
if (!eventListenerRegistered && smartLocationManagerEmitter) {
|
|
22
|
+
eventListenerRegistered = true;
|
|
23
|
+
eventListener = smartLocationManagerEmitter.addListener('locationChanged', (_payload: LocationResponse) => {
|
|
24
|
+
// listener(payload);
|
|
27
25
|
})
|
|
26
|
+
// Old-bridge for sending events was not working anymore, so using polling as a workaround, until we move to new architecture
|
|
27
|
+
locationInterval = setInterval(async () => {
|
|
28
|
+
const location = await RNSmartLocationManager.getLocation();
|
|
29
|
+
listener(location);
|
|
30
|
+
}, 1000);
|
|
28
31
|
}
|
|
29
32
|
},
|
|
30
33
|
removeLocationChangedListener() {
|
|
31
34
|
eventListenerRegistered = false;
|
|
32
35
|
eventListener.remove();
|
|
36
|
+
if (locationInterval) {
|
|
37
|
+
clearInterval(locationInterval);
|
|
38
|
+
locationInterval = null;
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
/**
|
|
42
|
+
* Mostly for internal use. Fetches user's current location once.
|
|
43
|
+
* Using this as a workaround for locationChanged event emitter not working with old bridge.
|
|
44
|
+
*
|
|
45
|
+
* @returns user's current location.
|
|
46
|
+
*/
|
|
47
|
+
getLocation(): Promise<LocationResponse> {
|
|
48
|
+
return RNSmartLocationManager.getLocation();
|
|
33
49
|
}
|
|
34
50
|
};
|
|
35
51
|
}
|