feat(resources/messages): server and client functionality for alerts

This commit is contained in:
Christopher committed 2021-02-28 01:37:22 +01:00
1 parent ec913fbef4
commit 09d397b6cf
3 files changed
+15 -17

No files matched your search

+4
View File
@@ -86,3 +86,7 @@ onNet(events.MESSAGES_SEND_MESSAGE_SUCCESS, (groupId: string) => {
onNet(events.MESSAGES_SEND_MESSAGE_FAILED, () => {
sendMessageEvent(events.MESSAGES_SEND_MESSAGE_FAILED);
});
onNet(events.MESSAGES_ACTION_RESULT, (result: any) => {
sendMessageEvent(events.MESSAGES_ACTION_RESULT, result);
});
+9 -14
View File
@@ -412,18 +412,7 @@ onNet(
label
);
if (result.error) {
// if it just fails, welp
emitNet(events.MESSAGES_CREATE_MESSAGE_GROUP_FAILED, _source, result);
/*emitNet(events.MESSAGES_ACTION_RESULT, _source, {
message: `MESSAGES_MESSAGE_GROUP_CREATE_FAILED:`,
type: 'error',
});*/
console.log(result);
// if you try to create a existing group
} else if (result.error && result.duplicate) {
if (result.error && result.duplicate) {
emitNet(events.MESSAGES_ACTION_RESULT, _source, {
message: 'MESSAGES_MESSAGE_GROUP_DUPLICATE',
type: 'error',
@@ -432,17 +421,23 @@ onNet(
// if the phoneNumber is invalid
} else if (result.error && result.phoneNumber) {
emitNet(events.MESSAGES_ACTION_RESULT, _source, {
message: 'MESSAGES_INVALID_PHONE_NUMBER' + result.phoneNumber,
message: 'MESSAGES_INVALID_PHONE_NUMBER',
type: 'error',
});
// if you are try to add yourself
} else if (result.error && result.mine) {
console.log('yes');
emitNet(events.MESSAGES_ACTION_RESULT, _source, {
message: 'MESSAGES_MESSAGE_GROUP_CREATE_MINE',
type: 'error',
});
} else if (result.error) {
// if it just fails, welp
emitNet(events.MESSAGES_CREATE_MESSAGE_GROUP_FAILED, _source, result);
emitNet(events.MESSAGES_ACTION_RESULT, _source, {
message: `MESSAGES_MESSAGE_GROUP_CREATE_FAILED:`,
type: 'error',
});
} else {
emitNet(events.MESSAGES_CREATE_MESSAGE_GROUP_SUCCESS, _source, result);
}
+2 -3
View File
@@ -68,7 +68,7 @@ export default {
MESSAGES_FETCH_MESSAGES: 'phone:fetchMessages',
MESSAGES_FETCH_MESSAGES_SUCCESS: 'phone:fetchMessagesSuccess',
MESSAGES_FETCH_MESSAGES_FAILED: 'phone:fetchMessagesFailed',
MESSAGES_ACTION_RESULT: 'phone:messagesActionResult',
MESSAGES_ACTION_RESULT: 'phone:setMessagesAlert',
// Notes
NOTE_ADD_NOTE: 'phone:addNote',
@@ -81,7 +81,6 @@ export default {
NOTE_UPDATE_NOTE_FAILURE: 'phone:updateNoteFailure',
NOTE_ACTION_RESULT: 'phone:notesActionResult',
// DO NOT CHANGE WHATS BELOW, PLEASE - CHIP
OPEN_APP_CONTACTS: 'phone:app:CONTACTS',
OPEN_APP_BANK: 'phone:app:BANK',
@@ -113,4 +112,4 @@ export default {
PHONE_CALL_FETCH_CALLS: 'phone:fetchCalls',
PHONE_CALL_SEND_HISTORY: 'phone:sendCallHistory',
PHONE_CALL_SEND_HANGUP_ANIM: 'phone:sendHangupAnim',
};
};