Skip to content

Commit

Permalink
Intros can't be too rude
Browse files Browse the repository at this point in the history
  • Loading branch information
duogenesis committed Dec 6, 2024
1 parent f46a5bb commit adff3a0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions components/conversation-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@ const ConversationScreen = ({navigation, route}) => {
}}
>
{lastMessageStatus === 'timeout' ? "Message not delivered. Are you online?" : '' }
{lastMessageStatus === 'offensive' ? `Intros can’t be too rude. Try sending ${name} a different message...` : '' }
{lastMessageStatus === 'blocked' ? name + ' is unavailable right now. Try messaging someone else!' : '' }
{lastMessageStatus === 'not unique' ? `Someone already sent that intro! Try sending ${name} a different message...` : '' }
{lastMessageStatus === 'too long' ? 'That message is too big! 😩' : '' }
Expand Down
10 changes: 9 additions & 1 deletion xmpp/xmpp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const safeSend = async (element: Element) => {

type MessageStatus =
| 'sent'
| 'offensive'
| 'blocked'
| 'not unique'
| 'too long'
Expand Down Expand Up @@ -576,6 +577,11 @@ const _sendMessage = (
doc
);

const offensiveNode = xpath.select1(
`/*[name()='duo_message_blocked'][@reason='offensive'][@id='${id}']`,
doc
);

const blockedNode = xpath.select1(
`/*[name()='duo_message_blocked'][@id='${id}']`,
doc
Expand All @@ -586,7 +592,9 @@ const _sendMessage = (
doc
);

if (blockedNode) {
if (offensiveNode) {
callback('offensive');
} else if (blockedNode) {
callback('blocked');
} else if (notUniqueNode) {
callback('not unique');
Expand Down

0 comments on commit adff3a0

Please sign in to comment.