Improved DB-based alarms

- got rid of GBAlarm
- added migration for prefs-based alarms
- various cleanups
This commit is contained in:
cpfeiffer
2019-01-07 01:15:49 +01:00
parent e7dc55821d
commit 903b50c2c5
18 changed files with 333 additions and 356 deletions
@@ -345,6 +345,7 @@ public class GBDaoGenerator {
private static void addAlarms(Schema schema, Entity user, Entity device) {
Entity alarm = addEntity(schema, "Alarm");
alarm.implementsInterface("nodomain.freeyourgadget.gadgetbridge.model.Alarm");
Property deviceId = alarm.addLongProperty("deviceId").notNull().getProperty();
Property userId = alarm.addLongProperty("userId").notNull().getProperty();
Property position = alarm.addIntProperty("position").notNull().getProperty();
@@ -355,8 +356,11 @@ public class GBDaoGenerator {
indexUnique.makeUnique();
alarm.addIndex(indexUnique);
alarm.addBooleanProperty("enabled").notNull();
alarm.addBooleanProperty("smartAlarm").notNull();
alarm.addIntProperty("repetition").notNull();
alarm.addBooleanProperty("smartWakeup").notNull();
alarm.addIntProperty("repetition").notNull().codeBeforeGetter(
"public boolean isRepetitive() { return getRepetition() != ALARM_ONCE; } " +
"public boolean getRepetition(int dow) { return (this.repetition & dow) > 0; }"
);
alarm.addIntProperty("hour").notNull();
alarm.addIntProperty("minute").notNull();
alarm.addToOne(user, userId);