mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-26 18:45:49 +01:00
Remove device specific Alarms upon device removal.
This commit is contained in:
parent
d6b5140519
commit
6b10453714
@ -404,7 +404,9 @@ public class DebugActivity extends AbstractGBActivity {
|
||||
Context context = getApplicationContext();
|
||||
GBApplication gbApp = (GBApplication) context;
|
||||
final GBDevice device = gbApp.getDeviceManager().getSelectedDevice();
|
||||
GBApplication.deleteDeviceSpecificSharedPrefs(device.getAddress());
|
||||
if (device != null) {
|
||||
GBApplication.deleteDeviceSpecificSharedPrefs(device.getAddress());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -40,6 +40,7 @@ import nodomain.freeyourgadget.gadgetbridge.GBException;
|
||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
|
||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.AlarmDao;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.BatteryLevelDao;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.Device;
|
||||
@ -105,6 +106,8 @@ public abstract class AbstractDeviceCoordinator implements DeviceCoordinator {
|
||||
qb.where(DeviceAttributesDao.Properties.DeviceId.eq(device.getId())).buildDelete().executeDeleteWithoutDetachingEntities();
|
||||
QueryBuilder<?> batteryLevelQueryBuilder = session.getBatteryLevelDao().queryBuilder();
|
||||
batteryLevelQueryBuilder.where(BatteryLevelDao.Properties.DeviceId.eq(device.getId())).buildDelete().executeDeleteWithoutDetachingEntities();
|
||||
QueryBuilder<?> alarmDeviceQueryBuilder = session.getAlarmDao().queryBuilder();
|
||||
alarmDeviceQueryBuilder.where(AlarmDao.Properties.DeviceId.eq(device.getId())).buildDelete().executeDeleteWithoutDetachingEntities();
|
||||
session.getDeviceDao().delete(device);
|
||||
} else {
|
||||
LOG.info("device to delete not found in db: " + gbDevice);
|
||||
|
Loading…
Reference in New Issue
Block a user