Skip to content

Commit 5678971

Browse files
Feature - TrackingOptions (#14)
* feat: creating TrackingOptions object to allow dynamic configuration * feat: adjusting hooks and module to work dynamic configuration * chore(lint): adjusting eslint config to ignore auto-generated files * feat(example): upgrading example app with mapping with current route * feat(example): upgrading example app with mapping with current route * chore(docs): updating docs * chore(version): updating package beta version * chore(CICD): disabling automatic deploy for develop changes * chore(tests): adjusting tests to use new config + new tests * chore(tests): adjusting tests * chore(CICD): adjusting podfile of example project
1 parent 631ae7d commit 5678971

33 files changed

+2876
-535
lines changed

.github/workflows/prerelease.yml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
name: Pre-release to NPM
22

33
on:
4-
push:
5-
branches:
6-
- develop
4+
workflow_dispatch:
5+
inputs:
6+
branch:
7+
description: 'Branch to release from (default: develop)'
8+
required: false
9+
type: string
10+
default: 'develop'
11+
version_suffix:
12+
description: 'Optional version suffix (e.g., "rc1", "beta1"). Leave empty for auto-generated beta version.'
13+
required: false
14+
type: string
15+
description:
16+
description: 'Optional description for this pre-release'
17+
required: false
18+
type: string
719

820
concurrency:
921
group: ${{ github.workflow }}-${{ github.ref }}
@@ -23,6 +35,7 @@ jobs:
2335
- name: Checkout
2436
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2537
with:
38+
ref: ${{ github.event.inputs.branch || 'develop' }}
2639
fetch-depth: 0
2740
token: ${{ secrets.GITHUB_TOKEN }}
2841

@@ -45,9 +58,15 @@ jobs:
4558
COMMIT_SHA=${GITHUB_SHA::7}
4659
TIMESTAMP=$(date +%Y%m%d%H%M%S)
4760
48-
# Remove any existing pre-release tag and add beta
61+
# Remove any existing pre-release tag
4962
BASE_VERSION=$(echo $CURRENT_VERSION | sed 's/-.*$//')
50-
PRERELEASE_VERSION="${BASE_VERSION}-beta.${TIMESTAMP}.${COMMIT_SHA}"
63+
64+
# Use custom suffix if provided, otherwise auto-generate beta version
65+
if [ -n "${{ github.event.inputs.version_suffix }}" ]; then
66+
PRERELEASE_VERSION="${BASE_VERSION}-${{ github.event.inputs.version_suffix }}"
67+
else
68+
PRERELEASE_VERSION="${BASE_VERSION}-beta.${TIMESTAMP}.${COMMIT_SHA}"
69+
fi
5170
5271
echo "version=$PRERELEASE_VERSION" >> $GITHUB_OUTPUT
5372
echo "Generated pre-release version: $PRERELEASE_VERSION"
@@ -124,13 +143,15 @@ jobs:
124143
const version = '${{ steps.version.outputs.version }}';
125144
const tagName = `v${version}`;
126145
146+
const description = '${{ github.event.inputs.description }}' || 'This is a beta release from the develop branch.';
147+
127148
await github.rest.repos.createRelease({
128149
owner: context.repo.owner,
129150
repo: context.repo.repo,
130151
tag_name: tagName,
131152
name: `Pre-release ${tagName}`,
132153
body: `🚀 Pre-release version ${version}\n\n` +
133-
`This is a beta release from the develop branch.\n\n` +
154+
`${description}\n\n` +
134155
`Install with: \`npm install @gabriel-sisjr/react-native-background-location@beta\`\n\n` +
135156
`Commit: ${context.sha}`,
136157
draft: false,

CHANGELOG.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,61 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.4.0] - 2025-11-05
9+
10+
### Added
11+
12+
- ⚙️ **Configurable Tracking Options**: Full customization of location tracking parameters
13+
- `TrackingOptions` interface for comprehensive configuration
14+
- Customizable update intervals (`updateInterval`, `fastestInterval`, `maxWaitTime`)
15+
- Location accuracy levels (`LocationAccuracy` enum)
16+
- Notification customization (`notificationTitle`, `notificationText`, `notificationChannelName`, `notificationPriority`)
17+
- `waitForAccurateLocation` option for precise GPS tracking
18+
- Support for configuration options in `startTracking()` method and `useBackgroundLocation` hook
19+
20+
- 📊 **Location Accuracy Enums**: Type-safe location accuracy levels
21+
- `LocationAccuracy.HIGH_ACCURACY` - Highest accuracy using GPS and sensors
22+
- `LocationAccuracy.BALANCED_POWER_ACCURACY` - Balanced accuracy and power consumption
23+
- `LocationAccuracy.LOW_POWER` - Low power consumption using network-based location
24+
- `LocationAccuracy.NO_POWER` - No power consumption, passive updates
25+
- `LocationAccuracy.PASSIVE` - Receives location updates from other apps
26+
27+
- 🔔 **Notification Priority Enums**: Type-safe notification priority levels
28+
- `NotificationPriority.LOW` - Low priority (default)
29+
- `NotificationPriority.DEFAULT` - Default priority
30+
- `NotificationPriority.HIGH` - High priority
31+
- `NotificationPriority.MAX` - Maximum priority
32+
33+
- 🗑️ **Clear Locations Method**: Added `clearLocations()` method to `useLocationUpdates` hook
34+
- Allows clearing all locations for the current trip
35+
- Prevents immediate reloading of data after clear operation
36+
- Works seamlessly with auto-update functionality
37+
38+
- 📱 **Configuration Presets**: Example app includes predefined configuration presets
39+
- **High Accuracy**: Optimized for navigation (2s interval, GPS)
40+
- **Balanced**: Good balance between accuracy and battery (10s interval)
41+
- **Low Power**: Optimized for battery efficiency (30s interval, network-based)
42+
- **Default**: Standard configuration (5s interval)
43+
44+
### Changed
45+
46+
- 🔧 **API Enhancement**: `startTracking()` now accepts optional `TrackingOptions` parameter
47+
- `startTracking(tripId?: string, options?: TrackingOptions): Promise<string>`
48+
- Backwards compatible with existing code (options are optional)
49+
- Default values applied when options not provided
50+
51+
- 📚 **Documentation Updates**: Comprehensive documentation for new features
52+
- Updated README.md with configuration examples and enums documentation
53+
- Enhanced hooks.md with TrackingOptions examples
54+
- Updated QUICKSTART.md with configuration examples
55+
- Added configuration presets documentation
56+
57+
### Fixed
58+
59+
- 🐛 Fixed inline styles warnings in RouteMap component
60+
- 🐛 Fixed enum export/import issues for proper TypeScript support
61+
- 🐛 Improved type safety for TrackingOptions across the codebase
62+
863
## [0.1.0] - 2025-10-26
964

1065
### Added

0 commit comments

Comments
 (0)