mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Improved DB-based alarms
- got rid of GBAlarm - added migration for prefs-based alarms - various cleanups
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user