Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jamorham committed Jun 25, 2024
2 parents e0e4267 + aceda70 commit 6e1f065
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 42 deletions.
5 changes: 4 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,12 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestImplementation 'androidx.test.ext:junit:1.1.1', {
androidTestImplementation 'androidx.test.ext:junit:1.1.5', {
exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.1.0'
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'
Expand Down
5 changes: 5 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@
# to depend on it.
-dontwarn kotlinx.serialization.Serializable

# The lib net.sf.kxml:kxml2:2.3.0 is referenced in same required libraries used for
# Android testing. R8 is showing missing classes warnings which can be safely ignored.
-dontwarn org.kxml2.io.KXmlParser
-dontwarn org.kxml2.io.KXmlSerializer

-dontwarn java.util.concurrent.**

-keep class rx.schedulers.Schedulers {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,28 @@
*/


import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.RootMatchers.isDialog;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static com.schibsted.spain.barista.BaristaClickActions.click;
import static com.schibsted.spain.barista.BaristaScrollActions.scrollTo;
import static com.schibsted.spain.barista.custom.NestedEnabledScrollToAction.scrollTo;
import static org.hamcrest.core.AllOf.allOf;

import android.app.Activity;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.annotation.UiThreadTest;
import android.support.test.espresso.ViewInteraction;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.view.WindowManager;

import androidx.test.InstrumentationRegistry;
import androidx.test.annotation.UiThreadTest;
import androidx.test.espresso.ViewInteraction;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;

import com.schibsted.spain.barista.flakyespresso.AllowFlaky;

import org.junit.After;
Expand All @@ -26,18 +39,6 @@

import java.io.File;

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.RootMatchers.isDialog;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static com.schibsted.spain.barista.BaristaClickActions.click;
import static com.schibsted.spain.barista.BaristaScrollActions.scrollTo;
import static com.schibsted.spain.barista.custom.NestedEnabledScrollToAction.scrollTo;
import static org.hamcrest.core.AllOf.allOf;

@RunWith(AndroidJUnit4.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class HomeEspressoTest {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/eveningoutpost/dexdrip/MegaStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private void addAsection(String section, String title) {
}

private static final String G4_STATUS = "BT Device";
public static final String G5_STATUS = "G5/G6/G7 Status";
public static final String G5_STATUS = "Dex Status";
private static final String MEDTRUM_STATUS = "Medtrum Status";
private static final String IP_COLLECTOR = "IP Collector";
private static final String XDRIP_PLUS_SYNC = "Followers";
Expand Down Expand Up @@ -168,7 +168,7 @@ private void populateSectionList() {
}
if (dexCollectionType.equals(DexcomG5)) {
if (Pref.getBooleanDefaultFalse(Ob1G5CollectionService.OB1G5_PREFS)) {
addAsection(G5_STATUS, "OB1 G5/G6/G7 Collector and Transmitter Status");
addAsection(G5_STATUS, "G6/Dex1/G7/1+ Collector/Transmitter Status");
} else {
addAsection(G5_STATUS, "G5 Collector and Transmitter Status");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import com.eveningoutpost.dexdrip.utilitymodels.CollectionServiceStarter;
import com.eveningoutpost.dexdrip.utilitymodels.Experience;
import com.eveningoutpost.dexdrip.stats.StatsActivity;
import com.eveningoutpost.dexdrip.utilitymodels.Pref;
import com.eveningoutpost.dexdrip.utils.DexCollectionType;
import com.eveningoutpost.dexdrip.utils.Preferences;

Expand Down Expand Up @@ -103,7 +102,7 @@ public NavDrawerBuilder(final Context context) {
}
}
}
if (!getBestCollectorHardwareName().equals("G7") || Pref.getBooleanDefaultFalse("engineering_mode")) { // If we are using G7, offer the stop sensor option in engineering mode only
if (!getBestCollectorHardwareName().equals("G7")) { // If we are using G7, there will be no stop sensor option in the menu.
this.nav_drawer_options.add(context.getString(R.string.stop_sensor));
this.nav_drawer_intents.add(new Intent(context, StopSensor.class));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,15 @@ public class UiBasedCollector extends NotificationListenerService {
coOptedPackages.add("com.medtronic.diabetes.simplera.eu");
coOptedPackages.add("com.senseonics.gen12androidapp");
coOptedPackages.add("com.senseonics.androidapp");
coOptedPackages.add("com.microtech.aidexx.mgdl"); // Experiment

coOptedPackagesAll.add("com.dexcom.dexcomone");
coOptedPackagesAll.add("com.dexcom.d1plus");
coOptedPackagesAll.add("com.medtronic.diabetes.guardian");
coOptedPackagesAll.add("com.medtronic.diabetes.simplera.eu");
coOptedPackagesAll.add("com.senseonics.gen12androidapp");
coOptedPackagesAll.add("com.senseonics.androidapp");
coOptedPackagesAll.add("com.microtech.aidexx.mgdl"); // Experiment

companionAppIoBPackages.add("com.insulet.myblue.pdm");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ public void onNavigationDrawerItemSelected(int position) {

private void getData() {
final List<BgReading> latest = BgReading.latest(5000);
parseDataForStats(latest);
ListAdapter adapter = new BgReadingAdapter(this, latest);
this.setListAdapter(adapter);
try {
parseDataForStats(latest);
ListAdapter adapter = new BgReadingAdapter(this, latest);
this.setListAdapter(adapter);
if (total > 0) {
this.getActionBar().setSubtitle(String.format(Locale.getDefault(), "%d in 24h, bf:%d%% mis:%d", total, ((backfilled * 100) / total), missing));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ private static void legacySettingsFix() {
Pref.setBoolean("ob1_g5_fallback_to_xdrip", false);
Pref.setBoolean("always_unbond_G5", false);
Pref.setBoolean("always_get_new_keys", true);
Pref.setBoolean("run_ble_scan_constantly", false);
Pref.setBoolean("run_G5_ble_tasks_on_uithread", false);
}
private static void legacySettingsMoveLanguageFromNoToNb() {
// Check if the user's language preference is set to "no"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1275,6 +1275,7 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {

final Preference shFollowUser = findPreference("shfollow_user");
final Preference shFollowPass = findPreference("shfollow_pass");
final Preference shFollowServerUS = findPreference("dex_share_us_acct");

if (collectionType == DexCollectionType.SHFollow) {
final Preference.OnPreferenceChangeListener shFollowListener = new Preference.OnPreferenceChangeListener() {
Expand All @@ -1289,6 +1290,7 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
try {
shFollowUser.setOnPreferenceChangeListener(shFollowListener);
shFollowPass.setOnPreferenceChangeListener(shFollowListener);
shFollowServerUS.setOnPreferenceChangeListener(shFollowListener);
} catch (Exception e) {
//
}
Expand All @@ -1297,6 +1299,7 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
try {
collectionCategory.removePreference(shFollowUser);
collectionCategory.removePreference(shFollowPass);
collectionCategory.removePreference(shFollowServerUS);
} catch (Exception e) {
//
}
Expand Down Expand Up @@ -2522,6 +2525,8 @@ private void removeLegacyPreferences() {
// removePreferenceFromCategory("ob1_g5_fallback_to_xdrip", "ob1_options");
// removePreferenceFromCategory("always_unbond_G5", "ob1_options");
// removePreferenceFromCategory("always_get_new_keys", "ob1_options");
// removePreferenceFromCategory("run_ble_scan_constantly", "ob1_options");
// removePreferenceFromCategory("run_G5_ble_tasks_on_uithread", "ob1_options");
}

private void removePreferenceFromCategory(final String preference, final String category) {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_system_status.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@

<LinearLayout
android:id="@+id/layout_sensor"
app:showIfTrue="@{ms.bluetooth()}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@
<string name="short_speak_readings_shortcut">Show a shortcut in the ☰ menu to toggle Speak Readings</string>
<string name="speak_readings_shortcut">Speak Readings Shortcut</string>
<string name="battery_optimization_off">On Android 6+ ensure battery optimization is switched off (recommended).</string>
<string name="battery_optimization_on">Don\'t keep asking about battery optimization (not recommended).</string>
<string name="battery_optimization_on">Will not keep asking about battery optimization when enabled (not recommended).</string>
<string name="battery_optimization_prompt">Battery Optimization prompt</string>
<string name="advanced_bluetooth_settings">Advanced Bluetooth Settings</string>
<string name="bluetooth_settings">Bluetooth Settings</string>
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/xml/pref_advanced_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1494,8 +1494,7 @@
<CheckBoxPreference
android:defaultValue="false"
android:key="requested_ignore_battery_optimizations_new"
android:summaryOff="@string/battery_optimization_off"
android:summaryOn="@string/battery_optimization_on"
android:summary="@string/battery_optimization_on"
android:title="@string/battery_optimization_prompt" />
<CheckBoxPreference
android:defaultValue="true"
Expand Down
19 changes: 5 additions & 14 deletions app/src/main/res/xml/pref_data_source.xml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@
android:singleLine="true"
android:summary="Login password for Dex Share Following"
android:title="Share Password" />
<CheckBoxPreference
android:defaultValue="true"
android:key="dex_share_us_acct"
android:summary="Your account and follower app are from the USA"
android:title="US Servers" />

<ListPreference
android:defaultValue="gb"
Expand Down Expand Up @@ -410,20 +415,6 @@
android:summary="@string/summary_dex_specified_slot"
android:title="@string/title_dex_specified_slot" />
</PreferenceCategory>
<PreferenceCategory
android:key="old_g5_options"
android:title="@string/title_old_g5_options">
<CheckBoxPreference
android:defaultValue="false"
android:key="run_ble_scan_constantly"
android:summary="@string/g5_scan_constantly"
android:title="@string/scan_for_g5_constantly" />
<CheckBoxPreference
android:defaultValue="false"
android:key="run_G5_ble_tasks_on_uithread"
android:summary="@string/g5_force_ui_thread"
android:title="@string/force_g5_ui_thread" />
</PreferenceCategory>
<PreferenceCategory
android:key="dex_battery_category"
android:title="@string/title_g5g6_battery_options">
Expand Down

0 comments on commit 6e1f065

Please sign in to comment.