mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 06:28:51 +00:00
Merge pull request #177 from project-error/feat/bank-enums
Feat(phone): Update to use all enums.
This commit is contained in:
17 files changed
+47
-30
No files matched your search
@@ -6,6 +6,8 @@ import { useSetRecoilState } from 'recoil';
|
||||
import { useBankNotification } from './useBankNotification';
|
||||
import { IAlert, useSnackbar } from '../../../ui/hooks/useSnackbar';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { BankEvents } from '../../../../../typings/bank';
|
||||
import { PhoneEvents } from '../../../../../typings/phone';
|
||||
|
||||
export const useBankService = () => {
|
||||
const setTransaction = useSetRecoilState(bankState.transactions);
|
||||
@@ -21,9 +23,9 @@ export const useBankService = () => {
|
||||
});
|
||||
};
|
||||
|
||||
useNuiEvent('BANK', 'setTransaction', setTransaction);
|
||||
useNuiEvent('BANK', 'setCredentials', setCredentials);
|
||||
useNuiEvent('BANK', 'setAlert', handleAddAlert);
|
||||
useNuiEvent('BANK', 'setNotification', setNotification);
|
||||
useNuiEvent('BANK', BankEvents.SEND_TRANSFERS, setTransaction);
|
||||
useNuiEvent('BANK', BankEvents.SEND_CREDENTIALS, setCredentials);
|
||||
useNuiEvent('BANK', BankEvents.SEND_ALERT, handleAddAlert);
|
||||
useNuiEvent('BANK', BankEvents.SEND_NOTIFICATION, setNotification);
|
||||
return { useTransactions, useCredentials, useBankNotification };
|
||||
};
|
||||
@@ -4,6 +4,7 @@ import { contactsState } from './state';
|
||||
import { useContacts } from './useContacts';
|
||||
import { IAlert, useSnackbar } from '../../../ui/hooks/useSnackbar';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { ContactEvents } from '../../../../../typings/contact';
|
||||
|
||||
export const useContactsService = () => {
|
||||
const setContacts = useSetRecoilState(contactsState.contacts);
|
||||
@@ -17,7 +18,7 @@ export const useContactsService = () => {
|
||||
});
|
||||
};
|
||||
|
||||
useNuiEvent('CONTACTS', 'setContacts', setContacts);
|
||||
useNuiEvent('CONTACTS', 'setAlert', handleAddAlert);
|
||||
useNuiEvent('CONTACTS', ContactEvents.SEND_CONTACTS, setContacts);
|
||||
useNuiEvent('CONTACTS', ContactEvents.SEND_ALERT, handleAddAlert);
|
||||
return useContacts();
|
||||
};
|
||||
@@ -1,8 +1,9 @@
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
|
||||
import { dialState } from './state';
|
||||
import { CallEvents } from '../../../../../typings/call';
|
||||
|
||||
export const useDialService = () => {
|
||||
const setHistory = useSetRecoilState(dialState.history);
|
||||
useNuiEvent('DIALER', 'setHistory', setHistory);
|
||||
useNuiEvent('DIALER', CallEvents.SET_CALL_HISTORY, setHistory);
|
||||
};
|
||||
@@ -3,6 +3,7 @@ import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
|
||||
import { noteStates } from './state';
|
||||
import { IAlert, useSnackbar } from '../../../ui/hooks/useSnackbar';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { NotesEvents } from '../../../../../typings/notes';
|
||||
|
||||
export const useNotesService = () => {
|
||||
const { addAlert } = useSnackbar();
|
||||
@@ -16,6 +17,6 @@ export const useNotesService = () => {
|
||||
});
|
||||
};
|
||||
|
||||
useNuiEvent('NOTES', 'setNotes', setNotes);
|
||||
useNuiEvent('NOTES', 'setAlert', handleAddAlert);
|
||||
useNuiEvent('NOTES', NotesEvents.SEND_NOTE, setNotes);
|
||||
useNuiEvent('NOTES', NotesEvents.SEND_ALERT, handleAddAlert);
|
||||
};
|
||||
@@ -4,6 +4,7 @@ import { useListing } from './useListing';
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import { IAlert, useSnackbar } from '../../../ui/hooks/useSnackbar';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { MarketplaceEvents } from '../../../../../typings/marketplace';
|
||||
|
||||
export const useSelloutService = () => {
|
||||
const setSellout = useSetRecoilState(selloutState.listing);
|
||||
@@ -17,7 +18,7 @@ export const useSelloutService = () => {
|
||||
});
|
||||
};
|
||||
|
||||
useNuiEvent('SELLOUT', 'setAlert', handleAddAlert);
|
||||
useNuiEvent('SELLOUT', 'setListings', setSellout);
|
||||
useNuiEvent('SELLOUT', MarketplaceEvents.SEND_ALERT, handleAddAlert);
|
||||
useNuiEvent('SELLOUT', MarketplaceEvents.SEND_LISTING, setSellout);
|
||||
return useListing();
|
||||
};
|
||||
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
|
||||
import { useNuiEvent } from '../../nui-events/hooks/useNuiEvent';
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import { useCall } from './useCall';
|
||||
import { CallProps } from '../../../../../typings/call';
|
||||
import { CallEvents, CallProps } from '../../../../../typings/call';
|
||||
import InjectDebugData from '../../debug/InjectDebugData';
|
||||
import { useCallModal } from './useCallModal';
|
||||
import { useHistory, useLocation } from 'react-router-dom';
|
||||
@@ -61,6 +61,6 @@ export const useCallService = () => {
|
||||
setCall(_call);
|
||||
setNotification(_call);
|
||||
};
|
||||
useNuiEvent<CallProps>('CALL', 'setCaller', _setCall, call);
|
||||
useNuiEvent<boolean>('CALL', 'callModal', setModal);
|
||||
useNuiEvent<CallProps>('CALL', CallEvents.SET_CALLER, _setCall, call);
|
||||
useNuiEvent<boolean>('CALL', CallEvents.SET_CALL_MODAL, setModal);
|
||||
};
|
||||
@@ -1,11 +1,12 @@
|
||||
import { IAlertProps } from '../../typings/alerts';
|
||||
import { BankEvents } from '../../typings/bank';
|
||||
import { PhoneEvents } from '../../typings/phone';
|
||||
|
||||
onNet(BankEvents.SEND_TRANSFERS, (transfer: any) => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: 'BANK',
|
||||
method: 'setTransaction',
|
||||
method: BankEvents.SEND_TRANSFERS,
|
||||
data: transfer,
|
||||
}),
|
||||
);
|
||||
@@ -15,7 +16,7 @@ onNet(BankEvents.SEND_CREDENTIALS, (credentials: any) => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: 'BANK',
|
||||
method: 'setCredentials',
|
||||
method: BankEvents.SEND_CREDENTIALS,
|
||||
data: credentials,
|
||||
}),
|
||||
);
|
||||
@@ -35,7 +36,7 @@ onNet(BankEvents.TRANSACTION_ALERT, (result: IAlertProps) => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: 'BANK',
|
||||
method: 'setAlert',
|
||||
method: BankEvents.SEND_ALERT,
|
||||
data: result,
|
||||
}),
|
||||
);
|
||||
@@ -45,7 +46,7 @@ onNet(BankEvents.TRANSACTION_NOTIFICATION, (transfer: any) => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: 'BANK',
|
||||
method: 'setNotification',
|
||||
method: BankEvents.SEND_NOTIFICATION,
|
||||
data: transfer,
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -16,7 +16,7 @@ onNet(CallEvents.START_CALL, (transmitter: string, receiver: string, isTransmitt
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: 'CALL',
|
||||
method: 'setCaller',
|
||||
method: CallEvents.SET_CALLER,
|
||||
data: {
|
||||
active: true,
|
||||
transmitter: transmitter,
|
||||
@@ -40,7 +40,7 @@ onNet(CallEvents.WAS_ACCEPTED, (channelId: number, currentCall: ICall, isTransmi
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: 'CALL',
|
||||
method: 'setCaller',
|
||||
method: CallEvents.SET_CALLER,
|
||||
data: {
|
||||
active: true,
|
||||
transmitter: currentCall.transmitter,
|
||||
@@ -63,7 +63,7 @@ onNet(CallEvents.WAS_REJECTED, () => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: 'CALL',
|
||||
method: 'setCaller',
|
||||
method: CallEvents.SET_CALLER,
|
||||
data: {
|
||||
transmitter: null,
|
||||
receiver: null,
|
||||
@@ -93,7 +93,7 @@ onNet(CallEvents.WAS_ENDED, () => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: 'CALL',
|
||||
method: 'setCaller',
|
||||
method: CallEvents.SET_CALLER,
|
||||
data: {
|
||||
transmitter: null,
|
||||
receiver: null,
|
||||
@@ -109,7 +109,7 @@ function openCallModal(show: boolean) {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: 'CALL',
|
||||
method: 'callModal',
|
||||
method: CallEvents.SET_CALL_MODAL,
|
||||
data: show,
|
||||
}),
|
||||
);
|
||||
@@ -119,7 +119,7 @@ onNet(CallEvents.SEND_HISTORY, (calls: ICall) => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: 'DIALER',
|
||||
method: 'setHistory',
|
||||
method: CallEvents.SET_CALL_HISTORY,
|
||||
data: calls,
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ContactEvents } from '../../typings/contact';
|
||||
import { sendContactsEvent } from '../utils/messages';
|
||||
|
||||
onNet(ContactEvents.SEND_CONTACTS, (contacts: any) => {
|
||||
sendContactsEvent('setContacts', contacts);
|
||||
sendContactsEvent(ContactEvents.SEND_CONTACTS, contacts);
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(ContactEvents.ADD_CONTACT);
|
||||
@@ -36,5 +36,5 @@ onNet(ContactEvents.DELETE_CONTACT_SUCCESS, () => {
|
||||
});
|
||||
|
||||
onNet(ContactEvents.ACTION_RESULT, (alert: any) => {
|
||||
sendContactsEvent('setAlert', alert);
|
||||
sendContactsEvent(ContactEvents.SEND_ALERT, alert);
|
||||
});
|
||||
@@ -2,7 +2,7 @@ import { NotesEvents } from '../../typings/notes';
|
||||
import { sendNotesEvent } from '../utils/messages';
|
||||
|
||||
onNet(NotesEvents.SEND_NOTE, (notes: any) => {
|
||||
sendNotesEvent('setNotes', notes);
|
||||
sendNotesEvent(NotesEvents.SEND_NOTE, notes);
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(NotesEvents.ADD_NOTE);
|
||||
@@ -35,5 +35,5 @@ onNet(NotesEvents.UPDATE_NOTE_SUCCESS, () => {
|
||||
});
|
||||
|
||||
onNet(NotesEvents.ACTION_RESULT, (alert: any) => {
|
||||
sendNotesEvent('setAlert', alert);
|
||||
sendNotesEvent(NotesEvents.SEND_ALERT, alert);
|
||||
});
|
||||
@@ -3,7 +3,7 @@ import { IAlertProps } from '../../typings/alerts';
|
||||
import { sendMarketplaceEvent } from '../utils/messages';
|
||||
|
||||
onNet(MarketplaceEvents.SEND_LISTING, (listings: MarketplaceListing[]) => {
|
||||
sendMarketplaceEvent('setListings', listings);
|
||||
sendMarketplaceEvent(MarketplaceEvents.SEND_LISTING, listings);
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(MarketplaceEvents.ADD_LISTING);
|
||||
@@ -33,5 +33,5 @@ onNet(MarketplaceEvents.DELETE_LISTING_SUCCESS, () => {
|
||||
});
|
||||
|
||||
onNet(MarketplaceEvents.ACTION_RESULT, (alert: IAlertProps) => {
|
||||
sendMarketplaceEvent('setAlert', alert);
|
||||
sendMarketplaceEvent(MarketplaceEvents.SEND_ALERT, alert);
|
||||
});
|
||||
@@ -27,4 +27,6 @@ export enum BankEvents {
|
||||
TRANSACTION_NOTIFICATION = 'npwd:bankTransactionNotification',
|
||||
SEND_CREDENTIALS = 'npwd:sendBankCredentials',
|
||||
GET_CREDENTIALS = 'npwd:getBankCredentials',
|
||||
SEND_ALERT = 'npwd:sendBankAlert',
|
||||
SEND_NOTIFICATION = 'npwd:sendBankNotification',
|
||||
}
|
||||
@@ -37,4 +37,7 @@ export enum CallEvents {
|
||||
FETCH_CALLS = 'npwd:fetchCalls',
|
||||
SEND_HISTORY = 'npwd:sendCallHistory',
|
||||
SEND_HANGUP_ANIM = 'npwd:sendHangupAnim',
|
||||
SET_CALLER = 'npwd:setCaller',
|
||||
SET_CALL_MODAL = 'npwd:callModal',
|
||||
SET_CALL_HISTORY = 'npwd:setCallHistory',
|
||||
}
|
||||
@@ -28,4 +28,5 @@ export enum ContactEvents {
|
||||
DELETE_CONTACT_SUCCESS = 'npwd:deleteSuccess',
|
||||
UPDATE_CONTACT_SUCCESS = 'npwd:updateContactSuccess',
|
||||
ACTION_RESULT = 'npwd:contactActionResult',
|
||||
SEND_ALERT = 'npwd:contactSetAlert',
|
||||
}
|
||||
@@ -20,4 +20,5 @@ export enum MarketplaceEvents {
|
||||
REPORT_LISTING = 'npwd:reportListing',
|
||||
REPORT_LISTING_SUCCESS = 'npwd:reportListingSuccess',
|
||||
REPORT_LISTING_SUCESS = 'npwd:reportListingFailed',
|
||||
SEND_ALERT = 'nwpd:sendListingAlert',
|
||||
}
|
||||
@@ -32,4 +32,5 @@ export enum NotesEvents {
|
||||
UPDATE_NOTE_SUCCESS = 'npwd:updateNoteSuccess',
|
||||
UPDATE_NOTE_FAILURE = 'npwd:updateNoteFailure',
|
||||
ACTION_RESULT = 'npwd:notesActionResult',
|
||||
SEND_ALERT = 'npwd:notesSetAlert',
|
||||
}
|
||||
@@ -8,4 +8,6 @@ export enum PhoneEvents {
|
||||
OPEN_APP_DAILER = 'npwd:app:DIALER',
|
||||
OPEN_PHONE = 'npwd:open',
|
||||
CLOSE_PHONE = 'npwd:close',
|
||||
SET_ALERT = 'npwd:setAlert',
|
||||
SET_NOTIFICATION = 'npwd:setNotification',
|
||||
}
|
||||
Reference in new issue
Block a user