@blife/rn-step-counter 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/LICENSE +1 -1
- package/README.kr.md +9 -3
- package/README.md +44 -7
- package/ios/StepCounter.mm +1 -1
- package/lib/module/index.js +4 -8
- package/lib/module/index.js.map +1 -1
- package/lib/module/packageMeta.js +5 -0
- package/lib/module/packageMeta.js.map +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/packageMeta.d.ts +3 -0
- package/lib/typescript/src/packageMeta.d.ts.map +1 -0
- package/package.json +19 -3
- package/src/index.tsx +4 -9
- package/src/packageMeta.ts +2 -0
package/LICENSE
CHANGED
package/README.kr.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# React-Native Step Counter Library
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@blife/rn-step-counter)
|
|
4
|
+
|
|
5
|
+
**npm:** [@blife/rn-step-counter](https://www.npmjs.com/package/@blife/rn-step-counter) · **GitHub:** [bonnmh/rn-step-counter](https://github.com/bonnmh/rn-step-counter)
|
|
6
|
+
|
|
3
7
|
English-speaking developers, please return to the repository main page or click [the following link](README.md)
|
|
4
8
|
|
|
5
9
|
사용자가 일정 시간 걸은 걸음 수를 계산하기 위한 리액트 네이티브 모듈입니다. 이 패키지는 Android의 `StepCounter` 센서, Android 기기에서 하드웨어 스텝 카운터를 사용할 수 없을 때의 가속도계 기반 폴백, iOS의 `Core Motion` 프레임워크를 사용합니다.
|
|
@@ -7,11 +11,13 @@ English-speaking developers, please return to the repository main page or click
|
|
|
7
11
|
## 설치 방법
|
|
8
12
|
|
|
9
13
|
```shell
|
|
10
|
-
npm install @
|
|
14
|
+
npm install @blife/rn-step-counter
|
|
11
15
|
```
|
|
12
16
|
|
|
17
|
+
npm 패키지: https://www.npmjs.com/package/@blife/rn-step-counter
|
|
18
|
+
|
|
13
19
|
```shell
|
|
14
|
-
yarn add @
|
|
20
|
+
yarn add @blife/rn-step-counter
|
|
15
21
|
```
|
|
16
22
|
|
|
17
23
|
리액트네이티브 0.60 버전 이후 설치된 네이티브 모듈은 오토 링크됩니다. 네이티브 모듈을 수동으로 연결할 필요가 없습니다.
|
|
@@ -100,7 +106,7 @@ import {
|
|
|
100
106
|
parseStepData,
|
|
101
107
|
startStepCounterUpdate,
|
|
102
108
|
stopStepCounterUpdate,
|
|
103
|
-
} from "@
|
|
109
|
+
} from "@blife/rn-step-counter";
|
|
104
110
|
```
|
|
105
111
|
|
|
106
112
|
`isStepCountingSupported` 메소드를 사용하여 장치에 스텝 카운터 또는 가속도계 센서가 있는지 확인합니다.
|
package/README.md
CHANGED
|
@@ -1,17 +1,31 @@
|
|
|
1
1
|
# React-Native Step Counter Library
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@blife/rn-step-counter)
|
|
4
|
+
[](https://www.npmjs.com/package/@blife/rn-step-counter)
|
|
5
|
+
[](https://github.com/bonnmh/rn-step-counter/blob/main/LICENSE)
|
|
6
|
+
|
|
7
|
+
**npm:** [@blife/rn-step-counter](https://www.npmjs.com/package/@blife/rn-step-counter) · **GitHub:** [bonnmh/rn-step-counter](https://github.com/bonnmh/rn-step-counter)
|
|
8
|
+
|
|
3
9
|
한국어 사용자는 [Korean version.](README.kr.md)를 참조하십시오.
|
|
4
10
|
|
|
5
11
|
This library provides an interface for tracking the number of steps taken by the user in a React Native app. It uses the Android `StepCounter` sensor, an accelerometer fallback on Android devices without a step counter sensor, and Apple's `Core Motion` framework on iOS.
|
|
6
12
|
|
|
7
13
|
## Installation
|
|
8
14
|
|
|
15
|
+
Install from npm:
|
|
16
|
+
|
|
9
17
|
```shell
|
|
10
|
-
npm install @
|
|
18
|
+
npm install @blife/rn-step-counter
|
|
11
19
|
```
|
|
12
20
|
|
|
21
|
+
Package page: https://www.npmjs.com/package/@blife/rn-step-counter
|
|
22
|
+
|
|
23
|
+
Alternatives:
|
|
24
|
+
|
|
13
25
|
```shell
|
|
14
|
-
bun add @
|
|
26
|
+
bun add @blife/rn-step-counter
|
|
27
|
+
yarn add @blife/rn-step-counter
|
|
28
|
+
pnpm add @blife/rn-step-counter
|
|
15
29
|
```
|
|
16
30
|
|
|
17
31
|
Native modules will automatically connect after React Native 0.60 version. So you don't need to link the native modules manually.
|
|
@@ -99,7 +113,7 @@ import {
|
|
|
99
113
|
parseStepData,
|
|
100
114
|
startStepCounterUpdate,
|
|
101
115
|
stopStepCounterUpdate,
|
|
102
|
-
} from "@
|
|
116
|
+
} from "@blife/rn-step-counter";
|
|
103
117
|
```
|
|
104
118
|
|
|
105
119
|
Use the `isStepCountingSupported` method to check if the device has a step counter or accelerometer sensor.
|
|
@@ -149,10 +163,33 @@ See the [`Release Notes`](CHANGELOG.md) for a list of changes.
|
|
|
149
163
|
|
|
150
164
|
See the [`Contributing Guide`](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
|
151
165
|
|
|
152
|
-
##
|
|
166
|
+
## Support the project
|
|
153
167
|
|
|
154
|
-
|
|
168
|
+
Help others discover this library:
|
|
169
|
+
|
|
170
|
+
1. **Star the repo:** https://github.com/bonnmh/rn-step-counter
|
|
171
|
+
2. **Install from npm:** `npm install @blife/rn-step-counter`
|
|
172
|
+
3. **Ask or answer on Stack Overflow** with tags `react-native`, `pedometer`, and `step-counter`. Mention the package name `@blife/rn-step-counter`.
|
|
173
|
+
4. **Open a GitHub Discussion** for questions, ideas, or show-and-tell: https://github.com/bonnmh/rn-step-counter/discussions
|
|
155
174
|
|
|
156
|
-
|
|
175
|
+
### Stack Overflow template
|
|
157
176
|
|
|
158
|
-
|
|
177
|
+
```text
|
|
178
|
+
Title: How do I track steps in React Native with @blife/rn-step-counter?
|
|
179
|
+
|
|
180
|
+
Body:
|
|
181
|
+
I'm using [@blife/rn-step-counter](https://www.npmjs.com/package/@blife/rn-step-counter)
|
|
182
|
+
(React Native TurboModule for iOS Core Motion / Android step counter).
|
|
183
|
+
|
|
184
|
+
Environment:
|
|
185
|
+
- React Native: ...
|
|
186
|
+
- Platform: iOS / Android
|
|
187
|
+
- New Architecture: enabled
|
|
188
|
+
|
|
189
|
+
Question:
|
|
190
|
+
...
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## License
|
|
194
|
+
|
|
195
|
+
MIT
|
package/ios/StepCounter.mm
CHANGED
|
@@ -246,7 +246,7 @@ RCT_EXPORT_METHOD(startStepsDetection) {
|
|
|
246
246
|
if (!self) return nil;
|
|
247
247
|
|
|
248
248
|
_pedometer = [[CMPedometer alloc] init];
|
|
249
|
-
_stateQueue = dispatch_queue_create("com.
|
|
249
|
+
_stateQueue = dispatch_queue_create("com.blife.rnstepcounter.state", DISPATCH_QUEUE_SERIAL);
|
|
250
250
|
_baselineSteps = 0;
|
|
251
251
|
_lastEmittedSteps = 0;
|
|
252
252
|
_baselineReady = NO;
|
package/lib/module/index.js
CHANGED
|
@@ -2,18 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import StepCounterModule, { eventName, NAME, VERSION } from "./NativeStepCounter.js";
|
|
4
4
|
import { NativeEventEmitter, Platform } from "react-native";
|
|
5
|
-
import
|
|
6
|
-
function repositoryWebUrl() {
|
|
7
|
-
const url = pkg.repository.url;
|
|
8
|
-
return url.replace(/^git\+/, "").replace(/\.git$/, "");
|
|
9
|
-
}
|
|
5
|
+
import { PACKAGE_NAME, REPOSITORY_WEB_URL } from "./packageMeta.js";
|
|
10
6
|
|
|
11
7
|
/* A way to check if the module is linked. */
|
|
12
|
-
const LINKING_ERROR = `The package '${
|
|
8
|
+
const LINKING_ERROR = `The package '${PACKAGE_NAME}' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
13
9
|
ios: "- You have run `pod install` in the `ios` directory and then clean, rebuild and re-run the app. You may also need to re-open Xcode to get the new pods.\n",
|
|
14
10
|
android: "- You have the Android development environment set up: `https://reactnative.dev/docs/environment-setup.`",
|
|
15
11
|
default: ""
|
|
16
|
-
}) + '- Use the "npx react-native clean" command to clean up the module\'s cache and select the ' + '"watchman", "metro", "android", "npm" (and your package manager) options with comma-separated. ' + "Re-install packages and re-build the app again.\n" + "- You rebuilt the app after installing the package\n" + "- You are not using Expo Go\n" + `If none of these fix the issue, please open an issue on the package repository: ${
|
|
12
|
+
}) + '- Use the "npx react-native clean" command to clean up the module\'s cache and select the ' + '"watchman", "metro", "android", "npm" (and your package manager) options with comma-separated. ' + "Re-install packages and re-build the app again.\n" + "- You rebuilt the app after installing the package\n" + "- You are not using Expo Go\n" + `If none of these fix the issue, please open an issue on the package repository: ${REPOSITORY_WEB_URL}`;
|
|
17
13
|
/**
|
|
18
14
|
* A module that allows you to get the step count data.
|
|
19
15
|
* `CMStepCounter` is deprecated in iOS 8.0. Used `CMPedometer` instead.
|
|
@@ -22,7 +18,7 @@ const LINKING_ERROR = `The package '${pkg.name}' doesn't seem to be linked. Make
|
|
|
22
18
|
* counterType - The type of counter used to count the steps.
|
|
23
19
|
* @throws {Error} LINKING_ERROR - Throws Error If global variable turboModuleProxy is undefined.
|
|
24
20
|
* @example
|
|
25
|
-
* import { StepCounter } from '@
|
|
21
|
+
* import { StepCounter } from '@blife/rn-step-counter';
|
|
26
22
|
*/
|
|
27
23
|
const StepCounter = StepCounterModule ? StepCounterModule : new Proxy({}, {
|
|
28
24
|
get() {
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["StepCounterModule","eventName","NAME","VERSION","NativeEventEmitter","Platform","
|
|
1
|
+
{"version":3,"names":["StepCounterModule","eventName","NAME","VERSION","NativeEventEmitter","Platform","PACKAGE_NAME","REPOSITORY_WEB_URL","LINKING_ERROR","select","ios","android","default","StepCounter","Proxy","get","Error","StepEventEmitter","DEFAULT_MINIMUM_STEP_INTERVAL_MS","_activeSubscription","parseStepData","data","steps","startDate","endDate","distance","dailyGoal","stepsString","kCal","toFixed","endDateTime","Date","toLocaleTimeString","startDateTime","roundedDistance","stepGoalStatus","calories","createStepCountFilter","options","minimumStepIntervalMs","previousRawData","ignoredSteps","ignoredDistance","Number","isFinite","referenceTime","stepDelta","distanceDelta","elapsedMs","POSITIVE_INFINITY","isSuspiciousBurst","Math","max","UnavailabilityError","constructor","moduleName","propertyName","OS","code","isStepCountingSupported","startStepCounterUpdate","start","callBack","remove","from","getTime","addListener","stopStepCounterUpdate"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AACA,OAAOA,iBAAiB,IACtBC,SAAS,EACTC,IAAI,EACJC,OAAO,QAIF,wBAAqB;AAC5B,SAASC,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAC3D,SAASC,YAAY,EAAEC,kBAAkB,QAAQ,kBAAe;;AAEhE;AACA,MAAMC,aAAa,GACjB,gBAAgBF,YAAY,8CAA8C,GAC1ED,QAAQ,CAACI,MAAM,CAAC;EACdC,GAAG,EAAE,2JAA2J;EAChKC,OAAO,EACL,0GAA0G;EAC5GC,OAAO,EAAE;AACX,CAAC,CAAC,GACF,4FAA4F,GAC5F,iGAAiG,GACjG,mDAAmD,GACnD,sDAAsD,GACtD,+BAA+B,GAC/B,mFAAmFL,kBAAkB,EAAE;AAYzG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMM,WAAW,GACfb,iBAAiB,GACbA,iBAAiB,GACjB,IAAIc,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACR,aAAa,CAAC;EAChC;AACF,CACF,CACG;AAET,MAAMS,gBAAgB,GAAG,IAAIb,kBAAkB,CAACS,WAAW,CAAC;AAc5D,MAAMK,gCAAgC,GAAG,GAAG;;AAE5C;AACA;AACA;AACA,IAAIC,mBAA6C,GAAG,IAAI;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAACC,IAAmB,EAAuB;EACtE,MAAM;IAAEC,KAAK;IAAEC,SAAS;IAAEC,OAAO;IAAEC;EAAS,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CAAC;EAC7B5C,mBAAmB,GAAG,IAAI;EAC1BN,WAAW,CAACsD,qBAAqB,CAAC,CAAC;AACrC;AAEA,SAASjE,IAAI,EAAEC,OAAO","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["PACKAGE_NAME","REPOSITORY_WEB_URL"],"sourceRoot":"../../src","sources":["packageMeta.ts"],"mappings":";;AAAA,OAAO,MAAMA,YAAY,GAAG,wBAAwB;AACpD,OAAO,MAAMC,kBAAkB,GAAG,2CAA2C","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAA0B,EAExB,IAAI,EACJ,OAAO,EACP,KAAK,WAAW,EAEhB,KAAK,aAAa,EACnB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAA0B,EAExB,IAAI,EACJ,OAAO,EACP,KAAK,WAAW,EAEhB,KAAK,aAAa,EACnB,MAAM,qBAAqB,CAAC;AAoB7B,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AA0BD,KAAK,uBAAuB,GAAG,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;AAC7D,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,aAAa,KAAK,aAAa,GAAG,IAAI,CAAC;AAE5E,MAAM,WAAW,sBAAsB;IACrC;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AASD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,aAAa,GAAG,mBAAmB,CAkBtE;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,sBAA2B,GAAG,eAAe,CAsD3F;AAuBD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,IAAI,OAAO,CAAC;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAE3F;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,uBAAuB,GAChC,iBAAiB,CAanB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAM5C;AAED,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packageMeta.d.ts","sourceRoot":"","sources":["../../../src/packageMeta.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,2BAA2B,CAAC;AACrD,eAAO,MAAM,kBAAkB,8CAA8C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blife/rn-step-counter",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "This library provides an interface for tracking the number of steps taken by the user in a React Native app.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -40,11 +40,27 @@
|
|
|
40
40
|
"test": "jest --runInBand --no-watchman",
|
|
41
41
|
"prepare": "bob build",
|
|
42
42
|
"typecheck": "tsc",
|
|
43
|
-
"sync-brand": "node scripts/sync-brand.mjs",
|
|
44
43
|
"watchman-reset": "watchman watch-del $PWD && watchman watch-project $PWD"
|
|
45
44
|
},
|
|
46
45
|
"keywords": [
|
|
47
46
|
"react-native",
|
|
47
|
+
"react-native-step-counter",
|
|
48
|
+
"step-counter",
|
|
49
|
+
"step-counter-sensor",
|
|
50
|
+
"pedometer",
|
|
51
|
+
"CMPedometer",
|
|
52
|
+
"CoreMotion",
|
|
53
|
+
"core-motion",
|
|
54
|
+
"ACTIVITY_RECOGNITION",
|
|
55
|
+
"TYPE_STEP_COUNTER",
|
|
56
|
+
"accelerometer",
|
|
57
|
+
"turbomodule",
|
|
58
|
+
"turbo-module",
|
|
59
|
+
"new-architecture",
|
|
60
|
+
"fabric",
|
|
61
|
+
"health",
|
|
62
|
+
"fitness",
|
|
63
|
+
"walking",
|
|
48
64
|
"ios",
|
|
49
65
|
"android"
|
|
50
66
|
],
|
|
@@ -52,7 +68,7 @@
|
|
|
52
68
|
"type": "git",
|
|
53
69
|
"url": "git+https://github.com/bonnmh/rn-step-counter.git"
|
|
54
70
|
},
|
|
55
|
-
"author": "
|
|
71
|
+
"author": "blife <blife.mobile@gmail.com> (https://github.com/bonnmh)",
|
|
56
72
|
"license": "MIT",
|
|
57
73
|
"bugs": {
|
|
58
74
|
"url": "https://github.com/bonnmh/rn-step-counter/issues"
|
package/src/index.tsx
CHANGED
|
@@ -8,16 +8,11 @@ import StepCounterModule, {
|
|
|
8
8
|
type StepCountData,
|
|
9
9
|
} from "./NativeStepCounter";
|
|
10
10
|
import { NativeEventEmitter, Platform } from "react-native";
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
function repositoryWebUrl(): string {
|
|
14
|
-
const url = pkg.repository.url;
|
|
15
|
-
return url.replace(/^git\+/, "").replace(/\.git$/, "");
|
|
16
|
-
}
|
|
11
|
+
import { PACKAGE_NAME, REPOSITORY_WEB_URL } from "./packageMeta";
|
|
17
12
|
|
|
18
13
|
/* A way to check if the module is linked. */
|
|
19
14
|
const LINKING_ERROR =
|
|
20
|
-
`The package '${
|
|
15
|
+
`The package '${PACKAGE_NAME}' doesn't seem to be linked. Make sure: \n\n` +
|
|
21
16
|
Platform.select({
|
|
22
17
|
ios: "- You have run `pod install` in the `ios` directory and then clean, rebuild and re-run the app. You may also need to re-open Xcode to get the new pods.\n",
|
|
23
18
|
android:
|
|
@@ -29,7 +24,7 @@ const LINKING_ERROR =
|
|
|
29
24
|
"Re-install packages and re-build the app again.\n" +
|
|
30
25
|
"- You rebuilt the app after installing the package\n" +
|
|
31
26
|
"- You are not using Expo Go\n" +
|
|
32
|
-
`If none of these fix the issue, please open an issue on the package repository: ${
|
|
27
|
+
`If none of these fix the issue, please open an issue on the package repository: ${REPOSITORY_WEB_URL}`;
|
|
33
28
|
|
|
34
29
|
export interface ParsedStepCountData {
|
|
35
30
|
dailyGoal: string;
|
|
@@ -49,7 +44,7 @@ export interface ParsedStepCountData {
|
|
|
49
44
|
* counterType - The type of counter used to count the steps.
|
|
50
45
|
* @throws {Error} LINKING_ERROR - Throws Error If global variable turboModuleProxy is undefined.
|
|
51
46
|
* @example
|
|
52
|
-
* import { StepCounter } from '@
|
|
47
|
+
* import { StepCounter } from '@blife/rn-step-counter';
|
|
53
48
|
*/
|
|
54
49
|
const StepCounter = (
|
|
55
50
|
StepCounterModule
|