Skip to content

Commit

Permalink
Update Expo version to 48
Browse files Browse the repository at this point in the history
Fix anchor for Maven repo (adapt to Expo 48).
Update README.
  • Loading branch information
ferologics authored and pavel-kuznetsov-hypertrack committed Mar 7, 2023
1 parent dd4052b commit 5c5d989
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 36 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.0.0] - 2023-03-07
### Changed
- Updated expo required version to 48

## [2.0.0] - 2023-03-03
### Changed
- Updated expo required version to 47
### Removed
- AppDelegate methods for push notifications (we don't need them anymore for HyperTrack iOS SDK 4.14.0+)

Expand Down
68 changes: 41 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# HyperTrack Expo config plugin for React Native HyperTrack SDK

![GitHub](https://img.shields.io/github/license/hypertrack/sdk-expo.svg)
![npm](https://img.shields.io/npm/v/hypertrack-sdk-expo.svg)
![GitHub](https://img.shields.io/github/license/hypertrack/sdk-expo.svg)
![hypertrack-sdk-expo](https://img.shields.io/npm/v/hypertrack-sdk-expo?label=hypertrack-sdk-expo)

[HyperTrack](https://www.hypertrack.com) lets you add live location tracking to your mobile app. Live location is made available along with ongoing activity, tracking controls and tracking outage with reasons.

Expand All @@ -13,8 +13,8 @@ For information about how to get started with Expo and React Native HyperTrack S

## Installation

[Install HyperTrack Expo plugin from NPM](https://www.npmjs.com/package/hypertrack-sdk-expo)
[Install React Native HyperTrack SDK from NPM](https://www.npmjs.com/package/hypertrack-sdk-react-native)
- `npx expo install hypertrack-sdk-expo`
- `npx expo install hypertrack-sdk-react-native`

### Add HyperTrack Expo plugin to the app

Expand All @@ -25,26 +25,18 @@ Add `hypertrack-sdk-expo` to [`plugins`](https://docs.expo.io/versions/latest/co
"expo": {
"plugins": [
[
"hypertrack-sdk-expo",
{
"locationPermission":
"PUT_YOUR_PERMISSION_HINT_MESSAGE_HERE",
"motionPermission":
"PUT_YOUR_PERMISSION_HINT_MESSAGE_HERE"
}
"hypertrack-sdk-expo"
]
]
}
}
```

Configuring permission permission purpose strings (`locationPermission`, `motionPermission`) is described below.

### Set required build properties

Use [expo-build-properties](https://docs.expo.dev/versions/latest/sdk/build-properties/) to set build properties
Use [expo-build-properties](https://docs.expo.dev/versions/latest/sdk/build-properties/) to set build properties.

Add this to `plugins` in `app.json` or `app.config.js`:
Run `npx expo install expo-build-properties` and add this to `plugins` in `app.json` or `app.config.js`:
```json
[
"expo-build-properties",
Expand All @@ -61,6 +53,10 @@ Add this to `plugins` in `app.json` or `app.config.js`:
- For iOS, to enable push notifcations you need to add [push notifications credentials](https://docs.expo.dev/app-signing/managed-credentials/#ios)
- For Android, to enable push notifcations you need to use [FCM for Push Notifications](https://docs.expo.dev/push-notifications/using-fcm/)

#### Manual Setup

For `Bare workflow projects, you can follow the [manual setup guide for React Native](https://hypertrack.com/docs/install-sdk-react-native/#set-up-silent-push-notifications).

## Sample code

[Quickstart Expo app](https://github.com/hypertrack/quickstart-expo)
Expand All @@ -73,27 +69,45 @@ Add this to `plugins` in `app.json` or `app.config.js`:

Ensure you use versions that work together!

| `expo` | `hypertrack-sdk-expo` | `hypertrack-sdk-react-native` |
| -------- | --------------------- | ----------------------------- |
| 45.0.0 | 1.0.0 | ^7.19.1 |
| 46.0.14+ | 1.1.0 | ^8.2.1 |
| 46.0.14+ | 1.2.0 | ^8.2.1 |
| 46.0.14+ | 2.0.0 | ^9.0.0 |
| `expo` | `hypertrack-sdk-expo` | `hypertrack-sdk-react-native` |
|----------|-----------------------|-------------------------------|
| ^45.0.0 | 1.0.0 | ^7.19.1 |
| ^46.0.14 | 1.1.0 | ^8.2.1 |
| ^46.0.14 | 1.2.0 | ^8.2.1 |
| ^47.0.0 | 2.0.0 | ^9.0.0 |
| ^48.0.0 | 3.0.0 | ^9.0.0 |

## Configuring permission purpose strings

iOS requires specifying [permission purpose strings](https://hypertrack.com/docs/install-sdk-ios/#add-location-and-motion-purpose-strings) in `Info.plist` for app to build.

You can use plugin parameters described below to set the strings.
You can use plugin parameters described below to set the strings.

Every time you change the props or plugins, you'll need to rebuild (and `prebuild`) the native app.
Every time you change the props or plugins, you'll need to rebuild (and `prebuild`) the native app.

If no extra properties are added, defaults will be used.

- `locationPermission` (_string_): Sets `NSLocationAlwaysAndWhenInUseUsageDescription`, `NSLocationAlwaysUsageDescription`, `NSLocationWhenInUseUsageDescription`
- `locationPermission` (_string_): Sets `NSLocationAlwaysAndWhenInUseUsageDescription`, `NSLocationAlwaysUsageDescription`, `NSLocationWhenInUseUsageDescription`

- `motionPermission` (_string_): Sets `NSMotionUsageDescription`
- `motionPermission` (_string_): Sets `NSMotionUsageDescription`
-

## Manual Setup
Edit `hypertrack-sdk-expo` item in your `app.json` or `app.config.js`:

For bare workflow projects, you can follow the [manual setup guide](https://hypertrack.com/docs/install-sdk-react-native/#step-4-set-up-silent-push-notifications).
```json
{
"expo": {
"plugins": [
[
"hypertrack-sdk-expo",
{
"locationPermission":
"PUT_YOUR_PERMISSION_HINT_MESSAGE_HERE",
"motionPermission":
"PUT_YOUR_PERMISSION_HINT_MESSAGE_HERE"
}
]
]
}
}
```
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hypertrack-sdk-expo",
"version": "2.0.0",
"version": "3.0.0",
"license": "MIT",
"description": "Config plugin to auto configure hypertrack-sdk-react-native on prebuild",
"homepage": "https://github.com/hypertrack/sdk-expo",
Expand Down Expand Up @@ -31,15 +31,15 @@
"repository": "https://github.com/hypertrack/sdk-expo",
"author": "HyperTrack <help@hypertrack.com> (https://hypertrack.com)",
"devDependencies": {
"expo": "^47.0.0",
"expo": "^48.0.0",
"expo-module-scripts": "^3.0.0"
},
"dependencies": {
"@expo/config-plugins": "^5.0.0",
"expo-modules-core": "^1.0.0"
},
"peerDependencies": {
"expo": "^47.0.0"
"expo": "^48.0.0"
},
"upstreamPackage": "hypertrack-sdk-react-native"
}
12 changes: 6 additions & 6 deletions src/withHyperTrackAndroid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ export function addMaven(src: string) {
return mergeContents({
tag: "hypertrack-sdk-expo-build-gradle",
src,
newSrc: `maven {
name 'hypertrack'
url 'https://s3-us-west-2.amazonaws.com/m2.hypertrack.com/'
}`,
anchor: /mavenCentral {/,
offset: -2,
newSrc: ` maven {
name 'hypertrack'
url 'https://s3-us-west-2.amazonaws.com/m2.hypertrack.com/'
}`,
anchor: /allprojects {/,
offset: 2,
comment: "//",
});
}
Expand Down

0 comments on commit 5c5d989

Please sign in to comment.