feat: keep device awake during navigation
This commit is contained in:
@ -9,6 +9,7 @@ android {
|
||||
|
||||
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
|
||||
dependencies {
|
||||
implementation project(':capacitor-community-keep-awake')
|
||||
implementation project(':capacitor-community-native-audio')
|
||||
implementation project(':capacitor-community-sqlite')
|
||||
implementation project(':capacitor-community-text-to-speech')
|
||||
|
||||
@ -2,6 +2,9 @@
|
||||
include ':capacitor-android'
|
||||
project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor')
|
||||
|
||||
include ':capacitor-community-keep-awake'
|
||||
project(':capacitor-community-keep-awake').projectDir = new File('../node_modules/@capacitor-community/keep-awake/android')
|
||||
|
||||
include ':capacitor-community-native-audio'
|
||||
project(':capacitor-community-native-audio').projectDir = new File('../node_modules/@capacitor-community/native-audio/android')
|
||||
|
||||
|
||||
3
bun.lock
3
bun.lock
@ -4,6 +4,7 @@
|
||||
"": {
|
||||
"name": "librenav",
|
||||
"dependencies": {
|
||||
"@capacitor-community/keep-awake": "^7.1.0",
|
||||
"@capacitor-community/native-audio": "^7.0.0",
|
||||
"@capacitor-community/sqlite": "^7.0.0",
|
||||
"@capacitor-community/text-to-speech": "^6.0.0",
|
||||
@ -54,6 +55,8 @@
|
||||
|
||||
"@babel/runtime": ["@babel/runtime@7.27.3", "", {}, "sha512-7EYtGezsdiDMyY80+65EzwiGmcJqpmcZCojSXaRgdrBaGtWTgDZKq69cPIVped6MkIM78cTQ2GOiEYjwOlG4xw=="],
|
||||
|
||||
"@capacitor-community/keep-awake": ["@capacitor-community/keep-awake@7.1.0", "", { "peerDependencies": { "@capacitor/core": ">=7.0.0" } }, "sha512-4Hj6OKnBd/DAOeiMnqBy74tg1rwC+qLYWQbWJmysMZm2e2nptz43hxaKu22Xlyyw5O71CwwskLCM0skDFMPpQQ=="],
|
||||
|
||||
"@capacitor-community/native-audio": ["@capacitor-community/native-audio@7.0.0", "", { "peerDependencies": { "@capacitor/core": ">=7.0.0" } }, "sha512-wi2l68tU6KDLJWKL6I0lPUKOdB+hNxlvF7RMe/jfkKOMZnd1eUq7kszmbMqyGFZFIxdNG/GMiZrEztZHDypf8A=="],
|
||||
|
||||
"@capacitor-community/sqlite": ["@capacitor-community/sqlite@7.0.0", "", { "dependencies": { "jeep-sqlite": "^2.7.2" }, "peerDependencies": { "@capacitor/core": ">=7.0.0" } }, "sha512-GSHxLEiyuhPoWwpMLOwfaOhLpfZglhfI1sqEgA5bSbtIYt1I+iK02b/ymonaghB176NhA5wuGd+spOIaL0kgHw=="],
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
},
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@capacitor-community/keep-awake": "^7.1.0",
|
||||
"@capacitor-community/native-audio": "^7.0.0",
|
||||
"@capacitor-community/sqlite": "^7.0.0",
|
||||
"@capacitor-community/text-to-speech": "^6.0.0",
|
||||
|
||||
@ -4,6 +4,8 @@ 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";
|
||||
|
||||
export const routing = $state({
|
||||
geojson: {
|
||||
@ -128,6 +130,9 @@ function drawCurrentTrip() {
|
||||
}
|
||||
|
||||
export async function startRoute(trip: Trip) {
|
||||
if(Capacitor.isNativePlatform()) {
|
||||
await KeepAwake.keepAwake();
|
||||
}
|
||||
routing.currentTrip = trip;
|
||||
removeAllRoutes();
|
||||
routing.geojson.route = tripToGeoJSON(trip);
|
||||
@ -266,6 +271,9 @@ export function stopNavigation() {
|
||||
routing.currentTrip = null;
|
||||
map.updateMapPadding(); // TODO: REMOVE
|
||||
removeAllRoutes();
|
||||
if(Capacitor.isNativePlatform()) {
|
||||
KeepAwake.allowSleep();
|
||||
}
|
||||
}
|
||||
|
||||
// function getUserLocation(): WorldLocation {
|
||||
|
||||
Reference in New Issue
Block a user