Skip to content

Commit

Permalink
Merge branch 'NightscoutFoundation:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
tolot27 authored May 30, 2024
2 parents b81c666 + 27de713 commit d1f4e82
Show file tree
Hide file tree
Showing 1,164 changed files with 31,723 additions and 8,031 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
java-version: [ 8, 11 ]
java-version: [ 11 ]

steps:
- uses: actions/checkout@v2
Expand Down
20 changes: 20 additions & 0 deletions Documentation/Quick_Start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Quick Start

### Currently Recommended IDE

Android Studio Giraffe | 2022.3.1 Patch 3


### Lombok Plugin

Until we are using Android Studio Iguana (where the lombok regression is believed to be corrected) you will need to manually install the lombok plugin jar from the etc source tree folder.

To install it you go to Settings -> Plugins -> Cog icon -> Install plugin from disk -> select the lombok-giraffe.jar file

### Android Studio Bugs and Regressions

Be aware that each new version of Android Studio introduces more regressions and bugs. There are still uncorrected bugs which were introduced back in version 3.6! Also each IDE version is tightly coupled with various versions of gradle which are also tightly coupled with various versions of the Android framework tools.

What this means, is that even though the command line compilation always works fine, any single version of Android Studio is unable to compile the entire xDrip source tree history and is likely to break in misleading and confusing ways based on simple dependency changes as there is such poor support in Android Studio for forward or backwards compatibility.

Expect to have to run multiple different versions of Android Studio over time or where in the commit history you may be working from and for each new version to potentially introduce new and unpredictable issues. Expect to have to clear cache and restart to avoid being misled about the source of errors.
57 changes: 57 additions & 0 deletions Documentation/technical/Incoming_Glucose_Broadcast.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@

# Integration with xDrip+ via Broadcast Intent

## Overview
This documentation provides guidance on how to send a broadcast intent from a third-party Android application to insert a glucose sensor record into the xDrip application. There are a few different broadcast receivers but this documents the Nightscout Emulation receiver just for glucose records.

## Sending a Broadcast Intent
To insert a glucose sensor record into xDrip, construct and send a broadcast intent with specific parameters as described below.

### Intent Action
Use the following intent action when constructing the intent:
```java
Intent intent = new Intent("com.eveningoutpost.dexdrip.NS_EMULATOR");
```

### Intent Package
To ensure the intent is received only by xDrip and to be allowed on Android 8+, specify the package name:
```java
intent.setPackage("com.eveningoutpost.dexdrip");
```

### Extra Parameters
Add extra parameters to the intent for the data collection and JSON payload containing the sensor readings.

- Collection: Indicate the type of data collection using the key `"collection"` with the value `"entries"`.
- Data: Provide the glucose sensor readings in a JSON array format with the key `"data"`.

### JSON Payload Structure
Construct the JSON payload with the glucose sensor readings as follows:
- Each reading should be a JSON object with the following attributes:
- `"type"`: Set to `"sgv"` for sensor glucose value record.
- `"date"`: The timestamp of the reading in milliseconds since epoch.
- `"sgv"`: The glucose value in mg/dL.
- `"direction"`: The rate of change of the glucose value, represented by a string such as `"SingleUp"`. Refer to `BgReading.slopeFromName()` for possible values.

Here is an example JSON payload with a single reading:
```java
final JSONArray sgv_array = new JSONArray();
final JSONObject sgv_object = new JSONObject();
sgv_object.put("type", "sgv");
sgv_object.put("date", 1526817691000.0);
sgv_object.put("sgv", 158);
sgv_object.put("direction", "SingleUp");
sgv_array.put(sgv_object);
intent.putExtra("data", sgv_array.toString());
```

A code example of this is in the unit test source tree in `NSEmulatorReceiverTest.bgReadingExampleBroadcast()`

### Sending the Intent
After constructing the intent, use `sendBroadcast()` to send it:
```java
context.sendBroadcast(intent);
```

## Testing the Integration
For testing purposes, make sure you set xDrip `Hardware Data Source` to `640G / Eversense` to enable the receiver.
9 changes: 9 additions & 0 deletions Documentation/technical/Kotlin_Policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### Kotlin Policy

xDrip supports both Java and Kotlin source files.

New class files in Java or Kotlin are accepted but there is no intention to convert existing Java files to Kotlin.

Kotlin classes should be mindful to maintain as much java compatibility as possible where they may need to interact with existing classes.

Overhead in terms of additional libraries and any performance related issues (such as threading and component lifecycle) should be carefully monitored.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

xDrip+ is an unofficial and independent Android app which works as data hub and processor between many different devices.

It supports wireless connections to G4, G5, G6, Medtrum A6, Libre via NFC and Bluetooth, 630G, 640G, 670G pumps and Eversense CGM via companion apps. Bluetooth Glucose Meters such as the Contour Next One, AccuChek Guide, Verio Flex & Diamond Mini as well as devices like the Pendiq 2.0 Insulin Pen.
It supports wireless connections to G4, G5, G6, G7, Medtrum A6, Libre via NFC and Bluetooth, 630G, 640G, 670G pumps, CareSens Air and Eversense CGM via companion apps. Bluetooth Glucose Meters such as the Contour Next One, AccuChek Guide, Verio Flex & Diamond Mini as well as devices like the Pendiq 2.0 Insulin Pen.

Heart-rate and step counter data is processed from Android Wear, Garmin, Fitbit and Pebble smart-watches and watch-faces for those that show glucose values and graphs.

Expand Down
Binary file removed aidex_text.png
Binary file not shown.
90 changes: 62 additions & 28 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ buildscript {
}
}
apply plugin: 'com.android.application'
apply from: 'token-replace.gradle'
//apply from: 'token-replace.gradle'
apply from: '../common.gradle'
apply plugin: 'kotlin-android'

if (project.file('local.gradle').exists()) {
apply from: 'local.gradle'
Expand All @@ -34,7 +35,7 @@ repositories {
url "https://jitpack.io"
}
flatDir {
dirs 'libs'
dirs project(':app').file('libs'), project(':wear').file('libs')
}
}

Expand Down Expand Up @@ -68,11 +69,8 @@ def getLocalProperty(String propertyName) {
}

android {
compileSdkVersion 29
compileSdk 34

dexOptions {
javaMaxHeapSize "3g"
}

configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
Expand All @@ -82,7 +80,7 @@ android {
// changes to databinding libraries can apparently result in nasty bugs on some handsets
// the following checks that databinding dependencies are not changed from the tested configuration
// 2.3.0 and 1.3.1 are from me.tatarka.bindingcollectionadapter2
if (!["3.1.4", "2.3.0", "1.3.1", "3.4.3"].contains(details.target.version)) {
if (!["3.1.4", "2.3.0", "1.3.1", "3.4.3", "3.6.4", "7.4.2"].contains(details.target.version)) {
throw new GradleException("Untested databinding version: " + details.requested.group + " " + details.requested.name + "- " + details.requested.version + " - " + details.target.version)
}
}
Expand All @@ -91,10 +89,10 @@ android {

defaultConfig {
applicationId "com.eveningoutpost.dexdrip"
minSdkVersion 21
minSdkVersion 24
// increasing target SDK version can cause compatibility issues with Android 7+
//noinspection ExpiredTargetSdkVersion
targetSdkVersion 23
targetSdkVersion 24
// change versionCode only when downgrade should be prevented
// eg, when data structures are incompatible
versionCode 1603091400
Expand All @@ -104,12 +102,14 @@ android {
buildConfigField "long", "buildTimestamp", generateTimestamp()
buildConfigField "int", "targetSDK", targetSdkVersion.mApiLevel.toString()
//vectorDrawables.useSupportLibrary = true // broken in newer gradle versions
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
multiDexEnabled false

// To get a Google Maps API key, follow this link, follow the directions and press "Create" at the end:
// https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=7C:1E:BB:15:CE:A1:92:30:47:9D:D0:3D:89:F6:C6:51:7D:3C:1B:DD%3Bcom.eveningoutpost.dexdrip
manifestPlaceholders = [google_maps_key:getLocalProperty('google_maps_key')]
manifestPlaceholders = [google_maps_key:getLocalProperty('google_maps_key'),
'appAuthRedirectScheme': 'xdrip'
]
}

// The defaultConfig values above are fixed, so your incremental builds don't
Expand All @@ -134,6 +134,7 @@ android {
}

lintOptions {
checkReleaseBuilds false
disable 'MissingTranslation'
disable 'ExtraTranslation'
}
Expand All @@ -145,6 +146,7 @@ android {
}
}


packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/INDEX.LIST'
Expand All @@ -156,7 +158,13 @@ android {
exclude 'META-INF/NOTICE'
exclude 'org/apache/http/version.properties'
exclude 'org/apache/http/client/version.properties'
//exclude 'META-INF/androidx.core_core.version'
exclude 'META-INF/com.android.tools/proguard/coroutines.pro'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/androidx.interpolator_interpolator.version'
exclude 'META-INF/androidx.core_core.version'
pickFirst 'org/bouncycastle/x509/CertPathReviewerMessages.properties'
pickFirst 'org/bouncycastle/x509/CertPathReviewerMessages_de.properties'
}

compileOptions {
Expand Down Expand Up @@ -190,7 +198,6 @@ android {
dev {
minifyEnabled false
shrinkResources false
useProguard false
ext.enableCrashlytics = false
ext.alwaysUpdateBuildId = false
versionNameSuffix "-debug"
Expand All @@ -209,7 +216,7 @@ android {
// set minSdkVersion to 21 or higher. When using Android Studio 2.3 or higher,
// the build automatically avoids legacy multidex when deploying to a device running
// API level 21 or higher—regardless of what you set as your minSdkVersion.
minSdkVersion 21
minSdkVersion 24
versionNameSuffix "-dev"
buildConfigField "int", "buildVersion", "2021010100"
buildConfigField "String", "buildUUID", "\"0f79a60a-5616-99be-8eb1-a430edcfd9fd\""
Expand All @@ -229,7 +236,7 @@ android {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
wearApp project(':wear')
//weapApp files('../wear/build/outputs/apk/wear_release.apk')
//testimplementation 'com.squareup.okhttp:mockwebserver:2.5.0'
Expand All @@ -238,19 +245,35 @@ dependencies {
}

implementation project(':localeapi')
implementation project(':libkeks')

// add missing JAXB dependencies for JDK 9+
if (JavaVersion.current().ordinal() >= JavaVersion.VERSION_1_9.ordinal()) {
annotationProcessor 'jakarta.xml.bind:jakarta.xml.bind-api:2.3.3'
annotationProcessor 'org.glassfish.jaxb:jaxb-runtime:2.3.5'
}

implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-v13:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:preference-v7:26.1.0'
// app auth implementation
//implementation(name: 'core-1.1.0', ext: 'aar')
implementation(name: 'appauth-release', ext: 'aar') {
exclude group: 'androidx.core', module: 'core' // fix INotificationSideChannel // android.support.v4.app
}
implementation("androidx.browser:browser:1.3.0") {
exclude group: 'androidx.core', module: 'core' // fix INotificationSideChannel // android.support.v4.app
}

api "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1"
implementation(name: 'ns-sdk-full-release', ext: 'aar')

//implementation 'androidx.core:core-ktx:1.9.0'
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.8.22'

implementation ('androidx.appcompat:appcompat:1.0.0')
implementation ('com.google.android.material:material:1.1.0')
implementation ('androidx.legacy:legacy-support-v13:1.0.0')
implementation ('androidx.recyclerview:recyclerview:1.0.0')
implementation ('androidx.cardview:cardview:1.0.0')
implementation ('androidx.preference:preference:1.0.0')

implementation ('com.google.apis:google-api-services-drive:v3-rev20220815-2.0.0') {
exclude group: 'org.apache.httpcomponents'
Expand Down Expand Up @@ -279,14 +302,17 @@ dependencies {
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
implementation 'com.getpebble:pebblekit:3.1.0'
implementation ("androidx.health.connect:connect-client:1.1.0-alpha06") {
exclude group: 'androidx.core', module: 'core'
}
implementation 'com.github.jamorham:amazfitcommunication:master-SNAPSHOT'
implementation 'io.reactivex:rxjava:1.3.3'
implementation "com.polidea.rxandroidble2:rxandroidble:1.12.1"
implementation 'com.google.guava:guava:24.1-android'
implementation 'com.embarkmobile:zxing-android-minimal:2.0.0@aar'
implementation 'com.embarkmobile:zxing-android-integration:2.0.0@aar'
//implementation 'com.embarkmobile:zxing-android-legacy:2.0.0@aar'
implementation 'com.google.zxing:core:3.1.0'
implementation 'com.google.zxing:core:3.5.1'
implementation 'net.tribe7.seeds:seeds-functional:16.0.1'
implementation 'net.tribe7.seeds:seeds-primitives:16.0.1'
implementation 'me.tatarka.bindingcollectionadapter2:bindingcollectionadapter:2.2.0'
Expand All @@ -309,19 +335,27 @@ dependencies {
implementation 'org.apache.commons:commons-text:1.3'
implementation 'com.google.dagger:dagger:2.25.4'
implementation "com.evernote:android-job:1.2.6"
implementation 'com.android.support:multidex:1.0.3'
//implementation 'com.android.support:multidex:1.0.3'
//implementation 'com.google.dagger:dagger-android-support:2.x' // if you use the support libraries
annotationProcessor 'com.google.dagger:dagger-compiler:2.25.4'
implementation 'net.danlew:android.joda:2.10.6.1'
implementation 'org.bouncycastle:bcpkix-jdk15to18:1.68'

def appCenterSdkVersion = '4.4.5'
implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"

testImplementation 'joda-time:joda-time:2.10.7'

testImplementation 'junit:junit:4.13.2'
testImplementation 'org.objenesis:objenesis:2.5.1'
testImplementation 'org.hamcrest:hamcrest-library:1.3'
testImplementation "org.robolectric:robolectric:4.2.1"
testImplementation "org.robolectric:robolectric:4.11.1"
testImplementation "com.google.truth:truth:1.1.3"

testImplementation 'org.mockito:mockito-core:2.4.0'
testImplementation 'org.mockito:mockito-inline:2.13.0'
testImplementation 'org.mockito:mockito-core:4.11.0'

testImplementation 'org.powermock:powermock-core:1.7.1'
testImplementation 'org.powermock:powermock-module-junit4:1.7.1'
testImplementation 'org.powermock:powermock-module-junit4-rule:1.7.1'
Expand All @@ -332,13 +366,13 @@ dependencies {
exclude group: 'com.android.support'
}
// espresso, workarounds needed for correct functioning
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1', {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestImplementation 'com.android.support.test:runner:1.0.2', {
androidTestImplementation 'androidx.test.ext:junit:1.1.1', {
exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestImplementation 'com.android.support.test.espresso:espresso-idling-resource:3.0.1'
androidTestImplementation 'androidx.test.espresso:espresso-idling-resource:3.1.0'
// add this for intent mocking support
//androidTestImplementation 'com.android.support.test.espresso:espresso-intents:3.0.1'
// add this for webview testing support
Expand Down
Binary file added app/libs/appauth-release.aar
Binary file not shown.
Binary file modified app/libs/hellocharts-library-release.aar
Binary file not shown.
Binary file added app/libs/ns-sdk-full-release.aar
Binary file not shown.
6 changes: 3 additions & 3 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@
-keep class org.slf4j.** { *; }
-keep class rx.internal.util.** { *; }
-keep class sun.misc.Unsafe { *; }
-keep class com.eveningoutpost.dexdrip.Models.** { *; }
-keep class com.eveningoutpost.dexdrip.models.** { *; }
-keep class com.eveningoutpost.dexdrip.ImportedLibraries.usbserial.** { *; }
-keep class com.eveningoutpost.dexdrip.models.** { *; }
-keep class com.eveningoutpost.dexdrip.importedlibraries.usbserial.** { *; }
-keep class com.eveningoutpost.dexdrip.importedlibraries.usbserial.** { *; }
-keep class ar.com.hjg.pngj.** { *; }
-keep class android.support.v7.widget.SearchView { *; }

-keep class kotlinx.serialization.Serializable { *; }

-dontwarn java.util.concurrent.**

Expand Down
Loading

0 comments on commit d1f4e82

Please sign in to comment.