Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jamorham committed Jul 13, 2023
2 parents 967b5a5 + 011820a commit 4ca4b00
Show file tree
Hide file tree
Showing 8 changed files with 250 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,120 +5,130 @@
public class CountryUtils {

public static final String[] supportedCountryCodes = {
"al",
"dz",
"ba",
"eg",
"za",
"ca",
"cr",
"mx",
"ma",
"pa",
"pr",
"us",
"ad",
"ar",
"br",
"cl",
"co",
"ve",
"hk",
"in",
"id",
"il",
"jp",
"kw",
"lb",
"my",
"ph",
"qa",
"sa",
"sg",
"kr",
"tw",
"th",
"tn",
"tr",
"ae",
"vn",
"at",
"be",
"bg",
"hr",
"cz",
"dk",
"ee",
"fi",
"fr",
"de",
"gr",
"hu",
"is",
"ie",
"it",
"lv",
"lt",
"lu",
"nl",
"no",
"pl",
"pt",
"ro",
"ru",
"rs",
"sk",
"si",
"es",
"se",
"ch",
"ua",
"gb",
"au",
"nz",
"bh",
"om",
"cn",
"cy",
"al",
"am",
"aw",
"au",
"at",
"az",
"bs",
"bh",
"bd",
"bb",
"by",
"be",
"bm",
"bo",
"ba",
"bw",
"br",
"bg",
"kh",
"ca",
"ky",
"cl",
"cn",
"co",
"cr",
"hr",
"cw",
"cy",
"cz",
"dk",
"do",
"ec",
"eg",
"sv",
"ee",
"fi",
"fr",
"pf",
"ge",
"de",
"gr",
"gt",
"hn",
"hk",
"hu",
"is",
"in",
"id",
"ir",
"iq",
"ie",
"il",
"it",
"jm",
"jp",
"jo",
"kz",
"ke",
"xk",
"kw",
"lv",
"lb",
"ly",
"li",
"lt",
"lu",
"mo",
"mk",
"my",
"mv",
"mt",
"mu",
"yt",
"mx",
"md",
"me",
"ma",
"na",
"nl",
"nc",
"nz",
"ni",
"ng",
"no",
"om",
"pk",
"pa",
"py",
"pe",
"ph",
"pl",
"pt",
"pr",
"qa",
"ro",
"ru",
"sa",
"rs",
"sg",
"sk",
"si",
"za",
"kr",
"es",
"mf",
"sd",
"se",
"ch",
"tw",
"th",
"tt",
"tn",
"tr",
"ua",
"ae",
"gb",
"us",
"uy",
"aw",
"ky",
"cw",
"pe"
"uz",
"ve",
"vn"
};

public static boolean isSupportedCountry(String countryCode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.eveningoutpost.dexdrip.models.UserError.Log;
import com.eveningoutpost.dexdrip.R;
import com.eveningoutpost.dexdrip.services.SyncService;
import com.eveningoutpost.dexdrip.services.UiBasedCollector;
import com.eveningoutpost.dexdrip.utilitymodels.Constants;
import com.eveningoutpost.dexdrip.utilitymodels.Pref;
import com.eveningoutpost.dexdrip.utilitymodels.UndoRedo;
Expand Down Expand Up @@ -57,6 +58,7 @@
import static com.eveningoutpost.dexdrip.models.JoH.msSince;
import static com.eveningoutpost.dexdrip.utilitymodels.Constants.HOUR_IN_MS;
import static com.eveningoutpost.dexdrip.utilitymodels.Constants.MINUTE_IN_MS;
import com.eveningoutpost.dexdrip.utilitymodels.Pref;
import static java.lang.StrictMath.abs;
import static com.eveningoutpost.dexdrip.models.JoH.emptyString;

Expand Down Expand Up @@ -1292,6 +1294,20 @@ public static List<Iob> ioBForGraph_old(int number, double startTime) {
}*/

public static Double getCurrentIoB() {
if (Pref.getBooleanDefaultFalse("fetch_iob_from_companion_app")) {
return getCurrentIoBFromCompanionApp();
} else {
return getCurrentIoBFromGraphCalculation();
}
}

public static Double getCurrentIoBFromCompanionApp() {
Double iob = UiBasedCollector.getCurrentIoB();

return iob;
}

public static Double getCurrentIoBFromGraphCalculation() {
long now = System.currentTimeMillis();

final List<Iob> iobInfo = Treatments.ioBForGraph_new(now - 1 * Constants.DAY_IN_MS);
Expand Down
Loading

0 comments on commit 4ca4b00

Please sign in to comment.