mirror of
https://github.com/zyphlar/LanternPowerMonitor.git
synced 2024-03-08 14:07:47 +00:00
Fix a bug that was making it impossible to display billing information in the android app.
This commit is contained in:
@@ -64,6 +64,11 @@ public class MongoRulesDataAccess implements RulesDataAccess {
|
||||
proxy.save(_device);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFcmDevice(String _id) {
|
||||
proxy.delete(FcmDevice.class, new DaoQuery("_id", _id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FcmDevice> getFcmDevicesForAccount(int _accountId) {
|
||||
return proxy.query(FcmDevice.class, new DaoQuery("account_id", _accountId));
|
||||
|
||||
@@ -17,5 +17,6 @@ public interface RulesDataAccess {
|
||||
Event getMostRecentEvent(int _accountId, EventType _type, String _sourceId);
|
||||
List<Event> getEvents(int _accountId, EventType _type, String _sourceId, Date _from, Date _to);
|
||||
void putFcmDevice(FcmDevice _device);
|
||||
void removeFcmDevice(String _id);
|
||||
List<FcmDevice> getFcmDevicesForAccount(int _accountId);
|
||||
}
|
||||
|
||||
@@ -45,6 +45,9 @@ public abstract class AbstractAlertAction implements ActionImpl {
|
||||
try {
|
||||
messaging.send(msg);
|
||||
} catch (Exception _e) {
|
||||
if (_e.getMessage().contains("not found")) {
|
||||
RulesEngine.instance().dao().removeFcmDevice(device.getId());
|
||||
}
|
||||
logger.error("Failed to send message to account {}, device {}", _rule.getAccountId(), device.getName(), _e);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user