Add phone service, rename phone app to dialer, etc improvements

This commit is contained in:
J Francisco Rader committed 2020-08-25 21:13:01 -03:00
1 parent bf2e7fa295
commit b2e0cba844
24 files changed
+311 -255

No files matched your search

+62 -25
View File
@@ -8,7 +8,7 @@ import MessageIcon from "@material-ui/icons/Email";
import { HomeApp } from "./apps/home/components/Home";
import { ContactsApp } from "./apps/contacts/components/ContactsApp";
import { SettingsApp } from "./apps/settings/components/SettingsApp";
import { PhoneApp } from "./apps/phone/components/PhoneApp";
import { DialerApp } from "./apps/dialer/components/DialerApp";
import { BankApp } from "./apps/bank/components/BankApp";
import { ThemeProvider } from "@material-ui/core";
import { CalculatorApp } from "./apps/calculator/components/CalculatorApp";
@@ -18,8 +18,10 @@ import { NotificationBar } from "./os/notifications/components/NotificationBar";
import { Navigation } from "./os/navigation-bar/components/Navigation";
import { useNuiService } from "./os/nui-events/hooks/useNuiService";
import { useSimcardService } from "./os/simcard/hooks/useSimcardService";
import { usePhoneService } from "./os/phone/hooks/usePhoneService";
// @TODO: Remove this testing shit
// Used for testing NUI events while we work on clientside
setTimeout(() => {
window.dispatchEvent(
new MessageEvent("message", {
@@ -32,12 +34,49 @@ setTimeout(() => {
);
}, 3000);
setTimeout(() => {
window.dispatchEvent(
new MessageEvent("message", {
data: {
app: "PHONE",
method: "setPowerOff",
data: false,
},
})
);
}, 4000);
setTimeout(() => {
window.dispatchEvent(
new MessageEvent("message", {
data: {
app: "PHONE",
method: "setVisibility",
data: true,
},
})
);
}, 3000);
function Phone() {
useNuiService();
const { visibility, powerOff } = usePhoneService();
useSimcardService();
useInitKeyboard();
const { settings, currentTheme } = useSettings();
if (visibility === false) {
return null;
}
const screenStyle = powerOff
? {
backgroundColor: "black",
}
: {
backgroundImage: `url(${process.env.PUBLIC_URL}/media/backgrounds/${settings.wallpaper})`,
};
return (
<ThemeProvider theme={currentTheme()}>
<div className="PhoneWrapper">
@@ -49,30 +88,28 @@ function Phone() {
backgroundImage: `url(${process.env.PUBLIC_URL}/media/frames/${settings.frame})`,
}}
></div>
<div
id="phone"
className="PhoneScreen"
style={{
backgroundImage: `url(${process.env.PUBLIC_URL}/media/backgrounds/${settings.wallpaper})`,
}}
>
<NotificationBar
notifications={[
{
key: "newMessage",
icon: <NotificationIcon Icon={MessageIcon} />,
},
]}
/>
<div className="PhoneAppContainer">
<Route exact path="/" component={HomeApp} />
<Route exact path="/contacts" component={ContactsApp} />
<Route exact path="/settings" component={SettingsApp} />
<Route exact path="/phone" component={PhoneApp} />
<Route exact path="/bank" component={BankApp} />
<Route exact path="/calculator" component={CalculatorApp} />
</div>
<Navigation />
<div id="phone" className="PhoneScreen" style={screenStyle}>
{!powerOff && (
<>
<NotificationBar
notifications={[
{
key: "newMessage",
icon: <NotificationIcon Icon={MessageIcon} />,
},
]}
/>
<div className="PhoneAppContainer">
<Route exact path="/" component={HomeApp} />
<Route exact path="/contacts" component={ContactsApp} />
<Route exact path="/settings" component={SettingsApp} />
<Route exact path="/phone" component={DialerApp} />
<Route exact path="/bank" component={BankApp} />
<Route exact path="/calculator" component={CalculatorApp} />
</div>
<Navigation />
</>
)}
</div>
</div>
</div>