Prechádzať zdrojové kódy

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

Fixes #540
SirTyson 7 rokov pred
rodič
commit
2d326a0839
2 zmenil súbory, kde vykonal 250 pridanie a 240 odobranie
  1. 240 240
      package-lock.json
  2. 10 0
      src/services/battery.ts

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 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) {

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov