Skip to content

Commit

Permalink
Merge tag '1.11.1' into develop
Browse files Browse the repository at this point in the history
Bug fixes and improvements
  • Loading branch information
douglasrafael committed Sep 23, 2020
2 parents c51cda2 + 42e9128 commit bfd6c62
Show file tree
Hide file tree
Showing 40 changed files with 339 additions and 531 deletions.
18 changes: 18 additions & 0 deletions .idea/codeStyles/Project.xml

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

2 changes: 2 additions & 0 deletions .idea/modules.xml

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

179 changes: 90 additions & 89 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,96 +1,97 @@
# OCARIoT Data Acquisition
[![License][license-image]][license-url] [![Vulnerabilities][known-vulnerabilities-image]][known-vulnerabilities-url] [![Commit][last-commit-image]][last-commit-url] [![Releases][releases-image]][releases-url] [![Contributors][contributors-image]][contributors-url]

[![Download][apk-download]][apk-download-url]

<p align="center"><img width="120" src="https://i.imgur.com/Z31yxK2.png"/></p>

Native Android application responsible for OCARIoT platform data acquisition. The application acts as an external services access token manager. Currently, only Fitbit service is available.

**MAIN FEATURES:**
- **Fitbit access token management:**
- The Educator and the Health Professional can grant the OCARIoT platform permission to collect Fitbit data from children who have privileges to manage their data according to the consent of those responsible;
- Support to request collection of Fitbit data from the child at any time, automatically saving to the OCARIoT platform;
- Revocation of permission to collect Fitbit data.
- **Display of data saved on the OCARIoT platform:**
- Physical activity;
- Sleep;
- Weight.
- **Display of heart rate data collected in real time. Supported devices:**
- Polar OH1;
- H10.

## Prerequisites
- Android SDK v28
- Latest Android Studio 3.5+

## Getting Started

1. **Clone this repository and import into Android Studio**

```console
git clone https://github.com/ocariot/da-app.git
```
2. **Set up the environment:**
- Make a copy of the `gradle.properties.example` file in the `/app` directory named `gradle.properties` _(This file will not be tracked by git because it is in .gitignore)_.
- Change the values of the variables you find necessary according to your development and production environment.

3. **Add the Firebase Android configuration file:**
- Sign in to Firebase, then open your project and click [Download](https://support.google.com/firebase/answer/7015592) `google-services.json` to obtain your Firebase Android config file.
- Move your config file into the module _(app-level)_ directory of your app.

4. **Open project in Android Studio:**
- From the Android Studio menu, click File > Open.
- Alternatively, on the "Welcome" screen, click > Open an existing Android Studio project.
- Select the project folder and click OK.

## Generating signed APK
From Android Studio:
1. ***Build*** menu
2. ***Generate Signed APK...***
3. Fill in the keystore information *(you only need to do this once manually and then let Android Studio remember it)*

----

## Contributing

1. Fork it
2. Create your feature branch `git checkout -b my-new-feature`
3. Commit your changes `git commit -m 'Add some feature`
4. Push your branch `git push origin my-new-feature`
5. Create a new Pull Request

[//]: # (These are reference links used in the body of this note.)
[license-image]: https://img.shields.io/badge/license-Apache%202-blue.svg
[license-url]: https://github.com/ocariot/da-app/blob/master/LICENSE
[known-vulnerabilities-image]: https://snyk.io/test/github/ocariot/da-app/badge.svg
[known-vulnerabilities-url]: https://snyk.io/test/github/ocariot/da-app
[last-commit-image]: https://img.shields.io/github/last-commit/ocariot/da-app.svg
[last-commit-url]: https://github.com/ocariot/da-app/commits
[releases-image]: https://img.shields.io/github/release-date/ocariot/da-app.svg
[releases-url]: https://github.com/ocariot/da-app/releases
[contributors-image]: https://img.shields.io/github/contributors/ocariot/da-app.svg
[contributors-url]: https://github.com/ocariot/da-app/graphs/contributors
[apk-download]: https://img.shields.io/badge/download%20apk-BR/EU-blue.svg?style=for-the-badge&logo=android
[apk-download-url]: https://play.google.com/store/apps/details?id=br.edu.uepb.nutes.ocariot

---
# OCARIoT Data Acquisition
[![License][license-image]][license-url] [![Vulnerabilities][known-vulnerabilities-image]][known-vulnerabilities-url] [![Commit][last-commit-image]][last-commit-url] [![Releases][releases-image]][releases-url] [![Contributors][contributors-image]][contributors-url]

[![Download][apk-download]][apk-download-url]

<p align="center"><img width="120" src="https://i.imgur.com/Z31yxK2.png"/></p>

Native Android application responsible for OCARIoT platform data acquisition. The application acts as an external services access token manager. Currently, only Fitbit service is available.

**MAIN FEATURES:**
- **Fitbit access token management:**
- The Educator and the Health Professional can grant the OCARIoT platform permission to collect Fitbit data from children who have privileges to manage their data according to the consent of those responsible;
- Support to request collection of Fitbit data from the child at any time, automatically saving to the OCARIoT platform;
- Revocation of permission to collect Fitbit data.
- **Display of data saved on the OCARIoT platform:**
- Physical activity;
- Sleep;
- Weight.
- **Display of heart rate data collected in real time. Supported devices:**
- Polar OH1;
- H10.

## Prerequisites
- Android SDK v29
- Latest Android Studio 3.5+

## Getting Started

1. **Clone this repository and import into Android Studio**

```console
git clone https://github.com/ocariot/da-app.git
```
2. **Set up the environment:**
- Make a copy of the `gradle.properties.example` file in the `/app` directory named `gradle.properties` _(This file will not be tracked by git because it is in .gitignore)_.
- Change the values of the variables you find necessary according to your development and production environment.
3. **Add the Firebase Android configuration file:**
- Sign in to Firebase, then open your project and click [Download](https://support.google.com/firebase/answer/7015592) `google-services.json` to obtain your Firebase Android config file.
- Move your config file into the module _(app-level)_ directory of your app.
4. **Open project in Android Studio:**
- From the Android Studio menu, click File > Open.
- Alternatively, on the "Welcome" screen, click > Open an existing Android Studio project.
- Select the project folder and click OK.
## Generating signed APK
From Android Studio:
1. ***Build*** menu
2. ***Generate Signed APK...***
3. Fill in the keystore information *(you only need to do this once manually and then let Android Studio remember it)*
----
## Contributing
1. Fork it
2. Create your feature branch `git checkout -b my-new-feature`
3. Commit your changes `git commit -m 'Add some feature`
4. Push your branch `git push origin my-new-feature`
5. Create a new Pull Request
[//]: # (These are reference links used in the body of this note.)
[license-image]: https://img.shields.io/badge/license-Apache%202-blue.svg
[license-url]: https://github.com/ocariot/da-app/blob/master/LICENSE
[known-vulnerabilities-image]: https://snyk.io/test/github/ocariot/da-app/badge.svg
[known-vulnerabilities-url]: https://snyk.io/test/github/ocariot/da-app
[last-commit-image]: https://img.shields.io/github/last-commit/ocariot/da-app.svg
[last-commit-url]: https://github.com/ocariot/da-app/commits
[releases-image]: https://img.shields.io/github/release-date/ocariot/da-app.svg
[releases-url]: https://github.com/ocariot/da-app/releases
[contributors-image]: https://img.shields.io/github/contributors/ocariot/da-app.svg
[contributors-url]: https://github.com/ocariot/da-app/graphs/contributors
[apk-download]: https://img.shields.io/badge/download%20apk-BR/EU-blue.svg?style=for-the-badge&logo=android
[apk-download-url]: https://play.google.com/store/apps/details?id=br.edu.uepb.nutes.ocariot
---

### Screenshots

<img align="left" src="https://i.imgur.com/ttlvzao.png" width="200" />
<img align="left" src="https://i.imgur.com/5WLaJlq.png" width="200" />
<img align="left" src="https://i.imgur.com/c5WjiZn.png" width="200" />
<img src="https://i.imgur.com/gxOEdZq.png" width="200" />
<img align="left" src="https://i.imgur.com/ttlvzao.png" width="180" />
<img align="left" src="https://i.imgur.com/5WLaJlq.png" width="180" />
<img align="left" src="https://i.imgur.com/c5WjiZn.png" width="180" />
<img src="https://i.imgur.com/gxOEdZq.png" width="180" />


<img align="left" src="https://i.imgur.com/4xOngef.png" width="200" />
<img align="left" src="https://i.imgur.com/wvlyHPs.png" width="200" />
<img align="left" src="https://i.imgur.com/aoqYNzg.png" width="200" />
<img src="https://i.imgur.com/MKTfM9e.png" width="200" />
<img align="left" src="https://i.imgur.com/4xOngef.png" width="180" />
<img align="left" src="https://i.imgur.com/wvlyHPs.png" width="180" />
<img align="left" src="https://i.imgur.com/aoqYNzg.png" width="180" />
<img src="https://i.imgur.com/MKTfM9e.png" width="180" />

#####

<img align="left" src="https://i.imgur.com/5j3YeNy.png" width="200" />
<img align="left" src="https://i.imgur.com/GugwblV.png" width="200" />
<img align="left" src="https://i.imgur.com/VSiuJNT.png" width="200" />
<img src="https://i.imgur.com/VzM9jQU.png" width="200" />
<img align="left" src="https://i.imgur.com/5j3YeNy.png" width="180" />
<img align="left" src="https://i.imgur.com/GugwblV.png" width="180" />
<img align="left" src="https://i.imgur.com/VSiuJNT.png" width="180" />
<img src="https://i.imgur.com/VzM9jQU.png" width="180" />
33 changes: 16 additions & 17 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
compileSdkVersion 28
buildToolsVersion = '28.0.3'
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "br.edu.uepb.nutes.ocariot"
minSdkVersion 23
targetSdkVersion 28
versionCode 15
versionName "1.11.0"
targetSdkVersion 29
versionCode 16
versionName "1.11.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

manifestPlaceholders = [
Expand Down Expand Up @@ -47,9 +46,10 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.preference:preference:1.1.1'

// Butterknife
implementation 'com.jakewharton:butterknife:10.2.1'
Expand All @@ -60,14 +60,14 @@ dependencies {
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'

// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.7.1'
implementation 'com.squareup.retrofit2:converter-gson:2.7.1'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.7.1'
implementation 'com.squareup.okhttp3:logging-interceptor:4.4.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.8.0'

// Encode/Decode
implementation 'com.auth0.android:jwtdecode:1.2.0'
implementation "androidx.security:security-crypto:1.0.0-alpha02"
implementation "androidx.security:security-crypto:1.1.0-alpha02"

// OAuth2 Client
implementation 'net.openid:appauth:0.7.1'
Expand All @@ -82,7 +82,7 @@ dependencies {
implementation 'br.com.simplepass:loading-button-android:2.2.0'

// EventBus
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'org.greenrobot:eventbus:3.2.0'

// Graphs
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
Expand All @@ -92,8 +92,7 @@ dependencies {
implementation 'com.github.nutes-uepb:simple-ble-scanner:v1.0.1'

// Firebase SDK for Google Analytics
implementation 'com.google.firebase:firebase-analytics:17.2.2'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.google.firebase:firebase-analytics:17.5.0'

// Logs
implementation 'com.jakewharton.timber:timber:4.7.1'
Expand All @@ -104,4 +103,4 @@ dependencies {
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.gms.google-services'
13 changes: 0 additions & 13 deletions app/src/main/java/br/edu/uepb/nutes/ocariot/OcariotApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
import android.app.Application;
import android.content.Context;

import com.crashlytics.android.Crashlytics;
import com.google.firebase.analytics.FirebaseAnalytics;

import org.jetbrains.annotations.NotNull;

import br.edu.uepb.nutes.ocariot.utils.CrashReportingTree;
import io.fabric.sdk.android.Fabric;
import timber.log.Timber;

public class OcariotApp extends Application {
Expand All @@ -22,12 +19,6 @@ public void onCreate() {
instance = (OcariotApp) getApplicationContext();
mFirebaseAnalytics = FirebaseAnalytics.getInstance(getContext());

if (!BuildConfig.DEBUG) {
Fabric.with(this, new Crashlytics());
Timber.plant(new CrashReportingTree());
return;
}

Timber.plant(new Timber.DebugTree() {
@Override
protected String createStackElementTag(@NotNull StackTraceElement element) {
Expand All @@ -36,10 +27,6 @@ protected String createStackElementTag(@NotNull StackTraceElement element) {
});
}

public static OcariotApp getAppContext() {
return instance;
}

public static Context getContext() {
return instance.getApplicationContext();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public String toString() {
return new Gson().toJson(this);
}

public class TokenStatus {
public static class TokenStatus {
private TokenStatus() {
throw new IllegalStateException("Utility class. Does not allow inheritance or instances to be created!");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,7 @@ public void setFitBitAccess(UserAccess fitBitAccess) {

public boolean isFitbitAccessValid() {
if (this.fitbitStatus == null) return false;
return fitbitStatus.equalsIgnoreCase(UserAccess.TokenStatus.VALID) ||
fitbitStatus.equalsIgnoreCase(UserAccess.TokenStatus.EXPIRED) ||
fitbitStatus.equalsIgnoreCase(UserAccess.TokenStatus.RATE_LIMIT) ||
fitbitStatus.equalsIgnoreCase(UserAccess.TokenStatus.INVALID_CLIENT);
return fitbitStatus.equalsIgnoreCase(UserAccess.TokenStatus.VALID);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import android.content.SharedPreferences;

import androidx.security.crypto.EncryptedSharedPreferences;
import androidx.security.crypto.MasterKeys;
import androidx.security.crypto.MasterKey;

import br.edu.uepb.nutes.ocariot.BuildConfig;
import br.edu.uepb.nutes.ocariot.OcariotApp;
Expand Down Expand Up @@ -31,11 +31,15 @@ public class AppPreferencesHelper implements PreferencesHelper {

private AppPreferencesHelper() {
try {
String masterKeyAlias = MasterKeys.getOrCreate(MasterKeys.AES256_GCM_SPEC);
MasterKey masterKey = new MasterKey
.Builder(OcariotApp.getContext(), MasterKey.DEFAULT_MASTER_KEY_ALIAS)
.setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
.build();

mPrefs = EncryptedSharedPreferences.create(
BuildConfig.PREFERENCES_FILENAME,
masterKeyAlias,
OcariotApp.getContext(),
BuildConfig.PREFERENCES_FILENAME,
masterKey,
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
);
Expand Down
Loading

0 comments on commit bfd6c62

Please sign in to comment.