Skip to content

Commit

Permalink
Merge pull request #3558 from Navid200/Navid_2024_07_05
Browse files Browse the repository at this point in the history
Delay G6 start prompt until ready
  • Loading branch information
jamorham authored Jul 17, 2024
2 parents f418d5b + b36b20f commit 4464060
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions app/src/main/java/com/eveningoutpost/dexdrip/Home.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
import android.widget.TextView;
import android.widget.Toast;

import com.eveningoutpost.dexdrip.g5model.DexSyncKeeper;
import com.eveningoutpost.dexdrip.g5model.DexTimeKeeper;
import com.eveningoutpost.dexdrip.g5model.Ob1G5StateMachine;
import com.eveningoutpost.dexdrip.g5model.SensorDays;
Expand Down Expand Up @@ -2630,11 +2631,11 @@ 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 || shortTxId()) { // Only if G6 has been selected and transmitter days is unknown, or if G7 has been selected.
// Define a variable (notConnectedToG6Yet) that is only true if Native G6 is chosen, but, transmitter days is unknown or not synced yet.
boolean notConnectedToG6Yet = DexCollectionType.getDexCollectionType() == DexcomG5 && Pref.getBooleanDefaultFalse("ob1_g5_use_transmitter_alg") && Pref.getBooleanDefaultFalse("using_g6") && (DexTimeKeeper.getTransmitterAgeInDays(getTransmitterID()) == -1 || !DexSyncKeeper.isReady(getTransmitterID()));
if (notConnectedToG6Yet || shortTxId()) { // Only if G6 has been selected and transmitter is not synced yet, 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.
} else { // Only if G6 is not selected or G6 transmitter is synced.
notificationText.setText(R.string.now_start_your_sensor);
}

Expand All @@ -2653,7 +2654,7 @@ private void updateCurrentBgInfoCommon(DexCollectionType collector, TextView not
dialog.show();
} else {
if (!Experience.gotData() && !QuickSettingsDialogs.isDialogShowing() && !notConnectedToG6Yet && JoH.ratelimit("start-sensor_prompt", 20)) {
// Show the dialog only if there is no data, and there is no dialog, and G6 is not selected or G6 is connected, and the rate limit is satisfied.
// Show the start sensor prompt only if G6 is not selected or the G6 transmitter is synchronized.
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
final Context context = this;
builder.setTitle(getString(R.string.start_sensor) + "?");
Expand Down

0 comments on commit 4464060

Please sign in to comment.