tweak(resources/main): fetch contacts on initalize

This commit is contained in:
Christopher committed 2021-02-17 18:36:48 +01:00
1 parent cf4baafb19
commit db5ef05687
1 file changed
+4 -7
+4 -7
View File
@@ -269,6 +269,7 @@ const togglePhoneVisible = async (): Promise<void> => {
* * * * * * * * * * * * */ * * * * * * * * * * * * */
async function Phone(): Promise<void> { async function Phone(): Promise<void> {
fetchOnInitialize()
if (config.PhoneAsItem) { if (config.PhoneAsItem) {
// TODO: Do promise callback here // TODO: Do promise callback here
// const hasPhoneItem = await emitNetPromise('phone:hasPhoneItem') // const hasPhoneItem = await emitNetPromise('phone:hasPhoneItem')
@@ -314,7 +315,6 @@ onNet('phone:sendCredentials', (number: string) => {
}); });
// DO NOT CHANGE THIS EITHER, PLEASE - CHIP // DO NOT CHANGE THIS EITHER, PLEASE - CHIP
/* * * * * * * * * * * * * /* * * * * * * * * * * * *
@@ -323,12 +323,10 @@ onNet('phone:sendCredentials', (number: string) => {
* *
* * * * * * * * * * * * */ * * * * * * * * * * * * */
// contacts app function fetchOnInitialize() {
RegisterNuiCallbackType(events.OPEN_APP_CONTACTS);
on(`__cfx_nui:${events.OPEN_APP_CONTACTS}`, (data: any, cb: Function) => {
emitNet(events.CONTACTS_GET_CONTACTS); emitNet(events.CONTACTS_GET_CONTACTS);
cb(); }
});
RegisterNuiCallbackType(events.OPEN_APP_LISTINGS); RegisterNuiCallbackType(events.OPEN_APP_LISTINGS);
on(`__cfx_nui:${events.OPEN_APP_LISTINGS}`, (data: any, cb: Function) => { on(`__cfx_nui:${events.OPEN_APP_LISTINGS}`, (data: any, cb: Function) => {
@@ -357,7 +355,6 @@ on(`__cfx_nui:${events.OPEN_APP_CAMERA}`, (data: any, cb: Function) => {
RegisterNuiCallbackType(events.OPEN_APP_DAILER); RegisterNuiCallbackType(events.OPEN_APP_DAILER);
on(`__cfx_nui:${events.OPEN_APP_DAILER}`, (data: any, cb: Function) => { on(`__cfx_nui:${events.OPEN_APP_DAILER}`, (data: any, cb: Function) => {
emitNet(events.CONTACTS_GET_CONTACTS);
emitNet(events.PHONE_CALL_FETCH_CALLS); emitNet(events.PHONE_CALL_FETCH_CALLS);
cb(); cb();
}); });