Skip to content

Commit

Permalink
Bug fixes and improvements
Browse files Browse the repository at this point in the history
- Adds correction in Spanish translation;
- Adds the MaterialComponents style;
- Adds updating used libraries;
- Adds general refactorings and code improvements.
  • Loading branch information
douglasrafael committed Sep 23, 2020
1 parent 20dde49 commit 47d33e7
Show file tree
Hide file tree
Showing 41 changed files with 362 additions and 499 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: 17 additions & 16 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

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

manifestPlaceholders = [
Expand Down Expand Up @@ -47,9 +48,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 +62,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 +84,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 +94,8 @@ 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'
implementation 'com.google.firebase:firebase-crashlytics-ktx:17.2.1'

// Logs
implementation 'com.jakewharton.timber:timber:4.7.1'
Expand All @@ -104,4 +106,3 @@ 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'
8 changes: 7 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,10 @@
-keepclassmembers class ** {
@org.greenrobot.eventbus.Subscribe <methods>;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }
-keep enum org.greenrobot.eventbus.ThreadMode { *; }

-keepattributes *Annotation*
-keepattributes SourceFile,LineNumberTable
# prevent Crashlytics obfuscation
-keep class com.google.firebase.crashlytics.** { *; }
-dontwarn com.google.firebase.crashlytics.**
9 changes: 1 addition & 8 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,11 @@
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 @@ -23,8 +21,7 @@ public void onCreate() {
mFirebaseAnalytics = FirebaseAnalytics.getInstance(getContext());

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

Expand All @@ -36,10 +33,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
Loading

0 comments on commit 47d33e7

Please sign in to comment.