Skip to content

Commit

Permalink
Use SDK v5/7 (#15)
Browse files Browse the repository at this point in the history
Implement static API
  • Loading branch information
pavel-kuznetsov-hypertrack authored Oct 27, 2023
1 parent 13b214c commit e3f63c6
Show file tree
Hide file tree
Showing 60 changed files with 2,273 additions and 1,437 deletions.
56 changes: 56 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,57 @@
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).

## [2.0.0] - 2023-10-27

We are excited to announce the release of HyperTrack Ionic Capacitor SDK 2.0.0, a major update to our location tracking SDK. This release ensures highest tracking performance, reduces deployed app sizes and comes with an improved API to simplify the integrations. We highly recommend upgrading, but please note that there are a few breaking changes.

### Changed

- Updated HyperTrack Android SDK to [7.0.6](https://github.com/hypertrack/sdk-android/releases/tag/7.0.1)
- Added Android SDK plugins (`location-services-google` and `push-service-firebase`)
- Updated HyperTrack iOS SDK to [5.0.4](https://github.com/hypertrack/sdk-ios/releases/tag/5.0.4)
- The whole HyperTrack API is now static
- Changed the way to provide publishableKey (you need to add `HyperTrackPublishableKey` `meta-data` item to your `AndroidManifest.xml`)
- Renamed HyperTrackError types:
- `gpsSignalLost` to `locationSignalLost`
- `locationPermissionsDenied` to `permissionsLocationDenied`
- `locationPermissionsInsufficientForBackground` to `permissionsLocationInsufficientForBackground`
- `locationPermissionsNotDetermined` to `permissionsLocationNotDetermined`
- `locationPermissionsProvisional` to `locationPermissionsProvisional`
- `locationPermissionsReducedAccuracy` to `permissionsLocationReducedAccuracy`
- `locationPermissionsRestricted` to `permissionsLocationRestricted`
- Renamed `isAvailable()` to `getIsAvailable()`
- Renamed `isTracking()` to `getIsTracking()`
- Renamed `setAvailability()` to `setIsAvailable(boolean)`
- Changed `startTracking()` and `stopTracking()` to `setIsTracking(boolean)`
- Renamed `subscribeToTracking()` to `subscribeToIsTracking()`
- Renamed `subscribeToAvailability()` to `subscribeToIsAvailable()`
- Changed `getLocation()` response to `Result<Location, LocationError>`

### Added

- `locate()` to ask for one-time user location
- `subscribeToLocation()` to subscribe to user location updates
- `getErrors()`
- `getName()`
- `getMetadata()`
- HyperTrackError types:
- `noExemptionFromBackgroundStartRestrictions`
- `permissionsNotificationsDenied`

### Removed

- `initialize()` method (the API is now static)
- `SdkInitParams` (the config now should be done with the `AndroidManifest` metadata and `Info.plist`)
- Motion Activity permissions are not required for tracking anymore
- HyperTrackError types:
- `motionActivityPermissionsDenied`
- `motionActivityServicesDisabled`
- `motionActivityServicesUnavailable`
- `motionActivityPermissionsRestricted`
- `networkConnectionUnavailable`
- `sync()` method

## [1.0.3] - 2023-06-16

### Changed
Expand All @@ -12,18 +63,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [1.0.2] - 2023-06-15

### Changed

- HyperTrack SDK Android updated to 6.4.2

## [1.0.1] - 2023-06-01

### Changed

- HyperTrack SDK iOS updated to 4.16.0

## [1.0.0] - 2023-02-10

### Added

- Initial release

[2.0.0] https://github.com/hypertrack/sdk-ionic-capacitor/releases/tag/2.0.0
[1.0.3] https://github.com/hypertrack/sdk-ionic-capacitor/releases/tag/1.0.3
[1.0.2] https://github.com/hypertrack/sdk-ionic-capacitor/releases/tag/1.0.2
[1.0.1] https://github.com/hypertrack/sdk-ionic-capacitor/releases/tag/1.0.1
[1.0.0] https://github.com/hypertrack/sdk-ionic-capacitor/releases/tag/1.0.0
2 changes: 1 addition & 1 deletion HypertrackSdkIonicCapacitor.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '12.0'
s.dependency 'Capacitor'
s.swift_version = '5.1'
s.dependency 'HyperTrack','4.16.1'
s.dependency 'HyperTrack','5.0.4'
end
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

[![GitHub](https://img.shields.io/github/license/hypertrack/sdk-ionic-capacitor.svg?color=orange)](./LICENSE)
[![npm](https://img.shields.io/npm/v/hypertrack-sdk-ionic-capacitor.svg)](https://www.npmjs.com/package/hypertrack-sdk-ionic-capacitor)
[![iOS SDK](https://img.shields.io/badge/iOS%20SDK-4.16.1-brightgreen.svg)](https://github.com/hypertrack/sdk-ios)
[![Android SDK](https://img.shields.io/badge/Android%20SDK-6.4.2-brightgreen.svg)](https://github.com/hypertrack/sdk-android)
[![iOS SDK](https://img.shields.io/badge/iOS%20SDK-5.0.4-brightgreen.svg)](https://github.com/hypertrack/sdk-ios)
[![Android SDK](https://img.shields.io/badge/Android%20SDK-7.0.6-brightgreen.svg)](https://github.com/hypertrack/sdk-android)

[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 @@ -16,6 +16,7 @@ For information about how to get started with Ionic Capacitor HyperTrack SDK, pl
`npm install hypertrack-sdk-ionic-capacitor`

### Android

In order to use this plugin, please add HyperTrack repository in `android/build.gradle`:

```
Expand Down
8 changes: 6 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ext {

buildscript {
ext.kotlin_version = "1.7.21"
ext.hypertrack_sdk_version = "6.4.2"
ext.hypertrack_sdk_version = "7.0.6"
ext.firebase_messaging_version = "23.1.1"

repositories {
Expand Down Expand Up @@ -64,6 +64,10 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':capacitor-android')
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation "com.hypertrack:hypertrack:$hypertrack_sdk_version"

implementation "com.hypertrack:sdk-android:$hypertrack_sdk_version"
implementation "com.hypertrack:location-services-google:$hypertrack_sdk_version"
implementation "com.hypertrack:push-service-firebase:$hypertrack_sdk_version"

implementation "com.google.firebase:firebase-messaging:$firebase_messaging_version"
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@ import com.getcapacitor.JSArray
import com.getcapacitor.JSObject
import com.getcapacitor.PluginCall
import com.hypertrack.sdk.capacitor.common.Failure
import com.hypertrack.sdk.capacitor.common.Result
import com.hypertrack.sdk.capacitor.common.Serialized
import com.hypertrack.sdk.capacitor.common.WrapperResult
import com.hypertrack.sdk.capacitor.common.Success
import org.json.JSONArray
import org.json.JSONObject

private const val KEY_ERRORS = "errors"

fun serializeErrorsForCapacitor(errors: List<Serialized>): Serialized {
return mapOf(
KEY_ERRORS to errors
)
}

@Suppress("UNCHECKED_CAST")
internal fun <T> Result<T>.toPluginCall(call: PluginCall) {
internal fun <T> WrapperResult<T>.toPluginCall(call: PluginCall) {
when (this) {
is Success -> {
when (this.success) {
Expand Down Expand Up @@ -65,7 +74,7 @@ internal fun Map<String, Any?>.toJSObject(): JSObject {
is Boolean -> {
put(key, value)
}
is Double -> {
is Double, is Float -> {
put(key, value)
}
is Int -> {
Expand Down
Loading

0 comments on commit e3f63c6

Please sign in to comment.