Skip to content

Commit

Permalink
VIT-7196: Move to Sonatype OSS registry (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
andersio committed Aug 15, 2024
1 parent 4d91845 commit a8e5b4d
Show file tree
Hide file tree
Showing 12 changed files with 862 additions and 124 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Android Release

on:
release:
types: [released, prereleased]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Publish
run: ./gradlew publish
env:
USERNAME: ${{ github.actor }}
TOKEN: ${{ github.token }}
1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

669 changes: 669 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

139 changes: 21 additions & 118 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,130 +1,33 @@
# vital_android
# vital-android

## Introduction
The official Swift Library for Vital API, HealthKit and Devices

You can find detailed documentation at [`https://docs.tryvital.io/`].
## Install

The Vital SDK is split into three main components: `VitalClient`, `VitalHealthConnect`
and `VitalDevices`.
Add the vital-ios package to your Package.swift.

- `VitalClient` holds common components to both `VitalHealthConnect` and `VitalDevices`. Among other
things, it has the network layer that allows us to send data from a device to a server.
- `VitalHealthConnect` is an abstraction over Health Connect
- `VitalDevices` is an abstraction over a set of Bluetooth devices.

## Installation

You can install the Vital SDK by adding the followings to your `build.gradle` file:

```groovy
repositories {
...
maven { url 'https://jitpack.io' }
}
```

```groovy
implementation 'com.github.tryVital.vital-android:VitalClient:$vital_version'
implementation 'com.github.tryVital.vital-android:VitalHealthConnect:$vital_version'
implementation 'com.github.tryVital.vital-android:VitalDevices:$vital_version'
```

Replace `$vital_version` with the latest version of the SDK. You only need to add the dependencies
for the components you want to use.

The min version of the SDK is `21` for VitalClient but for VitalHealthConnect and VitalDevices it is
`26`.

### VitalClient installation

You have no additional steps to take to use VitalClient.

### VitalHealthConnect installation

The sdk compiles on min version `26` but to get data out of the underlying Health Connect SDK you
need to be on `28` or higher.

### VitalDevices installation

Vital Devices uses bluetooth and it requires different permissions based on your apps min version.
Here is an example of a `AndroidManifest.xml` file that uses Vital Devices:

```xml
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation"/>
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>

<!-- Request legacy Bluetooth permissions on older devices. -->
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:maxSdkVersion="30"/>
```

## Usage

### VitalClient

First you need to get an instance of `VitalClient`:

```kotlin
val client = VitalClient(
context = this,
region = Region.EU,
environment = Environment.Sandbox,
apiKey = "sk_eu_S5LdX..." //your key from the dashboard
)
```

Now you can start using the client to send and receive data from the server.

You can read about the available methods in
the [docs](https://docs.tryvital.io/api-reference/user/create-user).

### VitalHealthConnect

Coming soon.

### VitalDevices

To interact with Vital Devices sdk you need to get an instance of the `VitalDeviceManager`:

```kotlin
val deviceManager = VitalDeviceManager.create(this)
```

Next you have to scan for one of the supported devices. You can find the list of supported devices
by calling `VitalDeviceManagerBrands.devices`.

You can search now.

```kotlin
vitalDeviceManager.search(deviceModel).collect { scannedDevice ->
// scannedDevice is the device that was found of the type deviceModel
}
```

Depending on the type of device you are connecting to, you will have to call different methods to
connect to it.

#### Blood pressure monitor

```kotlin
vitalDeviceManager.bloodPressure(context, scannedDevice)
.collect { bloodPressureSample ->
// bloodPressureSample is the sample that was received from the device
}
```swift
.package(url: "https://github.com/tryvital/vital-ios", from: "1.2.2"),
```

#### Glucose meter
Then add the Vital iOS library products you need to your app and/or library targets:

```kotlin
vitalDeviceManager.glucoseMeter(context, scannedDevice)
.collect { glucoseSample ->
// glucoseSample is the sample that was received from the device
}
```swift
.target(name: "AppTarget", dependencies: [
.product(name: "VitalCore", package: "vital-ios"),
.product(name: "VitalDevices", package: "vital-ios"),
.product(name: "VitalHealthKit", package: "vital-ios"),
]),
```

After you have received samples depending on the type of device you might need to star scanning
again to receive the next set of samples.
## Documentation

* [Installation](https://docs.tryvital.io/wearables/sdks/installation)
* [Authentication](https://docs.tryvital.io/wearables/sdks/authentication)
* [Core SDK](https://docs.tryvital.io/wearables/sdks/vital-core)
* [Health SDK](https://docs.tryvital.io/wearables/sdks/vital-health)
* [Devices SDK](https://docs.tryvital.io/wearables/sdks/vital-devices)

## License

vital-ios is available under the AGPLv3 license. See the LICENSE file for more info. VitalDevices is under the `Adept Labs Enterprise Edition (EE) license (the “EE License”)`. Please refer to its license inside its folder.
26 changes: 25 additions & 1 deletion VitalClient/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ android {
minSdk 24
targetSdk 34

aarMetadata {
minCompileSdk = 34
}

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
Expand All @@ -28,6 +32,12 @@ android {
}
}

publishing {
singleVariant("release") {
withSourcesJar()
}
}

compileOptions {
coreLibraryDesugaringEnabled true

Expand Down Expand Up @@ -74,4 +84,18 @@ dependencies {
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinx_coroutines_test"

coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:$desugar_jdk_libs"
}
}

publishing {
publications {
release(MavenPublication) {
groupId = 'io.tryvital'
artifactId = 'vital-client'
version = '3.2.0-beta.1'

afterEvaluate {
from components.release
}
}
}
}
42 changes: 42 additions & 0 deletions VitalDevices/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
The Adept Labs Enterprise Edition (EE) license (the “EE License”)
Copyright (c) 2024 Adept Labs, Inc

With regard to the Adept Labs Software:

This software and associated documentation files (the "Software") may only be
used in production, if you (and any entity that you represent) have agreed to,
and are in compliance with, the Adept Labs Terms available
at https://tryvital.io/terms (the “EE Terms”), or other agreements governing
the use of the Software, as mutually agreed by you and Adept Labs, Inc ("Adept Labs"),
and otherwise have a valid Adept Labs Enterprise Edition subscription ("EE Subscription")
for the correct number of hosts as defined in the EE Terms ("Hosts"). Subject to the foregoing sentence,
you are free to modify this Software and publish patches to the Software. You agree
that Adept Labs and/or its licensors (as applicable) retain all right, title and interest in
and to all such modifications and/or patches, and all such modifications and/or
patches may only be used, copied, modified, displayed, distributed, or otherwise
exploited with a valid EE Subscription for the correct number of hosts.
Notwithstanding the foregoing, you may copy and modify the Software for development
and testing purposes, without requiring a subscription. You agree that Adept Labs and/or
its licensors (as applicable) retain all right, title and interest in and to all such
modifications. You are not granted any other rights beyond what is expressly stated herein.
Subject to the foregoing, it is forbidden to copy, merge, publish, distribute, sublicense,
and/or sell the Software.

This EE License applies only to the part of this Software that is not distributed under
the AGPLv3 license. Any part of this Software distributed under the AGPLv3 license or which
is served client-side as an image, font, cascading stylesheet (CSS), file which produces
or is compiled, arranged, augmented, or combined into client-side JavaScript, in whole or
in part, is copyrighted under the AGPLv3 license. The full text of this EE License shall
be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

For all third party components incorporated into the Adept Labs Software, those
components are licensed under the original license provided by the owner of the
applicable component.
26 changes: 25 additions & 1 deletion VitalDevices/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ android {
minSdk 26
targetSdk 34

aarMetadata {
minCompileSdk = 34
}

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
Expand All @@ -22,6 +26,12 @@ android {
}
}

publishing {
singleVariant("release") {
withSourcesJar()
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand Down Expand Up @@ -49,4 +59,18 @@ dependencies {
testImplementation "junit:junit:$junit"
androidTestImplementation "androidx.test.ext:junit:$test_ext"
androidTestImplementation "androidx.test.espresso:espresso-core:$test_espresso"
}
}

publishing {
publications {
release(MavenPublication) {
groupId = 'io.tryvital'
artifactId = 'vital-devices'
version = '3.2.0-beta.1'

afterEvaluate {
from components.release
}
}
}
}
26 changes: 25 additions & 1 deletion VitalHealthConnect/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ android {
minSdk 26
targetSdk 34

aarMetadata {
minCompileSdk = 34
}

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
Expand All @@ -23,6 +27,12 @@ android {
}
}

publishing {
singleVariant("release") {
withSourcesJar()
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand Down Expand Up @@ -73,4 +83,18 @@ dependencies {
testImplementation "org.mockito:mockito-inline:$mockito_inline"
testImplementation "com.squareup.okhttp3:mockwebserver:$mockwebserver"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinx_coroutines_test"
}
}

publishing {
publications {
release(MavenPublication) {
groupId = 'io.tryvital'
artifactId = 'vital-health-connect'
version = '3.2.0-beta.1'

afterEvaluate {
from components.release
}
}
}
}
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,6 @@ dependencies {
debugImplementation "androidx.compose.ui:ui-tooling:$compose"
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose"
}

tasks.withType(PublishToMavenRepository).configureEach { enabled = false }
tasks.withType(PublishToMavenLocal).configureEach { enabled = false }
Loading

0 comments on commit a8e5b4d

Please sign in to comment.