From 3374a3a18bb4fcc2e6c45deb8e3e681060c1ea32 Mon Sep 17 00:00:00 2001 From: Eichenholz Date: Thu, 6 Aug 2026 16:34:58 +0200 Subject: [PATCH] FIX - power lock screen flashlight from camera light --- frontend/src/components/PhoneLockScreen.vue | 12 +++++++++++- sky_phone/source/client/camera.lua | 8 +++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/PhoneLockScreen.vue b/frontend/src/components/PhoneLockScreen.vue index 2f6588b..254bf22 100644 --- a/frontend/src/components/PhoneLockScreen.vue +++ b/frontend/src/components/PhoneLockScreen.vue @@ -11,6 +11,7 @@ import { import { computed, onBeforeUnmount, onMounted, ref } from 'vue' import { usePhoneStore } from '@/stores/phone' +import { nuiCall } from '@/utils/nui' const emit = defineEmits<{ camera: [] @@ -99,6 +100,13 @@ function unlockFromWallpaper(event: MouseEvent): void { emit('unlock') } +async function toggleFlashlight(): Promise { + const enabled = !flashlightActive.value + flashlightActive.value = enabled + const response = await nuiCall('camera:setFlash', { enabled }) + if (!response.success) flashlightActive.value = !enabled +} + onMounted(() => { clockTicker = window.setInterval(() => { now.value = new Date() @@ -107,6 +115,8 @@ onMounted(() => { onBeforeUnmount(() => { if (clockTicker !== undefined) window.clearInterval(clockTicker) + if (flashlightActive.value) + void nuiCall('camera:setFlash', { enabled: false }) }) @@ -156,7 +166,7 @@ onBeforeUnmount(() => { class="lock-screen__shortcut" :colors="flashlightShortcutColors" :aria-label="phone.t('LockScreen.flashlight')" - @click="flashlightActive = !flashlightActive" + @click="toggleFlashlight" >