feat: add keep-screen-on plugin
Some checks failed
TrafficCue CI / check (push) Failing after 55s
TrafficCue CI / build (push) Successful in 48s

This commit is contained in:
2025-08-06 11:53:24 +02:00
parent cc1d5ba32e
commit 0ded36e780
6 changed files with 27 additions and 5 deletions

View File

@@ -4,8 +4,9 @@ import say from "./TTS";
import type { ValhallaRequest } from "./ValhallaRequest";
import type { LngLatBoundsLike } from "maplibre-gl";
import { generateVoiceGuidance } from "./VoiceGuidance";
import { Capacitor } from "@capacitor/core";
import { KeepAwake } from "@capacitor-community/keep-awake";
import { keepScreenOn } from "tauri-plugin-keep-screen-on-api";
// import { Capacitor } from "@capacitor/core";
// import { KeepAwake } from "@capacitor-community/keep-awake";
export const routing = $state({
geojson: {
@@ -130,8 +131,11 @@ function drawCurrentTrip() {
}
export async function startRoute(trip: Trip) {
if (Capacitor.isNativePlatform()) {
/* if (Capacitor.isNativePlatform()) {
await KeepAwake.keepAwake();
} */
if(window.__TAURI__) {
await keepScreenOn(true);
}
routing.currentTrip = trip;
removeAllRoutes();
@@ -271,8 +275,11 @@ export function stopNavigation() {
routing.currentTrip = null;
map.updateMapPadding(); // TODO: REMOVE
removeAllRoutes();
if (Capacitor.isNativePlatform()) {
KeepAwake.allowSleep();
//if (Capacitor.isNativePlatform()) {
// KeepAwake.allowSleep();
//}
if(window.__TAURI__) {
keepScreenOn(false);
}
}