forked from Blendman974/faceclaw
Add charging mode
This commit is contained in:
1 parent
875956e140
commit
4b73cbff35
5 files changed
+138
-47
No files matched your search
@@ -18,7 +18,7 @@ export class MainViewModel extends Observable {
|
||||
private _rawScreenshotsEnabled = false;
|
||||
private _batteryOptimizationWarningVisible = false;
|
||||
private _showLog = false;
|
||||
private _phase: "disconnected" | "connecting" | "connected" | "disconnecting" = "disconnected";
|
||||
private _phase: "disconnected" | "connecting" | "connected" | "charging" | "disconnecting" = "disconnected";
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
@@ -278,11 +278,11 @@ export class MainViewModel extends Observable {
|
||||
dashboardController.requestBatteryOptimizationExemption();
|
||||
}
|
||||
|
||||
get phase(): "disconnected" | "connecting" | "connected" | "disconnecting" {
|
||||
get phase(): "disconnected" | "connecting" | "connected" | "charging" | "disconnecting" {
|
||||
return this._phase;
|
||||
}
|
||||
|
||||
set phase(value: "disconnected" | "connecting" | "connected" | "disconnecting") {
|
||||
set phase(value: "disconnected" | "connecting" | "connected" | "charging" | "disconnecting") {
|
||||
if (this._phase !== value) {
|
||||
this._phase = value;
|
||||
this.notifyPropertyChange("phase", value);
|
||||
@@ -296,6 +296,7 @@ export class MainViewModel extends Observable {
|
||||
case "connecting":
|
||||
return "Connecting...";
|
||||
case "connected":
|
||||
case "charging":
|
||||
return "Disconnect";
|
||||
case "disconnecting":
|
||||
return "Disconnecting...";
|
||||
@@ -312,7 +313,7 @@ export class MainViewModel extends Observable {
|
||||
if (!this.canRun) return;
|
||||
|
||||
try {
|
||||
if (this.phase === "connected") {
|
||||
if (this.phase === "connected" || this.phase === "charging") {
|
||||
await dashboardController.disconnect();
|
||||
} else {
|
||||
await dashboardController.connect();
|
||||
|
||||
Reference in new issue
Block a user