Skip to content

Commit f79a93d

Browse files
committed
Merge branch 'NightscoutFoundation-master'
2 parents 7cecb51 + 0549546 commit f79a93d

71 files changed

Lines changed: 1397 additions & 682 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/proguard-debug.pro

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,13 @@
5858

5959
-keep class com.newrelic.** { *; }
6060
-dontwarn com.newrelic.**
61-
-keepattributes Exceptions, Signature, InnerClasses, LineNumberTable, SourceFile, EnclosingMethod
61+
-keepattributes Exceptions, Signature, InnerClasses, LineNumberTable, SourceFile, EnclosingMethod
62+
63+
-keep class com.eveningoutpost.dexdrip.cgm.carelinkfollow.message.*
64+
-keep class com.eveningoutpost.dexdrip.cgm.carelinkfollow.message.util.*
65+
-keep class com.eveningoutpost.dexdrip.cgm.carelinkfollow.message.** { *; }
66+
-keep class com.eveningoutpost.dexdrip.cgm.carelinkfollow.message.util.** { *; }
67+
-keep class * extends com.google.gson.TypeAdapter
68+
-keep class * implements com.google.gson.TypeAdapterFactory
69+
-keep class * implements com.google.gson.JsonSerializer
70+
-keep class * implements com.google.gson.JsonDeserializer

app/proguard-rules.pro

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,11 @@
149149
-dontwarn com.newrelic.**
150150
-keepattributes Exceptions, Signature, InnerClasses, LineNumberTable
151151

152-
-keep class com.eveningoutpost.dexdrip.cgm.carelinkfollow.message.*
152+
-keep class com.eveningoutpost.dexdrip.cgm.carelinkfollow.message.*
153+
-keep class com.eveningoutpost.dexdrip.cgm.carelinkfollow.message.util.*
154+
-keep class com.eveningoutpost.dexdrip.cgm.carelinkfollow.message.** { *; }
155+
-keep class com.eveningoutpost.dexdrip.cgm.carelinkfollow.message.util.** { *; }
156+
-keep class * extends com.google.gson.TypeAdapter
157+
-keep class * implements com.google.gson.TypeAdapterFactory
158+
-keep class * implements com.google.gson.JsonSerializer
159+
-keep class * implements com.google.gson.JsonDeserializer

app/src/main/java/com/eveningoutpost/dexdrip/AlertList.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class AlertList extends ActivityWithMenu {
5252

5353
String stringTimeFromAlert(AlertType alert) {
5454
if (alert.all_day) {
55-
return "all day";
55+
return getString(R.string.all_day);
5656
}
5757
String start = timeFormatString(AlertType.time2Hours(alert.start_time_minutes), AlertType.time2Minutes(alert.start_time_minutes));
5858
String end = timeFormatString(AlertType.time2Hours(alert.end_time_minutes), AlertType.time2Minutes(alert.end_time_minutes));
@@ -61,9 +61,9 @@ String stringTimeFromAlert(AlertType alert) {
6161

6262
HashMap<String, String> createAlertMap(AlertType alert) {
6363
HashMap<String, String> map = new HashMap<String, String>();
64-
String overrideSilentMode = "Override Silent Mode";
65-
if (alert.override_silent_mode == false) {
66-
overrideSilentMode = "No Alert in Silent Mode";
64+
String overrideSilentMode = getString(R.string.override_silent_mode);
65+
if (!alert.override_silent_mode) {
66+
overrideSilentMode = getString(R.string.no_alert_in_silent_mode);
6767
}
6868
// We use a - sign to tell that this text should be stiked through
6969
String extra = "-";

app/src/main/java/com/eveningoutpost/dexdrip/Home.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2465,7 +2465,7 @@ private void updateCurrentBgInfo(final String source) {
24652465
updateCurrentBgInfoCommon(collector, notificationText);
24662466
}
24672467
if (collector.equals(DexCollectionType.Disabled)) {
2468-
notificationText.append("\n DATA SOURCE DISABLED");
2468+
notificationText.append(getString(R.string.__data_source_disabled));
24692469
if (!Experience.gotData()) {
24702470
// TODO should this move to Experience::processSteps ?
24712471
final Activity activity = this;

app/src/main/java/com/eveningoutpost/dexdrip/LibreAlarmReceiver.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public class LibreAlarmReceiver extends BroadcastReceiver {
5757
private static final Object lock = new Object();
5858
private static long sensorAge = 0;
5959
private static long timeShiftNearest = -1;
60+
public static final String LIBRE_SOURCE_INFO = "Libre2";
6061

6162
public static void clearSensorStats() {
6263
Pref.setInt("nfc_sensor_age", 0); // reset for nfc sensors
@@ -273,7 +274,7 @@ public static void CalculateFromDataTransferObject(ReadingData readingData, bool
273274
if (use_raw) {
274275
createBGfromGD(gd, use_smoothed_data, false); // not quick for recent
275276
} else {
276-
BgReading.bgReadingInsertFromInt(use_smoothed_data ? gd.glucoseLevelSmoothed : gd.glucoseLevel, gd.realDate, segmentation_timeslice, true);
277+
BgReading.bgReadingInsertFromInt(use_smoothed_data ? gd.glucoseLevelSmoothed : gd.glucoseLevel, gd.realDate, segmentation_timeslice, true, LIBRE_SOURCE_INFO);
277278
}
278279
}
279280
} else {
@@ -306,7 +307,9 @@ public static void insertFromHistory(final List<GlucoseData> mHistory, final boo
306307
} else {
307308
polyyList.add((double) gd.glucoseLevel);
308309
// add in the actual value
309-
BgReading.bgReadingInsertFromInt(gd.glucoseLevel, gd.realDate, timeslice, false);
310+
if (gd.glucoseLevel > 0) {
311+
BgReading.bgReadingInsertFromInt(gd.glucoseLevel, gd.realDate, timeslice, false, LIBRE_SOURCE_INFO);
312+
}
310313
}
311314
}
312315

@@ -332,7 +335,7 @@ public static void insertFromHistory(final List<GlucoseData> mHistory, final boo
332335
// Here we do not use smoothed data, since data is already smoothed for the history
333336
createBGfromGD(new GlucoseData((int) polySplineF.value(ptime), ptime), false, true);
334337
} else {
335-
BgReading.bgReadingInsertFromInt((int) polySplineF.value(ptime), ptime, timeslice, false);
338+
BgReading.bgReadingInsertFromInt((int) polySplineF.value(ptime), ptime, timeslice, false, LIBRE_SOURCE_INFO);
336339
}
337340
}
338341
} catch (org.apache.commons.math3.exception.NonMonotonicSequenceException e) {

app/src/main/java/com/eveningoutpost/dexdrip/LibreReceiver.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
package com.eveningoutpost.dexdrip;
22

33
import static com.eveningoutpost.dexdrip.Home.get_engineering_mode;
4+
import static com.eveningoutpost.dexdrip.LibreAlarmReceiver.LIBRE_SOURCE_INFO;
45
import static com.eveningoutpost.dexdrip.models.JoH.emptyString;
56
import static com.eveningoutpost.dexdrip.models.Libre2Sensor.Libre2Sensors;
67

78
import android.content.BroadcastReceiver;
89
import android.content.Context;
910
import android.content.Intent;
10-
import android.content.SharedPreferences;
1111
import android.os.Bundle;
1212
import android.os.PowerManager;
13-
import android.preference.PreferenceManager;
1413
import android.text.format.DateFormat;
1514

1615
import com.eveningoutpost.dexdrip.models.BgReading;
@@ -88,7 +87,7 @@ public void run() {
8887
val glucose = item.getDouble("glucoseValue");
8988
val timestamp = item.getLong("timestamp");
9089
if (d) UserError.Log.d(TAG, "Real time item: " + JoH.dateTimeText(timestamp) + " value: " + Unitized.unitized_string_static(glucose));
91-
BgReading.bgReadingInsertFromInt((int) Math.round(glucose), timestamp, timeslice, false);
90+
BgReading.bgReadingInsertFromInt((int) Math.round(glucose), timestamp, timeslice, false, LIBRE_SOURCE_INFO);
9291
}
9392

9493
} catch (Exception e) {

app/src/main/java/com/eveningoutpost/dexdrip/NewSensorLocation.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public void onClick(View v) {
116116

117117
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
118118

119-
prefs.edit().putBoolean("store_sensor_location", !DontAskAgain.isChecked()).apply();
119+
// prefs.edit().putBoolean("store_sensor_location", !DontAskAgain.isChecked()).apply();
120120

121121
Intent intent = new Intent(getApplicationContext(), Home.class);
122122
startActivity(intent);
@@ -129,7 +129,7 @@ public void onClick(View v) {
129129

130130
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
131131

132-
prefs.edit().putBoolean("store_sensor_location", !DontAskAgain.isChecked()).apply();
132+
// prefs.edit().putBoolean("store_sensor_location", !DontAskAgain.isChecked()).apply();
133133

134134
Intent intent = new Intent(getApplicationContext(), Home.class);
135135
startActivity(intent);

app/src/main/java/com/eveningoutpost/dexdrip/StartNewSensor.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,7 @@ private void startSensorAndSetIntent() {
224224
startSensorForTime(startTime);
225225

226226
Intent intent;
227-
if (Pref.getBoolean("store_sensor_location", false) && Experience.gotData()) {
228-
intent = new Intent(getApplicationContext(), NewSensorLocation.class);
229-
} else {
230-
intent = new Intent(getApplicationContext(), Home.class);
231-
}
227+
intent = new Intent(getApplicationContext(), Home.class);
232228

233229
startActivity(intent);
234230
finish();

app/src/main/java/com/eveningoutpost/dexdrip/cgm/carelinkfollow/CareLinkDataProcessor.java

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static synchronized void processData(final RecentData recentData, final boolean
7373
filteredSgList = new ArrayList<>();
7474
for (SensorGlucose sg : recentData.sgs) {
7575
//SG DateTime is null (sensor expired?)
76-
if (sg != null && sg.datetimeAsDate != null) {
76+
if (sg != null && sg.getDate() != null) {
7777
filteredSgList.add(sg);
7878
}
7979
}
@@ -84,31 +84,31 @@ static synchronized void processData(final RecentData recentData, final boolean
8484
sensor.save();
8585

8686
// place in order of oldest first
87-
Collections.sort(filteredSgList, (o1, o2) -> o1.datetimeAsDate.compareTo(o2.datetimeAsDate));
87+
Collections.sort(filteredSgList, (o1, o2) -> o1.getDate().compareTo(o2.getDate()));
8888

8989
for (final SensorGlucose sg : filteredSgList) {
9090

9191
//Not EPOCH 0 (warmup?)
92-
if (sg.datetimeAsDate.getTime() > 1) {
92+
if (sg.getDate().getTime() > 1) {
9393

9494
//Not in the future
95-
if (sg.datetimeAsDate.getTime() < new Date().getTime() + 300_000) {
95+
if (sg.getDate().getTime() < new Date().getTime() + 300_000) {
9696

9797
//Not 0 SG (not calibrated?)
9898
if (sg.sg > 0) {
9999

100100
//newer than last BG
101-
if (sg.datetimeAsDate.getTime() > lastBgTimestamp) {
101+
if (sg.getDate().getTime() > lastBgTimestamp) {
102102

103-
if (sg.datetimeAsDate.getTime() > 0) {
103+
if (sg.getDate().getTime() > 0) {
104104

105105
//New entry
106-
if (BgReading.getForPreciseTimestamp(sg.datetimeAsDate.getTime(), 10_000) == null) {
106+
if (BgReading.getForPreciseTimestamp(sg.getDate().getTime(), 10_000) == null) {
107107
UserError.Log.d(TAG, "NEW NEW NEW New entry: " + sg.toS());
108108

109109
if (live) {
110110
final BgReading bg = new BgReading();
111-
bg.timestamp = sg.datetimeAsDate.getTime();
111+
bg.timestamp = sg.getDate().getTime();
112112
bg.calculated_value = (double) sg.sg;
113113
bg.raw_data = SPECIAL_FOLLOWER_PLACEHOLDER;
114114
bg.filtered_data = (double) sg.sg;
@@ -149,25 +149,25 @@ static synchronized void processData(final RecentData recentData, final boolean
149149
//Filter markers
150150
filteredMarkerList = new ArrayList<>();
151151
for (Marker marker : recentData.markers) {
152-
if (marker != null && marker.type != null && marker.dateTime != null) {
152+
if (marker != null && marker.type != null && marker.getDate() != null) {
153153
filteredMarkerList.add(marker);
154154
}
155155
}
156156

157157
if (filteredMarkerList.size() > 0) {
158158
//sort markers by time
159-
Collections.sort(filteredMarkerList, (o1, o2) -> o1.dateTime.compareTo(o2.dateTime));
159+
Collections.sort(filteredMarkerList, (o1, o2) -> o1.getDate().compareTo(o2.getDate()));
160160

161161
//process markers one-by-one
162162
for (Marker marker : filteredMarkerList) {
163163

164164
//FINGER BG
165165
if (marker.isBloodGlucose() && Pref.getBooleanDefaultFalse("clfollow_download_finger_bgs")) {
166166
//check required values
167-
if (marker.value != null && !marker.value.equals(0)) {
167+
if (marker.getBloodGlucose() != null && !marker.getBloodGlucose().equals(0)) {
168168
//new blood test
169-
if (BloodTest.getForPreciseTimestamp(marker.dateTime.getTime(), 10000) == null) {
170-
BloodTest.create(marker.dateTime.getTime(), marker.value, SOURCE_CARELINK_FOLLOW);
169+
if (BloodTest.getForPreciseTimestamp(marker.getDate().getTime(), 10000) == null) {
170+
BloodTest.create(marker.getDate().getTime(), marker.getBloodGlucose(), SOURCE_CARELINK_FOLLOW);
171171
}
172172
}
173173

@@ -186,24 +186,24 @@ static synchronized void processData(final RecentData recentData, final boolean
186186
//Insulin
187187
if (marker.type.equals(Marker.MARKER_TYPE_INSULIN)) {
188188
carbs = 0;
189-
if (marker.deliveredExtendedAmount != null && marker.deliveredFastAmount != null) {
190-
insulin = marker.deliveredExtendedAmount + marker.deliveredFastAmount;
189+
if (marker.getInsulinAmount() != null) {
190+
insulin = marker.getInsulinAmount();
191191
}
192192
//SKIP if insulin = 0
193193
if (insulin == 0) continue;
194194
//Carbs
195195
} else if (marker.type.equals(Marker.MARKER_TYPE_MEAL)) {
196-
if (marker.amount != null) {
197-
carbs = marker.amount;
196+
if (marker.getCarbAmount() != null) {
197+
carbs = marker.getCarbAmount();
198198
}
199199
insulin = 0;
200200
//SKIP if carbs = 0
201201
if (carbs == 0) continue;
202202
}
203203

204204
//new Treatment
205-
if (newTreatment(carbs, insulin, marker.dateTime.getTime())) {
206-
t = Treatments.create(carbs, insulin, marker.dateTime.getTime());
205+
if (newTreatment(carbs, insulin, marker.getDate().getTime())) {
206+
t = Treatments.create(carbs, insulin, marker.getDate().getTime());
207207
if (t != null) {
208208
t.enteredBy = SOURCE_CARELINK_FOLLOW;
209209
t.save();
@@ -222,7 +222,7 @@ static synchronized void processData(final RecentData recentData, final boolean
222222
//PUMP INFO (Pump Status)
223223
if (recentData.isNGP()) {
224224
PumpStatus.setReservoir(recentData.reservoirRemainingUnits);
225-
PumpStatus.setBattery(recentData.medicalDeviceBatteryLevelPercent);
225+
PumpStatus.setBattery(recentData.getDeviceBatteryLevel());
226226
if (recentData.activeInsulin != null)
227227
PumpStatus.setBolusIoB(recentData.activeInsulin.amount);
228228
PumpStatus.syncUpdate();
@@ -246,13 +246,13 @@ static synchronized void processData(final RecentData recentData, final boolean
246246
//Active Notifications
247247
if (recentData.notificationHistory.activeNotifications != null) {
248248
for (ActiveNotification activeNotification : recentData.notificationHistory.activeNotifications) {
249-
addNotification(activeNotification.dateTime, recentData.getDeviceFamily(), activeNotification.messageId, activeNotification.faultId);
249+
addNotification(activeNotification.dateTime, recentData.getDeviceFamily(), activeNotification.getMessageId(), activeNotification.faultId);
250250
}
251251
}
252252
//Cleared Notifications
253253
if (recentData.notificationHistory.clearedNotifications != null) {
254254
for (ClearedNotification clearedNotification : recentData.notificationHistory.clearedNotifications) {
255-
addNotification(clearedNotification.triggeredDateTime, recentData.getDeviceFamily(), clearedNotification.messageId, clearedNotification.faultId);
255+
addNotification(clearedNotification.triggeredDateTime, recentData.getDeviceFamily(), clearedNotification.getMessageId(), clearedNotification.faultId);
256256
}
257257
}
258258
}

0 commit comments

Comments
 (0)