diff --git a/app/containers/RoomItem/IconOrAvatar.tsx b/app/containers/RoomItem/IconOrAvatar.tsx index 7d929189f..f9a9132bf 100644 --- a/app/containers/RoomItem/IconOrAvatar.tsx +++ b/app/containers/RoomItem/IconOrAvatar.tsx @@ -18,11 +18,19 @@ const IconOrAvatar = ({ teamMain, showLastMessage, displayMode, - sourceType + sourceType, + isUserProfile }: IIconOrAvatar): React.ReactElement | null => { if (showAvatar) { return ( - + ); } diff --git a/app/containers/RoomItem/RoomItem.tsx b/app/containers/RoomItem/RoomItem.tsx index 1e832aeea..0678278d2 100644 --- a/app/containers/RoomItem/RoomItem.tsx +++ b/app/containers/RoomItem/RoomItem.tsx @@ -52,7 +52,8 @@ const RoomItem = ({ showAvatar, displayMode, sourceType, - hideMentionStatus + hideMentionStatus, + isUserProfile }: IRoomItemProps) => ( {showLastMessage && displayMode === DisplayMode.Expanded ? ( <> diff --git a/app/containers/RoomItem/index.tsx b/app/containers/RoomItem/index.tsx index 5dd7d5469..5af96d2f4 100644 --- a/app/containers/RoomItem/index.tsx +++ b/app/containers/RoomItem/index.tsx @@ -34,7 +34,8 @@ const RoomItemContainer = React.memo( getRoomTitle = () => 'title', getRoomAvatar = () => '', getIsRead = () => false, - swipeEnabled = true + swipeEnabled = true, + isUserProfile }: IRoomItemContainerProps) => { const name = getRoomTitle(item); const testID = `rooms-list-view-item-${name}`; @@ -127,6 +128,7 @@ const RoomItemContainer = React.memo( showAvatar={showAvatar} displayMode={displayMode} sourceType={item.source} + isUserProfile={isUserProfile} /> ); }, diff --git a/app/containers/RoomItem/interfaces.ts b/app/containers/RoomItem/interfaces.ts index bf2cc3604..0a8dfd88f 100644 --- a/app/containers/RoomItem/interfaces.ts +++ b/app/containers/RoomItem/interfaces.ts @@ -47,6 +47,7 @@ export interface IWrapperProps { teamMain: boolean; showAvatar: boolean; sourceType: IOmnichannelSource; + isUserProfile: boolean; } export interface ITypeIconProps { @@ -116,6 +117,7 @@ export interface IRoomItemProps extends IBaseRoomItem { size?: number; sourceType: IOmnichannelSource; hideMentionStatus?: boolean; + isUserProfile: boolean; } export interface ILastMessageProps { @@ -152,4 +154,5 @@ export interface IIconOrAvatar { teamMain: boolean; showLastMessage: boolean; sourceType: IOmnichannelSource; + isUserProfile: boolean; } diff --git a/app/containers/UserItem.tsx b/app/containers/UserItem.tsx index 02739d2f8..9188dbdec 100644 --- a/app/containers/UserItem.tsx +++ b/app/containers/UserItem.tsx @@ -1,6 +1,8 @@ import React from 'react'; import { Pressable, StyleProp, StyleSheet, Text, View, ViewStyle } from 'react-native'; +import { useAppSelector } from '../lib/hooks'; +import { getUserSelector } from '../selectors/login'; import Avatar from './Avatar'; import { CustomIcon, TIconsName } from './CustomIcon'; import sharedStyles from '../views/Styles'; @@ -43,10 +45,12 @@ interface IUserItem { style?: StyleProp; icon?: TIconsName | null; iconColor?: string; + id?: string; } -const UserItem = ({ name, username, onPress, testID, onLongPress, style, icon, iconColor }: IUserItem) => { +const UserItem = ({ name, username, onPress, testID, onLongPress, style, icon, iconColor, id }: IUserItem) => { const { colors } = useTheme(); + const { userId } = useAppSelector(state => ({ userId: getUserSelector(state).id })); return ( - + {name} diff --git a/app/containers/message/MessageAvatar.tsx b/app/containers/message/MessageAvatar.tsx index 3852939f0..26fd2f662 100644 --- a/app/containers/message/MessageAvatar.tsx +++ b/app/containers/message/MessageAvatar.tsx @@ -20,6 +20,7 @@ const MessageAvatar = React.memo(({ isHeader, avatar, author, small, navToRoomIn size={small ? 20 : 36} borderRadius={small ? 2 : 4} onPress={author._id === user.id ? undefined : () => navToRoomInfo(navParam)} + isUserProfile={author._id === user.id} getCustomEmoji={getCustomEmoji} avatar={avatar} emoji={emoji} diff --git a/app/views/NewMessageView/index.tsx b/app/views/NewMessageView/index.tsx index f393a9f91..c4dc74afc 100644 --- a/app/views/NewMessageView/index.tsx +++ b/app/views/NewMessageView/index.tsx @@ -93,6 +93,7 @@ const NewMessageView = () => { return ( goRoom(itemModel)} diff --git a/app/views/RoomInfoView/index.tsx b/app/views/RoomInfoView/index.tsx index 2744c0cc6..94328faf4 100644 --- a/app/views/RoomInfoView/index.tsx +++ b/app/views/RoomInfoView/index.tsx @@ -183,17 +183,17 @@ class RoomInfoView extends React.Component ( - - { - const isLivechat = t === SubscriptionType.OMNICHANNEL; - logEvent(events[`RI_GO_${isLivechat ? 'LIVECHAT' : 'RI'}_EDIT`]); - navigation.navigate(isLivechat ? 'LivechatEditView' : 'RoomInfoEditView', { rid, room, roomUser }); - }} - testID='room-info-view-edit-button' - /> - + + { + const isLivechat = t === SubscriptionType.OMNICHANNEL; + logEvent(events[`RI_GO_${isLivechat ? 'LIVECHAT' : 'RI'}_EDIT`]); + navigation.navigate(isLivechat ? 'LivechatEditView' : 'RoomInfoEditView', { rid, room, roomUser }); + }} + testID='room-info-view-edit-button' + /> + ) : undefined }); @@ -399,11 +399,26 @@ class RoomInfoView extends React.Component { + const {navigation} = this.props + navigation.navigate("ChangeAvatarView",{titleHeader:I18n.t('Room_Info')}) + } + renderAvatar = (room: ISubscription, roomUser: IUserParsed) => { const { theme } = this.props; + const { showEdit } = this.state; + const showAvatarEdit = showEdit && this.t !== SubscriptionType.OMNICHANNEL; return ( - + {this.t === SubscriptionType.DIRECT && roomUser._id ? ( diff --git a/app/views/RoomInfoView/styles.ts b/app/views/RoomInfoView/styles.ts index fcee26058..091fb5275 100644 --- a/app/views/RoomInfoView/styles.ts +++ b/app/views/RoomInfoView/styles.ts @@ -27,7 +27,7 @@ export default StyleSheet.create({ marginHorizontal: 10 }, roomTitleContainer: { - paddingTop: 20, + paddingTop: 32, marginHorizontal: 16, alignItems: 'center' }, diff --git a/app/views/RoomsListView/index.tsx b/app/views/RoomsListView/index.tsx index 3ff5ff6a6..02a19d0ff 100644 --- a/app/views/RoomsListView/index.tsx +++ b/app/views/RoomsListView/index.tsx @@ -935,7 +935,7 @@ class RoomsListView extends React.Component ); }; diff --git a/app/views/SelectedUsersView/index.tsx b/app/views/SelectedUsersView/index.tsx index ac4693d99..a77853c9a 100644 --- a/app/views/SelectedUsersView/index.tsx +++ b/app/views/SelectedUsersView/index.tsx @@ -155,6 +155,7 @@ const SelectedUsersView = () => { const username = item.search ? (item.username as string) : item.name; return ( _onPressItem(item)}