Browse Source

Cancel battery alert when phone is plugged in (#547)

Fixes #540
SirTyson 7 years ago
parent
commit
2d326a0839
2 changed files with 250 additions and 240 deletions
  1. 240 240
      package-lock.json
  2. 10 0
      src/services/battery.ts

File diff suppressed because it is too large
+ 240 - 240
package-lock.json


+ 10 - 0
src/services/battery.ts

@@ -61,6 +61,16 @@ export class BatteryStatusService {
             }
         }
 
+        // Reset alert flag if device is plugged in
+        if (this.alertedLow && batteryStatus.isCharging) {
+            this.alertedLow = false;
+            this.notificationService.hideNotification('battery-low');
+        }
+        if (this.alertedCritical && batteryStatus.isCharging) {
+            this.alertedCritical = false;
+            this.notificationService.hideNotification('battery-critical');
+        }
+
         // Reset alert flag if percentage goes above a certain threshold
         const hysteresis = 3;
         if (this.alertedLow && batteryStatus.percent > BatteryStatusService.PERCENT_LOW + hysteresis) {

Some files were not shown because too many files changed in this diff