feat/messages additions (in memory of Leonard Nimoy) (#118)

* feat(resouces/messages): broadcast messagse to participants

* feat(phone/messages): notifications for messages

* remove weird empty onNet

* reformat?

* last reformat! This pr will be squashed

* tweak(phone/messages): send groupName to notification alert

* fix identifer

* fixing notification groupName

* resbasee...i think

* feat(messages): check for unread messages

* send nui event is count > 0

* remove usless test

* import.sql update

* Refactor NotificationsProvider and fix messages notifications

* Send groupId on message broadcast

* Update phone/src/apps/messages/components/modal/Conversation.tsx

* Update phone/src/apps/messages/hooks/useMessageNotifications.ts

* Update phone/src/os/notifications/providers/NotificationsProvider.tsx

* Update phone/src/common/typings/messages.ts

* Update phone/src/apps/messages/hooks/useMessageNotifications.ts

* clean sql file

* Update resources/server/sv_messages.ts

* Fetch message groups when other person created for you

* fix sql

* Select unreadCount from messageGroups

* whatever husky again

* Add members menu and add contact in messages

* Add from group bubbles

* Fix messages scroll with new msg

* Message image menu flicker + justify bottom messages

* Improve debugging

* Add container to Slider

* Improve logger

* Fix create message

* add creator identifier to group hash

* Fix dafuq i broke

* group_id bigger varchar in column

* group_id bigger varchar in column

* Phone visibility default browser

* Add debugging

Co-authored-by: J Francisco Rader <[email protected]>
Co-authored-by: J Francisco Rader <[email protected]>
This commit is contained in:
authored and GitHub committed 2021-03-04 18:35:33 -05:00
1 parent 42d3d573cb
commit 9abac70427
38 files changed
+634 -328

No files matched your search

+21 -2
View File
@@ -1,5 +1,10 @@
import events from '../utils/events';
import { Message, MessageGroup } from '../../phone/src/common/typings/messages';
import {
CreateMessageBroadcast,
Message,
MessageGroup,
SetMessageRead,
} from '../../phone/src/common/typings/messages';
import { sendMessageEvent } from '../utils/messages';
/**
@@ -19,6 +24,10 @@ onNet(events.MESSAGES_FETCH_MESSAGE_GROUPS_FAILED, () => {
sendMessageEvent(events.MESSAGES_FETCH_MESSAGE_GROUPS_FAILED);
});
onNet(events.MESSAGES_FETCH_MESSAGE_GROUPS, () => {
emitNet(events.MESSAGES_FETCH_MESSAGE_GROUPS);
});
/**
* Messages create message group
*/
@@ -49,6 +58,12 @@ on(`__cfx_nui:${events.MESSAGES_FETCH_MESSAGES}`, ({ groupId }: any, cb: Functio
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);
cb();
});
onNet(events.MESSAGES_FETCH_MESSAGES_SUCCESS, (messages: Message[]): void => {
sendMessageEvent(events.MESSAGES_FETCH_MESSAGES_SUCCESS, messages);
});
@@ -62,7 +77,7 @@ onNet(events.MESSAGES_FETCH_MESSAGES_FAILED, (): void => {
*/
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);
emitNet(events.MESSAGES_SEND_MESSAGE, data.groupId, data.message, data.groupName);
cb();
});
@@ -78,3 +93,7 @@ onNet(events.MESSAGES_SEND_MESSAGE_FAILED, () => {
onNet(events.MESSAGES_ACTION_RESULT, (result: any) => {
sendMessageEvent(events.MESSAGES_ACTION_RESULT, result);
});
onNet(events.MESSAGES_CREATE_MESSAGE_BROADCAST, (result: CreateMessageBroadcast) => {
sendMessageEvent(events.MESSAGES_CREATE_MESSAGE_BROADCAST, result);
});