mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
refactor(events): Events are now tied to a common enum typings (#167)
* chore(scripts/twitter): Refactored twitter to use event enums * chore(scripts/marketplace): Refactored marketplace to use event enums * chore(scripts/messages): Refactored messages to use event enums * chore(scripts/contacts): Refactored contacts to use event enums * chore(scripts/calls): Refactored calls to use event enums * chore(scripts/notes): Refactored notes to use event enums * chore(scripts/photos): Refactored photos to use event enums * chore(scripts/bank): Refactored bank to use event enums * chore(scripts/phone): Refactored phone to use event enums * chore(events): Removed old events object * refactor(phone/nui-events): Attached NUI events to respective enum * tweak(event-enums): Added npwd prefix to all events * tweak(phone/serve): Added craco to override CRA without eject Also bumped react-scripts to 4.0.1, with seemingly no issues * fix(typings/twitter): Fixed method enums for twitter
This commit is contained in:
62 files changed
+4734
-3470
No files matched your search
+10
-10
@@ -1,7 +1,7 @@
|
||||
import { IAlertProps } from '../../typings/alerts';
|
||||
import events from '../utils/events';
|
||||
import { BankEvents } from '../../typings/bank';
|
||||
|
||||
onNet(events.BANK_SEND_TRANSFERS, (transfer: any) => {
|
||||
onNet(BankEvents.SEND_TRANSFERS, (transfer: any) => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: 'BANK',
|
||||
@@ -11,7 +11,7 @@ onNet(events.BANK_SEND_TRANSFERS, (transfer: any) => {
|
||||
);
|
||||
});
|
||||
|
||||
onNet(events.BANK_SEND_CREDENTIALS, (credentials: any) => {
|
||||
onNet(BankEvents.SEND_CREDENTIALS, (credentials: any) => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: 'BANK',
|
||||
@@ -21,17 +21,17 @@ onNet(events.BANK_SEND_CREDENTIALS, (credentials: any) => {
|
||||
);
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(events.BANK_ADD_TRANSFER);
|
||||
on(`__cfx_nui:${events.BANK_ADD_TRANSFER}`, (data: any, cb: Function) => {
|
||||
emitNet(events.BANK_ADD_TRANSFER, data);
|
||||
RegisterNuiCallbackType(BankEvents.ADD_TRANSFER);
|
||||
on(`__cfx_nui:${BankEvents.ADD_TRANSFER}`, (data: any, cb: Function) => {
|
||||
emitNet(BankEvents.ADD_TRANSFER, data);
|
||||
cb();
|
||||
});
|
||||
|
||||
onNet(events.BANK_ADD_TRANSFER_SUCCESS, () => {
|
||||
emitNet(events.BANK_FETCH_TRANSACTIONS);
|
||||
onNet(BankEvents.ADD_TRANSFER_SUCCESS, () => {
|
||||
emitNet(BankEvents.FETCH_TRANSACTIONS);
|
||||
});
|
||||
|
||||
onNet(events.BANK_TRANSACTION_ALERT, (result: IAlertProps) => {
|
||||
onNet(BankEvents.TRANSACTION_ALERT, (result: IAlertProps) => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: 'BANK',
|
||||
@@ -41,7 +41,7 @@ onNet(events.BANK_TRANSACTION_ALERT, (result: IAlertProps) => {
|
||||
);
|
||||
});
|
||||
|
||||
onNet(events.BANK_TRANSACTION_NOTIFICATION, (transfer: any) => {
|
||||
onNet(BankEvents.TRANSACTION_NOTIFICATION, (transfer: any) => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: 'BANK',
|
||||
|
||||
+35
-38
@@ -1,16 +1,16 @@
|
||||
import events from '../utils/events';
|
||||
import { CallEvents } from '../../typings/call';
|
||||
import { ICall } from '../../typings/call';
|
||||
import { phoneCallStartAnim, phoneCallEndAnim } from './functions';
|
||||
|
||||
const exp = (global as any).exports;
|
||||
|
||||
RegisterNuiCallbackType(events.PHONE_INITIALIZE_CALL); // Fires when the call is started.
|
||||
on(`__cfx_nui:${events.PHONE_INITIALIZE_CALL}`, (data: any, cb: Function) => {
|
||||
emitNet(events.PHONE_INITIALIZE_CALL, data.number);
|
||||
RegisterNuiCallbackType(CallEvents.INITIALIZE_CALL); // Fires when the call is started.
|
||||
on(`__cfx_nui:${CallEvents.INITIALIZE_CALL}`, (data: any, cb: Function) => {
|
||||
emitNet(CallEvents.INITIALIZE_CALL, data.number);
|
||||
cb();
|
||||
});
|
||||
|
||||
onNet(events.PHONE_START_CALL, (transmitter: string, receiver: string, isTransmitter: boolean) => {
|
||||
onNet(CallEvents.START_CALL, (transmitter: string, receiver: string, isTransmitter: boolean) => {
|
||||
openCallModal(true);
|
||||
|
||||
SendNuiMessage(
|
||||
@@ -28,40 +28,37 @@ onNet(events.PHONE_START_CALL, (transmitter: string, receiver: string, isTransmi
|
||||
);
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(events.PHONE_ACCEPT_CALL); // Fires when the TARGET accepts.
|
||||
on(`__cfx_nui:${events.PHONE_ACCEPT_CALL}`, (data: any, cb: Function) => {
|
||||
emitNet(events.PHONE_ACCEPT_CALL, data.transmitterNumber);
|
||||
RegisterNuiCallbackType(CallEvents.ACCEPT_CALL); // Fires when the TARGET accepts.
|
||||
on(`__cfx_nui:${CallEvents.ACCEPT_CALL}`, (data: any, cb: Function) => {
|
||||
emitNet(CallEvents.ACCEPT_CALL, data.transmitterNumber);
|
||||
cb();
|
||||
});
|
||||
|
||||
onNet(
|
||||
events.PHONE_CALL_WAS_ACCEPTED,
|
||||
(channelId: number, currentCall: ICall, isTransmitter: boolean) => {
|
||||
exp['mumble-voip'].SetCallChannel(channelId);
|
||||
phoneCallStartAnim(); // Trigger call animation only if the call was accepted.
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: 'CALL',
|
||||
method: 'setCaller',
|
||||
data: {
|
||||
active: true,
|
||||
transmitter: currentCall.transmitter,
|
||||
receiver: currentCall.receiver,
|
||||
isTransmitter: isTransmitter,
|
||||
accepted: true,
|
||||
},
|
||||
}),
|
||||
);
|
||||
},
|
||||
);
|
||||
onNet(CallEvents.WAS_ACCEPTED, (channelId: number, currentCall: ICall, isTransmitter: boolean) => {
|
||||
exp['mumble-voip'].SetCallChannel(channelId);
|
||||
phoneCallStartAnim(); // Trigger call animation only if the call was accepted.
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: 'CALL',
|
||||
method: 'setCaller',
|
||||
data: {
|
||||
active: true,
|
||||
transmitter: currentCall.transmitter,
|
||||
receiver: currentCall.receiver,
|
||||
isTransmitter: isTransmitter,
|
||||
accepted: true,
|
||||
},
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(events.PHONE_CALL_REJECTED); // Fires when cancelling and rejecting a call.
|
||||
on(`__cfx_nui:${events.PHONE_CALL_REJECTED}`, (data: any, cb: Function) => {
|
||||
emitNet(events.PHONE_CALL_REJECTED, data.phoneNumber);
|
||||
RegisterNuiCallbackType(CallEvents.REJECTED); // Fires when cancelling and rejecting a call.
|
||||
on(`__cfx_nui:${CallEvents.REJECTED}`, (data: any, cb: Function) => {
|
||||
emitNet(CallEvents.REJECTED, data.phoneNumber);
|
||||
cb();
|
||||
});
|
||||
|
||||
onNet(events.PHONE_CALL_WAS_REJECTED, () => {
|
||||
onNet(CallEvents.WAS_REJECTED, () => {
|
||||
openCallModal(false);
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
@@ -78,18 +75,18 @@ onNet(events.PHONE_CALL_WAS_REJECTED, () => {
|
||||
);
|
||||
});
|
||||
|
||||
onNet(events.PHONE_CALL_SEND_HANGUP_ANIM, () => {
|
||||
onNet(CallEvents.SEND_HANGUP_ANIM, () => {
|
||||
phoneCallEndAnim();
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(events.PHONE_END_CALL); // Fires when ending an ACTIVE call
|
||||
on(`__cfx_nui:${events.PHONE_END_CALL}`, (data: any, cb: Function) => {
|
||||
RegisterNuiCallbackType(CallEvents.END_CALL); // Fires when ending an ACTIVE call
|
||||
on(`__cfx_nui:${CallEvents.END_CALL}`, (data: any, cb: Function) => {
|
||||
const end = Date.now();
|
||||
emitNet(events.PHONE_END_CALL, data.transmitterNumber, end);
|
||||
emitNet(CallEvents.END_CALL, data.transmitterNumber, end);
|
||||
cb();
|
||||
});
|
||||
|
||||
onNet(events.PHONE_CALL_WAS_ENDED, () => {
|
||||
onNet(CallEvents.WAS_ENDED, () => {
|
||||
exp['mumble-voip'].SetCallChannel(0);
|
||||
openCallModal(false);
|
||||
|
||||
@@ -118,7 +115,7 @@ function openCallModal(show: boolean) {
|
||||
);
|
||||
}
|
||||
|
||||
onNet(events.PHONE_CALL_SEND_HISTORY, (calls: ICall) => {
|
||||
onNet(CallEvents.SEND_HISTORY, (calls: ICall) => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: 'DIALER',
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
import events from '../utils/events';
|
||||
import { ContactEvents } from '../../typings/contact';
|
||||
import { sendContactsEvent } from '../utils/messages';
|
||||
|
||||
onNet(events.CONTACTS_SEND_CONTACTS, (contacts: any) => {
|
||||
onNet(ContactEvents.SEND_CONTACTS, (contacts: any) => {
|
||||
sendContactsEvent('setContacts', contacts);
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(events.CONTACTS_ADD_CONTACT);
|
||||
on(`__cfx_nui:${events.CONTACTS_ADD_CONTACT}`, (data: any, cb: Function) => {
|
||||
emitNet(events.CONTACTS_ADD_CONTACT, data.number, data.display, data.avatar);
|
||||
RegisterNuiCallbackType(ContactEvents.ADD_CONTACT);
|
||||
on(`__cfx_nui:${ContactEvents.ADD_CONTACT}`, (data: any, cb: Function) => {
|
||||
emitNet(ContactEvents.ADD_CONTACT, data.number, data.display, data.avatar);
|
||||
cb();
|
||||
});
|
||||
|
||||
onNet(events.CONTACTS_ADD_CONTACT_SUCCESS, () => {
|
||||
emitNet(events.CONTACTS_GET_CONTACTS);
|
||||
onNet(ContactEvents.ADD_CONTACT_SUCCESS, () => {
|
||||
emitNet(ContactEvents.GET_CONTACTS);
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(events.CONTACTS_UPDATE_CONTACT);
|
||||
on(`__cfx_nui:${events.CONTACTS_UPDATE_CONTACT}`, (data: any, cb: Function) => {
|
||||
emitNet(events.CONTACTS_UPDATE_CONTACT, data);
|
||||
RegisterNuiCallbackType(ContactEvents.UPDATE_CONTACT);
|
||||
on(`__cfx_nui:${ContactEvents.UPDATE_CONTACT}`, (data: any, cb: Function) => {
|
||||
emitNet(ContactEvents.UPDATE_CONTACT, data);
|
||||
cb();
|
||||
});
|
||||
|
||||
onNet(events.CONTACTS_UPDATE_CONTACT_SUCCESS, () => {
|
||||
emitNet(events.CONTACTS_GET_CONTACTS);
|
||||
onNet(ContactEvents.UPDATE_CONTACT_SUCCESS, () => {
|
||||
emitNet(ContactEvents.GET_CONTACTS);
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(events.CONTACTS_DELETE_CONTACT);
|
||||
on(`__cfx_nui:${events.CONTACTS_DELETE_CONTACT}`, (data: any, cb: Function) => {
|
||||
emitNet(events.CONTACTS_DELETE_CONTACT, data);
|
||||
RegisterNuiCallbackType(ContactEvents.DELETE_CONTACT);
|
||||
on(`__cfx_nui:${ContactEvents.DELETE_CONTACT}`, (data: any, cb: Function) => {
|
||||
emitNet(ContactEvents.DELETE_CONTACT, data);
|
||||
cb();
|
||||
});
|
||||
|
||||
onNet(events.CONTACTS_DELETE_CONTACT_SUCCESS, () => {
|
||||
emitNet(events.CONTACTS_GET_CONTACTS);
|
||||
onNet(ContactEvents.DELETE_CONTACT_SUCCESS, () => {
|
||||
emitNet(ContactEvents.GET_CONTACTS);
|
||||
});
|
||||
|
||||
onNet(events.CONTACTS_ACTION_RESULT, (alert: any) => {
|
||||
onNet(ContactEvents.ACTION_RESULT, (alert: any) => {
|
||||
sendContactsEvent('setAlert', alert);
|
||||
});
|
||||
+31
-23
@@ -1,7 +1,15 @@
|
||||
import config from '../utils/config';
|
||||
import events from '../utils/events';
|
||||
import { sendMessage } from '../utils/messages';
|
||||
import { PhoneEvents } from '../../typings/phone';
|
||||
import { TwitterEvents } from '../../typings/twitter';
|
||||
import { ContactEvents } from '../../typings/contact';
|
||||
import { MarketplaceEvents } from '../../typings/marketplace';
|
||||
import { phoneCloseAnim, phoneOpenAnim, removePhoneProp } from './functions';
|
||||
import { MessageEvents } from '../../typings/messages';
|
||||
import { NotesEvents } from '../../typings/notes';
|
||||
import { BankEvents } from '../../typings/bank';
|
||||
import { PhotoEvents } from '../../typings/photo';
|
||||
import { CallEvents } from '../../typings/call';
|
||||
|
||||
let isPhoneOpen = false;
|
||||
let isPhoneReady = false;
|
||||
@@ -13,9 +21,9 @@ let isPhoneReady = false;
|
||||
* * * * * * * * * * * * */
|
||||
function fetchOnInitialize() {
|
||||
isPhoneReady = true;
|
||||
emitNet(events.CONTACTS_GET_CONTACTS);
|
||||
emitNet(events.MESSAGES_FETCH_MESSAGE_GROUPS);
|
||||
emitNet(events.TWITTER_GET_OR_CREATE_PROFILE);
|
||||
emitNet(ContactEvents.GET_CONTACTS);
|
||||
emitNet(MessageEvents.FETCH_MESSAGE_GROUPS);
|
||||
emitNet(TwitterEvents.GET_OR_CREATE_PROFILE);
|
||||
sendMessage('PHONE', 'setPhoneReady', isPhoneReady);
|
||||
sendMessage('PHONE', 'phoneConfig', config);
|
||||
}
|
||||
@@ -88,7 +96,7 @@ async function Phone(): Promise<void> {
|
||||
}
|
||||
|
||||
// triggerd when the player is ready
|
||||
onNet(events.PLAYER_IS_READY, fetchOnInitialize);
|
||||
onNet(PhoneEvents.PLAYER_IS_READY, fetchOnInitialize);
|
||||
|
||||
AddEventHandler('onResourceStop', function (resource: string) {
|
||||
if (resource === GetCurrentResourceName()) {
|
||||
@@ -111,39 +119,39 @@ onNet('phone:sendCredentials', (number: string) => {
|
||||
* NUI Service Callback Registration
|
||||
*
|
||||
* * * * * * * * * * * * */
|
||||
RegisterNuiCallbackType(events.OPEN_APP_LISTINGS);
|
||||
on(`__cfx_nui:${events.OPEN_APP_LISTINGS}`, (data: any, cb: Function) => {
|
||||
emitNet(events.SELLOUT_FETCH_LISTING);
|
||||
RegisterNuiCallbackType(PhoneEvents.OPEN_APP_LISTINGS);
|
||||
on(`__cfx_nui:${PhoneEvents.OPEN_APP_LISTINGS}`, (data: any, cb: Function) => {
|
||||
emitNet(MarketplaceEvents.FETCH_LISTING);
|
||||
cb();
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(events.OPEN_APP_NOTES);
|
||||
on(`__cfx_nui:${events.OPEN_APP_NOTES}`, (data: any, cb: Function) => {
|
||||
emitNet(events.NOTE_FETCH_ALL_NOTES);
|
||||
RegisterNuiCallbackType(PhoneEvents.OPEN_APP_NOTES);
|
||||
on(`__cfx_nui:${PhoneEvents.OPEN_APP_NOTES}`, (data: any, cb: Function) => {
|
||||
emitNet(NotesEvents.FETCH_ALL_NOTES);
|
||||
cb();
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(events.OPEN_APP_BANK);
|
||||
on(`__cfx_nui:${events.OPEN_APP_BANK}`, (data: any, cb: Function) => {
|
||||
emitNet(events.BANK_FETCH_TRANSACTIONS);
|
||||
emitNet(events.BANK_GET_CREDENTIALS);
|
||||
RegisterNuiCallbackType(PhoneEvents.OPEN_APP_BANK);
|
||||
on(`__cfx_nui:${PhoneEvents.OPEN_APP_BANK}`, (data: any, cb: Function) => {
|
||||
emitNet(BankEvents.FETCH_TRANSACTIONS);
|
||||
emitNet(BankEvents.GET_CREDENTIALS);
|
||||
cb();
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(events.OPEN_APP_CAMERA);
|
||||
on(`__cfx_nui:${events.OPEN_APP_CAMERA}`, (data: any, cb: Function) => {
|
||||
emitNet(events.CAMERA_FETCH_PHOTOS);
|
||||
RegisterNuiCallbackType(PhoneEvents.OPEN_APP_CAMERA);
|
||||
on(`__cfx_nui:${PhoneEvents.OPEN_APP_CAMERA}`, (data: any, cb: Function) => {
|
||||
emitNet(PhotoEvents.FETCH_PHOTOS);
|
||||
cb();
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(events.OPEN_APP_DAILER);
|
||||
on(`__cfx_nui:${events.OPEN_APP_DAILER}`, (data: any, cb: Function) => {
|
||||
emitNet(events.PHONE_CALL_FETCH_CALLS);
|
||||
RegisterNuiCallbackType(PhoneEvents.OPEN_APP_DAILER);
|
||||
on(`__cfx_nui:${PhoneEvents.OPEN_APP_DAILER}`, (data: any, cb: Function) => {
|
||||
emitNet(CallEvents.FETCH_CALLS);
|
||||
cb();
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType('phone:close');
|
||||
on(`__cfx_nui:phone:close`, async (data: any, cb: Function) => {
|
||||
RegisterNuiCallbackType(PhoneEvents.CLOSE_PHONE);
|
||||
on(`__cfx_nui:${PhoneEvents.CLOSE_PHONE}`, async (data: any, cb: Function) => {
|
||||
await hidePhone();
|
||||
cb();
|
||||
}); // Called for when the phone is closed via the UI.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import events from '../utils/events';
|
||||
import {
|
||||
CreateMessageBroadcast,
|
||||
Message,
|
||||
MessageEvents,
|
||||
MessageGroup,
|
||||
SetMessageRead,
|
||||
} from '../../typings/messages';
|
||||
@@ -10,90 +10,90 @@ import { sendMessageEvent } from '../utils/messages';
|
||||
/**
|
||||
* Messages get message groups
|
||||
*/
|
||||
RegisterNuiCallbackType(events.MESSAGES_FETCH_MESSAGE_GROUPS);
|
||||
on(`__cfx_nui:${events.MESSAGES_FETCH_MESSAGE_GROUPS}`, (): void => {
|
||||
emitNet(events.MESSAGES_FETCH_MESSAGE_GROUPS);
|
||||
RegisterNuiCallbackType(MessageEvents.FETCH_MESSAGE_GROUPS);
|
||||
on(`__cfx_nui:${MessageEvents.FETCH_MESSAGE_GROUPS}`, (): void => {
|
||||
emitNet(MessageEvents.FETCH_MESSAGE_GROUPS);
|
||||
});
|
||||
|
||||
onNet(events.MESSAGES_FETCH_MESSAGE_GROUPS_SUCCESS, (messageGroups: MessageGroup[]): void => {
|
||||
sendMessageEvent(events.MESSAGES_FETCH_MESSAGE_GROUPS_SUCCESS, messageGroups);
|
||||
emitNet(events.MESSAGES_FETCH_MESSAGE_GROUPS_SUCCESS);
|
||||
onNet(MessageEvents.FETCH_MESSAGE_GROUPS_SUCCESS, (messageGroups: MessageGroup[]): void => {
|
||||
sendMessageEvent(MessageEvents.FETCH_MESSAGE_GROUPS_SUCCESS, messageGroups);
|
||||
emitNet(MessageEvents.FETCH_MESSAGE_GROUPS_SUCCESS);
|
||||
});
|
||||
|
||||
onNet(events.MESSAGES_FETCH_MESSAGE_GROUPS_FAILED, () => {
|
||||
sendMessageEvent(events.MESSAGES_FETCH_MESSAGE_GROUPS_FAILED);
|
||||
onNet(MessageEvents.FETCH_MESSAGE_GROUPS_FAILED, () => {
|
||||
sendMessageEvent(MessageEvents.FETCH_MESSAGE_GROUPS_FAILED);
|
||||
});
|
||||
|
||||
onNet(events.MESSAGES_FETCH_MESSAGE_GROUPS, () => {
|
||||
emitNet(events.MESSAGES_FETCH_MESSAGE_GROUPS);
|
||||
onNet(MessageEvents.FETCH_MESSAGE_GROUPS, () => {
|
||||
emitNet(MessageEvents.FETCH_MESSAGE_GROUPS);
|
||||
});
|
||||
|
||||
/**
|
||||
* Messages create message group
|
||||
*/
|
||||
RegisterNuiCallbackType(events.MESSAGES_CREATE_MESSAGE_GROUP);
|
||||
RegisterNuiCallbackType(MessageEvents.CREATE_MESSAGE_GROUP);
|
||||
on(
|
||||
`__cfx_nui:${events.MESSAGES_CREATE_MESSAGE_GROUP}`,
|
||||
`__cfx_nui:${MessageEvents.CREATE_MESSAGE_GROUP}`,
|
||||
({ phoneNumbers, label }: any, cb: Function): void => {
|
||||
emitNet(events.MESSAGES_CREATE_MESSAGE_GROUP, phoneNumbers, label);
|
||||
emitNet(MessageEvents.CREATE_MESSAGE_GROUP, phoneNumbers, label);
|
||||
cb();
|
||||
},
|
||||
);
|
||||
|
||||
onNet(events.MESSAGES_CREATE_MESSAGE_GROUP_SUCCESS, (result: any): void => {
|
||||
sendMessageEvent(events.MESSAGES_CREATE_MESSAGE_GROUP_SUCCESS, result);
|
||||
emitNet(events.MESSAGES_FETCH_MESSAGE_GROUPS);
|
||||
onNet(MessageEvents.CREATE_MESSAGE_GROUP_SUCCESS, (result: any): void => {
|
||||
sendMessageEvent(MessageEvents.CREATE_MESSAGE_GROUP_SUCCESS, result);
|
||||
emitNet(MessageEvents.FETCH_MESSAGE_GROUPS);
|
||||
});
|
||||
|
||||
onNet(events.MESSAGES_CREATE_MESSAGE_GROUP_FAILED, (result: any): void => {
|
||||
sendMessageEvent(events.MESSAGES_CREATE_MESSAGE_GROUP_FAILED, result);
|
||||
onNet(MessageEvents.CREATE_MESSAGE_GROUP_FAILED, (result: any): void => {
|
||||
sendMessageEvent(MessageEvents.CREATE_MESSAGE_GROUP_FAILED, result);
|
||||
});
|
||||
|
||||
/**
|
||||
* Messages fetch messages
|
||||
*/
|
||||
RegisterNuiCallbackType(events.MESSAGES_FETCH_MESSAGES);
|
||||
on(`__cfx_nui:${events.MESSAGES_FETCH_MESSAGES}`, ({ groupId }: any, cb: Function): void => {
|
||||
emitNet(events.MESSAGES_FETCH_MESSAGES, groupId);
|
||||
RegisterNuiCallbackType(MessageEvents.FETCH_MESSAGES);
|
||||
on(`__cfx_nui:${MessageEvents.FETCH_MESSAGES}`, ({ groupId }: any, cb: Function): void => {
|
||||
emitNet(MessageEvents.FETCH_MESSAGES, groupId);
|
||||
cb();
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(events.MESSAGES_SET_MESSAGE_READ);
|
||||
on(`__cfx_nui:${events.MESSAGES_SET_MESSAGE_READ}`, (data: SetMessageRead, cb: Function) => {
|
||||
emitNet(events.MESSAGES_SET_MESSAGE_READ, data.groupId);
|
||||
RegisterNuiCallbackType(MessageEvents.SET_MESSAGE_READ);
|
||||
on(`__cfx_nui:${MessageEvents.SET_MESSAGE_READ}`, (data: SetMessageRead, cb: Function) => {
|
||||
emitNet(MessageEvents.SET_MESSAGE_READ, data.groupId);
|
||||
cb();
|
||||
});
|
||||
|
||||
onNet(events.MESSAGES_FETCH_MESSAGES_SUCCESS, (messages: Message[]): void => {
|
||||
sendMessageEvent(events.MESSAGES_FETCH_MESSAGES_SUCCESS, messages);
|
||||
onNet(MessageEvents.FETCH_MESSAGES_SUCCESS, (messages: Message[]): void => {
|
||||
sendMessageEvent(MessageEvents.FETCH_MESSAGES_SUCCESS, messages);
|
||||
});
|
||||
|
||||
onNet(events.MESSAGES_FETCH_MESSAGES_FAILED, (): void => {
|
||||
sendMessageEvent(events.MESSAGES_FETCH_MESSAGES_FAILED);
|
||||
onNet(MessageEvents.FETCH_MESSAGES_FAILED, (): void => {
|
||||
sendMessageEvent(MessageEvents.FETCH_MESSAGES_FAILED);
|
||||
});
|
||||
|
||||
/**
|
||||
* Messages send message
|
||||
*/
|
||||
RegisterNuiCallbackType(events.MESSAGES_SEND_MESSAGE);
|
||||
on(`__cfx_nui:${events.MESSAGES_SEND_MESSAGE}`, (data: any, cb: Function) => {
|
||||
emitNet(events.MESSAGES_SEND_MESSAGE, data.groupId, data.message, data.groupName);
|
||||
RegisterNuiCallbackType(MessageEvents.SEND_MESSAGE);
|
||||
on(`__cfx_nui:${MessageEvents.SEND_MESSAGE}`, (data: any, cb: Function) => {
|
||||
emitNet(MessageEvents.SEND_MESSAGE, data.groupId, data.message, data.groupName);
|
||||
cb();
|
||||
});
|
||||
|
||||
onNet(events.MESSAGES_SEND_MESSAGE_SUCCESS, (groupId: string) => {
|
||||
sendMessageEvent(events.MESSAGES_SEND_MESSAGE_SUCCESS);
|
||||
emitNet(events.MESSAGES_FETCH_MESSAGES, groupId);
|
||||
onNet(MessageEvents.SEND_MESSAGE_SUCCESS, (groupId: string) => {
|
||||
sendMessageEvent(MessageEvents.SEND_MESSAGE_SUCCESS);
|
||||
emitNet(MessageEvents.FETCH_MESSAGES, groupId);
|
||||
});
|
||||
|
||||
onNet(events.MESSAGES_SEND_MESSAGE_FAILED, () => {
|
||||
sendMessageEvent(events.MESSAGES_SEND_MESSAGE_FAILED);
|
||||
onNet(MessageEvents.SEND_MESSAGE_FAILED, () => {
|
||||
sendMessageEvent(MessageEvents.SEND_MESSAGE_FAILED);
|
||||
});
|
||||
|
||||
onNet(events.MESSAGES_ACTION_RESULT, (result: any) => {
|
||||
sendMessageEvent(events.MESSAGES_ACTION_RESULT, result);
|
||||
onNet(MessageEvents.ACTION_RESULT, (result: any) => {
|
||||
sendMessageEvent(MessageEvents.ACTION_RESULT, result);
|
||||
});
|
||||
|
||||
onNet(events.MESSAGES_CREATE_MESSAGE_BROADCAST, (result: CreateMessageBroadcast) => {
|
||||
sendMessageEvent(events.MESSAGES_CREATE_MESSAGE_BROADCAST, result);
|
||||
onNet(MessageEvents.CREATE_MESSAGE_BROADCAST, (result: CreateMessageBroadcast) => {
|
||||
sendMessageEvent(MessageEvents.CREATE_MESSAGE_BROADCAST, result);
|
||||
});
|
||||
@@ -1,39 +1,39 @@
|
||||
import events from '../utils/events';
|
||||
import { NotesEvents } from '../../typings/notes';
|
||||
import { sendNotesEvent } from '../utils/messages';
|
||||
|
||||
onNet(events.NOTE_SEND_NOTE, (notes: any) => {
|
||||
onNet(NotesEvents.SEND_NOTE, (notes: any) => {
|
||||
sendNotesEvent('setNotes', notes);
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(events.NOTE_ADD_NOTE);
|
||||
on(`__cfx_nui:${events.NOTE_ADD_NOTE}`, (data: any) => {
|
||||
emitNet(events.NOTE_ADD_NOTE, data);
|
||||
RegisterNuiCallbackType(NotesEvents.ADD_NOTE);
|
||||
on(`__cfx_nui:${NotesEvents.ADD_NOTE}`, (data: any) => {
|
||||
emitNet(NotesEvents.ADD_NOTE, data);
|
||||
});
|
||||
|
||||
onNet(events.NOTE_SEND_NOTE_SUCCESS, () => {
|
||||
emitNet(events.NOTE_FETCH_ALL_NOTES);
|
||||
onNet(NotesEvents.SEND_NOTE_SUCCESS, () => {
|
||||
emitNet(NotesEvents.FETCH_ALL_NOTES);
|
||||
});
|
||||
|
||||
onNet(events.NOTE_DELETE_NOTE_SUCCESS, () => {
|
||||
emitNet(events.NOTE_FETCH_ALL_NOTES);
|
||||
onNet(NotesEvents.DELETE_NOTE_SUCCESS, () => {
|
||||
emitNet(NotesEvents.FETCH_ALL_NOTES);
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(events.NOTE_DELETE_NOTE);
|
||||
on(`__cfx_nui:${events.NOTE_DELETE_NOTE}`, (data: any) => {
|
||||
emitNet(events.NOTE_DELETE_NOTE, data);
|
||||
RegisterNuiCallbackType(NotesEvents.DELETE_NOTE);
|
||||
on(`__cfx_nui:${NotesEvents.DELETE_NOTE}`, (data: any) => {
|
||||
emitNet(NotesEvents.DELETE_NOTE, data);
|
||||
|
||||
emitNet(events.NOTE_FETCH_ALL_NOTES);
|
||||
emitNet(NotesEvents.FETCH_ALL_NOTES);
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(events.NOTE_UPDATE_NOTE);
|
||||
on(`__cfx_nui:${events.NOTE_UPDATE_NOTE}`, (data: any) => {
|
||||
emitNet(events.NOTE_UPDATE_NOTE, data);
|
||||
RegisterNuiCallbackType(NotesEvents.UPDATE_NOTE);
|
||||
on(`__cfx_nui:${NotesEvents.UPDATE_NOTE}`, (data: any) => {
|
||||
emitNet(NotesEvents.UPDATE_NOTE, data);
|
||||
});
|
||||
|
||||
onNet(events.NOTE_UPDATE_NOTE_SUCCESS, () => {
|
||||
emitNet(events.NOTE_FETCH_ALL_NOTES);
|
||||
onNet(NotesEvents.UPDATE_NOTE_SUCCESS, () => {
|
||||
emitNet(NotesEvents.FETCH_ALL_NOTES);
|
||||
});
|
||||
|
||||
onNet(events.NOTE_ACTION_RESULT, (alert: any) => {
|
||||
onNet(NotesEvents.ACTION_RESULT, (alert: any) => {
|
||||
sendNotesEvent('setAlert', alert);
|
||||
});
|
||||
@@ -1,4 +1,4 @@
|
||||
import events from '../utils/events';
|
||||
import { PhotoEvents } from '../../typings/photo';
|
||||
import { Delay } from '../utils/fivem';
|
||||
import { sendMessage, sendCameraEvent } from '../utils/messages';
|
||||
const SCREENSHOT_BASIC_TOKEN = GetConvar('SCREENSHOT_BASIC_TOKEN', 'none');
|
||||
@@ -28,8 +28,8 @@ const displayHelperText = () => {
|
||||
EndTextCommandDisplayHelp(0, true, false, -1);
|
||||
};
|
||||
|
||||
RegisterNuiCallbackType(events.CAMERA_TAKE_PHOTO);
|
||||
on(`__cfx_nui:${events.CAMERA_TAKE_PHOTO}`, async (data: any, cb: Function) => {
|
||||
RegisterNuiCallbackType(PhotoEvents.TAKE_PHOTO);
|
||||
on(`__cfx_nui:${PhotoEvents.TAKE_PHOTO}`, async (data: any, cb: Function) => {
|
||||
cb();
|
||||
// Create Phone Prop
|
||||
let frontCam = false;
|
||||
@@ -75,7 +75,7 @@ const handleCameraExit = () => {
|
||||
inCameraMode = false;
|
||||
};
|
||||
|
||||
onNet(events.CAMERA_SEND_PHOTOS, (photos: string[]) => {
|
||||
onNet(PhotoEvents.SEND_PHOTOS, (photos: string[]) => {
|
||||
sendCameraEvent('setPhotos', photos);
|
||||
});
|
||||
|
||||
@@ -95,23 +95,23 @@ function takePhoto() {
|
||||
},
|
||||
(data: string) => {
|
||||
const imageLink = JSON.parse(data).data.link;
|
||||
emitNet(events.CAMERA_UPLOAD_PHOTO, imageLink);
|
||||
emitNet(PhotoEvents.UPLOAD_PHOTO, imageLink);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
onNet(events.CAMERA_UPLOAD_PHOTO_SUCCESS, () => {
|
||||
emitNet(events.CAMERA_FETCH_PHOTOS);
|
||||
onNet(PhotoEvents.UPLOAD_PHOTO_SUCCESS, () => {
|
||||
emitNet(PhotoEvents.FETCH_PHOTOS);
|
||||
});
|
||||
|
||||
// delete photo
|
||||
|
||||
RegisterNuiCallbackType(events.CAMERA_DELETE_PHOTO);
|
||||
on(`__cfx_nui:${events.CAMERA_DELETE_PHOTO}`, (data: any, cb: Function) => {
|
||||
emitNet(events.CAMERA_DELETE_PHOTO, data);
|
||||
RegisterNuiCallbackType(PhotoEvents.DELETE_PHOTO);
|
||||
on(`__cfx_nui:${PhotoEvents.DELETE_PHOTO}`, (data: any, cb: Function) => {
|
||||
emitNet(PhotoEvents.DELETE_PHOTO, data);
|
||||
cb();
|
||||
});
|
||||
|
||||
onNet(events.CAMERA_DELETE_PHOTO_SUCCESS, () => {
|
||||
emitNet(events.CAMERA_FETCH_PHOTOS);
|
||||
onNet(PhotoEvents.DELETE_PHOTO_SUCCESS, () => {
|
||||
emitNet(PhotoEvents.FETCH_PHOTOS);
|
||||
});
|
||||
@@ -1,38 +1,38 @@
|
||||
import events from '../utils/events';
|
||||
import { MarketplaceListing } from '../../typings/marketplace';
|
||||
import { MarketplaceEvents, MarketplaceListing } from '../../typings/marketplace';
|
||||
import { IAlertProps } from '../../typings/alerts';
|
||||
import { sendMarketplaceEvent } from '../utils/messages';
|
||||
|
||||
onNet(events.SELLOUT_SEND_LISTING, (listing: MarketplaceListing) => {
|
||||
RegisterNuiCallbackType(MarketplaceEvents.ADD_LISTING);
|
||||
|
||||
onNet(MarketplaceEvents.SEND_LISTING, (listing: MarketplaceListing) => {
|
||||
sendMarketplaceEvent('setListing', listing);
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(events.SELLOUT_ADD_LISTING);
|
||||
on(`__cfx_nui:${events.SELLOUT_ADD_LISTING}`, (data: MarketplaceListing, cb: Function) => {
|
||||
emitNet(events.SELLOUT_ADD_LISTING, data);
|
||||
on(`__cfx_nui:${MarketplaceEvents.ADD_LISTING}`, (data: MarketplaceListing, cb: Function) => {
|
||||
emitNet(MarketplaceEvents.ADD_LISTING, data);
|
||||
cb();
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(events.SELLOUT_DELETE_LISTING);
|
||||
on(`__cfx_nui:${events.SELLOUT_DELETE_LISTING}`, (data: MarketplaceListing, cb: Function) => {
|
||||
emitNet(events.SELLOUT_DELETE_LISTING, data.id);
|
||||
RegisterNuiCallbackType(MarketplaceEvents.DELETE_LISTING);
|
||||
on(`__cfx_nui:${MarketplaceEvents.DELETE_LISTING}`, (data: MarketplaceListing, cb: Function) => {
|
||||
emitNet(MarketplaceEvents.DELETE_LISTING, data.id);
|
||||
cb();
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(events.SELLOUT_REPORT_LISTING);
|
||||
on(`__cfx_nui:${events.SELLOUT_REPORT_LISTING}`, (data: MarketplaceListing, cb: Function) => {
|
||||
emitNet(events.SELLOUT_REPORT_LISTING, data);
|
||||
RegisterNuiCallbackType(MarketplaceEvents.REPORT_LISTING);
|
||||
on(`__cfx_nui:${MarketplaceEvents.REPORT_LISTING}`, (data: MarketplaceListing, cb: Function) => {
|
||||
emitNet(MarketplaceEvents.REPORT_LISTING, data);
|
||||
cb();
|
||||
});
|
||||
|
||||
onNet(events.SELLOUT_ADD_LISTING_SUCCESS, () => {
|
||||
emitNet(events.SELLOUT_FETCH_LISTING);
|
||||
onNet(MarketplaceEvents.ADD_LISTING_SUCCESS, () => {
|
||||
emitNet(MarketplaceEvents.FETCH_LISTING);
|
||||
});
|
||||
|
||||
onNet(events.SELLOUT_DELETE_LISTING_SUCCESS, () => {
|
||||
emitNet(events.SELLOUT_FETCH_LISTING);
|
||||
onNet(MarketplaceEvents.DELETE_LISTING_SUCCESS, () => {
|
||||
emitNet(MarketplaceEvents.FETCH_LISTING);
|
||||
});
|
||||
|
||||
onNet(events.SELLOUT_ACTION_RESULT, (alert: IAlertProps) => {
|
||||
onNet(MarketplaceEvents.ACTION_RESULT, (alert: IAlertProps) => {
|
||||
sendMarketplaceEvent('setAlert', alert);
|
||||
});
|
||||
@@ -1,157 +1,157 @@
|
||||
import events from '../utils/events';
|
||||
import { TwitterEvents } from '../../typings/twitter';
|
||||
import { sendTwitterMessage } from '../utils/messages';
|
||||
import { IAlertProps } from '../../typings/alerts';
|
||||
|
||||
/**
|
||||
* Twitter get or create profile
|
||||
*/
|
||||
RegisterNuiCallbackType(events.TWITTER_GET_OR_CREATE_PROFILE);
|
||||
on(`__cfx_nui:${events.TWITTER_GET_OR_CREATE_PROFILE}`, () => {
|
||||
emitNet(events.TWITTER_GET_OR_CREATE_PROFILE);
|
||||
RegisterNuiCallbackType(TwitterEvents.GET_OR_CREATE_PROFILE);
|
||||
on(`__cfx_nui:${TwitterEvents.GET_OR_CREATE_PROFILE}`, () => {
|
||||
emitNet(TwitterEvents.GET_OR_CREATE_PROFILE);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_GET_OR_CREATE_PROFILE_SUCCESS, (profile: any) => {
|
||||
sendTwitterMessage(events.TWITTER_GET_OR_CREATE_PROFILE_SUCCESS, profile);
|
||||
onNet(TwitterEvents.GET_OR_CREATE_PROFILE_SUCCESS, (profile: any) => {
|
||||
sendTwitterMessage(TwitterEvents.GET_OR_CREATE_PROFILE_SUCCESS, profile);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_GET_OR_CREATE_PROFILE_FAILURE, () => {
|
||||
sendTwitterMessage(events.TWITTER_GET_OR_CREATE_PROFILE_FAILURE);
|
||||
onNet(TwitterEvents.GET_OR_CREATE_PROFILE_FAILURE, () => {
|
||||
sendTwitterMessage(TwitterEvents.GET_OR_CREATE_PROFILE_FAILURE);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_GET_OR_CREATE_PROFILE_NULL, (defaultProfileNames: string[]): void => {
|
||||
sendTwitterMessage(events.TWITTER_GET_OR_CREATE_PROFILE_NULL, defaultProfileNames);
|
||||
onNet(TwitterEvents.GET_OR_CREATE_PROFILE_NULL, (defaultProfileNames: string[]): void => {
|
||||
sendTwitterMessage(TwitterEvents.GET_OR_CREATE_PROFILE_NULL, defaultProfileNames);
|
||||
});
|
||||
|
||||
/**
|
||||
* Twitter create profile
|
||||
*/
|
||||
RegisterNuiCallbackType(events.TWITTER_CREATE_PROFILE);
|
||||
on(`__cfx_nui:${events.TWITTER_CREATE_PROFILE}`, (data: any) => {
|
||||
sendTwitterMessage(events.TWITTER_UPDATE_PROFILE_LOADING, true);
|
||||
emitNet(events.TWITTER_CREATE_PROFILE, data);
|
||||
RegisterNuiCallbackType(TwitterEvents.CREATE_PROFILE);
|
||||
on(`__cfx_nui:${TwitterEvents.CREATE_PROFILE}`, (data: any) => {
|
||||
sendTwitterMessage(TwitterEvents.UPDATE_PROFILE_LOADING, true);
|
||||
emitNet(TwitterEvents.CREATE_PROFILE, data);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_CREATE_PROFILE_RESULT, (alert: IAlertProps) => {
|
||||
sendTwitterMessage(events.TWITTER_CREATE_PROFILE_RESULT, alert);
|
||||
sendTwitterMessage(events.TWITTER_UPDATE_PROFILE_LOADING, false);
|
||||
emitNet(events.TWITTER_GET_OR_CREATE_PROFILE);
|
||||
onNet(TwitterEvents.CREATE_PROFILE_RESULT, (alert: IAlertProps) => {
|
||||
sendTwitterMessage(TwitterEvents.CREATE_PROFILE_RESULT, alert);
|
||||
sendTwitterMessage(TwitterEvents.UPDATE_PROFILE_LOADING, false);
|
||||
emitNet(TwitterEvents.GET_OR_CREATE_PROFILE);
|
||||
});
|
||||
|
||||
/**
|
||||
* Twitter update profile
|
||||
*/
|
||||
RegisterNuiCallbackType(events.TWITTER_UPDATE_PROFILE);
|
||||
on(`__cfx_nui:${events.TWITTER_UPDATE_PROFILE}`, (data: string) => {
|
||||
sendTwitterMessage(events.TWITTER_UPDATE_PROFILE_LOADING, true);
|
||||
emitNet(events.TWITTER_UPDATE_PROFILE, data);
|
||||
RegisterNuiCallbackType(TwitterEvents.UPDATE_PROFILE);
|
||||
on(`__cfx_nui:${TwitterEvents.UPDATE_PROFILE}`, (data: string) => {
|
||||
sendTwitterMessage(TwitterEvents.UPDATE_PROFILE_LOADING, true);
|
||||
emitNet(TwitterEvents.UPDATE_PROFILE, data);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_UPDATE_PROFILE_RESULT, (alert: IAlertProps) => {
|
||||
sendTwitterMessage(events.TWITTER_UPDATE_PROFILE_RESULT, alert);
|
||||
sendTwitterMessage(events.TWITTER_UPDATE_PROFILE_LOADING, false);
|
||||
emitNet(events.TWITTER_GET_OR_CREATE_PROFILE);
|
||||
onNet(TwitterEvents.UPDATE_PROFILE_RESULT, (alert: IAlertProps) => {
|
||||
sendTwitterMessage(TwitterEvents.UPDATE_PROFILE_RESULT, alert);
|
||||
sendTwitterMessage(TwitterEvents.UPDATE_PROFILE_LOADING, false);
|
||||
emitNet(TwitterEvents.GET_OR_CREATE_PROFILE);
|
||||
});
|
||||
|
||||
/**
|
||||
* Twitter fetch tweets
|
||||
*/
|
||||
RegisterNuiCallbackType(events.TWITTER_FETCH_TWEETS);
|
||||
on(`__cfx_nui:${events.TWITTER_FETCH_TWEETS}`, () => {
|
||||
emitNet(events.TWITTER_FETCH_TWEETS);
|
||||
RegisterNuiCallbackType(TwitterEvents.FETCH_TWEETS);
|
||||
on(`__cfx_nui:${TwitterEvents.FETCH_TWEETS}`, () => {
|
||||
emitNet(TwitterEvents.FETCH_TWEETS);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_FETCH_TWEETS_SUCCESS, (tweets: any) => {
|
||||
sendTwitterMessage(events.TWITTER_FETCH_TWEETS_SUCCESS, tweets);
|
||||
onNet(TwitterEvents.FETCH_TWEETS_SUCCESS, (tweets: any) => {
|
||||
sendTwitterMessage(TwitterEvents.FETCH_TWEETS_SUCCESS, tweets);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_FETCH_TWEETS_FAILURE, () => {
|
||||
sendTwitterMessage(events.TWITTER_FETCH_TWEETS_FAILURE);
|
||||
onNet(TwitterEvents.FETCH_TWEETS_FAILURE, () => {
|
||||
sendTwitterMessage(TwitterEvents.FETCH_TWEETS_FAILURE);
|
||||
});
|
||||
|
||||
/**
|
||||
* Twitter fetch filtered tweets
|
||||
*/
|
||||
RegisterNuiCallbackType(events.TWITTER_FETCH_TWEETS_FILTERED);
|
||||
on(`__cfx_nui:${events.TWITTER_FETCH_TWEETS_FILTERED}`, (searchValue: string) => {
|
||||
emitNet(events.TWITTER_FETCH_TWEETS_FILTERED, searchValue);
|
||||
RegisterNuiCallbackType(TwitterEvents.FETCH_TWEETS_FILTERED);
|
||||
on(`__cfx_nui:${TwitterEvents.FETCH_TWEETS_FILTERED}`, (searchValue: string) => {
|
||||
emitNet(TwitterEvents.FETCH_TWEETS_FILTERED, searchValue);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_FETCH_TWEETS_FILTERED_SUCCESS, (tweets: any) => {
|
||||
sendTwitterMessage(events.TWITTER_FETCH_TWEETS_FILTERED_SUCCESS, tweets);
|
||||
onNet(TwitterEvents.FETCH_TWEETS_FILTERED_SUCCESS, (tweets: any) => {
|
||||
sendTwitterMessage(TwitterEvents.FETCH_TWEETS_FILTERED_SUCCESS, tweets);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_FETCH_TWEETS_FILTERED_FAILURE, () => {
|
||||
sendTwitterMessage(events.TWITTER_FETCH_TWEETS_FILTERED_FAILURE);
|
||||
onNet(TwitterEvents.FETCH_TWEETS_FILTERED_FAILURE, () => {
|
||||
sendTwitterMessage(TwitterEvents.FETCH_TWEETS_FILTERED_FAILURE);
|
||||
});
|
||||
|
||||
/**
|
||||
* Twitter create tweet
|
||||
*/
|
||||
RegisterNuiCallbackType(events.TWITTER_CREATE_TWEET);
|
||||
on(`__cfx_nui:${events.TWITTER_CREATE_TWEET}`, (data: string) => {
|
||||
sendTwitterMessage(events.TWITTER_CREATE_TWEET_LOADING, true);
|
||||
emitNet(events.TWITTER_CREATE_TWEET, data);
|
||||
RegisterNuiCallbackType(TwitterEvents.CREATE_TWEET);
|
||||
on(`__cfx_nui:${TwitterEvents.CREATE_TWEET}`, (data: string) => {
|
||||
sendTwitterMessage(TwitterEvents.CREATE_TWEET_LOADING, true);
|
||||
emitNet(TwitterEvents.CREATE_TWEET, data);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_CREATE_TWEET_RESULT, (alert: IAlertProps) => {
|
||||
sendTwitterMessage(events.TWITTER_CREATE_TWEET_RESULT, alert);
|
||||
emitNet(events.TWITTER_FETCH_TWEETS);
|
||||
onNet(TwitterEvents.CREATE_TWEET_RESULT, (alert: IAlertProps) => {
|
||||
sendTwitterMessage(TwitterEvents.CREATE_TWEET_RESULT, alert);
|
||||
emitNet(TwitterEvents.FETCH_TWEETS);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_CREATE_TWEET_FAILURE, () => {
|
||||
sendTwitterMessage(events.TWITTER_CREATE_TWEET_FAILURE);
|
||||
onNet(TwitterEvents.CREATE_TWEET_FAILURE, () => {
|
||||
sendTwitterMessage(TwitterEvents.CREATE_TWEET_FAILURE);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_CREATE_TWEET_BROADCAST, (tweet: any) => {
|
||||
sendTwitterMessage(events.TWITTER_CREATE_TWEET_BROADCAST, tweet);
|
||||
onNet(TwitterEvents.CREATE_TWEET_BROADCAST, (tweet: any) => {
|
||||
sendTwitterMessage(TwitterEvents.CREATE_TWEET_BROADCAST, tweet);
|
||||
});
|
||||
|
||||
/**
|
||||
* Twitter delete tweet
|
||||
*/
|
||||
RegisterNuiCallbackType(events.TWITTER_DELETE_TWEET);
|
||||
on(`__cfx_nui:${events.TWITTER_DELETE_TWEET}`, (tweetId: number) => {
|
||||
emitNet(events.TWITTER_DELETE_TWEET, tweetId);
|
||||
RegisterNuiCallbackType(TwitterEvents.DELETE_TWEET);
|
||||
on(`__cfx_nui:${TwitterEvents.DELETE_TWEET}`, (tweetId: number) => {
|
||||
emitNet(TwitterEvents.DELETE_TWEET, tweetId);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_DELETE_TWEET_SUCCESS, () => {
|
||||
sendTwitterMessage(events.TWITTER_DELETE_TWEET_SUCCESS);
|
||||
emitNet(events.TWITTER_FETCH_TWEETS);
|
||||
onNet(TwitterEvents.DELETE_TWEET_SUCCESS, () => {
|
||||
sendTwitterMessage(TwitterEvents.DELETE_TWEET_SUCCESS);
|
||||
emitNet(TwitterEvents.FETCH_TWEETS);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_DELETE_TWEET_FAILURE, () => {
|
||||
sendTwitterMessage(events.TWITTER_DELETE_TWEET_FAILURE);
|
||||
onNet(TwitterEvents.DELETE_TWEET_FAILURE, () => {
|
||||
sendTwitterMessage(TwitterEvents.DELETE_TWEET_FAILURE);
|
||||
});
|
||||
|
||||
/**
|
||||
* Twitter likes
|
||||
*/
|
||||
RegisterNuiCallbackType(events.TWITTER_TOGGLE_LIKE);
|
||||
on(`__cfx_nui:${events.TWITTER_TOGGLE_LIKE}`, (tweetId: number) => {
|
||||
emitNet(events.TWITTER_TOGGLE_LIKE, tweetId);
|
||||
RegisterNuiCallbackType(TwitterEvents.TOGGLE_LIKE);
|
||||
on(`__cfx_nui:${TwitterEvents.TOGGLE_LIKE}`, (tweetId: number) => {
|
||||
emitNet(TwitterEvents.TOGGLE_LIKE, tweetId);
|
||||
});
|
||||
|
||||
/**
|
||||
* Twitter retweets
|
||||
*/
|
||||
RegisterNuiCallbackType(events.TWITTER_RETWEET);
|
||||
on(`__cfx_nui:${events.TWITTER_RETWEET}`, (tweetId: number, cb: Function) => {
|
||||
emitNet(events.TWITTER_RETWEET, tweetId);
|
||||
RegisterNuiCallbackType(TwitterEvents.RETWEET);
|
||||
on(`__cfx_nui:${TwitterEvents.RETWEET}`, (tweetId: number, cb: Function) => {
|
||||
emitNet(TwitterEvents.RETWEET, tweetId);
|
||||
cb();
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_RETWEET_EXISTS, (alert: IAlertProps) => {
|
||||
sendTwitterMessage(events.TWITTER_RETWEET_EXISTS, alert);
|
||||
onNet(TwitterEvents.RETWEET_EXISTS, (alert: IAlertProps) => {
|
||||
sendTwitterMessage(TwitterEvents.RETWEET_EXISTS, alert);
|
||||
});
|
||||
|
||||
/**
|
||||
* Twitter reporting tweets
|
||||
*/
|
||||
RegisterNuiCallbackType(events.TWITTER_REPORT);
|
||||
on(`__cfx_nui:${events.TWITTER_REPORT}`, (tweetId: number) => {
|
||||
emitNet(events.TWITTER_REPORT, tweetId);
|
||||
RegisterNuiCallbackType(TwitterEvents.REPORT);
|
||||
on(`__cfx_nui:${TwitterEvents.REPORT}`, (tweetId: number) => {
|
||||
emitNet(TwitterEvents.REPORT, tweetId);
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_REPORT_SUCCESS, () => {
|
||||
emitNet(events.TWITTER_FETCH_TWEETS);
|
||||
onNet(TwitterEvents.REPORT_SUCCESS, () => {
|
||||
emitNet(TwitterEvents.FETCH_TWEETS);
|
||||
});
|
||||
@@ -1,7 +1,7 @@
|
||||
import { mainLogger } from '../sv_logger';
|
||||
import { pool } from '../db';
|
||||
import { generatePhoneNumber } from '../functions';
|
||||
import events from '../../utils/events';
|
||||
import { PhoneEvents } from '../../../typings/phone';
|
||||
|
||||
export const playerLogger = mainLogger.child({
|
||||
module: 'player',
|
||||
@@ -56,7 +56,7 @@ export async function handlePlayerAdd(pSource: number) {
|
||||
playerLogger.debug(newPlayer);
|
||||
|
||||
// Emit to client that player is ready
|
||||
emitNet(events.PLAYER_IS_READY, pSource);
|
||||
emitNet(PhoneEvents.PLAYER_IS_READY, pSource);
|
||||
} catch (e) {
|
||||
playerLogger.error(`Failed to create a new player, ${e.message}`, {
|
||||
source: pSource,
|
||||
|
||||
+11
-12
@@ -1,8 +1,7 @@
|
||||
import events from '../utils/events';
|
||||
import { ESX } from './server';
|
||||
import { getSource } from './functions';
|
||||
import { pool } from './db';
|
||||
import { Transfer, IBankCredentials } from '../../typings/bank';
|
||||
import { Transfer, IBankCredentials, BankEvents } from '../../typings/bank';
|
||||
import { getIdentifier } from './functions';
|
||||
import { mainLogger } from './sv_logger';
|
||||
|
||||
@@ -40,9 +39,9 @@ async function addTransfer(identifier: string, transfer: Transfer): Promise<any>
|
||||
const xTarget = ESX.GetPlayerFromId(transfer.targetID);
|
||||
|
||||
if (transfer.transferAmount > bankBalance) {
|
||||
emitNet(events.BANK_TRANSACTION_ALERT, getSource(), false);
|
||||
emitNet(BankEvents.TRANSACTION_ALERT, getSource(), false);
|
||||
} else if (transfer.transferAmount < bankBalance) {
|
||||
emitNet(events.BANK_TRANSACTION_ALERT, getSource(), true);
|
||||
emitNet(BankEvents.TRANSACTION_ALERT, getSource(), true);
|
||||
|
||||
xTarget.addAccountMoney('bank', transfer.transferAmount);
|
||||
xPlayer.removeAccountMoney('bank', transfer.transferAmount);
|
||||
@@ -75,13 +74,13 @@ async function getTransfer(transferId: number): Promise<Transfer> {
|
||||
return { ...transfer };
|
||||
}
|
||||
|
||||
onNet(events.BANK_FETCH_TRANSACTIONS, async () => {
|
||||
onNet(BankEvents.FETCH_TRANSACTIONS, async () => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const _identifier = getIdentifier(_source);
|
||||
const transfer = await fetchAllTransactions(_identifier);
|
||||
|
||||
emitNet(events.BANK_SEND_TRANSFERS, _source, transfer);
|
||||
emitNet(BankEvents.SEND_TRANSFERS, _source, transfer);
|
||||
} catch (e) {
|
||||
bankLogger.error(`Failed to fetch transactions, ${e.message}`, {
|
||||
source: _source,
|
||||
@@ -89,7 +88,7 @@ onNet(events.BANK_FETCH_TRANSACTIONS, async () => {
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.BANK_ADD_TRANSFER, async (transfer: Transfer) => {
|
||||
onNet(BankEvents.ADD_TRANSFER, async (transfer: Transfer) => {
|
||||
const _source = getSource();
|
||||
const xTarget = ESX.GetPlayerFromId(transfer.targetID);
|
||||
try {
|
||||
@@ -101,8 +100,8 @@ onNet(events.BANK_ADD_TRANSFER, async (transfer: Transfer) => {
|
||||
|
||||
//emitNet(events.BANK_TRANSACTION_NOTIFICATION, xTarget, transferNotify);
|
||||
|
||||
emitNet(events.BANK_ADD_TRANSFER_SUCCESS, _source);
|
||||
emitNet(events.BANK_TRANSACTION_ALERT, _source, {
|
||||
emitNet(BankEvents.ADD_TRANSFER_SUCCESS, _source);
|
||||
emitNet(BankEvents.TRANSACTION_ALERT, _source, {
|
||||
message: 'BANK_ALERT_TRANSFER_SUCCESS',
|
||||
type: 'success',
|
||||
});
|
||||
@@ -110,18 +109,18 @@ onNet(events.BANK_ADD_TRANSFER, async (transfer: Transfer) => {
|
||||
bankLogger.error(`Failed to add transaction, ${e.message}`, {
|
||||
source: _source,
|
||||
});
|
||||
emitNet(events.BANK_TRANSACTION_ALERT, _source, {
|
||||
emitNet(BankEvents.TRANSACTION_ALERT, _source, {
|
||||
message: 'APPS_BANK_ALERT_TRANSFER_FAILURE',
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.BANK_GET_CREDENTIALS, () => {
|
||||
onNet(BankEvents.GET_CREDENTIALS, () => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const credentials = fetchCredentials();
|
||||
emitNet(events.BANK_SEND_CREDENTIALS, _source, credentials);
|
||||
emitNet(BankEvents.SEND_CREDENTIALS, _source, credentials);
|
||||
} catch (e) {
|
||||
bankLogger.error(`Failed to fetch credentials, ${e.message}`, {
|
||||
source: _source,
|
||||
|
||||
+17
-23
@@ -1,4 +1,4 @@
|
||||
import events from '../utils/events';
|
||||
import { CallEvents } from '../../typings/call';
|
||||
import { getIdentifierByPhoneNumber, getPlayer, getSource } from './functions';
|
||||
import { getPlayerFromIdentifier } from './functions';
|
||||
import { ICall } from '../../typings/call';
|
||||
@@ -29,7 +29,7 @@ async function fetchCalls(phoneNumber: string): Promise<ICall[]> {
|
||||
|
||||
let calls: Map<string, ICall> = new Map();
|
||||
|
||||
onNet(events.PHONE_INITIALIZE_CALL, async (phoneNumber: string) => {
|
||||
onNet(CallEvents.INITIALIZE_CALL, async (phoneNumber: string) => {
|
||||
const _source = getSource();
|
||||
|
||||
const startCallTimeUnix = new Date().getTime() / 1000;
|
||||
@@ -72,13 +72,13 @@ onNet(events.PHONE_INITIALIZE_CALL, async (phoneNumber: string) => {
|
||||
|
||||
// events
|
||||
// client that is calling
|
||||
emitNet(events.PHONE_START_CALL, _source, transmitterNumber, receiverNumber, true);
|
||||
emitNet(CallEvents.START_CALL, _source, transmitterNumber, receiverNumber, true);
|
||||
|
||||
// client that is being called
|
||||
emitNet(events.PHONE_START_CALL, xReceiver.source, transmitterNumber, receiverNumber, false);
|
||||
emitNet(CallEvents.START_CALL, xReceiver.source, transmitterNumber, receiverNumber, false);
|
||||
});
|
||||
|
||||
onNet(events.PHONE_ACCEPT_CALL, async (transmitterNumber: string) => {
|
||||
onNet(CallEvents.ACCEPT_CALL, async (transmitterNumber: string) => {
|
||||
const pSource = getSource();
|
||||
try {
|
||||
const currentCall = calls.get(transmitterNumber);
|
||||
@@ -91,16 +91,10 @@ onNet(events.PHONE_ACCEPT_CALL, async (transmitterNumber: string) => {
|
||||
await updateCall(currentCall, true, null);
|
||||
|
||||
// player who is being called
|
||||
emitNet(events.PHONE_CALL_WAS_ACCEPTED, pSource, channelId, currentCall, false);
|
||||
emitNet(CallEvents.WAS_ACCEPTED, pSource, channelId, currentCall, false);
|
||||
|
||||
// player who is calling
|
||||
emitNet(
|
||||
events.PHONE_CALL_WAS_ACCEPTED,
|
||||
currentCall.transmitterSource,
|
||||
channelId,
|
||||
currentCall,
|
||||
true,
|
||||
);
|
||||
emitNet(CallEvents.WAS_ACCEPTED, currentCall.transmitterSource, channelId, currentCall, true);
|
||||
|
||||
currentCall.accepted = true;
|
||||
} catch (e) {
|
||||
@@ -110,7 +104,7 @@ onNet(events.PHONE_ACCEPT_CALL, async (transmitterNumber: string) => {
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.PHONE_CALL_REJECTED, async (transmitterNumber: string, timestamp: number) => {
|
||||
onNet(CallEvents.REJECTED, async (transmitterNumber: string, timestamp: number) => {
|
||||
const pSource = getSource();
|
||||
try {
|
||||
const currentCall = calls.get(transmitterNumber);
|
||||
@@ -120,10 +114,10 @@ onNet(events.PHONE_CALL_REJECTED, async (transmitterNumber: string, timestamp: n
|
||||
await updateCall(currentCall, false, timestamp);
|
||||
|
||||
// player who is called and initiasted the rejection.
|
||||
emitNet(events.PHONE_CALL_WAS_REJECTED, currentCall.receiverSource);
|
||||
emitNet(CallEvents.WAS_REJECTED, currentCall.receiverSource);
|
||||
|
||||
// player who is calling and recieved the rejection.
|
||||
emitNet(events.PHONE_CALL_WAS_REJECTED, currentCall.transmitterSource);
|
||||
emitNet(CallEvents.WAS_REJECTED, currentCall.transmitterSource);
|
||||
calls.delete(transmitterNumber);
|
||||
} catch (e) {
|
||||
callLogger.error(`Phone Call Rejected Event Error ${e.message}`, {
|
||||
@@ -132,7 +126,7 @@ onNet(events.PHONE_CALL_REJECTED, async (transmitterNumber: string, timestamp: n
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.PHONE_END_CALL, async (transmitterNumber: string) => {
|
||||
onNet(CallEvents.END_CALL, async (transmitterNumber: string) => {
|
||||
const pSource = getSource();
|
||||
try {
|
||||
const currentTimeUnix = new Date().getTime() / 1000;
|
||||
@@ -145,13 +139,13 @@ onNet(events.PHONE_END_CALL, async (transmitterNumber: string) => {
|
||||
await updateCall(currentCall, false, currentTimeUnix);
|
||||
|
||||
// player who is being called
|
||||
emitNet(events.PHONE_CALL_WAS_ENDED, currentCall.receiverSource);
|
||||
emitNet(CallEvents.WAS_ENDED, currentCall.receiverSource);
|
||||
// player who is calling
|
||||
emitNet(events.PHONE_CALL_WAS_ENDED, currentCall.transmitterSource);
|
||||
emitNet(CallEvents.WAS_ENDED, currentCall.transmitterSource);
|
||||
// ends animations if call is active
|
||||
if (currentCall.accepted) {
|
||||
emitNet(events.PHONE_CALL_SEND_HANGUP_ANIM, currentCall.receiverSource);
|
||||
emitNet(events.PHONE_CALL_SEND_HANGUP_ANIM, currentCall.transmitterSource);
|
||||
emitNet(CallEvents.SEND_HANGUP_ANIM, currentCall.receiverSource);
|
||||
emitNet(CallEvents.SEND_HANGUP_ANIM, currentCall.transmitterSource);
|
||||
}
|
||||
calls.delete(transmitterNumber);
|
||||
} catch (e) {
|
||||
@@ -161,12 +155,12 @@ onNet(events.PHONE_END_CALL, async (transmitterNumber: string) => {
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.PHONE_CALL_FETCH_CALLS, async () => {
|
||||
onNet(CallEvents.FETCH_CALLS, async () => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const phoneNumber = getPlayer(_source).getPhoneNumber();
|
||||
const calls = await fetchCalls(phoneNumber);
|
||||
emitNet(events.PHONE_CALL_SEND_HISTORY, _source, calls);
|
||||
emitNet(CallEvents.SEND_HISTORY, _source, calls);
|
||||
} catch (e) {
|
||||
callLogger.error(`Failed to fetch calls, ${e.message}`, {
|
||||
source: _source,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { pool } from './db';
|
||||
import events from '../utils/events';
|
||||
import { getIdentifier, getSource } from './functions';
|
||||
import { mainLogger } from './sv_logger';
|
||||
import { ContactEvents } from '../../typings/contact';
|
||||
|
||||
const contactsLogger = mainLogger.child({ module: 'contact' });
|
||||
|
||||
@@ -52,30 +52,30 @@ async function deleteContact(contact: ContactId, identifier: string): Promise<an
|
||||
await pool.query(query, [contact.id, identifier]);
|
||||
}
|
||||
|
||||
onNet(events.CONTACTS_GET_CONTACTS, async () => {
|
||||
onNet(ContactEvents.GET_CONTACTS, async () => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const _identifier = getIdentifier(_source);
|
||||
|
||||
const contacts = await fetchAllContacts(_identifier);
|
||||
emitNet(events.CONTACTS_SEND_CONTACTS, _source, contacts);
|
||||
emitNet(ContactEvents.SEND_CONTACTS, _source, contacts);
|
||||
} catch (e) {
|
||||
contactsLogger.error(`Failed to fetch contacts, ${e.message}`);
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.CONTACTS_ADD_CONTACT, async (number: string, display: string, avatar: string) => {
|
||||
onNet(ContactEvents.ADD_CONTACT, async (number: string, display: string, avatar: string) => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const _identifier = getIdentifier(_source);
|
||||
await addContact(_identifier, number, display, avatar);
|
||||
emitNet(events.CONTACTS_ADD_CONTACT_SUCCESS, _source);
|
||||
emitNet(events.CONTACTS_ACTION_RESULT, _source, {
|
||||
emitNet(ContactEvents.ADD_CONTACT_SUCCESS, _source);
|
||||
emitNet(ContactEvents.ACTION_RESULT, _source, {
|
||||
message: 'CONTACT_ADD_SUCCESS',
|
||||
type: 'success',
|
||||
});
|
||||
} catch (e) {
|
||||
emitNet(events.CONTACTS_ACTION_RESULT, _source, {
|
||||
emitNet(ContactEvents.ACTION_RESULT, _source, {
|
||||
message: 'CONTACT_ADD_FAILED',
|
||||
type: 'error',
|
||||
});
|
||||
@@ -85,21 +85,21 @@ onNet(events.CONTACTS_ADD_CONTACT, async (number: string, display: string, avata
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.CONTACTS_UPDATE_CONTACT, async (contact: Contacts) => {
|
||||
onNet(ContactEvents.UPDATE_CONTACT, async (contact: Contacts) => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const _identifier = getIdentifier(_source);
|
||||
await updateContact(contact, _identifier);
|
||||
|
||||
emitNet(events.CONTACTS_UPDATE_CONTACT_SUCCESS, _source);
|
||||
emitNet(ContactEvents.UPDATE_CONTACT_SUCCESS, _source);
|
||||
|
||||
emitNet(events.CONTACTS_ACTION_RESULT, _source, {
|
||||
emitNet(ContactEvents.ACTION_RESULT, _source, {
|
||||
message: 'CONTACT_UPDATE_SUCCESS',
|
||||
type: 'success',
|
||||
});
|
||||
} catch (e) {
|
||||
const _source = (global as any).source;
|
||||
emitNet(events.CONTACTS_ACTION_RESULT, _source, {
|
||||
emitNet(ContactEvents.ACTION_RESULT, _source, {
|
||||
message: 'CONTACT_UPDATE_FAILED',
|
||||
type: 'error',
|
||||
});
|
||||
@@ -109,13 +109,13 @@ onNet(events.CONTACTS_UPDATE_CONTACT, async (contact: Contacts) => {
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.CONTACTS_DELETE_CONTACT, async (contact: ContactId) => {
|
||||
onNet(ContactEvents.DELETE_CONTACT, async (contact: ContactId) => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const _identifier = getIdentifier(_source);
|
||||
await deleteContact(contact, _identifier);
|
||||
emitNet(events.CONTACTS_DELETE_CONTACT_SUCCESS, _source);
|
||||
emitNet(events.CONTACTS_ACTION_RESULT, _source, {
|
||||
emitNet(ContactEvents.DELETE_CONTACT_SUCCESS, _source);
|
||||
emitNet(ContactEvents.ACTION_RESULT, _source, {
|
||||
message: 'CONTACT_DELETE_SUCCESS',
|
||||
type: 'success',
|
||||
});
|
||||
@@ -123,7 +123,7 @@ onNet(events.CONTACTS_DELETE_CONTACT, async (contact: ContactId) => {
|
||||
contactsLogger.error(`Failed to delete contact, ${e.message}`, {
|
||||
source: _source,
|
||||
});
|
||||
emitNet(events.CONTACTS_ACTION_RESULT, _source, {
|
||||
emitNet(ContactEvents.ACTION_RESULT, _source, {
|
||||
message: 'CONTACT_DELETE_FAILED',
|
||||
type: 'error',
|
||||
});
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import events from '../utils/events';
|
||||
import { CreateMessageGroupResult, Message, MessageGroup } from '../../typings/messages';
|
||||
import {
|
||||
CreateMessageGroupResult,
|
||||
Message,
|
||||
MessageGroup,
|
||||
MessageEvents,
|
||||
} from '../../typings/messages';
|
||||
import { pool, withTransaction } from './db';
|
||||
import { getIdentifier, getSource, getPlayerFromIdentifier } from './functions';
|
||||
import { mainLogger } from './sv_logger';
|
||||
@@ -404,104 +408,84 @@ async function setMessageRead(groupId: string, identifier: string) {
|
||||
await pool.query(query, [groupId, identifier]);
|
||||
}
|
||||
|
||||
onNet(events.MESSAGES_FETCH_MESSAGE_GROUPS, async () => {
|
||||
onNet(MessageEvents.FETCH_MESSAGE_GROUPS, async () => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const identifier = getIdentifier(_source);
|
||||
const messageGroups = await getFormattedMessageGroups(identifier);
|
||||
emitNet(events.MESSAGES_FETCH_MESSAGE_GROUPS_SUCCESS, _source, messageGroups);
|
||||
emitNet(MessageEvents.FETCH_MESSAGE_GROUPS_SUCCESS, _source, messageGroups);
|
||||
} catch (e) {
|
||||
emitNet(events.MESSAGES_FETCH_MESSAGE_GROUPS_FAILED, _source);
|
||||
emitNet(MessageEvents.FETCH_MESSAGE_GROUPS_FAILED, _source);
|
||||
messageLogger.error(`Failed to fetch messages groups, ${e.message}`);
|
||||
}
|
||||
});
|
||||
|
||||
onNet(
|
||||
events.MESSAGES_CREATE_MESSAGE_GROUP,
|
||||
async (phoneNumbers: string[], label: string = null) => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const _identifier = getIdentifier(_source);
|
||||
const result = await createMessageGroupsFromPhoneNumbers(_identifier, phoneNumbers, label);
|
||||
onNet(MessageEvents.CREATE_MESSAGE_GROUP, async (phoneNumbers: string[], label: string = null) => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const _identifier = getIdentifier(_source);
|
||||
const result = await createMessageGroupsFromPhoneNumbers(_identifier, phoneNumbers, label);
|
||||
|
||||
if (result.error && result.duplicate) {
|
||||
return emitNet(events.MESSAGES_ACTION_RESULT, _source, {
|
||||
message: 'MESSAGES_MESSAGE_GROUP_DUPLICATE',
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
if (result.error && result.duplicate) {
|
||||
return emitNet(MessageEvents.ACTION_RESULT, _source, {
|
||||
message: 'MESSAGES_MESSAGE_GROUP_DUPLICATE',
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
|
||||
// if the phoneNumber is invalid
|
||||
if (result.error && result.phoneNumber) {
|
||||
return emitNet(events.MESSAGES_ACTION_RESULT, _source, {
|
||||
message: 'MESSAGES_INVALID_PHONE_NUMBER',
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
|
||||
// if you are try to add yourself
|
||||
if (result.error && result.mine) {
|
||||
return emitNet(events.MESSAGES_ACTION_RESULT, _source, {
|
||||
message: 'MESSAGES_MESSAGE_GROUP_CREATE_MINE',
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
|
||||
// if it just fails, welp
|
||||
if (result.error) {
|
||||
emitNet(events.MESSAGES_CREATE_MESSAGE_GROUP_FAILED, _source, result);
|
||||
return emitNet(events.MESSAGES_ACTION_RESULT, _source, {
|
||||
message: `MESSAGES_MESSAGE_GROUP_CREATE_FAILED:`,
|
||||
type: 'error',
|
||||
});
|
||||
} else {
|
||||
emitNet(events.MESSAGES_CREATE_MESSAGE_GROUP_SUCCESS, _source, result);
|
||||
if (result.duplicate) {
|
||||
return;
|
||||
}
|
||||
if (result.identifiers) {
|
||||
for (const participantId of result.identifiers) {
|
||||
// we don't broadcast to the source of the event.
|
||||
if (participantId !== _identifier) {
|
||||
const participantPlayer = getPlayerFromIdentifier(participantId);
|
||||
if (!participantPlayer) {
|
||||
return;
|
||||
}
|
||||
emitNet(events.MESSAGES_FETCH_MESSAGE_GROUPS, participantPlayer.source);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
emitNet(events.MESSAGES_CREATE_MESSAGE_GROUP_FAILED, _source);
|
||||
|
||||
emitNet(events.MESSAGES_ACTION_RESULT, _source, {
|
||||
if (result.error) {
|
||||
emitNet(MessageEvents.CREATE_MESSAGE_GROUP_FAILED, _source, result);
|
||||
return emitNet(MessageEvents.ACTION_RESULT, _source, {
|
||||
message: `MESSAGES_MESSAGE_GROUP_CREATE_FAILED:`,
|
||||
type: 'error',
|
||||
});
|
||||
messageLogger.error(`Failed to create message group, ${e.message}`, {
|
||||
source: _source,
|
||||
e,
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
onNet(events.MESSAGES_FETCH_MESSAGES, async (groupId: string) => {
|
||||
emitNet(MessageEvents.CREATE_MESSAGE_GROUP_SUCCESS, _source, result);
|
||||
if (result.duplicate) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (result.identifiers) {
|
||||
for (const participantId of result.identifiers) {
|
||||
// we don't broadcast to the source of the event.
|
||||
if (participantId !== _identifier) {
|
||||
const participantPlayer = getPlayerFromIdentifier(participantId);
|
||||
if (!participantPlayer) {
|
||||
return;
|
||||
}
|
||||
emitNet(MessageEvents.FETCH_MESSAGE_GROUPS, participantPlayer.source);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
emitNet(MessageEvents.CREATE_MESSAGE_GROUP_FAILED, _source);
|
||||
emitNet(MessageEvents.ACTION_RESULT, _source, {
|
||||
message: `MESSAGES_MESSAGE_GROUP_CREATE_FAILED:`,
|
||||
type: 'error',
|
||||
});
|
||||
messageLogger.error(`Failed to create message group, ${e.message}`, {
|
||||
source: _source,
|
||||
e,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
onNet(MessageEvents.FETCH_MESSAGES, async (groupId: string) => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const _identifier = getIdentifier(_source);
|
||||
const messages = await getMessages(_identifier, groupId);
|
||||
emitNet(events.MESSAGES_FETCH_MESSAGES_SUCCESS, _source, messages);
|
||||
emitNet(MessageEvents.FETCH_MESSAGES_SUCCESS, _source, messages);
|
||||
} catch (e) {
|
||||
emitNet(events.MESSAGES_FETCH_MESSAGES_FAILED, _source);
|
||||
emitNet(MessageEvents.FETCH_MESSAGES_FAILED, _source);
|
||||
messageLogger.error(`Failed to fetch messages, ${e.message}`, {
|
||||
source: _source,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.MESSAGES_SEND_MESSAGE, async (groupId: string, message: string, groupName: string) => {
|
||||
onNet(MessageEvents.SEND_MESSAGE, async (groupId: string, message: string, groupName: string) => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const _identifier = getIdentifier(_source);
|
||||
@@ -509,7 +493,7 @@ onNet(events.MESSAGES_SEND_MESSAGE, async (groupId: string, message: string, gro
|
||||
|
||||
await createMessage(_identifier, groupId, message, userParticipants);
|
||||
|
||||
emitNet(events.MESSAGES_SEND_MESSAGE_SUCCESS, _source, groupId);
|
||||
emitNet(MessageEvents.SEND_MESSAGE_SUCCESS, _source, groupId);
|
||||
|
||||
// gets the identifiers foe the participants for current groupId.
|
||||
|
||||
@@ -520,8 +504,8 @@ onNet(events.MESSAGES_SEND_MESSAGE, async (groupId: string, message: string, gro
|
||||
if (!participantPlayer) {
|
||||
return;
|
||||
}
|
||||
emitNet(events.MESSAGES_FETCH_MESSAGE_GROUPS, participantPlayer.source);
|
||||
emitNet(events.MESSAGES_CREATE_MESSAGE_BROADCAST, participantPlayer.source, {
|
||||
emitNet(MessageEvents.FETCH_MESSAGE_GROUPS, participantPlayer.source);
|
||||
emitNet(MessageEvents.CREATE_MESSAGE_BROADCAST, participantPlayer.source, {
|
||||
groupName,
|
||||
groupId,
|
||||
message,
|
||||
@@ -531,11 +515,11 @@ onNet(events.MESSAGES_SEND_MESSAGE, async (groupId: string, message: string, gro
|
||||
} catch (e) {
|
||||
// Not really sure what this does? As I cant find any reference
|
||||
// of this in the ui part.
|
||||
emitNet(events.MESSAGES_SEND_MESSAGE_FAILED, _source);
|
||||
emitNet(MessageEvents.SEND_MESSAGE_FAILED, _source);
|
||||
// sending a new alert
|
||||
// The message property is always using the locale strings without
|
||||
// the APPS_ prefix.
|
||||
emitNet(events.MESSAGES_ACTION_RESULT, _source, {
|
||||
emitNet(MessageEvents.ACTION_RESULT, _source, {
|
||||
message: 'MESSAGES_NEW_MESSAGE_FAILED',
|
||||
type: 'error',
|
||||
});
|
||||
@@ -545,12 +529,12 @@ onNet(events.MESSAGES_SEND_MESSAGE, async (groupId: string, message: string, gro
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.MESSAGES_SET_MESSAGE_READ, async (groupId: string) => {
|
||||
onNet(MessageEvents.SET_MESSAGE_READ, async (groupId: string) => {
|
||||
const pSource = getSource();
|
||||
try {
|
||||
const identifier = getIdentifier(pSource);
|
||||
await setMessageRead(groupId, identifier);
|
||||
emitNet(events.MESSAGES_FETCH_MESSAGE_GROUPS, pSource);
|
||||
emitNet(MessageEvents.FETCH_MESSAGE_GROUPS, pSource);
|
||||
} catch (e) {
|
||||
messageLogger.error(`Failed to set message as read, ${e.message}`, {
|
||||
source: pSource,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import events from '../utils/events';
|
||||
import { pool } from './db';
|
||||
import { getIdentifier, getSource } from './functions';
|
||||
import { Note, NoteId } from '../../typings/notes';
|
||||
import { Note, NoteId, NotesEvents } from '../../typings/notes';
|
||||
import { mainLogger } from './sv_logger';
|
||||
|
||||
const notesLogger = mainLogger.child({ module: 'notes' });
|
||||
@@ -27,13 +26,13 @@ async function updateNote(note: Note, identifier: string): Promise<any> {
|
||||
await pool.query(query, [note.title, note.content, note.id, identifier]);
|
||||
}
|
||||
|
||||
onNet(events.NOTE_ADD_NOTE, async (note: Note) => {
|
||||
onNet(NotesEvents.ADD_NOTE, async (note: Note) => {
|
||||
const pSource = getSource();
|
||||
try {
|
||||
const _identifier = getIdentifier(pSource);
|
||||
await addNote(_identifier, note);
|
||||
emitNet(events.NOTE_SEND_NOTE_SUCCESS, pSource);
|
||||
emitNet(events.NOTE_ACTION_RESULT, pSource, {
|
||||
emitNet(NotesEvents.SEND_NOTE_SUCCESS, pSource);
|
||||
emitNet(NotesEvents.ACTION_RESULT, pSource, {
|
||||
message: 'NOTES_ADD_SUCCESS',
|
||||
type: 'success',
|
||||
});
|
||||
@@ -41,19 +40,19 @@ onNet(events.NOTE_ADD_NOTE, async (note: Note) => {
|
||||
notesLogger.error(`Failed to add note ${e.message}`, {
|
||||
source: pSource,
|
||||
});
|
||||
emitNet(events.NOTE_ACTION_RESULT, pSource, {
|
||||
emitNet(NotesEvents.ACTION_RESULT, pSource, {
|
||||
message: 'NOTES_ADD_FAILED',
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.NOTE_FETCH_ALL_NOTES, async () => {
|
||||
onNet(NotesEvents.FETCH_ALL_NOTES, async () => {
|
||||
const pSource = getSource();
|
||||
try {
|
||||
const _identifier = getIdentifier(pSource);
|
||||
const notes = await fetchAllNotes(_identifier);
|
||||
emitNet(events.NOTE_SEND_NOTE, pSource, notes);
|
||||
emitNet(NotesEvents.SEND_NOTE, pSource, notes);
|
||||
} catch (e) {
|
||||
notesLogger.error(`Failed to fetch notes ${e.message}`, {
|
||||
source: pSource,
|
||||
@@ -61,45 +60,45 @@ onNet(events.NOTE_FETCH_ALL_NOTES, async () => {
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.NOTE_DELETE_NOTE, async (noteId: NoteId) => {
|
||||
onNet(NotesEvents.DELETE_NOTE, async (noteId: NoteId) => {
|
||||
const pSource = getSource();
|
||||
try {
|
||||
const _identifier = getIdentifier(pSource);
|
||||
await deleteNote(noteId.id, _identifier);
|
||||
|
||||
emitNet(events.NOTE_DELETE_NOTE_SUCCESS, pSource);
|
||||
emitNet(NotesEvents.DELETE_NOTE_SUCCESS, pSource);
|
||||
|
||||
emitNet(events.NOTE_ACTION_RESULT, pSource, {
|
||||
emitNet(NotesEvents.ACTION_RESULT, pSource, {
|
||||
message: 'NOTES_DELETE_SUCCESS',
|
||||
type: 'success',
|
||||
});
|
||||
} catch (e) {
|
||||
const pSource = (global as any).source;
|
||||
notesLogger.error(`Failed to delete note, ${e.message}`);
|
||||
emitNet(events.NOTE_ACTION_RESULT, pSource, {
|
||||
emitNet(NotesEvents.ACTION_RESULT, pSource, {
|
||||
message: 'NOTES_DELETE_FAILED',
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.NOTE_UPDATE_NOTE, async (note: Note) => {
|
||||
onNet(NotesEvents.UPDATE_NOTE, async (note: Note) => {
|
||||
const pSource = getSource();
|
||||
try {
|
||||
const _identifier = getIdentifier(pSource);
|
||||
await updateNote(note, _identifier);
|
||||
emitNet(events.NOTE_UPDATE_NOTE_SUCCESS, pSource);
|
||||
emitNet(NotesEvents.UPDATE_NOTE_SUCCESS, pSource);
|
||||
|
||||
emitNet(events.NOTE_ACTION_RESULT, pSource, {
|
||||
emitNet(NotesEvents.ACTION_RESULT, pSource, {
|
||||
message: 'NOTES_UPDATE_SUCCESS',
|
||||
type: 'success',
|
||||
});
|
||||
} catch (e) {
|
||||
emitNet(events.NOTE_UPDATE_NOTE_FAILURE, pSource);
|
||||
emitNet(NotesEvents.UPDATE_NOTE_FAILURE, pSource);
|
||||
notesLogger.error(`Failed to update note, ${e.message}`, {
|
||||
source: pSource,
|
||||
});
|
||||
emitNet(events.NOTE_ACTION_RESULT, pSource, {
|
||||
emitNet(NotesEvents.ACTION_RESULT, pSource, {
|
||||
message: 'NOTES_UPDATE_FAILED',
|
||||
type: 'error',
|
||||
});
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import events from '../utils/events';
|
||||
import { pool } from './db';
|
||||
import { getIdentifier, getSource } from './functions';
|
||||
import { IPhoto } from '../../typings/photo';
|
||||
import { IPhoto, PhotoEvents } from '../../typings/photo';
|
||||
import { mainLogger } from './sv_logger';
|
||||
|
||||
const photoLogger = mainLogger.child({ module: 'photo' });
|
||||
@@ -22,12 +21,12 @@ async function deletePhoto(photo: IPhoto, identifier: string) {
|
||||
await pool.query(query, [photo.image, identifier]);
|
||||
}
|
||||
|
||||
onNet(events.CAMERA_UPLOAD_PHOTO, async (image: string) => {
|
||||
onNet(PhotoEvents.UPLOAD_PHOTO, async (image: string) => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const identifier = getIdentifier(_source);
|
||||
await uploadPhoto(identifier, image);
|
||||
emitNet(events.CAMERA_UPLOAD_PHOTO_SUCCESS, _source);
|
||||
emitNet(PhotoEvents.UPLOAD_PHOTO_SUCCESS, _source);
|
||||
} catch (e) {
|
||||
photoLogger.error(`Failed to upload photo, ${e.message}`, {
|
||||
source: _source,
|
||||
@@ -35,12 +34,12 @@ onNet(events.CAMERA_UPLOAD_PHOTO, async (image: string) => {
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.CAMERA_FETCH_PHOTOS, async () => {
|
||||
onNet(PhotoEvents.FETCH_PHOTOS, async () => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const identifier = getIdentifier(_source);
|
||||
const photos = await getPhotosByIdentifier(identifier);
|
||||
emitNet(events.CAMERA_SEND_PHOTOS, _source, photos);
|
||||
emitNet(PhotoEvents.SEND_PHOTOS, _source, photos);
|
||||
} catch (e) {
|
||||
photoLogger.error(`Failed to fetch photos, ${e.message}`, {
|
||||
source: _source,
|
||||
@@ -48,12 +47,12 @@ onNet(events.CAMERA_FETCH_PHOTOS, async () => {
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.CAMERA_DELETE_PHOTO, async (photo: IPhoto) => {
|
||||
onNet(PhotoEvents.DELETE_PHOTO, async (photo: IPhoto) => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const identifier = getIdentifier(_source);
|
||||
await deletePhoto(photo, identifier);
|
||||
emitNet(events.CAMERA_DELETE_PHOTO_SUCCESS, _source);
|
||||
emitNet(PhotoEvents.DELETE_PHOTO_SUCCESS, _source);
|
||||
} catch (e) {
|
||||
photoLogger.error(`Failed to fetch photos, ${e.message}`, {
|
||||
source: _source,
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import events from '../utils/events';
|
||||
import { getIdentifier, getPlayer, getSource } from './functions';
|
||||
import { ESX } from './server';
|
||||
import { pool } from './db';
|
||||
import { mainLogger } from './sv_logger';
|
||||
import { MarketplaceListing } from '../../typings/marketplace';
|
||||
import { reportListingToDiscord } from './discord';
|
||||
import { MarketplaceEvents } from '../../typings/marketplace';
|
||||
|
||||
const selloutLogger = mainLogger.child({ module: 'sellout' });
|
||||
|
||||
@@ -62,11 +61,11 @@ async function doesReportExist(listingId: number, profile: string): Promise<bool
|
||||
return result.length > 0;
|
||||
}
|
||||
|
||||
onNet(events.SELLOUT_FETCH_LISTING, async () => {
|
||||
onNet(MarketplaceEvents.FETCH_LISTING, async () => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const listings = await fetchAllListings();
|
||||
emitNet(events.SELLOUT_SEND_LISTING, _source, listings);
|
||||
emitNet(MarketplaceEvents.SEND_LISTING, _source, listings);
|
||||
} catch (e) {
|
||||
selloutLogger.error(`Failed to fetch listings, ${e.message}`, {
|
||||
source: _source,
|
||||
@@ -74,7 +73,7 @@ onNet(events.SELLOUT_FETCH_LISTING, async () => {
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.SELLOUT_ADD_LISTING, async (listing: MarketplaceListing) => {
|
||||
onNet(MarketplaceEvents.ADD_LISTING, async (listing: MarketplaceListing) => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const player = getPlayer(_source);
|
||||
@@ -88,8 +87,8 @@ onNet(events.SELLOUT_ADD_LISTING, async (listing: MarketplaceListing) => {
|
||||
listing,
|
||||
);
|
||||
|
||||
emitNet(events.SELLOUT_ADD_LISTING_SUCCESS, _source);
|
||||
emitNet(events.SELLOUT_ACTION_RESULT, _source, {
|
||||
emitNet(MarketplaceEvents.ADD_LISTING_SUCCESS, _source);
|
||||
emitNet(MarketplaceEvents.ACTION_RESULT, _source, {
|
||||
message: 'MARKETPLACE_CREATE_LISTING_SUCCESS',
|
||||
type: 'success',
|
||||
});
|
||||
@@ -98,14 +97,14 @@ onNet(events.SELLOUT_ADD_LISTING, async (listing: MarketplaceListing) => {
|
||||
source: _source,
|
||||
});
|
||||
|
||||
emitNet(events.SELLOUT_ACTION_RESULT, _source, {
|
||||
emitNet(MarketplaceEvents.ACTION_RESULT, _source, {
|
||||
message: 'MARKETPLACE_CREATE_LISTING_FAILED',
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.SELLOUT_DELETE_LISTING, async (listingId: number) => {
|
||||
onNet(MarketplaceEvents.DELETE_LISTING, async (listingId: number) => {
|
||||
const pSource = getSource();
|
||||
try {
|
||||
const identifier = getIdentifier(pSource);
|
||||
@@ -113,9 +112,9 @@ onNet(events.SELLOUT_DELETE_LISTING, async (listingId: number) => {
|
||||
await deleteListing(listingId, identifier);
|
||||
|
||||
// fetches the listings again
|
||||
emitNet(events.SELLOUT_DELETE_LISTING_SUCCESS, pSource);
|
||||
emitNet(MarketplaceEvents.DELETE_LISTING_SUCCESS, pSource);
|
||||
|
||||
emitNet(events.SELLOUT_ACTION_RESULT, pSource, {
|
||||
emitNet(MarketplaceEvents.ACTION_RESULT, pSource, {
|
||||
message: 'MARKETPLACE_DELETE_LISTING_SUCCESS',
|
||||
type: 'success',
|
||||
});
|
||||
@@ -123,14 +122,14 @@ onNet(events.SELLOUT_DELETE_LISTING, async (listingId: number) => {
|
||||
selloutLogger.error(`Failed to delete listing ${e.message}`, {
|
||||
source: pSource,
|
||||
});
|
||||
emitNet(events.SELLOUT_ACTION_RESULT, pSource, {
|
||||
emitNet(MarketplaceEvents.ACTION_RESULT, pSource, {
|
||||
message: 'MARKETPLACE_DELETE_LISTING_FAILED',
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.SELLOUT_REPORT_LISTING, async (listing: MarketplaceListing) => {
|
||||
onNet(MarketplaceEvents.REPORT_LISTING, async (listing: MarketplaceListing) => {
|
||||
const pSource = getSource();
|
||||
|
||||
try {
|
||||
@@ -142,7 +141,7 @@ onNet(events.SELLOUT_REPORT_LISTING, async (listing: MarketplaceListing) => {
|
||||
if (reportExists) {
|
||||
// send an info alert
|
||||
selloutLogger.error(`This listing has already been reported`);
|
||||
return emitNet(events.SELLOUT_ACTION_RESULT, pSource, {
|
||||
return emitNet(MarketplaceEvents.ACTION_RESULT, pSource, {
|
||||
message: 'MARKETPLACE_REPORT_LISTING_FAILED',
|
||||
type: 'info',
|
||||
});
|
||||
@@ -151,7 +150,7 @@ onNet(events.SELLOUT_REPORT_LISTING, async (listing: MarketplaceListing) => {
|
||||
await reportListing(rListing.id, rListing.name);
|
||||
await reportListingToDiscord(rListing, reportingPlayer);
|
||||
|
||||
emitNet(events.SELLOUT_ACTION_RESULT, pSource, {
|
||||
emitNet(MarketplaceEvents.ACTION_RESULT, pSource, {
|
||||
message: 'MARKETPLACE_REPORT_LISTING_SUCCESS',
|
||||
type: 'success',
|
||||
});
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import { ResultSetHeader } from 'mysql2';
|
||||
|
||||
import { pool } from './db';
|
||||
import { getIdentifier, getSource } from './functions';
|
||||
import { NewTweet, Tweet, Profile } from '../../typings/twitter';
|
||||
import events from '../utils/events';
|
||||
import config from '../utils/config';
|
||||
import { reportTweetToDiscord } from './discord';
|
||||
import { mainLogger } from './sv_logger';
|
||||
import { generateProfileName, getDefaultProfileNames } from './players/sv_players';
|
||||
import { TwitterEvents } from '../../typings/twitter';
|
||||
|
||||
const twitterLogger = mainLogger.child({ module: 'twitter' });
|
||||
|
||||
@@ -310,36 +309,35 @@ async function doesRetweetExist(tweetId: number, identifier: string): Promise<bo
|
||||
return counts[0].count > 0;
|
||||
}
|
||||
|
||||
onNet(events.TWITTER_GET_OR_CREATE_PROFILE, async () => {
|
||||
onNet(TwitterEvents.GET_OR_CREATE_PROFILE, async () => {
|
||||
const _source = getSource();
|
||||
const identifier = getIdentifier(_source);
|
||||
|
||||
try {
|
||||
const profile = await getOrCreateProfile(identifier);
|
||||
|
||||
// if we got null from getOrCreateProfile it means it doesn't exist and
|
||||
// we failed to create it. In this case we pass the UI some default
|
||||
// profile names it can choose from
|
||||
if (!profile) {
|
||||
const defaultProfileNames = await getDefaultProfileNames(identifier);
|
||||
emitNet(events.TWITTER_GET_OR_CREATE_PROFILE_NULL, _source, defaultProfileNames);
|
||||
emitNet(TwitterEvents.GET_OR_CREATE_PROFILE_NULL, _source, defaultProfileNames);
|
||||
} else {
|
||||
emitNet(events.TWITTER_GET_OR_CREATE_PROFILE_SUCCESS, _source, profile);
|
||||
emitNet(TwitterEvents.GET_OR_CREATE_PROFILE_SUCCESS, _source, profile);
|
||||
}
|
||||
} catch (e) {
|
||||
twitterLogger.error(`Failed to get or create profile, ${e.message}`, {
|
||||
source: _source,
|
||||
});
|
||||
emitNet(events.TWITTER_GET_OR_CREATE_PROFILE_FAILURE, _source);
|
||||
emitNet(TwitterEvents.GET_OR_CREATE_PROFILE_FAILURE, _source);
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_CREATE_PROFILE, async (profile: Profile) => {
|
||||
onNet(TwitterEvents.CREATE_PROFILE, async (profile: Profile) => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const identifier = getIdentifier(_source);
|
||||
await createProfile(identifier, profile.profile_name);
|
||||
emitNet(events.TWITTER_CREATE_PROFILE_RESULT, _source, {
|
||||
emitNet(TwitterEvents.CREATE_PROFILE_RESULT, _source, {
|
||||
message: 'TWITTER_CREATE_PROFILE_SUCCESS',
|
||||
type: 'success',
|
||||
});
|
||||
@@ -347,19 +345,19 @@ onNet(events.TWITTER_CREATE_PROFILE, async (profile: Profile) => {
|
||||
twitterLogger.error(`Failed to create twitter profile: ${e.message}`, {
|
||||
source: _source,
|
||||
});
|
||||
emitNet(events.TWITTER_CREATE_PROFILE_RESULT, _source, {
|
||||
emitNet(TwitterEvents.CREATE_PROFILE_RESULT, _source, {
|
||||
message: 'TWITTER_CREATE_PROFILE_FAILURE',
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_UPDATE_PROFILE, async (profile: Profile) => {
|
||||
onNet(TwitterEvents.UPDATE_PROFILE, async (profile: Profile) => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const identifier = getIdentifier(_source);
|
||||
await updateProfile(identifier, profile);
|
||||
emitNet(events.TWITTER_UPDATE_PROFILE_RESULT, _source, {
|
||||
emitNet(TwitterEvents.UPDATE_PROFILE_RESULT, _source, {
|
||||
message: 'TWITTER_EDIT_PROFILE_SUCCESS',
|
||||
type: 'success',
|
||||
});
|
||||
@@ -367,14 +365,14 @@ onNet(events.TWITTER_UPDATE_PROFILE, async (profile: Profile) => {
|
||||
twitterLogger.error(`Failed to update twitter profile: ${e.message}`, {
|
||||
source: _source,
|
||||
});
|
||||
emitNet(events.TWITTER_UPDATE_PROFILE_RESULT, _source, {
|
||||
emitNet(TwitterEvents.UPDATE_PROFILE_RESULT, _source, {
|
||||
message: 'TWITTER_EDIT_PROFILE_FAILURE',
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_FETCH_TWEETS, async () => {
|
||||
onNet(TwitterEvents.FETCH_TWEETS, async () => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const identifier = getIdentifier(_source);
|
||||
@@ -387,63 +385,63 @@ onNet(events.TWITTER_FETCH_TWEETS, async () => {
|
||||
}
|
||||
|
||||
const tweets = await fetchAllTweets(profile.id);
|
||||
emitNet(events.TWITTER_FETCH_TWEETS_SUCCESS, _source, tweets);
|
||||
emitNet(TwitterEvents.FETCH_TWEETS_SUCCESS, _source, tweets);
|
||||
} catch (e) {
|
||||
twitterLogger.error(`Fetching tweets failed, ${e.message}`, {
|
||||
source: _source,
|
||||
});
|
||||
emitNet(events.TWITTER_FETCH_TWEETS_FAILURE, _source);
|
||||
emitNet(TwitterEvents.FETCH_TWEETS_FAILURE, _source);
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_FETCH_TWEETS_FILTERED, async (searchValue: string) => {
|
||||
onNet(TwitterEvents.FETCH_TWEETS_FILTERED, async (searchValue: string) => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const identifier = getIdentifier(_source);
|
||||
const profile = await getProfile(identifier);
|
||||
const tweets = await fetchTweetsFiltered(profile.id, searchValue);
|
||||
emitNet(events.TWITTER_FETCH_TWEETS_FILTERED_SUCCESS, _source, tweets);
|
||||
emitNet(TwitterEvents.FETCH_TWEETS_FILTERED_SUCCESS, _source, tweets);
|
||||
} catch (e) {
|
||||
twitterLogger.error(`Fetch filtered tweets failed, ${e.message}`, {
|
||||
source: _source,
|
||||
});
|
||||
emitNet(events.TWITTER_FETCH_TWEETS_FILTERED_FAILURE, _source);
|
||||
emitNet(TwitterEvents.FETCH_TWEETS_FILTERED_FAILURE, _source);
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_CREATE_TWEET, async (tweet: Tweet) => {
|
||||
onNet(TwitterEvents.CREATE_TWEET, async (tweet: Tweet) => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const identifier = getIdentifier(_source);
|
||||
const createdTweet = await createTweet(identifier, tweet);
|
||||
emitNet(events.TWITTER_CREATE_TWEET_BROADCAST, -1, createdTweet);
|
||||
emitNet(TwitterEvents.CREATE_TWEET_BROADCAST, -1, createdTweet);
|
||||
} catch (e) {
|
||||
twitterLogger.error(`Create tweet failed, ${e.message}`, {
|
||||
source: _source,
|
||||
});
|
||||
emitNet(events.TWITTER_CREATE_TWEET_RESULT, _source, {
|
||||
emitNet(TwitterEvents.CREATE_TWEET_RESULT, _source, {
|
||||
message: 'TWITTER_CREATE_FAILED',
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_DELETE_TWEET, async (tweetId: number) => {
|
||||
onNet(TwitterEvents.DELETE_TWEET, async (tweetId: number) => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const identifier = getIdentifier(_source);
|
||||
await deleteTweet(identifier, tweetId);
|
||||
|
||||
emitNet(events.TWITTER_DELETE_TWEET_SUCCESS, _source);
|
||||
emitNet(TwitterEvents.DELETE_TWEET_SUCCESS, _source);
|
||||
} catch (e) {
|
||||
twitterLogger.error(`Delete tweet failed, ${e.message}`, {
|
||||
source: _source,
|
||||
});
|
||||
emitNet(events.TWITTER_DELETE_TWEET_FAILURE, _source);
|
||||
emitNet(TwitterEvents.DELETE_TWEET_FAILURE, _source);
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_TOGGLE_LIKE, async (tweetId: number) => {
|
||||
onNet(TwitterEvents.TOGGLE_LIKE, async (tweetId: number) => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const identifier = getIdentifier(_source);
|
||||
@@ -454,16 +452,16 @@ onNet(events.TWITTER_TOGGLE_LIKE, async (tweetId: number) => {
|
||||
} else {
|
||||
await createLike(profile.id, tweetId);
|
||||
}
|
||||
emitNet(events.TWITTER_TOGGLE_LIKE_SUCCESS, _source);
|
||||
emitNet(TwitterEvents.TOGGLE_LIKE_SUCCESS, _source);
|
||||
} catch (e) {
|
||||
twitterLogger.error(`Like failed, ${e.message}`, {
|
||||
source: _source,
|
||||
});
|
||||
emitNet(events.TWITTER_TOGGLE_LIKE_FAILURE, _source);
|
||||
emitNet(TwitterEvents.TOGGLE_LIKE_FAILURE, _source);
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_RETWEET, async (tweetId: number) => {
|
||||
onNet(TwitterEvents.RETWEET, async (tweetId: number) => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const identifier = getIdentifier(_source);
|
||||
@@ -471,7 +469,7 @@ onNet(events.TWITTER_RETWEET, async (tweetId: number) => {
|
||||
// alert the player that they have already retweeted
|
||||
// this post (or that they are the original poster)
|
||||
if (await doesRetweetExist(tweetId, identifier)) {
|
||||
return emitNet(events.TWITTER_RETWEET_EXISTS, _source, {
|
||||
return emitNet(TwitterEvents.RETWEET_EXISTS, _source, {
|
||||
message: 'TWITTER_RETWEET_EXISTS',
|
||||
type: 'error',
|
||||
});
|
||||
@@ -485,16 +483,16 @@ onNet(events.TWITTER_RETWEET, async (tweetId: number) => {
|
||||
|
||||
const profile = await getProfile(identifier);
|
||||
const tweet = await getTweet(profile.id, createdTweet.id);
|
||||
emitNet(events.TWITTER_CREATE_TWEET_BROADCAST, -1, tweet);
|
||||
emitNet(TwitterEvents.CREATE_TWEET_BROADCAST, -1, tweet);
|
||||
} catch (e) {
|
||||
twitterLogger.error(`Retweet failed, ${e.message}`, {
|
||||
source: _source,
|
||||
});
|
||||
emitNet(events.TWITTER_RETWEET_FAILURE, _source);
|
||||
emitNet(TwitterEvents.RETWEET_FAILURE, _source);
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.TWITTER_REPORT, async (tweetId: number) => {
|
||||
onNet(TwitterEvents.REPORT, async (tweetId: number) => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const identifier = getIdentifier(_source);
|
||||
@@ -510,9 +508,9 @@ onNet(events.TWITTER_REPORT, async (tweetId: number) => {
|
||||
await createTweetReport(tweet.id, profile.id);
|
||||
await reportTweetToDiscord(tweet, profile);
|
||||
|
||||
emitNet(events.TWITTER_REPORT_SUCCESS, _source);
|
||||
emitNet(TwitterEvents.REPORT_SUCCESS, _source);
|
||||
} catch (e) {
|
||||
emitNet(events.TWITTER_REPORT_FAILURE, _source);
|
||||
emitNet(TwitterEvents.REPORT_FAILURE, _source);
|
||||
twitterLogger.error(`Twitter report failed, ${e.message}`, {
|
||||
source: _source,
|
||||
});
|
||||
|
||||
@@ -1,133 +0,0 @@
|
||||
export default {
|
||||
// Twitter
|
||||
TWITTER_FETCH_TWEETS: 'phone:fetchTweets',
|
||||
TWITTER_FETCH_TWEETS_SUCCESS: 'fetchTweets',
|
||||
TWITTER_FETCH_TWEETS_FAILURE: 'fetchTweetsFailed',
|
||||
TWITTER_FETCH_TWEETS_FILTERED: 'phone:fetchTweetsFiltered',
|
||||
TWITTER_FETCH_TWEETS_FILTERED_SUCCESS: 'fetchTweetsFiltered',
|
||||
TWITTER_FETCH_TWEETS_FILTERED_FAILURE: 'fetchTweetsFilteredFailed',
|
||||
TWITTER_GET_OR_CREATE_PROFILE: 'phone:getOrCreateTwitterProfile',
|
||||
TWITTER_GET_OR_CREATE_PROFILE_SUCCESS: 'getOrCreateTwitterProfile',
|
||||
TWITTER_GET_OR_CREATE_PROFILE_NULL: 'getOrCreateTwitterProfileNull',
|
||||
TWITTER_GET_OR_CREATE_PROFILE_FAILURE: 'getOrCreateTwitterProfileFailed',
|
||||
TWITTER_CREATE_PROFILE: 'phone:createTwitterProfile',
|
||||
TWITTER_CREATE_PROFILE_RESULT: 'phone:createProfileResult',
|
||||
TWITTER_UPDATE_PROFILE: 'phone:updateTwitterProfile',
|
||||
TWITTER_UPDATE_PROFILE_LOADING: 'updateProfileLoading',
|
||||
TWITTER_UPDATE_PROFILE_RESULT: 'updateProfileResult',
|
||||
TWITTER_CREATE_TWEET: 'phone:createTweet',
|
||||
TWITTER_CREATE_TWEET_LOADING: 'createTweetLoading',
|
||||
TWITTER_CREATE_TWEET_RESULT: 'createTweetResult',
|
||||
TWITTER_CREATE_TWEET_BROADCAST: 'createTweetBroadcast',
|
||||
TWITTER_CREATE_TWEET_FAILURE: 'createTweetResultFailed',
|
||||
TWITTER_DELETE_TWEET: 'phone:deleteTweet',
|
||||
TWITTER_DELETE_TWEET_SUCCESS: 'deleteTweetSuccess',
|
||||
TWITTER_DELETE_TWEET_FAILURE: 'deleteTweetFailed',
|
||||
TWITTER_TOGGLE_LIKE: 'phone:toggleLike',
|
||||
TWITTER_TOGGLE_LIKE_SUCCESS: 'toggleLikeSuccess',
|
||||
TWITTER_TOGGLE_LIKE_FAILURE: 'toggleLikeFailed',
|
||||
TWITTER_RETWEET: 'phone:retweet',
|
||||
TWITTER_RETWEET_SUCCESS: 'phone:retweetSuccess',
|
||||
TWITTER_RETWEET_EXISTS: 'phone:retweetExists',
|
||||
TWITTER_RETWEET_FAILURE: 'phone:retweetFailed',
|
||||
TWITTER_REPORT: 'phone:reportTweet',
|
||||
TWITTER_REPORT_SUCCESS: 'reportTweetSuccess',
|
||||
TWITTER_REPORT_FAILURE: 'reportTweetFailed',
|
||||
|
||||
// Contacts
|
||||
CONTACTS_SEND_CONTACTS: 'phone:sendContacts',
|
||||
CONTACTS_GET_CONTACTS: 'phone:getContacts',
|
||||
CONTACTS_ADD_CONTACT_NUI: 'contacts:add',
|
||||
CONTACTS_ADD_CONTACT: 'phone:addContacts',
|
||||
CONTACTS_ADD_CONTACT_SUCCESS: 'contacts:addSuccess',
|
||||
CONTACTS_UPDATE_CONTACT: 'phone:updateContact',
|
||||
CONTACTS_DELETE_CONTACT: 'phone:deleteContact',
|
||||
CONTACTS_DELETE_CONTACT_SUCCESS: 'contacts:deleteSuccess',
|
||||
CONTACTS_UPDATE_CONTACT_SUCCESS: 'phone:updateContactSuccess',
|
||||
CONTACTS_ACTION_RESULT: 'phone:contactActionResult',
|
||||
|
||||
// Sellout
|
||||
// these event keys needs to be changed to 'MARKETPLACE'
|
||||
SELLOUT_ADD_LISTING: 'phone:addListing',
|
||||
SELLOUT_ADD_LISTING_SUCCESS: 'phone:addListingSuccess',
|
||||
SELLOUT_FETCH_LISTING: 'phone:fetchAllListings',
|
||||
SELLOUT_SEND_LISTING: 'phone:sendAllListings',
|
||||
SELLOUT_ACTION_RESULT: 'phone:selloutActionResult',
|
||||
SELLOUT_DELETE_LISTING: 'phone:marketplaceDeleteListing',
|
||||
SELLOUT_DELETE_LISTING_SUCCESS: 'phone:marketplaceDeleteListingSuccess',
|
||||
SELLOUT_REPORT_LISTING: 'phone:reportListing',
|
||||
SELLOUT_REPORT_LISTING_SUCCESS: 'phone:reportListingSuccess',
|
||||
SELLOUT_REPORT_LISTING_SUCESS: 'phone:reportListingFailed',
|
||||
|
||||
//
|
||||
BANK_ADD_TRANSFER: 'phone:addTransfer',
|
||||
BANK_ADD_TRANSFER_SUCCESS: 'phone:addTransferSuccess',
|
||||
BANK_FETCH_TRANSACTIONS: 'phone:fetchAllTransactions',
|
||||
BANK_SEND_TRANSFERS: 'phone:sendTransfers',
|
||||
BANK_TRANSACTION_ALERT: 'phone:bankTransactionAlert',
|
||||
BANK_TRANSACTION_NOTIFICATION: 'phone:bankTransactionNotification',
|
||||
BANK_SEND_CREDENTIALS: 'phone:sendBankCredentials',
|
||||
BANK_GET_CREDENTIALS: 'phone:getBankCredentials',
|
||||
|
||||
//messages
|
||||
MESSAGES_FETCH_MESSAGE_GROUPS: 'phone:fetchMessageGroups',
|
||||
MESSAGES_FETCH_MESSAGE_GROUPS_SUCCESS: 'phone:fetchMessageGroupsSuccess',
|
||||
MESSAGES_FETCH_MESSAGE_GROUPS_FAILED: 'phone:fetchMessageGroupsFailed',
|
||||
MESSAGES_CREATE_MESSAGE_GROUP: 'phone:createMessageGroup',
|
||||
MESSAGES_CREATE_MESSAGE_GROUP_SUCCESS: 'phone:createMessageGroupSuccess',
|
||||
MESSAGES_CREATE_MESSAGE_GROUP_FAILED: 'phone:createMessageGroupFailed',
|
||||
MESSAGES_SEND_MESSAGE: 'phone:sendMessage',
|
||||
MESSAGES_SEND_MESSAGE_SUCCESS: 'phone:sendMessageSuccess',
|
||||
MESSAGES_SEND_MESSAGE_FAILED: 'phone:sendMessageFailed',
|
||||
MESSAGES_FETCH_MESSAGES: 'phone:fetchMessages',
|
||||
MESSAGES_FETCH_MESSAGES_SUCCESS: 'phone:fetchMessagesSuccess',
|
||||
MESSAGES_FETCH_MESSAGES_FAILED: 'phone:fetchMessagesFailed',
|
||||
MESSAGES_ACTION_RESULT: 'phone:setMessagesAlert',
|
||||
MESSAGES_CREATE_MESSAGE_BROADCAST: 'createMessagesBroadcast',
|
||||
MESSAGES_SET_MESSAGE_READ: 'phone:setReadMessages',
|
||||
|
||||
// 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_DELETE_NOTE_SUCCESS: 'phone:deleteNoteSuccess',
|
||||
NOTE_UPDATE_NOTE: 'phone:updateNote',
|
||||
NOTE_UPDATE_NOTE_SUCCESS: 'phone:updateNoteSuccess',
|
||||
NOTE_UPDATE_NOTE_FAILURE: 'phone:updateNoteFailure',
|
||||
NOTE_ACTION_RESULT: 'phone:notesActionResult',
|
||||
|
||||
// DO NOT CHANGE WHATS BELOW, PLEASE - CHIP
|
||||
PLAYER_IS_READY: 'phone:playerIsReady',
|
||||
OPEN_APP_CONTACTS: 'phone:app:CONTACTS',
|
||||
OPEN_APP_BANK: 'phone:app:BANK',
|
||||
OPEN_APP_NOTES: 'phone:app:NOTES',
|
||||
OPEN_APP_LISTINGS: 'phone:app:SELLOUT',
|
||||
OPEN_APP_CAMERA: 'phone:app:CAMERA',
|
||||
OPEN_APP_DAILER: 'phone:app:DIALER',
|
||||
|
||||
// camera
|
||||
CAMERA_TAKE_PHOTO: 'phone:TakePhoto',
|
||||
CAMERA_UPLOAD_PHOTO: 'phone:UploadPhoto',
|
||||
CAMERA_UPLOAD_PHOTO_SUCCESS: 'phone:UploadPhotoSuccess',
|
||||
CAMERA_FETCH_PHOTOS: 'phone:FetchPhotos',
|
||||
CAMERA_SEND_PHOTOS: 'phone:SendPhotos',
|
||||
CAMERA_DELETE_PHOTO: 'photo:deletePhoto',
|
||||
CAMERA_DELETE_PHOTO_SUCCESS: 'phone:deletePhotoSuccess',
|
||||
// copy
|
||||
PHONE_USE_CLIPBOARD: 'phone:useClipboard',
|
||||
|
||||
// calling
|
||||
PHONE_INITIALIZE_CALL: 'phone:beginCall',
|
||||
PHONE_START_CALL: 'phone:startCall',
|
||||
PHONE_ACCEPT_CALL: 'phone:acceptCall',
|
||||
PHONE_END_CALL: 'phone:endCall',
|
||||
PHONE_CALL_WAS_ENDED: 'phone:callEnded',
|
||||
PHONE_CALL_WAS_ACCEPTED: 'phone:callAccepted',
|
||||
PHONE_CALL_REJECTED: 'phone:rejectCall',
|
||||
PHONE_CALL_WAS_REJECTED: 'phone:callRejected',
|
||||
PHONE_CALL_FETCH_CALLS: 'phone:fetchCalls',
|
||||
PHONE_CALL_SEND_HISTORY: 'phone:sendCallHistory',
|
||||
PHONE_CALL_SEND_HANGUP_ANIM: 'phone:sendHangupAnim',
|
||||
};
|
||||
Reference in new issue
Block a user