mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-22 04:29:22 +01:00
Merge branch 'bugfix/alarm_fix' into develop
This commit is contained in:
commit
5907994ff6
5 changed files with 84 additions and 11 deletions
|
@ -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);
|
||||
dbHelper.getAllDrugs();
|
||||
|
||||
List<Drug> drugs = dbHelper.getAllDrugs();
|
||||
|
||||
Drug firstDrug = null;
|
||||
PrescriptionDatabase prescriptions = null;
|
||||
assert false;
|
||||
PrescriptionsDAO prescriptionsDAO = prescriptions.getPrescriptionsDAO();
|
||||
List<Prescription> prescriptionList = prescriptionsDAO.getAllMedics();
|
||||
Prescription firstPrescription = null ;
|
||||
//List<Drug> 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);
|
||||
}
|
||||
}
|
||||
|
|
35
fastlane/metadata/android/en-US/changelogs/v0.201-beta.txt
Normal file
35
fastlane/metadata/android/en-US/changelogs/v0.201-beta.txt
Normal file
|
@ -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).
|
34
fastlane/metadata/android/fr-FR/changelogs/v0.201-beta.txt
Normal file
34
fastlane/metadata/android/fr-FR/changelogs/v0.201-beta.txt
Normal file
|
@ -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).
|
Loading…
Reference in a new issue