From bbc1f39ebeaf853ea8bb05882585a15b95986e10 Mon Sep 17 00:00:00 2001 From: jacques Date: Sun, 1 May 2022 07:05:40 +0200 Subject: [PATCH 1/4] add comment to see where to change code --- app/src/main/java/net/foucry/pilldroid/AlarmReceiver.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/net/foucry/pilldroid/AlarmReceiver.java b/app/src/main/java/net/foucry/pilldroid/AlarmReceiver.java index 7912308..ffdcfd0 100644 --- a/app/src/main/java/net/foucry/pilldroid/AlarmReceiver.java +++ b/app/src/main/java/net/foucry/pilldroid/AlarmReceiver.java @@ -41,7 +41,7 @@ public class AlarmReceiver extends BroadcastReceiver { if (BuildConfig.DEBUG) { Toast.makeText(context, "New stock calculated", Toast.LENGTH_LONG).show(); } createNotificationChannel(context); - DBHelper dbHelper = new DBHelper(context); + DBHelper dbHelper = new DBHelper(context); // TODO use room dbHelper.getAllDrugs(); List drugs = dbHelper.getAllDrugs(); From 88843e011085f7075ed15b3742ef204bfc71ca5b Mon Sep 17 00:00:00 2001 From: jacques Date: Wed, 4 May 2022 19:46:50 +0200 Subject: [PATCH 2/4] change name and text --- .../android/en-US/changelogs/{v0.2.0.txt => v0.200-beta.txt} | 0 .../android/fr-FR/changelogs/{v0.2.0.txt => v0.200-beta.txt} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename fastlane/metadata/android/en-US/changelogs/{v0.2.0.txt => v0.200-beta.txt} (100%) rename fastlane/metadata/android/fr-FR/changelogs/{v0.2.0.txt => v0.200-beta.txt} (100%) diff --git a/fastlane/metadata/android/en-US/changelogs/v0.2.0.txt b/fastlane/metadata/android/en-US/changelogs/v0.200-beta.txt similarity index 100% rename from fastlane/metadata/android/en-US/changelogs/v0.2.0.txt rename to fastlane/metadata/android/en-US/changelogs/v0.200-beta.txt diff --git a/fastlane/metadata/android/fr-FR/changelogs/v0.2.0.txt b/fastlane/metadata/android/fr-FR/changelogs/v0.200-beta.txt similarity index 100% rename from fastlane/metadata/android/fr-FR/changelogs/v0.2.0.txt rename to fastlane/metadata/android/fr-FR/changelogs/v0.200-beta.txt From b5c9336bfce5e8142bece1466bc661729325dfc4 Mon Sep 17 00:00:00 2001 From: jacques Date: Wed, 4 May 2022 19:47:06 +0200 Subject: [PATCH 3/4] Changelogs for new version --- .../android/en-US/changelogs/v0.201-beta.txt | 35 +++++++++++++++++++ .../android/fr-FR/changelogs/v0.201-beta.txt | 34 ++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 fastlane/metadata/android/en-US/changelogs/v0.201-beta.txt create mode 100644 fastlane/metadata/android/fr-FR/changelogs/v0.201-beta.txt diff --git a/fastlane/metadata/android/en-US/changelogs/v0.201-beta.txt b/fastlane/metadata/android/en-US/changelogs/v0.201-beta.txt new file mode 100644 index 0000000..45162b3 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/v0.201-beta.txt @@ -0,0 +1,35 @@ +# v0.201-beta - fix bug in `alarmReceiver` + +The `alarmReceiver` was still using the old database that *should* be empty. I use `room` database +management now. + +# v0.200-beta – New semantic version number (VRelease.MajorMinorPatch) + +**REMEMBER** Pilldroid is a French people user only. + +I made a lot a tests but there must stay some bugs. + +## What's new + +A lot of things under the surface : +- Add an alert about non responsibility of the author in case of trouble; +- Using `Room` to manage databases; +- Migration of the old database to the new one, you should not see anything; +- Code cleaning. + +## What should work. +- QR-code scan on a dark background. The library have an option for that. + + +**WARNING**, Pilldroid does not manage creams, liquids +(like insulin). + +Thanks to use [github](https://github/jfoucry/pilldroid) for bugs +reports and new features. + +> I made Pilldroid on my free time which is not expandable. Please +do not stress me it will be unproductive. + +Pilldroid will available only from [f-droid](https://f-droid.org) + +You can reach me and discuss on [Pilldroid](mailto:jacques+pilldroid@foucry.net). diff --git a/fastlane/metadata/android/fr-FR/changelogs/v0.201-beta.txt b/fastlane/metadata/android/fr-FR/changelogs/v0.201-beta.txt new file mode 100644 index 0000000..2092790 --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/v0.201-beta.txt @@ -0,0 +1,34 @@ +# v0.201-beta - deverminage dans `alarmReceiver` + +`alarmReceiver` utilisait l'ancienne base de données qui *doit* être vide. J'utilise maintenant +la base de données gérée par `room` + +# v0200 – Nouvelle numérotation sémantique (VRelease.Major.Minor.Patch) + +Malgré de nombreux tests et une utilisation quotidienne, +tout est à tester. + +## Nouveautés + +Pas grand chose de visible pour les personnes utilisatrices : +- Ajout d'une demande explicite de non responsabilité de l'auteur en cas de problème ; +- Utilisation de `Room` pour gérer les bases de données ; +- Migration de l'ancienne base de données à la nouvelle, vous ne devriez rien voir ; +- Nettoyage de code. + +## Ce qui devrait fonctionner +- le scan de QR-code sur fond foncé. La bibliothèque utilisée a un paramètre pour cela. + + +**ATTENTION**, Pilldroid ne sait pas gérer les crèmes, les liquides +(l'insuline par exemple). + +Merci d'utiliser [github](https://github/jfoucry/pilldroid) pour +les rapports de bogues et demandes de fonctionnalités. + +> Je fais Pilldroid sur mon temps libre et accessible. Il est inutile +et contre productif de me « mettre la pression ». + +Pilldroid ne sera diffusé que par [f-droid](https://f-droid.org) (pour l'instant) + +Vous pouvez m'écrire pour discuter de [Pildroid](mailto:jacques+pilldroid@foucry.net). From 742d7cbe1f8d9851430cd2c2d2853bf435e05579 Mon Sep 17 00:00:00 2001 From: jacques Date: Wed, 4 May 2022 19:48:19 +0200 Subject: [PATCH 4/4] fix AlarmReceiver bug, was still using the hold that should be empty. Use now the room database management --- .../net/foucry/pilldroid/AlarmReceiver.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/net/foucry/pilldroid/AlarmReceiver.java b/app/src/main/java/net/foucry/pilldroid/AlarmReceiver.java index ffdcfd0..26265c6 100644 --- a/app/src/main/java/net/foucry/pilldroid/AlarmReceiver.java +++ b/app/src/main/java/net/foucry/pilldroid/AlarmReceiver.java @@ -14,6 +14,10 @@ import android.widget.Toast; import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationManagerCompat; +import net.foucry.pilldroid.dao.PrescriptionsDAO; +import net.foucry.pilldroid.databases.PrescriptionDatabase; +import net.foucry.pilldroid.models.Prescription; + import java.time.LocalTime; import java.util.Date; import java.util.List; @@ -41,24 +45,24 @@ public class AlarmReceiver extends BroadcastReceiver { if (BuildConfig.DEBUG) { Toast.makeText(context, "New stock calculated", Toast.LENGTH_LONG).show(); } createNotificationChannel(context); - DBHelper dbHelper = new DBHelper(context); // TODO use room - dbHelper.getAllDrugs(); - - List drugs = dbHelper.getAllDrugs(); - - Drug firstDrug = null; + PrescriptionDatabase prescriptions = null; + assert false; + PrescriptionsDAO prescriptionsDAO = prescriptions.getPrescriptionsDAO(); + List prescriptionList = prescriptionsDAO.getAllMedics(); + Prescription firstPrescription = null ; + //List drugs = dbHelper.getAllDrugs(); try { - firstDrug = drugs.get(0); + firstPrescription = prescriptionList.get(1); } catch (Exception e){ Log.e(TAG, e.toString()); e.printStackTrace(); } - if (firstDrug != null) { - if (firstDrug.getTake() != 0) { - if(firstDrug.getStock() <= firstDrug.getAlertThreshold()) { + if (firstPrescription != null) { + if (firstPrescription.getTake() != 0) { + if(firstPrescription.getStock() <= firstPrescription.getAlertThreshold()) { notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); Intent notificationIntent = new Intent(context, DrugListActivity.class); @@ -81,7 +85,7 @@ public class AlarmReceiver extends BroadcastReceiver { notificationManager.notify(notificationId, builder.build()); } else { - double dummy = (firstDrug.getStock() - firstDrug.getAlertThreshold()); + double dummy = (firstPrescription.getStock() - firstPrescription.getAlertThreshold()); Log.d(TAG, "no notification scheduled " + dummy); } }