From 5b8d6bad35b97c93685992e6ec0a53304072499e Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Wed, 18 Oct 2023 11:52:46 -0300 Subject: [PATCH] feat: create notification in room view (#5250) * button and simple navigation done, missing master detail * navigation * add withTheme and colors to rightuttons * fix e2e test --- app/lib/constants/colors.ts | 3 ++ app/views/RoomView/RightButtons.tsx | 50 ++++++++++++++++++++++++++--- 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/app/lib/constants/colors.ts b/app/lib/constants/colors.ts index 4231b0145..0228a0370 100644 --- a/app/lib/constants/colors.ts +++ b/app/lib/constants/colors.ts @@ -108,6 +108,7 @@ export const colors = { badgeBackgroundLevel3: '#F38C39', statusFontOnDanger: '#9B1325', statusFontOnSuccess: '#148660', + fontDanger: '#D40C26', ...mentions, ...callButtons }, @@ -193,6 +194,7 @@ export const colors = { badgeBackgroundLevel3: '#F38C39', statusFontOnDanger: '#9B1325', statusFontOnSuccess: '#148660', + fontDanger: '#D40C26', ...mentions, ...callButtons }, @@ -278,6 +280,7 @@ export const colors = { badgeBackgroundLevel3: '#F38C39', statusFontOnDanger: '#9B1325', statusFontOnSuccess: '#148660', + fontDanger: '#D40C26', ...mentions, ...callButtons } diff --git a/app/views/RoomView/RightButtons.tsx b/app/views/RoomView/RightButtons.tsx index b1e724a3e..d80c55966 100644 --- a/app/views/RoomView/RightButtons.tsx +++ b/app/views/RoomView/RightButtons.tsx @@ -21,6 +21,7 @@ import { getUserSelector } from '../../selectors/login'; import { TNavigation } from '../../stacks/stackType'; import { ChatsStackParamList } from '../../stacks/types'; import HeaderCallButton from './components/HeaderCallButton'; +import { TColors, TSupportedThemes, withTheme } from '../../theme'; interface IRightButtonsProps extends Pick { userId?: string; @@ -43,6 +44,8 @@ interface IRightButtonsProps extends Pick { showActionSheet: Function; departmentId?: string; rid?: string; + theme?: TSupportedThemes; + colors?: TColors; } interface IRigthButtonsState { @@ -52,9 +55,12 @@ interface IRigthButtonsState { tunreadGroup: string[]; } +const deviceNotificationEnabled = true; + class RightButtonsContainer extends Component { private threadSubscription?: Subscription; private subSubscription?: Subscription; + private room?: TSubscriptionModel; constructor(props: IRightButtonsProps) { super(props); @@ -80,8 +86,8 @@ class RightButtonsContainer extends Component { + const { room } = this; + const { rid, navigation, isMasterDetail } = this.props; + + if (!rid || !room) { + return; + } + if (deviceNotificationEnabled && room) { + if (isMasterDetail) { + navigation.navigate('ModalStackNavigator', { + screen: 'NotificationPrefView', + params: { rid, room } + }); + } else { + navigation.navigate('NotificationPrefView', { rid, room }); + } + } else if (isMasterDetail) { + navigation.navigate('ModalStackNavigator', { + screen: 'PushTroubleshootView' + }); + } else { + navigation.navigate('PushTroubleshootView'); + } + }; + goSearchView = () => { logEvent(events.ROOM_GO_SEARCH); const { rid, t, navigation, isMasterDetail, encrypted } = this.props; @@ -321,7 +355,7 @@ class RightButtonsContainer extends Component + {rid ? : null} {threadsEnabled ? ( ({ livechatRequestComment: state.settings.Livechat_request_comment_when_closing_conversation as boolean }); -export default connect(mapStateToProps)(RightButtonsContainer); +export default connect(mapStateToProps)(withTheme(RightButtonsContainer));