From a1e5876406f2a36d84c361878cc01c1f5d8a0558 Mon Sep 17 00:00:00 2001 From: itschip Date: Wed, 18 Nov 2020 19:13:17 +0100 Subject: [PATCH] close phone on ESC - thank me later Rocky --- phone/src/Phone.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/phone/src/Phone.tsx b/phone/src/Phone.tsx index b6bc26c..6ef384f 100644 --- a/phone/src/Phone.tsx +++ b/phone/src/Phone.tsx @@ -21,6 +21,8 @@ import { useTwitterService } from "./apps/twitter/hooks/useTwitterService"; import { useSelloutService } from "./apps/sellout/hooks/useSelloutService"; import { useBankService } from './apps/bank/hooks/useBankService'; import { useNotesService } from "./apps/notes/hooks/useNotesService"; +import { usePhone } from "./os/phone/hooks/usePhone"; +import Nui from "./os/nui-events/utils/Nui"; //These events are just for testing. Comment it out before building. setTimeout(() => { @@ -223,6 +225,7 @@ setTimeout(() => { function Phone() { useNuiService(); + const { } = usePhone() const { visibility } = usePhoneService(); const { settings, currentTheme } = useSettings(); const { allApps } = useApps(); @@ -240,6 +243,12 @@ function Phone() { const calling = false; + document.onkeyup = function(data) { + if (data.which == 27) { + Nui.send("phone:close"); + } + } + return (