diff --git a/phone/src/Phone.js b/phone/src/Phone.js index 381721d..b148847 100644 --- a/phone/src/Phone.js +++ b/phone/src/Phone.js @@ -56,7 +56,7 @@ import { useContactsService } from "./apps/contacts/hooks/useContactsService"; // data: { // app: "PHONE", // method: "setVisibility", -// data: false, +// data: true, // }, // }) // ); diff --git a/phone/src/os/navigation-bar/components/Navigation.js b/phone/src/os/navigation-bar/components/Navigation.js index 77c7dcc..c41b8f3 100644 --- a/phone/src/os/navigation-bar/components/Navigation.js +++ b/phone/src/os/navigation-bar/components/Navigation.js @@ -7,8 +7,11 @@ import { import KeyboardArrowLeftIcon from "@material-ui/icons/KeyboardArrowLeft"; import AppsIcon from "@material-ui/icons/Apps"; import PhoneIcon from "@material-ui/icons/Phone"; +import RadioButtonUncheckedIcon from "@material-ui/icons/RadioButtonUnchecked"; import { useHistory } from "react-router-dom"; +import Nui from "../../nui-events/utils/Nui"; + const useStyles = makeStyles((theme) => ({ root: { zIndex: 2, @@ -17,6 +20,11 @@ const useStyles = makeStyles((theme) => ({ })); export const Navigation = () => { + const closePhone = () => { + console.log("Phone closed"); + Nui.send("phone:close"); + }; + const classes = useStyles(); const history = useHistory(); return ( @@ -34,6 +42,11 @@ export const Navigation = () => { value={() => history.push("/")} icon={} /> + closePhone()} + icon={} + /> history.goBack()} diff --git a/phone/src/os/nui-events/utils/Nui.js b/phone/src/os/nui-events/utils/Nui.js new file mode 100644 index 0000000..8272529 --- /dev/null +++ b/phone/src/os/nui-events/utils/Nui.js @@ -0,0 +1,17 @@ +export default { + async send(event, data = {}) { + // /// #if DEBUG + //return new Promise(resolve => setTimeout(resolve, 100)); + // /// #endif + + /* eslint-disable no-unreachable */ + return fetch(`http://new-phone-who-dis/${event}`, { + method: "post", + headers: { + "Content-type": "application/json; charset=UTF-8", + }, + body: JSON.stringify(data), + }); + /* eslint-enable no-unreachable */ + }, +};