feat: add keep-screen-on plugin
This commit is contained in:
5
bun.lock
5
bun.lock
@ -23,6 +23,7 @@
|
|||||||
"pako": "^2.1.0",
|
"pako": "^2.1.0",
|
||||||
"sql.js": "^1.13.0",
|
"sql.js": "^1.13.0",
|
||||||
"svelte-maplibre-gl": "^0.1.8",
|
"svelte-maplibre-gl": "^0.1.8",
|
||||||
|
"tauri-plugin-keep-screen-on-api": "^0.1.4",
|
||||||
"typescript-eslint": "^8.34.1",
|
"typescript-eslint": "^8.34.1",
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -354,6 +355,8 @@
|
|||||||
|
|
||||||
"@tailwindcss/vite": ["@tailwindcss/vite@4.1.8", "", { "dependencies": { "@tailwindcss/node": "4.1.8", "@tailwindcss/oxide": "4.1.8", "tailwindcss": "4.1.8" }, "peerDependencies": { "vite": "^5.2.0 || ^6" } }, "sha512-CQ+I8yxNV5/6uGaJjiuymgw0kEQiNKRinYbZXPdx1fk5WgiyReG0VaUx/Xq6aVNSUNJFzxm6o8FNKS5aMaim5A=="],
|
"@tailwindcss/vite": ["@tailwindcss/vite@4.1.8", "", { "dependencies": { "@tailwindcss/node": "4.1.8", "@tailwindcss/oxide": "4.1.8", "tailwindcss": "4.1.8" }, "peerDependencies": { "vite": "^5.2.0 || ^6" } }, "sha512-CQ+I8yxNV5/6uGaJjiuymgw0kEQiNKRinYbZXPdx1fk5WgiyReG0VaUx/Xq6aVNSUNJFzxm6o8FNKS5aMaim5A=="],
|
||||||
|
|
||||||
|
"@tauri-apps/api": ["@tauri-apps/api@2.7.0", "", {}, "sha512-v7fVE8jqBl8xJFOcBafDzXFc8FnicoH3j8o8DNNs0tHuEBmXUDqrCOAzMRX0UkfpwqZLqvrvK0GNQ45DfnoVDg=="],
|
||||||
|
|
||||||
"@tauri-apps/cli": ["@tauri-apps/cli@2.7.1", "", { "optionalDependencies": { "@tauri-apps/cli-darwin-arm64": "2.7.1", "@tauri-apps/cli-darwin-x64": "2.7.1", "@tauri-apps/cli-linux-arm-gnueabihf": "2.7.1", "@tauri-apps/cli-linux-arm64-gnu": "2.7.1", "@tauri-apps/cli-linux-arm64-musl": "2.7.1", "@tauri-apps/cli-linux-riscv64-gnu": "2.7.1", "@tauri-apps/cli-linux-x64-gnu": "2.7.1", "@tauri-apps/cli-linux-x64-musl": "2.7.1", "@tauri-apps/cli-win32-arm64-msvc": "2.7.1", "@tauri-apps/cli-win32-ia32-msvc": "2.7.1", "@tauri-apps/cli-win32-x64-msvc": "2.7.1" }, "bin": { "tauri": "tauri.js" } }, "sha512-RcGWR4jOUEl92w3uvI0h61Llkfj9lwGD1iwvDRD2isMrDhOzjeeeVn9aGzeW1jubQ/kAbMYfydcA4BA0Cy733Q=="],
|
"@tauri-apps/cli": ["@tauri-apps/cli@2.7.1", "", { "optionalDependencies": { "@tauri-apps/cli-darwin-arm64": "2.7.1", "@tauri-apps/cli-darwin-x64": "2.7.1", "@tauri-apps/cli-linux-arm-gnueabihf": "2.7.1", "@tauri-apps/cli-linux-arm64-gnu": "2.7.1", "@tauri-apps/cli-linux-arm64-musl": "2.7.1", "@tauri-apps/cli-linux-riscv64-gnu": "2.7.1", "@tauri-apps/cli-linux-x64-gnu": "2.7.1", "@tauri-apps/cli-linux-x64-musl": "2.7.1", "@tauri-apps/cli-win32-arm64-msvc": "2.7.1", "@tauri-apps/cli-win32-ia32-msvc": "2.7.1", "@tauri-apps/cli-win32-x64-msvc": "2.7.1" }, "bin": { "tauri": "tauri.js" } }, "sha512-RcGWR4jOUEl92w3uvI0h61Llkfj9lwGD1iwvDRD2isMrDhOzjeeeVn9aGzeW1jubQ/kAbMYfydcA4BA0Cy733Q=="],
|
||||||
|
|
||||||
"@tauri-apps/cli-darwin-arm64": ["@tauri-apps/cli-darwin-arm64@2.7.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-j2NXQN6+08G03xYiyKDKqbCV2Txt+hUKg0a8hYr92AmoCU8fgCjHyva/p16lGFGUG3P2Yu0xiNe1hXL9ZuRMzA=="],
|
"@tauri-apps/cli-darwin-arm64": ["@tauri-apps/cli-darwin-arm64@2.7.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-j2NXQN6+08G03xYiyKDKqbCV2Txt+hUKg0a8hYr92AmoCU8fgCjHyva/p16lGFGUG3P2Yu0xiNe1hXL9ZuRMzA=="],
|
||||||
@ -918,6 +921,8 @@
|
|||||||
|
|
||||||
"tar": ["tar@6.2.1", "", { "dependencies": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", "minipass": "^5.0.0", "minizlib": "^2.1.1", "mkdirp": "^1.0.3", "yallist": "^4.0.0" } }, "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A=="],
|
"tar": ["tar@6.2.1", "", { "dependencies": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", "minipass": "^5.0.0", "minizlib": "^2.1.1", "mkdirp": "^1.0.3", "yallist": "^4.0.0" } }, "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A=="],
|
||||||
|
|
||||||
|
"tauri-plugin-keep-screen-on-api": ["tauri-plugin-keep-screen-on-api@0.1.4", "", { "dependencies": { "@tauri-apps/api": ">=2.0.0-beta.6" } }, "sha512-uFY2EKWiKQ3xmwpMYfjaXgYr5USSNS0/Nz8h75lnG0bgttsEcUs4soP0fHPpE7tL3BKbzJdyTycusirkS9aKkA=="],
|
||||||
|
|
||||||
"terra-draw": ["terra-draw@1.6.2", "", {}, "sha512-U5vHQ8CPOM52cHcHUrCewuQnmaUWRXF2g3UJV2IDLyVtzeOBbkBXl2ZNXD4AhA3roEDwYi5wZ5ZbB6pKuC62Kw=="],
|
"terra-draw": ["terra-draw@1.6.2", "", {}, "sha512-U5vHQ8CPOM52cHcHUrCewuQnmaUWRXF2g3UJV2IDLyVtzeOBbkBXl2ZNXD4AhA3roEDwYi5wZ5ZbB6pKuC62Kw=="],
|
||||||
|
|
||||||
"terra-draw-maplibre-gl-adapter": ["terra-draw-maplibre-gl-adapter@1.1.0", "", { "peerDependencies": { "maplibre-gl": ">=4", "terra-draw": "^1.0.0" } }, "sha512-o9k0Ndk7Q/KfxpFeG7vq8YC+n1NxAHs4cCt+jqio36h4IbQvQ2O4kawcgAzrSqq6+MCBtNhsImwsvWZ+w+l3vw=="],
|
"terra-draw-maplibre-gl-adapter": ["terra-draw-maplibre-gl-adapter@1.1.0", "", { "peerDependencies": { "maplibre-gl": ">=4", "terra-draw": "^1.0.0" } }, "sha512-o9k0Ndk7Q/KfxpFeG7vq8YC+n1NxAHs4cCt+jqio36h4IbQvQ2O4kawcgAzrSqq6+MCBtNhsImwsvWZ+w+l3vw=="],
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
"pako": "^2.1.0",
|
"pako": "^2.1.0",
|
||||||
"sql.js": "^1.13.0",
|
"sql.js": "^1.13.0",
|
||||||
"svelte-maplibre-gl": "^0.1.8",
|
"svelte-maplibre-gl": "^0.1.8",
|
||||||
|
"tauri-plugin-keep-screen-on-api": "^0.1.4",
|
||||||
"typescript-eslint": "^8.34.1"
|
"typescript-eslint": "^8.34.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,3 +23,4 @@ serde = { version = "1.0", features = ["derive"] }
|
|||||||
log = "0.4"
|
log = "0.4"
|
||||||
tauri = { version = "2.7.0", features = [] }
|
tauri = { version = "2.7.0", features = [] }
|
||||||
tauri-plugin-log = "2"
|
tauri-plugin-log = "2"
|
||||||
|
tauri-plugin-keep-screen-on = "0.1.2"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||||
pub fn run() {
|
pub fn run() {
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
|
.plugin(tauri_plugin_keep_screen_on::init())
|
||||||
.setup(|app| {
|
.setup(|app| {
|
||||||
if cfg!(debug_assertions) {
|
if cfg!(debug_assertions) {
|
||||||
app.handle().plugin(
|
app.handle().plugin(
|
||||||
|
7
src/global.d.ts
vendored
Normal file
7
src/global.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
export {};
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
__TAURI__: object?;
|
||||||
|
}
|
||||||
|
}
|
@ -4,8 +4,9 @@ import say from "./TTS";
|
|||||||
import type { ValhallaRequest } from "./ValhallaRequest";
|
import type { ValhallaRequest } from "./ValhallaRequest";
|
||||||
import type { LngLatBoundsLike } from "maplibre-gl";
|
import type { LngLatBoundsLike } from "maplibre-gl";
|
||||||
import { generateVoiceGuidance } from "./VoiceGuidance";
|
import { generateVoiceGuidance } from "./VoiceGuidance";
|
||||||
import { Capacitor } from "@capacitor/core";
|
import { keepScreenOn } from "tauri-plugin-keep-screen-on-api";
|
||||||
import { KeepAwake } from "@capacitor-community/keep-awake";
|
// import { Capacitor } from "@capacitor/core";
|
||||||
|
// import { KeepAwake } from "@capacitor-community/keep-awake";
|
||||||
|
|
||||||
export const routing = $state({
|
export const routing = $state({
|
||||||
geojson: {
|
geojson: {
|
||||||
@ -130,8 +131,11 @@ function drawCurrentTrip() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function startRoute(trip: Trip) {
|
export async function startRoute(trip: Trip) {
|
||||||
if (Capacitor.isNativePlatform()) {
|
/* if (Capacitor.isNativePlatform()) {
|
||||||
await KeepAwake.keepAwake();
|
await KeepAwake.keepAwake();
|
||||||
|
} */
|
||||||
|
if(window.__TAURI__) {
|
||||||
|
await keepScreenOn(true);
|
||||||
}
|
}
|
||||||
routing.currentTrip = trip;
|
routing.currentTrip = trip;
|
||||||
removeAllRoutes();
|
removeAllRoutes();
|
||||||
@ -271,8 +275,11 @@ export function stopNavigation() {
|
|||||||
routing.currentTrip = null;
|
routing.currentTrip = null;
|
||||||
map.updateMapPadding(); // TODO: REMOVE
|
map.updateMapPadding(); // TODO: REMOVE
|
||||||
removeAllRoutes();
|
removeAllRoutes();
|
||||||
if (Capacitor.isNativePlatform()) {
|
//if (Capacitor.isNativePlatform()) {
|
||||||
KeepAwake.allowSleep();
|
// KeepAwake.allowSleep();
|
||||||
|
//}
|
||||||
|
if(window.__TAURI__) {
|
||||||
|
keepScreenOn(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user