Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jamorham committed Feb 24, 2024
2 parents 5af2267 + 10c2231 commit bd9179a
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/com/eveningoutpost/dexdrip/Home.java
Original file line number Diff line number Diff line change
Expand Up @@ -2622,7 +2622,7 @@ private void updateCurrentBgInfoCommon(DexCollectionType collector, TextView not
if (!isSensorActive) {
// Define a variable (notConnectedToG6Yet) that is only true if Native G6 is chosen, but, transmitter days is unknown.
boolean notConnectedToG6Yet = DexCollectionType.getDexCollectionType() == DexcomG5 && Pref.getBooleanDefaultFalse("ob1_g5_use_transmitter_alg") && Pref.getBooleanDefaultFalse("using_g6") && DexTimeKeeper.getTransmitterAgeInDays(getTransmitterID()) == -1;
if (notConnectedToG6Yet) { // Only if G6 has been selected and transmitter days is unknown.
if (notConnectedToG6Yet || shortTxId()) { // Only if G6 has been selected and transmitter days is unknown, or if G7 has been selected.
notificationText.setText(R.string.wait_to_connect);
} else { // Only if G6 is not selected or G6 transmitter days is known.
notificationText.setText(R.string.now_start_your_sensor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public static boolean processTreatmentResponse(final String response) throws Exc
} catch (JSONException e) {
//
}

boolean skip_from_xdrip = Pref.getBooleanDefaultFalse("cloud_storage_api_skip_download_from_xdrip");

// extract blood test data if present
try {
if (!from_xdrip) {
Expand Down Expand Up @@ -130,7 +133,7 @@ public static boolean processTreatmentResponse(final String response) throws Exc
Treatments existing = Treatments.byuuid(nightscout_id);
if (existing == null)
existing = Treatments.byuuid(uuid);
if ((existing == null) && (!from_xdrip)) {
if ((existing == null) && !(from_xdrip && skip_from_xdrip)) {
// check for close timestamp duplicates perhaps
existing = Treatments.byTimestamp(timestamp, 60000);
if (!((existing != null) && (JoH.roundDouble(existing.insulin, 2) == JoH.roundDouble(insulin, 2))
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1207,6 +1207,8 @@
<string name="use_mobile_data">Use mobile data</string>
<string name="summary_cloud_storage_api_download_enable">Also try to download treatments from Nightscout</string>
<string name="title_cloud_storage_api_download_enable">Download treatments</string>
<string name="title_cloud_storage_api_download_from_xdrip">Skip items from xDrip</string>
<string name="summary_cloud_storage_api_download_from_xdrip">Avoid downloading items uploaded by xDrip</string>
<string name="summary_bluetooth_meter_for_calibrations_auto">Calibrate using new blood glucose readings if the conditions appear right to do so without asking confirmation (experimental)</string>
<string name="title_bluetooth_meter_for_calibrations_auto">Automatic Calibration</string>
<string name="title_rest_api_extra_options">Extra Options</string>
Expand Down
20 changes: 15 additions & 5 deletions app/src/main/res/xml/pref_data_source.xml
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,21 @@
android:singleLine="true"
android:summary="@string/summary_nsfollow_url"
android:title="@string/title_nsfollow_url" />
<CheckBoxPreference
android:defaultValue="false"
android:key="nsfollow_download_treatments"
android:summary="@string/summary_nsfollow_download_treatments"
android:title="@string/title_nsfollow_download_treatments" />
<PreferenceScreen
android:key="_nsfollow_download_treatments_screen"
android:title="@string/title_nsfollow_download_treatments">
<CheckBoxPreference
android:defaultValue="false"
android:key="nsfollow_download_treatments"
android:summary="@string/summary_nsfollow_download_treatments"
android:title="@string/title_nsfollow_download_treatments" />
<SwitchPreference
android:defaultValue="true"
android:dependency="nsfollow_download_treatments"
android:key="cloud_storage_api_skip_download_from_xdrip"
android:summary="@string/summary_cloud_storage_api_download_from_xdrip"
android:title="@string/title_cloud_storage_api_download_from_xdrip" />
</PreferenceScreen>
<ListPreference
android:defaultValue="0"
android:key="nsfollow_lag"
Expand Down
23 changes: 17 additions & 6 deletions app/src/main/res/xml/pref_data_sync.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,23 @@
android:key="cloud_storage_api_base"
android:title="@string/pref_title_api_url" />

<SwitchPreference
android:defaultValue="true"
android:dependency="cloud_storage_api_enable"
android:key="cloud_storage_api_download_enable"
android:summary="@string/summary_cloud_storage_api_download_enable"
android:title="@string/title_cloud_storage_api_download_enable" />
<PreferenceScreen
android:key="download_treatments_screen"
android:title="@string/title_cloud_storage_api_download_enable"
android:dependency="cloud_storage_api_enable">
<SwitchPreference
android:defaultValue="true"
android:dependency="cloud_storage_api_enable"
android:key="cloud_storage_api_download_enable"
android:summary="@string/summary_cloud_storage_api_download_enable"
android:title="@string/title_cloud_storage_api_download_enable" />
<SwitchPreference
android:defaultValue="true"
android:dependency="cloud_storage_api_download_enable"
android:key="cloud_storage_api_skip_download_from_xdrip"
android:summary="@string/summary_cloud_storage_api_download_from_xdrip"
android:title="@string/title_cloud_storage_api_download_from_xdrip" />
</PreferenceScreen>
<CheckBoxPreference
android:defaultValue="false"
android:dependency="cloud_storage_api_download_enable"
Expand Down

0 comments on commit bd9179a

Please sign in to comment.