don't show notification if reaction

This commit is contained in:
PhilReact 2024-09-26 23:47:26 +03:00
parent 0810381455
commit 9b14f5be19
4 changed files with 8 additions and 5 deletions

View File

@ -478,7 +478,7 @@ const handleNotification = async (groups) => {
if(!isArray(mutedGroups)) mutedGroups = [] if(!isArray(mutedGroups)) mutedGroups = []
let isFocused; let isFocused;
const data = groups.filter((group) => group?.sender !== address && !mutedGroups.includes(group.groupId)); const data = groups.filter((group) => group?.sender !== address && !mutedGroups.includes(group.groupId) && !group?.chatReference);
try { try {
if(isDisableNotifications) return if(isDisableNotifications) return
if (!data || data?.length === 0) return; if (!data || data?.length === 0) return;

View File

@ -128,7 +128,7 @@ export const ChatGroup = ({selectedGroup, secretKey, setSecretKey, getSecretKey,
id: item.signature, id: item.signature,
text: item?.decryptedData?.message || "", text: item?.decryptedData?.message || "",
repliedTo: item?.decryptedData?.repliedTo, repliedTo: item?.decryptedData?.repliedTo,
unread: item?.sender === myAddress ? false : true unread: item?.sender === myAddress ? false : !!item?.chatReference ? false : true
} }
} ) } )
setMessages((prev)=> [...prev, ...formatted]) setMessages((prev)=> [...prev, ...formatted])

View File

@ -621,7 +621,7 @@ export const Group = ({
isExtMsg(group?.data) && isExtMsg(group?.data) &&
group?.sender !== myAddress && group?.sender !== myAddress &&
group?.timestamp && group?.timestamp &&
((!timestampEnterData[group?.groupId] && ((!timestampEnterData[group?.groupId] && !group?.chatReference &&
Date.now() - group?.timestamp < timeDifferenceForNotificationChats) || Date.now() - group?.timestamp < timeDifferenceForNotificationChats) ||
timestampEnterData[group?.groupId] < group?.timestamp) timestampEnterData[group?.groupId] < group?.timestamp)
) { ) {
@ -1102,7 +1102,7 @@ export const Group = ({
if (!findGroup) return false; if (!findGroup) return false;
if (!findGroup?.data || !isExtMsg(findGroup?.data)) return false; if (!findGroup?.data || !isExtMsg(findGroup?.data)) return false;
return ( return (
findGroup?.timestamp && findGroup?.timestamp && !findGroup?.chatReference &&
((!timestampEnterData[selectedGroup?.groupId] && ((!timestampEnterData[selectedGroup?.groupId] &&
Date.now() - findGroup?.timestamp < Date.now() - findGroup?.timestamp <
timeDifferenceForNotificationChats) || timeDifferenceForNotificationChats) ||
@ -2101,7 +2101,7 @@ export const Group = ({
/> />
)} )}
{group?.data && {group?.data &&
isExtMsg(group?.data) && isExtMsg(group?.data) && !group?.chatReference &&
group?.sender !== myAddress && group?.sender !== myAddress &&
group?.timestamp && group?.timestamp &&
((!timestampEnterData[group?.groupId] && ((!timestampEnterData[group?.groupId] &&

View File

@ -2,6 +2,7 @@ import React, { useState, useRef, useEffect } from 'react';
import Picker, { Theme } from 'emoji-picker-react'; import Picker, { Theme } from 'emoji-picker-react';
import './ReactionPicker.css'; // CSS for proper positioning import './ReactionPicker.css'; // CSS for proper positioning
import { ButtonBase } from '@mui/material'; import { ButtonBase } from '@mui/material';
import { isMobile } from '../App';
export const ReactionPicker = ({ onReaction }) => { export const ReactionPicker = ({ onReaction }) => {
const [showPicker, setShowPicker] = useState(false); // Manage picker visibility const [showPicker, setShowPicker] = useState(false); // Manage picker visibility
@ -51,6 +52,8 @@ export const ReactionPicker = ({ onReaction }) => {
{showPicker && ( {showPicker && (
<div className="emoji-picker" ref={pickerRef}> <div className="emoji-picker" ref={pickerRef}>
<Picker <Picker
height={isMobile ? 300 : 450}
width={isMobile ? 250 : 350 }
reactionsDefaultOpen={true} reactionsDefaultOpen={true}
onReactionClick={handleReaction} onReactionClick={handleReaction}
onEmojiClick={handlePicker} onEmojiClick={handlePicker}