diff --git a/phone/src/Phone.tsx b/phone/src/Phone.tsx
index 4fe7842..5d5600f 100644
--- a/phone/src/Phone.tsx
+++ b/phone/src/Phone.tsx
@@ -20,6 +20,7 @@ import { useContactsService } from "./apps/contacts/hooks/useContactsService";
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";
//These events are just for testing. Comment it out before building.
setTimeout(() => {
@@ -35,6 +36,30 @@ setTimeout(() => {
}, 1000);
+setTimeout(() => {
+ window.dispatchEvent(
+ new MessageEvent("message", {
+ data: {
+ app: 'NOTES',
+ method: 'setNotes',
+ data: [
+ {
+ id: 1,
+ title: 'First note',
+ content: 'Hello, this is my shitty note'
+ },
+ {
+ id: 2,
+ title: 'Second note',
+ content: 'Hello, this is another shitty note'
+ },
+ ]
+ }
+ })
+ )
+}, 1000)
+
+
setTimeout(() => {
window.dispatchEvent(
new MessageEvent("message", {
@@ -183,6 +208,7 @@ function Phone() {
useInitKeyboard();
useSelloutService();
useBankService();
+ useNotesService();
if (visibility === false) {
return null;
diff --git a/phone/src/apps/notes/NotesApp.css b/phone/src/apps/notes/NotesApp.css
new file mode 100644
index 0000000..ed44c69
--- /dev/null
+++ b/phone/src/apps/notes/NotesApp.css
@@ -0,0 +1,7 @@
+#notes-app .Mui-focused::after {
+ border-bottom: 3px solid #f9a825;
+}
+
+#notes-app .MuiOutlinedInput-root {
+ border: 2px soild #f9a825;
+}
\ No newline at end of file
diff --git a/phone/src/apps/notes/NotesApp.tsx b/phone/src/apps/notes/NotesApp.tsx
new file mode 100644
index 0000000..d7d51bd
--- /dev/null
+++ b/phone/src/apps/notes/NotesApp.tsx
@@ -0,0 +1,48 @@
+import React from "react";
+import { AppWrapper } from "../../ui/components/AppWrapper";
+import { AppContent } from "../../ui/components/AppContent";
+import NotesTitle from "./NotesTitle";
+import NoteList from "./list/NoteList";
+
+import { useNotes } from "./hooks/useNotes";
+import { NoteModal } from "./modal/NoteModal";
+import { Fab } from "@material-ui/core";
+import AddIcon from "@material-ui/icons/Add";
+
+import { useNoteModal } from "./hooks/useNoteModal";
+import { useNoteDetail } from "./hooks/useNoteDetail";
+
+import useStyles from "./notes.styles";
+
+export const NotesApp = () => {
+ const { setNoteModal } = useNoteModal();
+ const { detail, setDetail } = useNoteDetail();
+ const notes = useNotes();
+
+ const classes = useStyles();
+
+ const handleModal = () => {
+ setNoteModal(true);
+ setDetail(null);
+ };
+
+ return (
+
+
+
+
+
+
+
+
+
+
+ );
+};
diff --git a/phone/src/apps/notes/NotesTitle.tsx b/phone/src/apps/notes/NotesTitle.tsx
new file mode 100644
index 0000000..8197ac4
--- /dev/null
+++ b/phone/src/apps/notes/NotesTitle.tsx
@@ -0,0 +1,20 @@
+import React from 'react'
+
+import { yellow } from "@material-ui/core/colors";
+
+import useStyles from './notes.styles';
+
+import { Paper } from "@material-ui/core";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { faStickyNote } from "@fortawesome/free-solid-svg-icons";
+
+const NotesTitle = () => {
+ const classes = useStyles()
+ return (
+
+
+
+ )
+}
+
+export default NotesTitle;
\ No newline at end of file
diff --git a/phone/src/apps/notes/hooks/state.ts b/phone/src/apps/notes/hooks/state.ts
new file mode 100644
index 0000000..9599aa0
--- /dev/null
+++ b/phone/src/apps/notes/hooks/state.ts
@@ -0,0 +1,16 @@
+import { atom } from 'recoil';
+
+export const noteStates = {
+ noteItems: atom({
+ key: 'noteItem',
+ default: []
+ }),
+ noteModal: atom({
+ key: 'noteModal',
+ default: false
+ }),
+ noteDetail: atom({
+ key: 'noteDetail',
+ default: null
+ })
+}
\ No newline at end of file
diff --git a/phone/src/apps/notes/hooks/useNoteDetail.ts b/phone/src/apps/notes/hooks/useNoteDetail.ts
new file mode 100644
index 0000000..9faab1e
--- /dev/null
+++ b/phone/src/apps/notes/hooks/useNoteDetail.ts
@@ -0,0 +1,7 @@
+import { useRecoilState } from 'recoil';
+import { noteStates } from './state';
+
+export const useNoteDetail = (): any => {
+ const [detail, setDetail] = useRecoilState(noteStates.noteDetail);
+ return { detail, setDetail };
+}
\ No newline at end of file
diff --git a/phone/src/apps/notes/hooks/useNoteModal.ts b/phone/src/apps/notes/hooks/useNoteModal.ts
new file mode 100644
index 0000000..adbcc9a
--- /dev/null
+++ b/phone/src/apps/notes/hooks/useNoteModal.ts
@@ -0,0 +1,7 @@
+import { useRecoilState } from 'recoil';
+import { noteStates } from './state';
+
+export const useNoteModal = () => {
+ const [noteModal, setNoteModal] = useRecoilState(noteStates.noteModal);
+ return { noteModal, setNoteModal };
+}
\ No newline at end of file
diff --git a/phone/src/apps/notes/hooks/useNotes.ts b/phone/src/apps/notes/hooks/useNotes.ts
new file mode 100644
index 0000000..69ce277
--- /dev/null
+++ b/phone/src/apps/notes/hooks/useNotes.ts
@@ -0,0 +1,7 @@
+import { useRecoilValue } from 'recoil';
+import { noteStates } from './state';
+
+export const useNotes = () => {
+ const notes = useRecoilValue(noteStates.noteItems);
+ return notes;
+}
diff --git a/phone/src/apps/notes/hooks/useNotesService.ts b/phone/src/apps/notes/hooks/useNotesService.ts
new file mode 100644
index 0000000..3b7df58
--- /dev/null
+++ b/phone/src/apps/notes/hooks/useNotesService.ts
@@ -0,0 +1,10 @@
+import { useSetRecoilState } from 'recoil'
+import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
+import { useNotes } from './useNotes';
+import { noteStates } from './state';
+
+export const useNotesService = () => {
+ const setNotes = useSetRecoilState(noteStates.noteItems);
+ useNuiEvent('NOTES', 'setNotes', setNotes);
+ return useNotes();
+}
\ No newline at end of file
diff --git a/phone/src/apps/notes/list/NoteList.tsx b/phone/src/apps/notes/list/NoteList.tsx
new file mode 100644
index 0000000..113c3d7
--- /dev/null
+++ b/phone/src/apps/notes/list/NoteList.tsx
@@ -0,0 +1,28 @@
+import { List, ListItem, ListItemText } from '@material-ui/core';
+import React, { useState } from 'react'
+
+import { useNoteModal } from '../hooks/useNoteModal';
+import { useNoteDetail } from '../hooks/useNoteDetail';
+
+// add search bar later
+const NoteList = ({notes}) => {
+ const { setNoteModal } = useNoteModal();
+ const { setDetail } = useNoteDetail();
+
+ const handleNoteModal = (note) => {
+ setNoteModal(true)
+ setDetail(note)
+ }
+
+ return (
+
+ {notes.map((note) => (
+ handleNoteModal(note)}>
+ {note.title}
+
+ ))}
+
+ )
+}
+
+export default NoteList;
diff --git a/phone/src/apps/notes/modal/NoteModal.tsx b/phone/src/apps/notes/modal/NoteModal.tsx
new file mode 100644
index 0000000..141d752
--- /dev/null
+++ b/phone/src/apps/notes/modal/NoteModal.tsx
@@ -0,0 +1,116 @@
+import {
+ Button,
+ TextField,
+ Slide,
+} from "@material-ui/core";
+import React, { useState } from "react";
+import ArrowBackIcon from "@material-ui/icons/ArrowBack";
+
+import { useNoteModal } from "../hooks/useNoteModal";
+import { useNoteDetail } from "../hooks/useNoteDetail";
+
+import useStyles from "./modal.styles";
+
+import "../NotesApp.css";
+import Nui from "../../../os/nui-events/utils/Nui";
+
+export const NoteModal = () => {
+ const { noteModal, setNoteModal } = useNoteModal();
+ const { detail, setDetail } = useNoteDetail();
+ console.log(detail);
+ const [title, setTitle] = useState(detail ? detail.title : "");
+ const [content, setContent] = useState(detail ? detail.content : "");
+
+ const classes = useStyles();
+
+ const _handleClose = () => {
+ setNoteModal(false);
+ setDetail(null);
+ };
+
+ const handleNoteSave = () => {
+ setNoteModal(false);
+ setDetail(null);
+ Nui.send("phone:addNote", {
+ title,
+ content,
+ });
+ };
+
+ const handleDeleteNote = () => {
+ const id = detail.id;
+ setNoteModal(false);
+ Nui.send("phone:deleteNote", {
+ id,
+ });
+ setDetail(null);
+ };
+
+ const handleUpdateNote = () => {
+ Nui.send("phone:updateNote", {
+ id: detail.id,
+ title,
+ content,
+ });
+ setNoteModal(false);
+ setDetail(null);
+ };
+
+ return (
+
+
+
+
+
+ setTitle(e.target.value)}
+ />
+ setContent(e.target.value)}
+ />
+ {!detail && (
+
+ )}
+ {detail && (
+
+ )}
+ {detail && (
+
+ )}
+
+
+
+
+ );
+};
diff --git a/phone/src/apps/notes/modal/modal.styles.ts b/phone/src/apps/notes/modal/modal.styles.ts
new file mode 100644
index 0000000..079dd05
--- /dev/null
+++ b/phone/src/apps/notes/modal/modal.styles.ts
@@ -0,0 +1,49 @@
+import { makeStyles } from '@material-ui/core';
+
+const useStyles = makeStyles((theme) => ({
+ modalRoot: {
+ zIndex: 20,
+ position: "absolute",
+ height: '100%',
+ width: '100%',
+ background: '#232323',
+ },
+ modalHide: {
+ display: 'none'
+ },
+ closeButton: {
+ width: '10%',
+ position: 'absolute',
+ top: 10,
+ left: 0
+ },
+ noteContainer: {
+ width: '90%',
+ marginTop: 80,
+ margin: '0 auto',
+ },
+ input: {
+ marginBottom: 20,
+ },
+ inputPropsTitle: {
+ fontSize: 28,
+ },
+ inputPropsContent: {
+ fontSize: 20,
+ },
+ saveButton: {
+ background: '#f9a825',
+ padding: '10px 30px'
+ },
+ updateButton: {
+ background: '#f9a825',
+ padding: '10px 30px',
+ marginRight: '8px'
+ },
+ deleteButton: {
+ background: '#c62828',
+ padding: '10px 30px'
+ }
+}))
+
+export default useStyles;
\ No newline at end of file
diff --git a/phone/src/apps/notes/notes.styles.ts b/phone/src/apps/notes/notes.styles.ts
new file mode 100644
index 0000000..2623a4d
--- /dev/null
+++ b/phone/src/apps/notes/notes.styles.ts
@@ -0,0 +1,30 @@
+import { makeStyles } from '@material-ui/core';
+
+const useStyles = makeStyles((theme) => ({
+ header: {
+ width: '100%',
+ display: 'flex',
+ flexFlow: 'row nowrap',
+ justifyContent: 'center',
+ alignItems: 'center',
+ textAlign: 'center',
+ height: '60px',
+ },
+ backgroundModal: {
+ background: "black",
+ opacity: "0.6",
+ position: "absolute",
+ top: 0,
+ left: 0,
+ right: 0,
+ bottom: 0,
+ zIndex: 5,
+ },
+ absolute: {
+ position: "absolute",
+ bottom: theme.spacing(2),
+ right: theme.spacing(3),
+ },
+}))
+
+export default useStyles;
\ No newline at end of file
diff --git a/phone/src/common/interfaces/notes.ts b/phone/src/common/interfaces/notes.ts
new file mode 100644
index 0000000..8d9cb5d
--- /dev/null
+++ b/phone/src/common/interfaces/notes.ts
@@ -0,0 +1,9 @@
+export interface Note {
+ id?: number;
+ title: string;
+ content: string;
+}
+
+export interface NoteId {
+ id: number;
+}
\ No newline at end of file
diff --git a/phone/src/locale/en.json b/phone/src/locale/en.json
index 148f759..6b5bee5 100644
--- a/phone/src/locale/en.json
+++ b/phone/src/locale/en.json
@@ -39,9 +39,11 @@
"APPS_TWITTER_TIME_HOURS": "h",
"APPS_TWITTER_TIME_DAYS": "d",
- "APPS_BANK_HOME_TITLE": "Welcome, ",
+ "APPS_BANK_HOME_TITLE": "Welcome",
+ "APPS_BANK_ACCOUNT_LINK": "Account",
"APPS_BANK_ACCOUNT_TITLE": "Account Summary",
"APPS_BANK_ACCOUNT_TRANSACTIONS": "Transactions",
- "APPS_BANK_ACCOUNT_SEE_TRANSACTION": "See all"
+ "APPS_BANK_ACCOUNT_SEE_TRANSACTION": "See all",
+ "APPS_BANK_ACTIONS_TRANSFER": "Transfer"
}
}
diff --git a/phone/src/os/apps/hooks/useApps.tsx b/phone/src/os/apps/hooks/useApps.tsx
index f744ab6..40b4d25 100644
--- a/phone/src/os/apps/hooks/useApps.tsx
+++ b/phone/src/os/apps/hooks/useApps.tsx
@@ -6,6 +6,7 @@ import {
grey,
green,
purple,
+ yellow,
red,
amber,
} from "@material-ui/core/colors";
@@ -14,7 +15,8 @@ import {
faAd,
faPlaneArrival,
faPhoneAlt,
- faWonSign
+ faWonSign,
+ faStickyNote
} from "@fortawesome/free-solid-svg-icons";
import { faTwitter } from "@fortawesome/free-brands-svg-icons";
@@ -33,6 +35,7 @@ import { MessagesApp } from "../../../apps/messages/components/MessagesApp";
import { TwitterApp } from "../../../apps/twitter/components/TwitterApp";
import { ExampleApp } from "../../../apps/example/components/ExampleApp";
import { SelloutApp } from "../../../apps/sellout/components/SelloutApp";
+import { NotesApp } from "../../../apps/notes/NotesApp";
const appsState = atom({
key: "apps",
@@ -110,6 +113,15 @@ const appsState = atom({
path: "/sellout",
Route: () => ,
},
+ {
+ id: 'NOTES',
+ name: 'APPS_NOTES',
+ icon: ,
+ backgroundColor: yellow[800],
+ color: common.white,
+ path: "/notes",
+ Route: () =>
+ },
{
id: "EXAMPLE",
nameLocale: "APPS_EXAMPLE",
diff --git a/resources/client/cl_main.ts b/resources/client/cl_main.ts
index 2ac5c9a..a787742 100644
--- a/resources/client/cl_main.ts
+++ b/resources/client/cl_main.ts
@@ -239,6 +239,7 @@ async function Phone() {
emitNet(events.SELLOUT_FETCH_LISTING);
emitNet(events.BANK_FETCH_TRANSACTIONS);
emitNet(events.BANK_GET_CREDENTIALS);
+ emitNet(events.NOTE_FETCH_ALL_NOTES);
console.log("Sellout fetched from client side")// Gets the credentials. Will eventually most likely only get the phone number and name, idk.
SetCursorLocation(0.90, 0.922) //Experimental
let res = GetActiveScreenResolution()
@@ -278,6 +279,7 @@ async function Phone() {
emitNet(events.SELLOUT_FETCH_LISTING);
emitNet(events.BANK_FETCH_TRANSACTIONS);
emitNet(events.BANK_GET_CREDENTIALS);
+ emitNet(events.NOTE_FETCH_ALL_NOTES);
console.log("Sellout fetched from client side")
SetCursorLocation(0.936, 0.922) //Experimental
let res = GetActiveScreenResolution()
diff --git a/resources/client/cl_notes.ts b/resources/client/cl_notes.ts
new file mode 100644
index 0000000..ba8f367
--- /dev/null
+++ b/resources/client/cl_notes.ts
@@ -0,0 +1,40 @@
+import events from "../utils/events";
+
+onNet(events.NOTE_SEND_NOTE, (notes: any) => {
+ SendNuiMessage(
+ JSON.stringify({
+ app: "NOTES",
+ method: "setNotes",
+ data: notes,
+ })
+ );
+});
+
+RegisterNuiCallbackType(events.NOTE_ADD_NOTE);
+on(`__cfx_nui:${events.NOTE_ADD_NOTE}`, (data: any) => {
+ const note = data;
+ emitNet(events.NOTE_ADD_NOTE, note);
+});
+
+onNet(events.NOTE_SEND_NOTE_SUCCESS, () => {
+ emitNet(events.NOTE_FETCH_ALL_NOTES);
+});
+
+RegisterNuiCallbackType(events.NOTE_DELETE_NOTE);
+on(`__cfx_nui:${events.NOTE_DELETE_NOTE}`, (data: any) => {
+ const noteId = data;
+ emitNet(events.NOTE_DELETE_NOTE, noteId);
+
+ emitNet(events.NOTE_FETCH_ALL_NOTES);
+});
+
+// coming soon tm
+RegisterNuiCallbackType(events.NOTE_UPDATE_NOTE);
+on(`__cfx_nui:${events.NOTE_UPDATE_NOTE}`, (data: any) => {
+ const note = data;
+ emitNet(events.NOTE_UPDATE_NOTE, note);
+});
+
+onNet(events.NOTE_UPDATE_NOTE_SUCCESS, () => {
+ emitNet(events.NOTE_FETCH_ALL_NOTES);
+});
diff --git a/resources/client/client.ts b/resources/client/client.ts
index 2b6c28d..10c3786 100644
--- a/resources/client/client.ts
+++ b/resources/client/client.ts
@@ -4,6 +4,7 @@ import './cl_twitter';
import './cl_contacts';
import './cl_sellout';
import './cl_bank';
+import './cl_notes';
export let ESX: ESXClient = null;
diff --git a/resources/html/index.html b/resources/html/index.html
index 9c511ba..d196fe9 100644
--- a/resources/html/index.html
+++ b/resources/html/index.html
@@ -1 +1,44 @@
-React App
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
+
+ React App
+
+
+
+
+
+
+
diff --git a/resources/html/media/BAHNSCHRIFT.8cab203d.woff b/resources/html/media/BAHNSCHRIFT.8cab203d.woff
new file mode 100644
index 0000000..2d86200
Binary files /dev/null and b/resources/html/media/BAHNSCHRIFT.8cab203d.woff differ
diff --git a/resources/import.sql b/resources/import.sql
index 4891576..18d14b9 100644
--- a/resources/import.sql
+++ b/resources/import.sql
@@ -57,6 +57,36 @@ CREATE TABLE IF NOT EXISTS `npwd_twitter_likes` (
CONSTRAINT `tweet` FOREIGN KEY (`tweet_id`) REFERENCES `npwd_twitter_tweets` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+
+CREATE TABLE IF NOT EXISTS npwd_notes (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ identifier varchar(255) NOT NULL,
+ title varchar(255) NOT NULL,
+ content varchar(255) NOT NULL,
+ PRIMARY KEY (id)
+)
+ENGINE = INNODB,
+AUTO_INCREMENT = 5,
+AVG_ROW_LENGTH = 4096,
+CHARACTER SET utf8mb4,
+COLLATE utf8mb4_general_ci;
+
+CREATE TABLE npwd_sellout_listings (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ identifier varchar(255) DEFAULT NULL,
+ name varchar(50) DEFAULT NULL,
+ number varchar(255) NOT NULL,
+ title varchar(255) DEFAULT NULL,
+ url varchar(255) DEFAULT NULL,
+ description varchar(255) NOT NULL,
+ PRIMARY KEY (id)
+)
+ENGINE = INNODB,
+AUTO_INCREMENT = 26,
+AVG_ROW_LENGTH = 2048,
+CHARACTER SET utf8mb4,
+COLLATE utf8mb4_general_ci;
+
CREATE TABLE IF NOT EXISTS `npwd_twitter_reports` (
`id` int NOT NULL AUTO_INCREMENT,
`profile_id` int NOT NULL,
diff --git a/resources/server/functions.ts b/resources/server/functions.ts
index 709f5fc..118977c 100644
--- a/resources/server/functions.ts
+++ b/resources/server/functions.ts
@@ -1,4 +1,5 @@
import { pool } from './db';
+import { ESX, getSource } from './server';
interface IPhoneNumber {
phone_number: string;
@@ -9,4 +10,9 @@ export async function usePhoneNumber(identifier: string): Promise {
const [results] = await pool.query(query, [identifier]);
const phoneNumber = results;
return phoneNumber[0].phone_number;
+}
+
+export async function useIdentifier(): Promise {
+ const identifier = await ESX.GetPlayerFromId(getSource()).getIdentifier()
+ return identifier;
}
\ No newline at end of file
diff --git a/resources/server/server.ts b/resources/server/server.ts
index cc0af0e..a0640ab 100644
--- a/resources/server/server.ts
+++ b/resources/server/server.ts
@@ -6,6 +6,7 @@ import './sv_main';
import './sv_contacts';
import './sv_sellout';
import './sv_bank';
+import './sv_notes';
export let ESX: ESXServer = null;
diff --git a/resources/server/sv_notes.ts b/resources/server/sv_notes.ts
new file mode 100644
index 0000000..b1cd777
--- /dev/null
+++ b/resources/server/sv_notes.ts
@@ -0,0 +1,72 @@
+import events from "../utils/events";
+import { ESX, getSource } from "./server";
+import { pool } from "./db";
+import { useIdentifier } from "./functions";
+import { Note, NoteId } from "../../phone/src/common/interfaces/notes";
+
+async function addNote(identifier: string, note: Note): Promise {
+ const query =
+ "INSERT INTO npwd_notes (identifier, title, content) VALUES (?, ?, ?)";
+ await pool.query(query, [identifier, note.title, note.content]);
+}
+
+async function fetchAllNotes(identifier: string): Promise {
+ const query =
+ "SELECT * FROM npwd_notes WHERE identifier = ? ORDER BY id DESC";
+ const [result] = await pool.query(query, [identifier]);
+ const notes = result;
+ return notes;
+}
+
+async function deleteNote(noteId: number, identifier: string) {
+ const query = "DELETE FROM npwd_notes WHERE id = ? AND identifier = ?";
+ await pool.query(query, [noteId, identifier]);
+}
+
+async function updateNote(note: Note, identifier: string): Promise {
+ const query =
+ "UPDATE npwd_notes SET title = ?, content = ? WHERE id = ? AND identifier = ?";
+ await pool.query(query, [note.title, note.content, note.id, identifier]);
+}
+
+onNet(events.NOTE_ADD_NOTE, async (note: Note) => {
+ try {
+ const _identifier = await useIdentifier();
+ addNote(_identifier, note);
+ } catch (error) {
+ console.log("NOTES ERROR: ", error);
+ }
+});
+
+onNet(events.NOTE_FETCH_ALL_NOTES, async () => {
+ try {
+ const _source = (global as any).source;
+ const _identifier = await useIdentifier();
+ const notes = await fetchAllNotes(_identifier);
+ emitNet(events.NOTE_SEND_NOTE, _source, notes);
+ emitNet(events.NOTE_SEND_NOTE_SUCCESS, _source);
+ } catch (error) {
+ console.log("NOTE ERROR: ", error);
+ }
+});
+
+onNet(events.NOTE_DELETE_NOTE, async (noteId: NoteId) => {
+ try {
+ const _identifier = await useIdentifier();
+ const id = noteId.id;
+ await deleteNote(id, _identifier);
+ } catch (error) {
+ console.log("NOTE ERROR:", error);
+ }
+});
+
+onNet(events.NOTE_UPDATE_NOTE, async (note: Note) => {
+ const _source = (global as any).source;
+ try {
+ const _identifier = await useIdentifier();
+ updateNote(note, _identifier);
+ emitNet(events.NOTE_UPDATE_NOTE_SUCCESS, _source);
+ } catch (error) {
+ emitNet(events.NOTE_UPDATE_NOTE_FAILURE, _source);
+ }
+});
diff --git a/resources/utils/events.ts b/resources/utils/events.ts
index 4da51cf..7623d9c 100644
--- a/resources/utils/events.ts
+++ b/resources/utils/events.ts
@@ -45,5 +45,15 @@ export default {
BANK_SEND_TRANSFERS: 'phone:sendTransfers',
BANK_TRANSACTION_ALERT: 'phone:transactionAlert',
BANK_SEND_CREDENTIALS: 'phone:sendBankCredentials',
- BANK_GET_CREDENTIALS: 'phone:getBankCredentials'
+ BANK_GET_CREDENTIALS: 'phone:getBankCredentials',
+
+ // Notes
+ NOTE_ADD_NOTE: 'phone:addNote',
+ NOTE_FETCH_ALL_NOTES: 'phone:fetchAllNotes',
+ NOTE_SEND_NOTE: 'phone:sendNote',
+ NOTE_SEND_NOTE_SUCCESS: 'phone:sendNoteSuccess',
+ NOTE_DELETE_NOTE: 'phone:deleteNote',
+ NOTE_UPDATE_NOTE: 'phone:updateNote',
+ NOTE_UPDATE_NOTE_SUCCESS: 'phone:updateNoteSuccess',
+ NOTE_UPDATE_NOTE_FAILURE: 'phone:updateNoteFailure'
}