This commit is contained in:
Milos Kozak 2018-11-20 14:40:44 +01:00
commit f600ff045f
24 changed files with 1115 additions and 26 deletions

View file

@ -1,10 +1,10 @@
Reporting bugs
--------------
- Note the precise time the problem occurred and describe the circumstances and steps that caused
- **Note the precise time the problem occurred** and describe the circumstances and steps that caused
the problem
- Note the Build version (found in the About dialog in the app, when pressing the three dots in the
upper-right corner).
- Obtain the app's log files, which can be found on the phone in
_/storage/emulated/0/Android/data/info.nightscout.androidaps/_
See https://github.com/MilosKozak/AndroidAPS/wiki/Accessing-logfiles
- Open an issue at https://github.com/MilosKozak/AndroidAPS/issues/new
- Open an issue at https://github.com/MilosKozak/AndroidAPS/issues/new

View file

@ -1,6 +1,6 @@
# AndroidAPS
* Check the wiki: https://github.com/MilosKozak/AndroidAPS/wiki
* Check the wiki: http://wiki.androidaps.org
* Everyone whos been looping with AndroidAPS needs to fill out the form after 3 days of looping https://docs.google.com/forms/d/14KcMjlINPMJHVt28MDRupa4sz4DDIooI4SrW0P3HSN8/viewform?c=0&w=1
[![Gitter](https://badges.gitter.im/MilosKozak/AndroidAPS.svg)](https://gitter.im/MilosKozak/AndroidAPS?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

View file

@ -63,7 +63,7 @@ android {
targetSdkVersion 25
multiDexEnabled true
versionCode 1500
version "2.0i-dev"
version "2.0"
buildConfigField "String", "VERSION", '"' + version + '"'
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
buildConfigField "String", "HEAD", '"' + generateGitBuild() + '"'

View file

@ -12,6 +12,7 @@
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECEIVE_MMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.SEND_MMS" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.INTERNET" />

View file

@ -326,6 +326,7 @@ public class MainActivity extends AppCompatActivity {
case AndroidPermission.CASE_LOCATION:
case AndroidPermission.CASE_SMS:
case AndroidPermission.CASE_BATTERY:
case AndroidPermission.CASE_PHONESTATE:
break;
}
}

View file

@ -101,6 +101,11 @@ public class ProfileSwitch implements Interval, DataPointWithLabelInterface {
return profile;
}
/**
* Note: the name returned here is used as the PS name when uploading to NS. When such a PS is retrieved
* again from NS, the added parts must be removed again, see
* {@link info.nightscout.utils.PercentageSplitter#pureName}
*/
public String getCustomizedName() {
String name = profileName;
if(LocalProfilePlugin.LOCAL_PROFILE.equals(name)){

View file

@ -99,13 +99,13 @@ public class L {
private static void initialize() {
logElements = new ArrayList<>();
logElements.add(new LogElement(APS, true));
logElements.add(new LogElement(AUTOSENS, true));
logElements.add(new LogElement(AUTOSENS, false));
logElements.add(new LogElement(BGSOURCE, true));
logElements.add(new LogElement(CONFIGBUILDER, true));
logElements.add(new LogElement(CONFIGBUILDER, false));
logElements.add(new LogElement(CONSTRAINTS, true));
logElements.add(new LogElement(CORE, true));
logElements.add(new LogElement(DATABASE, true));
logElements.add(new LogElement(DATAFOOD, true));
logElements.add(new LogElement(DATAFOOD, false));
logElements.add(new LogElement(DATASERVICE, true));
logElements.add(new LogElement(DATATREATMENTS, true));
logElements.add(new LogElement(EVENTS, false, true));

View file

@ -409,8 +409,10 @@ public class LoopPlugin extends PluginBase {
.setAutoCancel(true)
.setPriority(Notification.PRIORITY_HIGH)
.setCategory(Notification.CATEGORY_ALARM)
.setVisibility(Notification.VISIBILITY_PUBLIC)
.setLocalOnly(true);
.setVisibility(Notification.VISIBILITY_PUBLIC);
if (SP.getBoolean("wearcontrol", false)) {
builder.setLocalOnly(true);
}
// Creates an explicit intent for an Activity in your app
Intent resultIntent = new Intent(MainApp.instance().getApplicationContext(), MainActivity.class);

View file

@ -71,6 +71,7 @@ public class Notification {
public static final int DEVICENOTPAIRED = 43;
public static final int MEDTRONIC_PUMP_ALARM = 44;
public static final int RILEYLINK_CONNECTION = 45;
public static final int PERMISSION_PHONESTATE = 46;
public int id;

View file

@ -21,6 +21,7 @@ public class AndroidPermission {
public static final int CASE_SMS = 0x2;
public static final int CASE_LOCATION = 0x3;
public static final int CASE_BATTERY = 0x4;
public static final int CASE_PHONESTATE = 0x5;
public static void askForPermission(Activity activity, String[] permission, Integer requestCode) {
boolean test = false;
@ -55,6 +56,16 @@ public class AndroidPermission {
} else
MainApp.bus().post(new EventDismissNotification(Notification.PERMISSION_SMS));
}
// Following is a bug in Android 8
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.O) {
if (!checkForPermission(activity, Manifest.permission.READ_PHONE_STATE)) {
NotificationWithAction notification = new NotificationWithAction(Notification.PERMISSION_PHONESTATE, MainApp.gs(R.string.smscommunicator_missingphonestatepermission), Notification.URGENT);
notification.action(MainApp.gs(R.string.request), () ->
AndroidPermission.askForPermission(activity, new String[]{Manifest.permission.READ_PHONE_STATE}, AndroidPermission.CASE_PHONESTATE));
MainApp.bus().post(new EventNewNotification(notification));
} else
MainApp.bus().post(new EventDismissNotification(Notification.PERMISSION_PHONESTATE));
}
}
}

View file

@ -8,23 +8,15 @@ import java.util.regex.Pattern;
*/
public class PercentageSplitter {
// "Profile name (200%,2h)"
private static final Pattern percentagePattern = Pattern.compile("(.+)\\(\\d+%,\\d+h\\)");
// "Profile name (200%)"
private static final Pattern percentageShiftPattern = Pattern.compile("(.+)\\(\\d+%\\)");
// Matches "Profile name (200%,-2h)", "Profile name (50%)
private static final Pattern splitPattern = Pattern.compile("(.+)\\(\\d+%(,-?\\d+h)?\\)");
/** Removes the suffix for percentage and timeshift from a profile name. */
/** Removes the suffix for percentage and timeshift from a profile name. This is the inverse of what
* {@link info.nightscout.androidaps.db.ProfileSwitch#getCustomizedName()} does.
* Since the customized name is used for the PS upload to NS, this is needed get the original profile name
* when retrieving the PS from NS again. */
public static String pureName(String name) {
Matcher percentageMatch = percentagePattern.matcher(name);
if (percentageMatch.find()) {
return percentageMatch.group(1).trim();
}
Matcher percentageShiftMatch = percentageShiftPattern.matcher(name);
if (percentageShiftMatch.find()) {
return percentageShiftMatch.group(1).trim();
}
return name;
Matcher percentageMatch = splitPattern.matcher(name);
return percentageMatch.find() ? percentageMatch.group(1).trim() : name;
}
}

View file

@ -532,6 +532,7 @@
<string name="disconnectpumpfor2h">Ontkoppel pomp vir 2 h</string>
<string name="disconnectpumpfor3h">Ontkoppel pomp vir 3 h</string>
<string name="resume">Hervat</string>
<string name="reconnect">Herverbind Pomp</string>
<string name="smscommunicator_wrongduration">Verkeerde duur</string>
<string name="smscommunicator_loopsuspended">Lus opgeskort</string>
<string name="smscommunicator_loopresumed">Lus hervat</string>
@ -556,6 +557,7 @@
<string name="danar_bluetooth_status">Bluetooth status</string>
<string name="nav_about">Omtrent</string>
<string name="smscommunicator_missingsmspermission">Vermiste SMS toestemming</string>
<string name="smscommunicator_missingphonestatepermission">Toestemming vir foon status nog nie gegee nie</string>
<string name="xdripstatus_settings">xDrip Status (horlosie)</string>
<string name="xdripstatus">xDrip Statusline (horlosie)</string>
<string name="xdripstatus_shortname">xds</string>

View file

@ -556,6 +556,7 @@
<string name="danar_bluetooth_status">Stav Bluetooth</string>
<string name="nav_about">O aplikaci</string>
<string name="smscommunicator_missingsmspermission">Chybějící povolení SMS</string>
<string name="smscommunicator_missingphonestatepermission">Chybí oprávnění pro zjišťování stavu telefonu</string>
<string name="xdripstatus_settings">Status z xDripu (hodinky)</string>
<string name="xdripstatus">Statusový řádek xDripu (hodinky)</string>
<string name="xdripstatus_shortname">XDS</string>

View file

@ -532,6 +532,7 @@
<string name="disconnectpumpfor2h">Αποσύνδεση αντλίας για 2h</string>
<string name="disconnectpumpfor3h">Αποσύνδεση αντλίας για 3h</string>
<string name="resume">Επαναφορά</string>
<string name="reconnect">Επανασύνδεση αντλίας</string>
<string name="smscommunicator_wrongduration">Λάθος διάρκεια</string>
<string name="smscommunicator_loopsuspended">Κύκλωμα σε αναστολή</string>
<string name="smscommunicator_loopresumed">Επαναφορά κυκλώματος</string>

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--Generated by crowdin.com-->
<resources>
<string name="treatmentssafety_title">Seguridad de tratamientos</string>
<string name="nav_exit">Salir</string>
<string name="danar_useextended_title">Usar bolos extendidos para &gt;200%</string>
<string name="danar_bt_name_title">Dispositivo Bluetooth DanaR</string>

View file

@ -533,6 +533,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
<string name="disconnectpumpfor2h">Déconnecter la pompe 2h</string>
<string name="disconnectpumpfor3h">Déconnecter la pompe 3h</string>
<string name="resume">Reprendre</string>
<string name="reconnect">Rebrancher la pompe</string>
<string name="smscommunicator_wrongduration">Durée incorrecte</string>
<string name="smscommunicator_loopsuspended">Boucle suspendue</string>
<string name="smscommunicator_loopresumed">Boucle relancée</string>
@ -557,6 +558,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
<string name="danar_bluetooth_status">État Bluetooth</string>
<string name="nav_about">À propos de</string>
<string name="smscommunicator_missingsmspermission">Autorisation SMS manquante</string>
<string name="smscommunicator_missingphonestatepermission">Autorisation du téléphone manquante</string>
<string name="xdripstatus_settings">état Xdrip (montre)</string>
<string name="xdripstatus">Barre d\'état pour xDrip (Montre)</string>
<string name="xdripstatus_shortname">xds</string>

View file

@ -556,6 +556,7 @@
<string name="danar_bluetooth_status">Status bluetooth</string>
<string name="nav_about">Despre</string>
<string name="smscommunicator_missingsmspermission">Lipsesc permisiunile de SMS</string>
<string name="smscommunicator_missingphonestatepermission">Nu este acordată permisiunea de citire a stării telefonului</string>
<string name="xdripstatus_settings">Status xDrip (ceas)</string>
<string name="xdripstatus">Linie de status xDrip (ceas)</string>
<string name="xdripstatus_shortname">xds</string>

View file

@ -532,6 +532,7 @@
<string name="disconnectpumpfor2h">отсоединить помпу на 2 часа</string>
<string name="disconnectpumpfor3h">отсоединить помпу на 3 часа</string>
<string name="resume">возобновить</string>
<string name="reconnect">Возобновить соединение с помпой</string>
<string name="smscommunicator_wrongduration">неверное значение длительности</string>
<string name="smscommunicator_loopsuspended">ЗЦ остановлен</string>
<string name="smscommunicator_loopresumed">ЗЦикл возобновлен</string>

View file

@ -556,6 +556,7 @@
<string name="danar_bluetooth_status">Bluetoothstatus</string>
<string name="nav_about">Om</string>
<string name="smscommunicator_missingsmspermission">Saknar behörighet att skicka SMS</string>
<string name="smscommunicator_missingphonestatepermission">Behörighet saknas</string>
<string name="xdripstatus_settings">xDrip Status (klocka)</string>
<string name="xdripstatus">xDrip Statusrad (klocka)</string>
<string name="xdripstatus_shortname">xds</string>

View file

@ -5,6 +5,7 @@
<string name="alert_w32">Uyarı W32: Pil bitmek üzere</string>
<string name="alert_w33">Uyarı W33: Geçersiz saat/tarih</string>
<string name="alert_w34">Garanti süresi doldu</string>
<string name="alert_w36">Uyarı W36: Geçici bazal iptal edildi</string>
<string name="alert_w38">Uyarı W38: Bolus iptal edildi</string>
<string name="alert_w39">Uyarı W39: Kiralama süresi uyarısı</string>
<string name="alert_m20">Bakım M20: Kartuş takılı değil</string>
@ -12,6 +13,7 @@
<string name="alert_m22">Bakım M22: Pil boş</string>
<string name="alert_m23">Bakım M23: Otomatik kapalı</string>
<string name="alert_m24">Bakım M24: Tıkanıklık</string>
<string name="alert_m25">Bakım M25: Kiralama süresi doldu</string>
<string name="alert_m26">Bakım M26: Kartuş değişimi tamamlanamadı</string>
<string name="alert_m27">Bakım M27: Veri yükleme başarısız</string>
<string name="alert_m28">Bakım M28: Duraklat modunda zaman aşımı</string>
@ -20,4 +22,5 @@
<string name="alert_e6">Hata E6: Mekanik hata</string>
<string name="alert_e7">Hata E7: Elektronik hata</string>
<string name="alert_e10">Hata E10: Geri sarma hata</string>
<string name="alert_e13">Hata E13: Dil ekranında hata</string>
</resources>

File diff suppressed because it is too large Load diff

View file

@ -612,6 +612,7 @@
<string name="danar_bluetooth_status">Bluetooth status</string>
<string name="nav_about">About</string>
<string name="smscommunicator_missingsmspermission">Missing SMS permission</string>
<string name="smscommunicator_missingphonestatepermission">Missing phone state permission</string>
<string name="xdripstatus_settings">xDrip Status (watch)</string>
<string name="xdripstatus">xDrip Statusline (watch)</string>
<string name="xdripstatus_shortname">xds</string>

View file

@ -117,6 +117,7 @@ public class MainAppTest {
@Test
public void isEngineeringModeOrReleaseTest() {
mainApp.devBranch = true;
Assert.assertEquals(!Config.APS, mainApp.isEngineeringModeOrRelease());
}

View file

@ -19,7 +19,12 @@ public class PercentageSplitterTest {
}
@Test
public void pureNameTestPercentageAndShift() {
public void pureNameTestPercentageAndPositiveTimeShift() {
assertEquals("Fiasp", PercentageSplitter.pureName("Fiasp (101%,2h)"));
}
@Test
public void pureNameTestPercentageAndNegtiveTimeShift() {
assertEquals("Fiasp", PercentageSplitter.pureName("Fiasp (50%,-2h)"));
}
}