restrict wrong password notification to once every 30 seconds
This commit is contained in:
parent
c8c7e12056
commit
70b2b1502f
4 changed files with 17 additions and 6 deletions
|
@ -64,6 +64,8 @@ public abstract class AbstractDanaRExecutionService extends Service {
|
||||||
protected IBinder mBinder;
|
protected IBinder mBinder;
|
||||||
|
|
||||||
protected final UUID SPP_UUID = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb");
|
protected final UUID SPP_UUID = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb");
|
||||||
|
|
||||||
|
protected long lastWrongPumpPassword;
|
||||||
|
|
||||||
public abstract boolean updateBasalsInPump(final Profile profile);
|
public abstract boolean updateBasalsInPump(final Profile profile);
|
||||||
|
|
||||||
|
|
|
@ -97,8 +97,11 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{
|
||||||
|
|
||||||
public void connect() {
|
public void connect() {
|
||||||
if (mDanaRPump.password != -1 && mDanaRPump.password != SP.getInt(R.string.key_danar_password, -1)) {
|
if (mDanaRPump.password != -1 && mDanaRPump.password != SP.getInt(R.string.key_danar_password, -1)) {
|
||||||
Notification notification = new Notification(Notification.WRONG_PUMP_PASSWORD, MainApp.gs(R.string.wrongpumppassword), Notification.URGENT);
|
if(System.currentTimeMillis() > lastWrongPumpPassword + 30 * 1000) {
|
||||||
notification.soundId = R.raw.error;
|
Notification notification = new Notification(Notification.WRONG_PUMP_PASSWORD, MainApp.gs(R.string.wrongpumppassword), Notification.URGENT);
|
||||||
|
notification.soundId = R.raw.error;
|
||||||
|
lastWrongPumpPassword = System.currentTimeMillis();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,8 +105,11 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
||||||
|
|
||||||
public void connect() {
|
public void connect() {
|
||||||
if (mDanaRPump.password != -1 && mDanaRPump.password != SP.getInt(R.string.key_danar_password, -1)) {
|
if (mDanaRPump.password != -1 && mDanaRPump.password != SP.getInt(R.string.key_danar_password, -1)) {
|
||||||
Notification notification = new Notification(Notification.WRONG_PUMP_PASSWORD, MainApp.gs(R.string.wrongpumppassword), Notification.URGENT);
|
if(System.currentTimeMillis() > lastWrongPumpPassword + 30 * 1000) {
|
||||||
notification.soundId = R.raw.error;
|
Notification notification = new Notification(Notification.WRONG_PUMP_PASSWORD, MainApp.gs(R.string.wrongpumppassword), Notification.URGENT);
|
||||||
|
notification.soundId = R.raw.error;
|
||||||
|
lastWrongPumpPassword = System.currentTimeMillis();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,8 +120,11 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
||||||
|
|
||||||
public void connect() {
|
public void connect() {
|
||||||
if (mDanaRPump.password != -1 && mDanaRPump.password != SP.getInt(R.string.key_danar_password, -1)) {
|
if (mDanaRPump.password != -1 && mDanaRPump.password != SP.getInt(R.string.key_danar_password, -1)) {
|
||||||
Notification notification = new Notification(Notification.WRONG_PUMP_PASSWORD, MainApp.gs(R.string.wrongpumppassword), Notification.URGENT);
|
if(System.currentTimeMillis() > lastWrongPumpPassword + 30 * 1000) {
|
||||||
notification.soundId = R.raw.error;
|
Notification notification = new Notification(Notification.WRONG_PUMP_PASSWORD, MainApp.gs(R.string.wrongpumppassword), Notification.URGENT);
|
||||||
|
notification.soundId = R.raw.error;
|
||||||
|
lastWrongPumpPassword = System.currentTimeMillis();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue