Skip to content

Commit

Permalink
chore: 🔖 release v0.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewDongminYoo committed Oct 15, 2023
1 parent c92efd8 commit 11532bb
Show file tree
Hide file tree
Showing 15 changed files with 49 additions and 32 deletions.
4 changes: 2 additions & 2 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ nmHoistingLimits: workspaces
plugins:
- path: scripts/pod-install.cjs
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
spec: '@yarnpkg/plugin-interactive-tools'
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
spec: '@yarnpkg/plugin-workspace-tools'

yarnPath: .yarn/releases/yarn-3.6.1.cjs
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [0.2.3](https://github.com/AndrewDongminYoo/react-native-step-counter/compare/v0.2.2...v0.2.3) (2023-10-15)

### Chore Changes

- Add Example App Link and Notices (walking_tracker)

## [0.2.2](https://github.com/AndrewDongminYoo/react-native-step-counter/compare/v0.2.1...v0.2.2) (2023-10-14)

### Bug Fixes
Expand Down
6 changes: 6 additions & 0 deletions README.kr.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ pnpm add react-native-step-counter

👣 리액트 네이티브의 새로운 아키텍쳐를 사용하기 때문에 원하지 않는 경우 아래 가이드를 따라야 합니다. 이미 New Architecture를 활성화하고 사전설정을 마친 상태라면, [다음 단계](#android)로 넘어갑니다.

## 독립 앱에서 사용할 수 있는 리얼월드 예제 앱을 원하시는 분들은 [walking_tracker](https://github.com/AndrewDongminYoo/walking_tracker) 참고

저의 첫 NPM 오픈소스 패키지에 많은 관심 가져주셔서 감사합니다! 배포 이후 사용자 분들로부터 특히 리액트 네이티브 신규 아키텍쳐 하위호환에 관한 이슈 제보가 많았습니다. 전반적으로 코드 구조를 고치면서 해당 이슈를 어느 정도 마무리했습니다. [create-react-native-library](https://github.com/callstack/react-native-builder-bob)의 템플릿으로부터 생성되는 example 폴더에 예제 앱을 작성했고 저도 개발 중에 사용해왔지만, 해당 템플릿의 구조 상 example 폴더가 하나의 standalone 애플리케이션보다는 전체 개발 프로세스의 한 부분을 맡고 있는 관계로, 실제 사용하는 앱에서 참고하기에는 부적합한 코드들이 다수 포함되어 있는 점을 발견했습니다. 이 때문에 비공식적으로 서브 리포지토리로 개발 중이던 example 애플리케이션을 [walking_tracker](https://github.com/AndrewDongminYoo/walking_tracker)라는 이름의 리포지토리로 독립 관리하려고 합니다. 이 점을 꼭 참고해 주시면 감사하겠습니다.

---

## 라이브러리를 의존성에 추가하기 전 사전세팅

- 리액트 네이티브 애플리케이션 공통 변경사항 셋업
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ Native modules will automatically connect after React Native 0.60 version. So yo

👣 if you are using the legacy architecture, you need to follow the guide below. otherwise, you can [skip](#android) next step.

## IF YOU WANT SEE A DEMO IN STANDALONE REACT-NATIVE APPLICATION, SEE [WALKING_TRACKER EXAMPLE](https://github.com/AndrewDongminYoo/walking_tracker) REPO

Thank you for your interest in my first NPM open source package! I've received a lot of issue reports on various issues, especially the react-native's `NEW ARCHITECTURE` backwards compatibility, and I've more or less finalized those issues by fixing the code structure across the board. We had generated an example folder from [create-react-native-library](https://github.com/callstack/react-native-builder-bob)'s template and used it for this project, but due to the structure of that template, we found that the example folder contained a lot of code that was not suitable for reference in a working app, as it was part of the overall development process rather than a standalone application. For this reason, I'm going to independently manage the example application, which we had been developing informally as a sub-repository, as a repository named [walking_tracker](https://github.com/AndrewDongminYoo/walking_tracker). I'd really appreciate it if you could take this into consideration.

---

## Setup the New Architecture

- Applying a new architecture to React Native applications (Common)
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/java/com/stepcounter/StepCounterModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class StepCounterModule internal constructor(context: ReactApplicationContext) :

/**
* StepCounterPackage requires this property for the module.
* @return the name of the module. usually "RNStepCounter".
* @return the name of the module. usually "StepCounter".
*/
override fun getName(): String = NAME

Expand Down
6 changes: 3 additions & 3 deletions docs/NativeStepCounter.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ <h3>Classes</h3>
</ul>
<h3>Global</h3>
<ul>
<li><a href="global.html#RNStepCounter">RNStepCounter</a></li>
<li><a href="global.html#StepCounter">StepCounter</a></li>
<li>
<a href="global.html#isStepCountingSupported"
>isStepCountingSupported</a
Expand Down Expand Up @@ -74,11 +74,11 @@ <h1 class="page-title">NativeStepCounter.js</h1>
* @property {number|undefined} floorsDescended - number of floors descended (iOS only)
*/

export const NAME = 'RNStepCounter';
export const NAME = 'StepCounter';
export const VERSION = '0.1.15';
export const eventName = 'StepCounter.stepCounterUpdate';
/* Getting enforcing the module from the registry. */
export default TurboModuleRegistry.getEnforcing('RNStepCounter');
export default TurboModuleRegistry.getEnforcing('StepCounter');
//# sourceMappingURL=NativeStepCounter.js.map</code></pre>
</article>
</section>
Expand Down
4 changes: 2 additions & 2 deletions docs/UnavailabilityError.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ <h3>Classes</h3>
</ul>
<h3>Global</h3>
<ul>
<li><a href="global.html#RNStepCounter">RNStepCounter</a></li>
<li><a href="global.html#StepCounter">StepCounter</a></li>
<li>
<a href="global.html#isStepCountingSupported"
>isStepCountingSupported</a
Expand Down Expand Up @@ -147,7 +147,7 @@ <h5>Returns:</h5>
<h5>Example</h5>

<pre
class="prettyprint"><code>if (!RNStepCounter.startStepCounterUpdate) {
class="prettyprint"><code>if (!StepCounter.startStepCounterUpdate) {
throw new UnavailabilityError(NativeModuleName, eventName);
}</code></pre>
</div>
Expand Down
8 changes: 4 additions & 4 deletions docs/global.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ <h3>Classes</h3>
</ul>
<h3>Global</h3>
<ul>
<li><a href="global.html#RNStepCounter">RNStepCounter</a></li>
<li><a href="global.html#StepCounter">StepCounter</a></li>
<li>
<a href="global.html#isStepCountingSupported"
>isStepCountingSupported</a
Expand Down Expand Up @@ -68,8 +68,8 @@ <h2></h2>

<h3 class="subsection-title">Members</h3>

<h4 class="name" id="RNStepCounter">
<span class="type-signature">(constant) </span>RNStepCounter<span
<h4 class="name" id="StepCounter">
<span class="type-signature">(constant) </span>StepCounter<span
class="type-signature"></span>
</h4>

Expand Down Expand Up @@ -154,7 +154,7 @@ <h5 class="subsection-title">Properties:</h5>
<h5>Example</h5>

<pre
class="prettyprint"><code>import { RNStepCounter } from '@dongminyu/react-native-step-counter';</code></pre>
class="prettyprint"><code>import { StepCounter } from '@dongminyu/react-native-step-counter';</code></pre>

<h4 class="name" id="isTurboModuleEnabled">
<span class="type-signature">(constant) </span
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ <h3>Classes</h3>
</ul>
<h3>Global</h3>
<ul>
<li><a href="global.html#RNStepCounter">RNStepCounter</a></li>
<li><a href="global.html#StepCounter">StepCounter</a></li>
<li>
<a href="global.html#isStepCountingSupported"
>isStepCountingSupported</a
Expand Down
22 changes: 11 additions & 11 deletions docs/index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ <h3>Classes</h3>
</ul>
<h3>Global</h3>
<ul>
<li><a href="global.html#RNStepCounter">RNStepCounter</a></li>
<li><a href="global.html#StepCounter">StepCounter</a></li>
<li>
<a href="global.html#isStepCountingSupported"
>isStepCountingSupported</a
Expand Down Expand Up @@ -81,7 +81,7 @@ <h1 class="page-title">index.js</h1>
*/
// @ts-ignore
const isTurboModuleEnabled = global.__turboModuleProxy != null;
const StepCounterModule = isTurboModuleEnabled ? require('./NativeStepCounter').default : NativeModules.RNStepCounter;
const StepCounterModule = isTurboModuleEnabled ? require('./NativeStepCounter').default : NativeModules.StepCounter;

/**
* A module that allows you to get the step count data.
Expand All @@ -92,14 +92,14 @@ <h1 class="page-title">index.js</h1>
* @property {string} counterType - The type of counter used to count the steps.
* @throws {Error} LINKING_ERROR - Throws Error If global variable turboModuleProxy is undefined.
* @example
* import { RNStepCounter } from '@dongminyu/react-native-step-counter';
* import { StepCounter } from '@dongminyu/react-native-step-counter';
*/
const RNStepCounter = StepCounterModule ? StepCounterModule : new Proxy({}, {
const StepCounter = StepCounterModule ? StepCounterModule : new Proxy({}, {
get() {
throw new Error(LINKING_ERROR);
}
});
const StepEventEmitter = new NativeEventEmitter(RNStepCounter);
const StepEventEmitter = new NativeEventEmitter(StepCounter);
export const isSensorWorking = StepEventEmitter.listenerCount(eventName) > 0;

/**
Expand Down Expand Up @@ -141,7 +141,7 @@ <h1 class="page-title">index.js</h1>
* @param {string} propertyName The name of the property.
* @returns {Error} The error.
* @example
* if (!RNStepCounter.startStepCounterUpdate) {
* if (!StepCounter.startStepCounterUpdate) {
* throw new UnavailabilityError(NativeModuleName, eventName);
* }
*/
Expand All @@ -163,7 +163,7 @@ <h1 class="page-title">index.js</h1>
* @property {boolean} granted - Whether user granted the permission.
*/
export function isStepCountingSupported() {
return RNStepCounter.isStepCountingSupported();
return StepCounter.isStepCountingSupported();
}

/**
Expand All @@ -186,11 +186,11 @@ <h1 class="page-title">index.js</h1>
* })
*/
export function startStepCounterUpdate(start, callBack) {
if (!RNStepCounter.startStepCounterUpdate) {
if (!StepCounter.startStepCounterUpdate) {
throw new UnavailabilityError(NAME, eventName);
}
const from = start.getTime();
RNStepCounter.startStepCounterUpdate(from);
StepCounter.startStepCounterUpdate(from);
return StepEventEmitter.addListener(eventName, callBack);
}

Expand All @@ -204,10 +204,10 @@ <h1 class="page-title">index.js</h1>
*/
export function stopStepCounterUpdate() {
StepEventEmitter.removeAllListeners(eventName);
RNStepCounter.stopStepCounterUpdate();
StepCounter.stopStepCounterUpdate();
}
export { NAME, VERSION };
export default RNStepCounter;
export default StepCounter;
//# sourceMappingURL=index.js.map</code></pre>
</article>
</section>
Expand Down
2 changes: 1 addition & 1 deletion docs/module-StepCounter-UnavailabilityError.html
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ <h5>Example</h5>

<pre class="prettyprint">
<code>```ts
if (!RNStepCounter.startStepCounterUpdate) {
if (!StepCounter.startStepCounterUpdate) {
throw new UnavailabilityError(NativeModuleName, eventName);
}
```</code></pre>
Expand Down
2 changes: 1 addition & 1 deletion example/src/LogCat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { View, Text, StyleSheet, ScrollView } from 'react-native';
import type { EmitterSubscription } from 'react-native';
import { NativeEventEmitter, NativeModules } from 'react-native';

const eventEmitter = new NativeEventEmitter(NativeModules.RNStepCounter);
const eventEmitter = new NativeEventEmitter(NativeModules.StepCounter);

/**
* @description A component that displays the logs from the native module.
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"name": "@dongminyu/react-native-step-counter",
"displayName": "react-native-step-counter",
"version": "0.2.2",
"private": false,
"version": "0.2.3",
"summary": "It is a multi-platform library that combines CoreMotionSensor from iOS with SensorEventListener from Android.",
"description": "This library provides an interface for tracking the number of steps taken by the user in a React Native app.",
"main": "lib/commonjs/index.js",
Expand Down
4 changes: 2 additions & 2 deletions src/NativeStepCounter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export type StepCountData = {
floorsDescended?: number; // number of floors descended (iOS only)
};

export const NAME = 'RNStepCounter';
export const VERSION = '0.2.1';
export const NAME = 'StepCounter';
export const VERSION = '0.2.3';
export const eventName = 'StepCounter.stepCounterUpdate';

export interface Spec extends TurboModule {
Expand Down
4 changes: 2 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const StepCounterModule = isTurboModuleEnabled
* counterType - The type of counter used to count the steps.
* @throws {Error} LINKING_ERROR - Throws Error If global variable turboModuleProxy is undefined.
* @example
* import { RNStepCounter } from '@dongminyu/react-native-step-counter';
* import { StepCounter } from '@dongminyu/react-native-step-counter';
*/
const StepCounter = (
StepCounterModule
Expand Down Expand Up @@ -114,7 +114,7 @@ export function parseStepData(data: StepCountData): ParsedStepCountData {
* @param {string} propertyName The name of the property.
* @returns {Error} The error.
* @example
* if (!RNStepCounter.startStepCounterUpdate) {
* if (!StepCounter.startStepCounterUpdate) {
* throw new UnavailabilityError(NativeModuleName, eventName);
* }
*/
Expand Down

0 comments on commit 11532bb

Please sign in to comment.