From a58d2d008d6ad97fa6f21d557dab4f905d366115 Mon Sep 17 00:00:00 2001 From: cakesoft-vaibhav Date: Mon, 18 Aug 2025 12:28:03 +0530 Subject: [PATCH 1/5] fix: minorUiForShareContact --- src/screens/Home/components/Contact/component/Contact.tsx | 1 + src/screens/QRScreens/ScanQR.tsx | 3 ++- src/screens/Recieve/ReceiveAddress.tsx | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/screens/Home/components/Contact/component/Contact.tsx b/src/screens/Home/components/Contact/component/Contact.tsx index 981cae31d..7003cc077 100644 --- a/src/screens/Home/components/Contact/component/Contact.tsx +++ b/src/screens/Home/components/Contact/component/Contact.tsx @@ -202,6 +202,7 @@ const Contact = () => { isSingning: true, contactShareData: contactShareLink, isPSBT: true, + placeholder: 'or paste text', }, }) ); diff --git a/src/screens/QRScreens/ScanQR.tsx b/src/screens/QRScreens/ScanQR.tsx index 4c8ce97c4..f760c9b7c 100644 --- a/src/screens/QRScreens/ScanQR.tsx +++ b/src/screens/QRScreens/ScanQR.tsx @@ -52,6 +52,7 @@ function ScanQR() { Instructions, isSingning = false, contactShareData = null, + placeholder = null, } = route.params as any; const { translations } = useContext(LocalizationContext); @@ -127,7 +128,7 @@ function ScanQR() { borderColor={`${colorMode}.greyBorder`} > - + {address.length > 50 ? address.slice(0, 50) + '...' : address} From 2d14dfe81d7b7184547372fbd7c026d8d18f98f3 Mon Sep 17 00:00:00 2001 From: cakesoft-vaibhav Date: Mon, 18 Aug 2025 14:08:21 +0530 Subject: [PATCH 2/5] fix: unreadCount --- .../components/Contact/ChatRoomScreen.tsx | 12 +++++++-- src/services/p2p/ChatPeerManager.ts | 27 ++++++++++--------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/screens/Home/components/Contact/ChatRoomScreen.tsx b/src/screens/Home/components/Contact/ChatRoomScreen.tsx index bf99ee142..7568e0cb6 100644 --- a/src/screens/Home/components/Contact/ChatRoomScreen.tsx +++ b/src/screens/Home/components/Contact/ChatRoomScreen.tsx @@ -1,4 +1,4 @@ -import React, { useContext, useState } from 'react'; +import React, { useContext, useEffect, useState } from 'react'; import { Box, useColorMode } from 'native-base'; import { StyleSheet } from 'react-native'; import { RouteProp, useRoute } from '@react-navigation/native'; @@ -10,7 +10,8 @@ import { LocalizationContext } from 'src/context/Localization/LocContext'; import { KeeperApp } from 'src/models/interfaces/KeeperApp'; import { RealmSchema } from 'src/storage/realm/enum'; import { useObject, useQuery } from '@realm/react'; -import { Community, Contact, Message } from 'src/services/p2p/interface'; +import { Community, Message } from 'src/services/p2p/interface'; +import { useChatPeer } from 'src/hooks/useChatPeer'; type ChatRoomParams = { ChatRoomScreen: { @@ -30,10 +31,17 @@ const ChatRoomScreen = () => { const messages = useQuery(RealmSchema.Message) .filtered('communityId = $0', communityId) .sorted('createdAt', true); + const { markCommunityAsRead } = useChatPeer(); const [editUserProfileImage, setEditUserProfileImage] = useState(''); const [editReceiverProfileName, setEditReceiverProfileName] = useState(community.name); + useEffect(() => { + // mark messages are read + const unreadMsgId = messages.filter((msg) => msg.unread).map((msg) => msg.id); + if (unreadMsgId.length) markCommunityAsRead(communityId); + }, []); + return ( Date: Mon, 18 Aug 2025 14:24:58 +0530 Subject: [PATCH 3/5] fix: AddContactKBOverlap --- src/screens/QRScreens/ScanQR.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/screens/QRScreens/ScanQR.tsx b/src/screens/QRScreens/ScanQR.tsx index f760c9b7c..17e0cf001 100644 --- a/src/screens/QRScreens/ScanQR.tsx +++ b/src/screens/QRScreens/ScanQR.tsx @@ -27,6 +27,7 @@ import Instruction from 'src/components/Instruction'; import ThemedSvg from 'src/components/ThemedSvg.tsx/ThemedSvg'; import Buttons from 'src/components/Buttons'; import ShareDark from 'src/assets/images/share-white.svg'; +import { useKeyboard } from 'src/hooks/useKeyboard'; const decoder = new URRegistryDecoder(); @@ -64,6 +65,7 @@ function ScanQR() { const isDarkMode = colorMode === 'dark'; const isHealthCheck = mode === InteracationMode.HEALTH_CHECK; const [infoModal, setInfoModal] = useState(false); + const isKeyboardOpen = useKeyboard(); const onTextSubmit = (data) => { if (!data.startsWith('UR') && !data.startsWith('ur')) { @@ -166,7 +168,7 @@ function ScanQR() { )} - {contactShareData && ( + {!isKeyboardOpen && contactShareData && ( Date: Mon, 18 Aug 2025 16:02:00 +0530 Subject: [PATCH 4/5] feat: ContactsNotificationHandling --- src/components/HomeScreenHeader.tsx | 4 ++++ src/hooks/useNotificationHandler.tsx | 7 ++++-- src/hooks/useUaiStack.ts | 1 + src/models/enums/Notifications.ts | 1 + src/models/interfaces/Uai.ts | 2 ++ src/screens/Home/InititalAppController.tsx | 4 +++- .../Notifications/NotificationsCenter.tsx | 24 +++++++++++++++++++ 7 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/components/HomeScreenHeader.tsx b/src/components/HomeScreenHeader.tsx index 1db98b4b7..9f0a0d3b9 100644 --- a/src/components/HomeScreenHeader.tsx +++ b/src/components/HomeScreenHeader.tsx @@ -169,6 +169,10 @@ const HomeScreenHeader: React.FC = ({ dispatch(uaiActioned({ uaiId: localLatestUnseenUai.id, action: false })); navigtaion.dispatch(CommonActions.navigate('ChoosePlan', { showDiscounted: true })); }, + [uaiType.CONTACTS]: () => { + dispatch(uaiActioned({ uaiId: localLatestUnseenUai.id, action: false })); + navigtaion.dispatch(CommonActions.navigate('Home', { selectedOption: 'Contacts' })); + }, }; return ( diff --git a/src/hooks/useNotificationHandler.tsx b/src/hooks/useNotificationHandler.tsx index b855725ee..9475a9906 100644 --- a/src/hooks/useNotificationHandler.tsx +++ b/src/hooks/useNotificationHandler.tsx @@ -7,7 +7,7 @@ import { notificationType } from 'src/models/enums/Notifications'; import { useDispatch } from 'react-redux'; import { addTicketStatusUAI } from 'src/store/sagaActions/concierge'; import { uaiType } from 'src/models/interfaces/Uai'; -import { uaiChecks } from 'src/store/sagaActions/uai'; +import { addToUaiStack, uaiChecks } from 'src/store/sagaActions/uai'; const NotificationHandler = () => { const [showRemoteNotificationModel, setShowRemoteNotificationModel] = useState(false); @@ -16,7 +16,10 @@ const NotificationHandler = () => { const dispatch = useDispatch(); useEffect(() => { const unsubscribe = messaging().onMessage(async (remoteMessage) => { - if (remoteMessage.data?.notificationType === notificationType.REMOTE_KEY_SHARE) { + if (remoteMessage.data?.notificationType === notificationType.CONTACTS) { + dispatch(addToUaiStack({ uaiType: uaiType.CONTACTS })); + dispatch(uaiChecks([uaiType.CONTACTS])); + } else if (remoteMessage.data?.notificationType === notificationType.REMOTE_KEY_SHARE) { setForegroundNotifcation(remoteMessage); setShowRemoteNotificationModel(true); } else if (remoteMessage.data?.notificationType === notificationType.ZENDESK_TICKET) { diff --git a/src/hooks/useUaiStack.ts b/src/hooks/useUaiStack.ts index a84cca9b4..6e6e8317d 100644 --- a/src/hooks/useUaiStack.ts +++ b/src/hooks/useUaiStack.ts @@ -21,6 +21,7 @@ export const uaiPriorityMap: UAIPriorityMap = { [uaiType.POLICY_DELAY]: 90, [uaiType.INCOMING_TRANSACTION]: 100, [uaiType.CAMPAIGN]: 101, + [uaiType.CONTACTS]: 101, }; const useUaiStack = (): { uaiStack: UAI[]; isLoading: boolean } => { diff --git a/src/models/enums/Notifications.ts b/src/models/enums/Notifications.ts index b921301cc..9a3f1f6d2 100644 --- a/src/models/enums/Notifications.ts +++ b/src/models/enums/Notifications.ts @@ -2,4 +2,5 @@ export enum notificationType { REMOTE_KEY_SHARE = 'REMOTE_KEY_SHARE', ZENDESK_TICKET = 'ZENDESK_TICKET', CAMPAIGN = 'CAMPAIGN', + CONTACTS = 'CONTACT_MESSAGE', } diff --git a/src/models/interfaces/Uai.ts b/src/models/interfaces/Uai.ts index 060a55a54..85924702e 100644 --- a/src/models/interfaces/Uai.ts +++ b/src/models/interfaces/Uai.ts @@ -31,4 +31,6 @@ export enum uaiType { DEFAULT = 'DEFAULT', RELEASE_MESSAGE = 'RELEASE_MESSAGE', CAMPAIGN = 'CAMPAIGN', + + CONTACTS = 'CONTACTS', } diff --git a/src/screens/Home/InititalAppController.tsx b/src/screens/Home/InititalAppController.tsx index b100bc05a..7ef4c744a 100644 --- a/src/screens/Home/InititalAppController.tsx +++ b/src/screens/Home/InititalAppController.tsx @@ -287,7 +287,9 @@ function InititalAppController({ navigation, electrumErrorVisible, setElectrumEr }; const handleZendeskNotificationRedirection = (data) => { - if (data?.notificationType === notificationType.ZENDESK_TICKET) { + if (data?.notificationType === notificationType.CONTACTS) { + navigation.dispatch(CommonActions.navigate('Home', { selectedOption: 'Contacts' })); + } else if (data?.notificationType === notificationType.ZENDESK_TICKET) { const { ticketId = null, ticketStatus = null } = data; if (ticketId && ticketStatus) navigation.navigate({ diff --git a/src/screens/Home/Notifications/NotificationsCenter.tsx b/src/screens/Home/Notifications/NotificationsCenter.tsx index 29e1873c6..732da75db 100644 --- a/src/screens/Home/Notifications/NotificationsCenter.tsx +++ b/src/screens/Home/Notifications/NotificationsCenter.tsx @@ -81,6 +81,7 @@ const SUPPORTED_NOTOFOCATION_TYPES = [ uaiType.INCOMING_TRANSACTION, uaiType.SERVER_BACKUP_FAILURE, uaiType.CAMPAIGN, + uaiType.CONTACTS, ]; const Card = memo(({ uai }: CardProps) => { @@ -347,6 +348,23 @@ const Card = memo(({ uai }: CardProps) => { }; } + case uaiType.CONTACTS: { + return { + heading: content.heading, + body: content.body, + icon: content.icon, + btnConfig: { + primary: { + text: 'View', + cta: () => { + dispatch(uaiActioned({ uaiId: uai.id, action: false })); + navigtaion.dispatch(CommonActions.navigate('Home', { selectedOption: 'Contacts' })); + }, + }, + }, + }; + } + default: return null; } @@ -634,6 +652,12 @@ export const getUaiContent = (type: uaiType, details?: any) => { body: 'Plan your inheritance and improve your security', icon: , }; + case uaiType.CONTACTS: + return { + heading: 'Contacts', + body: 'You have a new message', + icon: , // ! + }; default: return { From cb20f0e1a9857a6950a268d4919f14d9cd105e17 Mon Sep 17 00:00:00 2001 From: cakesoft-vaibhav Date: Mon, 18 Aug 2025 16:07:35 +0530 Subject: [PATCH 5/5] upt: ContactsNotificationIcon --- src/screens/Home/Notifications/NotificationsCenter.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/screens/Home/Notifications/NotificationsCenter.tsx b/src/screens/Home/Notifications/NotificationsCenter.tsx index 732da75db..2c95cb917 100644 --- a/src/screens/Home/Notifications/NotificationsCenter.tsx +++ b/src/screens/Home/Notifications/NotificationsCenter.tsx @@ -39,6 +39,7 @@ import { backupAllSignersAndVaults } from 'src/store/sagaActions/bhr'; import { LocalizationContext } from 'src/context/Localization/LocContext'; import ThemedSvg from 'src/components/ThemedSvg.tsx/ThemedSvg'; import Fonts from 'src/constants/Fonts'; +import ContactIcon from 'src/assets/images/Contact-footer-dark.svg'; type CardProps = { uai: any; @@ -656,7 +657,7 @@ export const getUaiContent = (type: uaiType, details?: any) => { return { heading: 'Contacts', body: 'You have a new message', - icon: , // ! + icon: , }; default: