diff --git a/app/constants/constantDisplayMode.js b/app/constants/constantDisplayMode.js deleted file mode 100644 index d7d7e1d53..000000000 --- a/app/constants/constantDisplayMode.js +++ /dev/null @@ -1,2 +0,0 @@ -export const DISPLAY_MODE_CONDENSED = 'condensed'; -export const DISPLAY_MODE_EXPANDED = 'expanded'; diff --git a/app/constants/constantDisplayMode.ts b/app/constants/constantDisplayMode.ts new file mode 100644 index 000000000..ecb6bd4b7 --- /dev/null +++ b/app/constants/constantDisplayMode.ts @@ -0,0 +1,9 @@ +export enum DisplayMode { + Condensed = 'condensed', + Expanded = 'expanded' +} + +export enum SortBy { + Alphabetical = 'alphabetical', + Activity = 'activity' +} diff --git a/app/containers/message/Reply.tsx b/app/containers/message/Reply.tsx index fbc8984fc..8d8126050 100644 --- a/app/containers/message/Reply.tsx +++ b/app/containers/message/Reply.tsx @@ -13,6 +13,7 @@ import { themes } from '../../constants/colors'; import MessageContext from './Context'; import { fileDownloadAndPreview } from '../../utils/fileDownload'; import { formatAttachmentUrl } from '../../lib/utils'; +import { IAttachment } from '../../definitions/IAttachment'; import RCActivityIndicator from '../ActivityIndicator'; const styles = StyleSheet.create({ @@ -90,43 +91,26 @@ const styles = StyleSheet.create({ } }); -interface IMessageReplyAttachment { - author_name: string; - message_link: string; - ts: string; - text: string; - title: string; - short: boolean; - value: string; - title_link: string; - author_link: string; - type: string; - color: string; - description: string; - fields: IMessageReplyAttachment[]; - thumb_url: string; -} - interface IMessageTitle { - attachment: Partial; + attachment: IAttachment; timeFormat: string; theme: string; } interface IMessageDescription { - attachment: Partial; + attachment: IAttachment; getCustomEmoji: Function; theme: string; } interface IMessageFields { - attachment: Partial; + attachment: IAttachment; theme: string; getCustomEmoji: Function; } interface IMessageReply { - attachment: IMessageReplyAttachment; + attachment: IAttachment; timeFormat: string; index: number; theme: string; @@ -198,7 +182,7 @@ const Fields = React.memo( {field.title} {/* @ts-ignore*/} void; + +export interface ITranslations { + _id: string; + language: string; + value: string; +} + +export interface ILastMessage { + _id: string; + rid: string; + tshow: boolean; + tmid: string; + msg: string; + ts: Date; + u: IUserMessage; + _updatedAt: Date; + urls: string[]; + mentions: IUserMention[]; + channels: IUserChannel[]; + md: MarkdownAST; + attachments: IAttachment[]; + reactions: IReaction[]; + unread: boolean; + status: boolean; +} + +export interface IMessage { + msg?: string; + t?: SubscriptionType; + ts: Date; + u: IUserMessage; + alias: string; + parseUrls: boolean; + groupable?: boolean; + avatar?: string; + emoji?: string; + attachments?: IAttachment[]; + urls?: string[]; + _updatedAt: Date; + status?: number; + pinned?: boolean; + starred?: boolean; + editedBy?: IEditedBy; + reactions?: IReaction[]; + role?: string; + drid?: string; + dcount?: number; + dlm?: Date; + tmid?: string; + tcount?: number; + tlm?: Date; + replies?: string[]; + mentions?: IUserMention[]; + channels?: IUserChannel[]; + unread?: boolean; + autoTranslate?: boolean; + translations?: ITranslations[]; + tmsg?: string; + blocks?: any; + e2e?: string; + tshow?: boolean; + md?: MarkdownAST; + subscription: { id: string }; +} + +export type TMessageModel = IMessage & Model; diff --git a/app/definitions/IPermission.ts b/app/definitions/IPermission.ts new file mode 100644 index 000000000..0ccc13465 --- /dev/null +++ b/app/definitions/IPermission.ts @@ -0,0 +1,9 @@ +import Model from '@nozbe/watermelondb/Model'; + +export interface IPermission { + id: string; + roles: string[]; + _updatedAt: Date; +} + +export type TPermissionModel = IPermission & Model; diff --git a/app/definitions/IReaction.ts b/app/definitions/IReaction.ts new file mode 100644 index 000000000..a28f5d06e --- /dev/null +++ b/app/definitions/IReaction.ts @@ -0,0 +1,5 @@ +export interface IReaction { + _id: string; + emoji: string; + usernames: string[]; +} diff --git a/app/definitions/IRocketChatRecord.ts b/app/definitions/IRocketChatRecord.ts deleted file mode 100644 index 48d91fa84..000000000 --- a/app/definitions/IRocketChatRecord.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface IRocketChatRecord { - id: string; - updatedAt: Date; -} diff --git a/app/definitions/IRole.ts b/app/definitions/IRole.ts new file mode 100644 index 000000000..1fec42150 --- /dev/null +++ b/app/definitions/IRole.ts @@ -0,0 +1,8 @@ +import Model from '@nozbe/watermelondb/Model'; + +export interface IRole { + id: string; + description?: string; +} + +export type TRoleModel = IRole & Model; diff --git a/app/definitions/IRoom.ts b/app/definitions/IRoom.ts index 786c1d7c8..d55cf34a5 100644 --- a/app/definitions/IRoom.ts +++ b/app/definitions/IRoom.ts @@ -1,27 +1,20 @@ -import { IRocketChatRecord } from './IRocketChatRecord'; +import Model from '@nozbe/watermelondb/Model'; -export enum RoomType { - GROUP = 'p', - DIRECT = 'd', - CHANNEL = 'c', - OMNICHANNEL = 'l', - THREAD = 'thread' +import { IServedBy } from './IServedBy'; + +export interface IRoom { + id: string; + customFields: string[]; + broadcast: boolean; + encrypted: boolean; + ro: boolean; + v?: string[]; + servedBy?: IServedBy; + departmentId?: string; + livechatData?: any; + tags?: string[]; + e2eKeyId?: string; + avatarETag?: string; } -export interface IRoom extends IRocketChatRecord { - rid: string; - t: RoomType; - name: string; - fname: string; - prid?: string; - tmid?: string; - topic?: string; - teamMain?: boolean; - teamId?: string; - encrypted?: boolean; - visitor?: boolean; - autoTranslateLanguage?: boolean; - autoTranslate?: boolean; - observe?: Function; - usedCannedResponse: string; -} +export type TRoomModel = IRoom & Model; diff --git a/app/definitions/IServedBy.ts b/app/definitions/IServedBy.ts new file mode 100644 index 000000000..4bf31aad2 --- /dev/null +++ b/app/definitions/IServedBy.ts @@ -0,0 +1,5 @@ +export interface IServedBy { + _id: string; + username: string; + ts: Date; +} diff --git a/app/definitions/IServer.ts b/app/definitions/IServer.ts index 534a29c9c..014a2702b 100644 --- a/app/definitions/IServer.ts +++ b/app/definitions/IServer.ts @@ -1,3 +1,5 @@ +import Model from '@nozbe/watermelondb/Model'; + export interface IServer { name: string; iconURL: string; @@ -14,3 +16,5 @@ export interface IServer { enterpriseModules: string; E2E_Enable: boolean; } + +export type TServerModel = IServer & Model; diff --git a/app/definitions/IServerHistory.ts b/app/definitions/IServerHistory.ts new file mode 100644 index 000000000..296cba4ed --- /dev/null +++ b/app/definitions/IServerHistory.ts @@ -0,0 +1,10 @@ +import Model from '@nozbe/watermelondb/Model'; + +export interface IServerHistory { + id: string; + url: string; + username: string; + updatedAt: Date; +} + +export type TServerHistory = IServerHistory & Model; diff --git a/app/definitions/ISettings.ts b/app/definitions/ISettings.ts new file mode 100644 index 000000000..1fbb63ac8 --- /dev/null +++ b/app/definitions/ISettings.ts @@ -0,0 +1,12 @@ +import Model from '@nozbe/watermelondb/Model'; + +export interface ISettings { + id: string; + valueAsString?: string; + valueAsBoolean?: boolean; + valueAsNumber?: number; + valueAsArray?: string[]; + _updatedAt?: Date; +} + +export type TSettingsModel = ISettings & Model; diff --git a/app/definitions/ISlashCommand.ts b/app/definitions/ISlashCommand.ts new file mode 100644 index 000000000..a859448df --- /dev/null +++ b/app/definitions/ISlashCommand.ts @@ -0,0 +1,12 @@ +import Model from '@nozbe/watermelondb/Model'; + +export interface ISlashCommand { + id: string; + params?: string; + description?: string; + clientOnly?: boolean; + providesPreview?: boolean; + appId?: string; +} + +export type TSlashCommandModel = ISlashCommand & Model; diff --git a/app/definitions/ISubscription.ts b/app/definitions/ISubscription.ts new file mode 100644 index 000000000..5f561edfb --- /dev/null +++ b/app/definitions/ISubscription.ts @@ -0,0 +1,89 @@ +import Model from '@nozbe/watermelondb/Model'; +import Relation from '@nozbe/watermelondb/Relation'; + +import { ILastMessage, TMessageModel } from './IMessage'; +import { IServedBy } from './IServedBy'; +import { TThreadModel } from './IThread'; +import { TThreadMessageModel } from './IThreadMessage'; +import { TUploadModel } from './IUpload'; + +export enum SubscriptionType { + GROUP = 'p', + DIRECT = 'd', + CHANNEL = 'c', + OMNICHANNEL = 'l', + THREAD = 'thread' +} + +export interface IVisitor { + _id: string; + username: string; + token: string; + status: string; + lastMessageTs: Date; +} + +export interface ISubscription { + _id: string; // _id belongs watermelonDB + id: string; // id from server + f: boolean; + t: SubscriptionType; + ts: Date; + ls: Date; + name: string; + fname?: string; + rid: string; // the same as id + open: boolean; + alert: boolean; + roles?: string[]; + unread: number; + userMentions: number; + groupMentions: number; + tunread?: string[]; + tunreadUser?: string[]; + tunreadGroup?: string[]; + roomUpdatedAt: Date; + ro: boolean; + lastOpen?: Date; + description?: string; + announcement?: string; + bannerClosed?: boolean; + topic?: string; + blocked?: boolean; + blocker?: boolean; + reactWhenReadOnly?: boolean; + archived: boolean; + joinCodeRequired?: boolean; + muted?: string[]; + ignored?: string[]; + broadcast?: boolean; + prid?: string; + draftMessage?: string; + lastThreadSync?: Date; + jitsiTimeout?: number; + autoTranslate?: boolean; + autoTranslateLanguage: string; + lastMessage?: ILastMessage; + hideUnreadStatus?: boolean; + sysMes?: string[] | boolean; + uids?: string[]; + usernames?: string[]; + visitor?: IVisitor; + departmentId?: string; + servedBy?: IServedBy; + livechatData?: any; + tags?: string[]; + E2EKey?: string; + encrypted?: boolean; + e2eKeyId?: string; + avatarETag?: string; + teamId?: string; + teamMain?: boolean; + // https://nozbe.github.io/WatermelonDB/Relation.html#relation-api + messages: Relation; + threads: Relation; + threadMessages: Relation; + uploads: Relation; +} + +export type TSubscriptionModel = ISubscription & Model; diff --git a/app/definitions/IThread.ts b/app/definitions/IThread.ts new file mode 100644 index 000000000..ad151283b --- /dev/null +++ b/app/definitions/IThread.ts @@ -0,0 +1,78 @@ +import Model from '@nozbe/watermelondb/Model'; +import { MarkdownAST } from '@rocket.chat/message-parser'; + +import { IAttachment } from './IAttachment'; +import { IEditedBy, IUserChannel, IUserMention, IUserMessage } from './IMessage'; +import { IReaction } from './IReaction'; +import { SubscriptionType } from './ISubscription'; + +export interface IUrl { + title: string; + description: string; + image: string; + url: string; +} + +interface IFileThread { + _id: string; + name: string; + type: string; +} + +export interface IThreadResult { + _id: string; + rid: string; + ts: string; + msg: string; + file?: IFileThread; + files?: IFileThread[]; + groupable?: boolean; + attachments?: IAttachment[]; + md?: MarkdownAST; + u: IUserMessage; + _updatedAt: string; + urls: IUrl[]; + mentions: IUserMention[]; + channels: IUserChannel[]; + replies: string[]; + tcount: number; + tlm: string; +} + +export interface IThread { + id: string; + msg?: string; + t?: SubscriptionType; + rid: string; + _updatedAt: Date; + ts: Date; + u: IUserMessage; + alias?: string; + parseUrls?: boolean; + groupable?: boolean; + avatar?: string; + emoji?: string; + attachments?: IAttachment[]; + urls?: IUrl[]; + status?: number; + pinned?: boolean; + starred?: boolean; + editedBy?: IEditedBy; + reactions?: IReaction[]; + role?: string; + drid?: string; + dcount?: number; + dlm?: number; + tmid?: string; + tcount?: number; + tlm?: Date; + replies?: string[]; + mentions?: IUserMention[]; + channels?: IUserChannel[]; + unread?: boolean; + autoTranslate?: boolean; + translations?: any; + e2e?: string; +} + +export type TThreadModel = IThread & Model; diff --git a/app/definitions/IThreadMessage.ts b/app/definitions/IThreadMessage.ts new file mode 100644 index 000000000..c773e4dc5 --- /dev/null +++ b/app/definitions/IThreadMessage.ts @@ -0,0 +1,44 @@ +import Model from '@nozbe/watermelondb/Model'; + +import { IAttachment } from './IAttachment'; +import { IEditedBy, ITranslations, IUserChannel, IUserMention, IUserMessage } from './IMessage'; +import { IReaction } from './IReaction'; +import { SubscriptionType } from './ISubscription'; + +export interface IThreadMessage { + msg?: string; + t?: SubscriptionType; + rid: string; + ts: Date; + u: IUserMessage; + alias?: string; + parseUrls?: boolean; + groupable?: boolean; + avatar?: string; + emoji?: string; + attachments?: IAttachment[]; + urls?: string[]; + _updatedAt?: Date; + status?: number; + pinned?: boolean; + starred?: boolean; + editedBy?: IEditedBy; + reactions?: IReaction[]; + role?: string; + drid?: string; + dcount?: number; + dlm?: Date; + tmid?: string; + tcount?: number; + tlm?: Date; + replies?: string[]; + mentions?: IUserMention[]; + channels?: IUserChannel[]; + unread?: boolean; + autoTranslate?: boolean; + translations?: ITranslations[]; + e2e?: string; + subscription?: { id: string }; +} + +export type TThreadMessageModel = IThreadMessage & Model; diff --git a/app/definitions/IUpload.ts b/app/definitions/IUpload.ts new file mode 100644 index 000000000..6ff03c519 --- /dev/null +++ b/app/definitions/IUpload.ts @@ -0,0 +1,16 @@ +import Model from '@nozbe/watermelondb/Model'; + +export interface IUpload { + id: string; + path?: string; + name?: string; + description?: string; + size: number; + type?: string; + store?: string; + progress: number; + error: boolean; + subscription: { id: string }; +} + +export type TUploadModel = IUpload & Model; diff --git a/app/definitions/IUser.ts b/app/definitions/IUser.ts new file mode 100644 index 000000000..012ef8087 --- /dev/null +++ b/app/definitions/IUser.ts @@ -0,0 +1,10 @@ +import Model from '@nozbe/watermelondb/Model'; + +export interface IUser { + _id: string; + name?: string; + username: string; + avatarETag?: string; +} + +export type TUserModel = IUser & Model; diff --git a/app/definitions/index.ts b/app/definitions/index.ts index 4f23911bb..b17d68da4 100644 --- a/app/definitions/index.ts +++ b/app/definitions/index.ts @@ -11,3 +11,4 @@ export interface IBaseScreen, S ext export * from './redux'; export * from './redux/TRootEnum'; + diff --git a/app/lib/rocketchat.js b/app/lib/rocketchat.js index 239487b1b..ac923025f 100644 --- a/app/lib/rocketchat.js +++ b/app/lib/rocketchat.js @@ -835,17 +835,21 @@ const RocketChat = { // RC 3.13.0 return this.post('teams.removeRoom', { roomId, teamId }); }, - leaveTeam({ teamName, rooms }) { + leaveTeam({ teamId, rooms }) { // RC 3.13.0 - return this.post('teams.leave', { teamName, rooms }); + return this.post('teams.leave', { + teamId, + // RC 4.2.0 + ...(rooms?.length && { rooms }) + }); }, - removeTeamMember({ teamId, teamName, userId, rooms }) { + removeTeamMember({ teamId, userId, rooms }) { // RC 3.13.0 return this.post('teams.removeMember', { teamId, - teamName, userId, - rooms + // RC 4.2.0 + ...(rooms?.length && { rooms }) }); }, updateTeamRoom({ roomId, isDefault }) { diff --git a/app/lib/userPreferences.js b/app/lib/userPreferences.ts similarity index 75% rename from app/lib/userPreferences.js rename to app/lib/userPreferences.ts index 3377856d6..6f4818da6 100644 --- a/app/lib/userPreferences.js +++ b/app/lib/userPreferences.ts @@ -7,11 +7,12 @@ const MMKV = new MMKVStorage.Loader() .initialize(); class UserPreferences { + private mmkv: MMKVStorage.API; constructor() { this.mmkv = MMKV; } - async getStringAsync(key) { + async getStringAsync(key: string) { try { const value = await this.mmkv.getStringAsync(key); return value; @@ -20,11 +21,11 @@ class UserPreferences { } } - setStringAsync(key, value) { + setStringAsync(key: string, value: string) { return this.mmkv.setStringAsync(key, value); } - async getBoolAsync(key) { + async getBoolAsync(key: string) { try { const value = await this.mmkv.getBoolAsync(key); return value; @@ -33,11 +34,11 @@ class UserPreferences { } } - setBoolAsync(key, value) { + setBoolAsync(key: string, value: boolean) { return this.mmkv.setBoolAsync(key, value); } - async getMapAsync(key) { + async getMapAsync(key: string) { try { const value = await this.mmkv.getMapAsync(key); return value; @@ -46,11 +47,11 @@ class UserPreferences { } } - setMapAsync(key, value) { + setMapAsync(key: string, value: object) { return this.mmkv.setMapAsync(key, value); } - removeItem(key) { + removeItem(key: string) { return this.mmkv.removeItem(key); } } diff --git a/app/navigationTypes.ts b/app/navigationTypes.ts index 568b75d0f..cbf17f42e 100644 --- a/app/navigationTypes.ts +++ b/app/navigationTypes.ts @@ -1,6 +1,6 @@ import { NavigatorScreenParams } from '@react-navigation/core'; -import { IRoom } from './definitions/IRoom'; +import { ISubscription } from './definitions/ISubscription'; import { IServer } from './definitions/IServer'; import { IAttachment } from './definitions/IAttachment'; import { MasterDetailInsideStackParamList } from './stacks/MasterDetailStack/types'; @@ -28,7 +28,7 @@ export type ShareInsideStackParamList = { isShareExtension: boolean; serverInfo: IServer; text: string; - room: IRoom; + room: ISubscription; thread: any; // TODO: Change }; SelectServerView: undefined; diff --git a/app/presentation/RoomItem/Actions.tsx b/app/presentation/RoomItem/Actions.tsx index 19c63baaf..2b53955a9 100644 --- a/app/presentation/RoomItem/Actions.tsx +++ b/app/presentation/RoomItem/Actions.tsx @@ -5,7 +5,7 @@ import { RectButton } from 'react-native-gesture-handler'; import { isRTL } from '../../i18n'; import { CustomIcon } from '../../lib/Icons'; import { themes } from '../../constants/colors'; -import { DISPLAY_MODE_CONDENSED } from '../../constants/constantDisplayMode'; +import { DisplayMode } from '../../constants/constantDisplayMode'; import styles, { ACTION_WIDTH, LONG_SWIPE, ROW_HEIGHT_CONDENSED } from './styles'; interface ILeftActions { @@ -40,7 +40,7 @@ export const LeftActions = React.memo(({ theme, transX, isRead, width, onToggleR reverse ); - const isCondensed = displayMode === DISPLAY_MODE_CONDENSED; + const isCondensed = displayMode === DisplayMode.Condensed; const viewHeight = isCondensed ? { height: ROW_HEIGHT_CONDENSED } : null; return ( @@ -87,7 +87,7 @@ export const RightActions = React.memo( reverse ); - const isCondensed = displayMode === DISPLAY_MODE_CONDENSED; + const isCondensed = displayMode === DisplayMode.Condensed; const viewHeight = isCondensed ? { height: ROW_HEIGHT_CONDENSED } : null; return ( diff --git a/app/presentation/RoomItem/IconOrAvatar.js b/app/presentation/RoomItem/IconOrAvatar.js index cedd3b0ff..29343477a 100644 --- a/app/presentation/RoomItem/IconOrAvatar.js +++ b/app/presentation/RoomItem/IconOrAvatar.js @@ -3,7 +3,7 @@ import { View } from 'react-native'; import PropTypes from 'prop-types'; import Avatar from '../../containers/Avatar'; -import { DISPLAY_MODE_CONDENSED, DISPLAY_MODE_EXPANDED } from '../../constants/constantDisplayMode'; +import { DisplayMode } from '../../constants/constantDisplayMode'; import TypeIcon from './TypeIcon'; import styles from './styles'; @@ -22,11 +22,11 @@ const IconOrAvatar = ({ }) => { if (showAvatar) { return ( - + ); } - if (displayMode === DISPLAY_MODE_EXPANDED && showLastMessage) { + if (displayMode === DisplayMode.Expanded && showLastMessage) { return ( - {showLastMessage && displayMode === DISPLAY_MODE_EXPANDED ? ( + {showLastMessage && displayMode === DisplayMode.Expanded ? ( <> {showAvatar ? ( diff --git a/app/presentation/RoomItem/Wrapper.tsx b/app/presentation/RoomItem/Wrapper.tsx index cb4d6e1bd..30c3283d3 100644 --- a/app/presentation/RoomItem/Wrapper.tsx +++ b/app/presentation/RoomItem/Wrapper.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { View } from 'react-native'; import { themes } from '../../constants/colors'; -import { DISPLAY_MODE_CONDENSED } from '../../constants/constantDisplayMode'; +import { DisplayMode } from '../../constants/constantDisplayMode'; import IconOrAvatar from './IconOrAvatar'; import styles from './styles'; @@ -25,7 +25,7 @@ interface IWrapper { const Wrapper = ({ accessibilityLabel, theme, children, displayMode, ...props }: IWrapper) => ( {children} diff --git a/app/reducers/sortPreferences.js b/app/reducers/sortPreferences.js index 31b501852..4ad9e797d 100644 --- a/app/reducers/sortPreferences.js +++ b/app/reducers/sortPreferences.js @@ -1,13 +1,13 @@ import { SORT_PREFERENCES } from '../actions/actionsTypes'; -import { DISPLAY_MODE_EXPANDED } from '../constants/constantDisplayMode'; +import { DisplayMode, SortBy } from '../constants/constantDisplayMode'; const initialState = { - sortBy: 'activity', + sortBy: SortBy.Activity, groupByType: false, showFavorites: false, showUnread: false, showAvatar: true, - displayMode: DISPLAY_MODE_EXPANDED + displayMode: DisplayMode.Expanded }; export default (state = initialState, action) => { diff --git a/app/sagas/room.js b/app/sagas/room.js index e3437a4ae..f45bf123a 100644 --- a/app/sagas/room.js +++ b/app/sagas/room.js @@ -67,7 +67,7 @@ const handleLeaveRoom = function* handleLeaveRoom({ room, roomType, selected }) if (roomType === 'channel') { result = yield RocketChat.leaveRoom(room.rid, room.t); } else if (roomType === 'team') { - result = yield RocketChat.leaveTeam({ teamName: room.name, ...(selected && { rooms: selected }) }); + result = yield RocketChat.leaveTeam({ teamId: room.teamId, ...(selected && { rooms: selected }) }); } if (result?.success) { diff --git a/app/stacks/MasterDetailStack/ModalContainer.tsx b/app/stacks/MasterDetailStack/ModalContainer.tsx index aeea3d88c..376ff8769 100644 --- a/app/stacks/MasterDetailStack/ModalContainer.tsx +++ b/app/stacks/MasterDetailStack/ModalContainer.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { StyleSheet, TouchableWithoutFeedback, View } from 'react-native'; +import { StyleSheet, TouchableWithoutFeedback, useWindowDimensions, View } from 'react-native'; import { StackNavigationProp } from '@react-navigation/stack'; import { NavigationContainerProps } from '@react-navigation/core'; @@ -23,11 +23,21 @@ const styles = StyleSheet.create({ } }); -export const ModalContainer = ({ navigation, children, theme }: IModalContainer): JSX.Element => ( - - navigation.pop()}> - - - {children} - -); +export const ModalContainer = ({ navigation, children, theme }: IModalContainer): JSX.Element => { + const { height } = useWindowDimensions(); + const modalHeight = sharedStyles.modalFormSheet.height; + return ( + + navigation.pop()}> + + + height ? height : modalHeight + }}> + {children} + + + ); +}; diff --git a/app/stacks/MasterDetailStack/types.ts b/app/stacks/MasterDetailStack/types.ts index 202ad6014..242c13bab 100644 --- a/app/stacks/MasterDetailStack/types.ts +++ b/app/stacks/MasterDetailStack/types.ts @@ -3,18 +3,18 @@ import { NavigatorScreenParams } from '@react-navigation/core'; import { IAttachment } from '../../definitions/IAttachment'; import { IMessage } from '../../definitions/IMessage'; -import { IRoom, RoomType } from '../../definitions/IRoom'; +import { ISubscription, SubscriptionType } from '../../definitions/ISubscription'; export type MasterDetailChatsStackParamList = { RoomView: { rid: string; - t: RoomType; + t: SubscriptionType; tmid?: string; message?: string; name?: string; fname?: string; prid?: string; - room: IRoom; + room: ISubscription; jumpToMessageId?: string; jumpToThreadId?: string; roomUserId?: string; @@ -27,17 +27,17 @@ export type MasterDetailDrawerParamList = { export type ModalStackParamList = { RoomActionsView: { - room: IRoom; + room: ISubscription; member: any; rid: string; - t: RoomType; + t: SubscriptionType; joined: boolean; }; RoomInfoView: { - room: IRoom; + room: ISubscription; member: any; rid: string; - t: RoomType; + t: SubscriptionType; }; SelectListView: { data: any; @@ -54,11 +54,11 @@ export type ModalStackParamList = { }; RoomMembersView: { rid: string; - room: IRoom; + room: ISubscription; }; SearchMessagesView: { rid: string; - t: RoomType; + t: SubscriptionType; encrypted?: boolean; showCloseModal?: boolean; }; @@ -84,18 +84,18 @@ export type ModalStackParamList = { }; MessagesView: { rid: string; - t: RoomType; + t: SubscriptionType; name: string; }; AutoTranslateView: { rid: string; - room: IRoom; + room: ISubscription; }; DirectoryView: undefined; QueueListView: undefined; NotificationPrefView: { rid: string; - room: IRoom; + room: ISubscription; }; ForwardLivechatView: { rid: string; @@ -110,10 +110,10 @@ export type ModalStackParamList = { scopeName: string; tags: string[]; }; - room: IRoom; + room: ISubscription; }; LivechatEditView: { - room: IRoom; + room: ISubscription; roomUser: any; // TODO: Change }; PickerView: { @@ -126,7 +126,7 @@ export type ModalStackParamList = { }; ThreadMessagesView: { rid: string; - t: RoomType; + t: SubscriptionType; }; TeamChannelsView: { teamId: string; @@ -160,7 +160,7 @@ export type ModalStackParamList = { teamId?: string; }; CreateDiscussionView: { - channel: IRoom; + channel: ISubscription; message: IMessage; showCloseModal: boolean; }; @@ -194,7 +194,7 @@ export type MasterDetailInsideStackParamList = { isShareView?: boolean; serverInfo: {}; text: string; - room: IRoom; + room: ISubscription; thread: any; // TODO: Change }; }; diff --git a/app/stacks/types.ts b/app/stacks/types.ts index 3107c69ce..daf366d92 100644 --- a/app/stacks/types.ts +++ b/app/stacks/types.ts @@ -6,28 +6,28 @@ import { IOptionsField } from '../views/NotificationPreferencesView/options'; import { IServer } from '../definitions/IServer'; import { IAttachment } from '../definitions/IAttachment'; import { IMessage } from '../definitions/IMessage'; -import { IRoom, RoomType } from '../definitions/IRoom'; +import { ISubscription, SubscriptionType, TSubscriptionModel } from '../definitions/ISubscription'; export type ChatsStackParamList = { RoomsListView: undefined; RoomView: { rid: string; - t: RoomType; + t: SubscriptionType; tmid?: string; message?: string; name?: string; fname?: string; prid?: string; - room: IRoom; + room: ISubscription; jumpToMessageId?: string; jumpToThreadId?: string; roomUserId?: string; }; RoomActionsView: { - room: IRoom; + room: ISubscription; member: any; rid: string; - t: RoomType; + t: SubscriptionType; joined: boolean; }; SelectListView: { @@ -41,21 +41,21 @@ export type ChatsStackParamList = { isRadio?: boolean; }; RoomInfoView: { - room: IRoom; + room: ISubscription; member: any; rid: string; - t: RoomType; + t: SubscriptionType; }; RoomInfoEditView: { rid: string; }; RoomMembersView: { rid: string; - room: IRoom; + room: ISubscription; }; SearchMessagesView: { rid: string; - t: RoomType; + t: SubscriptionType; encrypted?: boolean; showCloseModal?: boolean; }; @@ -74,12 +74,12 @@ export type ChatsStackParamList = { }; MessagesView: { rid: string; - t: RoomType; + t: SubscriptionType; name: string; }; AutoTranslateView: { rid: string; - room: IRoom; + room: TSubscriptionModel; }; DirectoryView: undefined; NotificationPrefView: { @@ -90,7 +90,7 @@ export type ChatsStackParamList = { rid: string; }; LivechatEditView: { - room: IRoom; + room: ISubscription; roomUser: any; // TODO: Change }; PickerView: { @@ -103,7 +103,7 @@ export type ChatsStackParamList = { }; ThreadMessagesView: { rid: string; - t: RoomType; + t: SubscriptionType; }; TeamChannelsView: { teamId: string; @@ -138,7 +138,7 @@ export type ChatsStackParamList = { scopeName: string; tags: string[]; }; - room: IRoom; + room: ISubscription; }; }; @@ -198,7 +198,7 @@ export type NewMessageStackParamList = { teamId?: string; }; CreateDiscussionView: { - channel: IRoom; + channel: ISubscription; message: IMessage; showCloseModal: boolean; }; @@ -230,7 +230,7 @@ export type InsideStackParamList = { isShareExtension: boolean; serverInfo: IServer; text: string; - room: IRoom; + room: ISubscription; thread: any; // TODO: Change }; ModalBlockView: { diff --git a/app/views/AttachmentView.tsx b/app/views/AttachmentView.tsx index 09e2d5d61..d0bd021c9 100644 --- a/app/views/AttachmentView.tsx +++ b/app/views/AttachmentView.tsx @@ -123,7 +123,11 @@ class AttachmentView extends React.Component { if (room && room.observe) { this.roomObservable = room.observe(); - this.subscription = this.roomObservable.subscribe((changes: IRoom) => { + this.subscription = this.roomObservable.subscribe((changes: ISubscription) => { if (this.mounted) { const { selectedLanguage, enableAutoTranslate } = this.state; if (selectedLanguage !== changes.autoTranslateLanguage) { diff --git a/app/views/DefaultBrowserView.tsx b/app/views/DefaultBrowserView.tsx index 0282e0df2..cfe977d2c 100644 --- a/app/views/DefaultBrowserView.tsx +++ b/app/views/DefaultBrowserView.tsx @@ -107,7 +107,7 @@ class DefaultBrowserView extends React.Component { logEvent(events.DB_CHANGE_DEFAULT_BROWSER, { browser: newBrowser }); try { - const browser = newBrowser !== 'systemDefault:' ? newBrowser : null; + const browser = newBrowser || 'systemDefault:'; await UserPreferences.setStringAsync(DEFAULT_BROWSER_KEY, browser); this.setState({ browser }); } catch { diff --git a/app/views/DisplayPrefsView.js b/app/views/DisplayPrefsView.tsx similarity index 76% rename from app/views/DisplayPrefsView.js rename to app/views/DisplayPrefsView.tsx index 09da4edc9..959682c4c 100644 --- a/app/views/DisplayPrefsView.js +++ b/app/views/DisplayPrefsView.tsx @@ -1,7 +1,7 @@ import React, { useEffect } from 'react'; -import PropTypes from 'prop-types'; import { Switch } from 'react-native'; import { RadioButton } from 'react-native-ui-lib'; +import { StackNavigationProp } from '@react-navigation/stack'; import { useDispatch, useSelector } from 'react-redux'; import { setPreference } from '../actions/sortPreferences'; @@ -15,13 +15,30 @@ import * as HeaderButton from '../containers/HeaderButton'; import SafeAreaView from '../containers/SafeAreaView'; import { ICON_SIZE } from '../containers/List/constants'; import log, { events, logEvent } from '../utils/log'; -import { DISPLAY_MODE_CONDENSED, DISPLAY_MODE_EXPANDED } from '../constants/constantDisplayMode'; +import { DisplayMode, SortBy } from '../constants/constantDisplayMode'; +import { SettingsStackParamList } from '../stacks/types'; -const DisplayPrefsView = props => { +interface IParam { + sortBy: SortBy; + groupByType: boolean; + showFavorites: boolean; + showUnread: boolean; + showAvatar: boolean; + displayMode: DisplayMode; +} + +interface IDisplayPrefsView { + navigation: StackNavigationProp; + isMasterDetail: boolean; +} + +const DisplayPrefsView = (props: IDisplayPrefsView): JSX.Element => { const { theme } = useTheme(); - const { sortBy, groupByType, showFavorites, showUnread, showAvatar, displayMode } = useSelector(state => state.sortPreferences); - const { isMasterDetail } = useSelector(state => state.app); + const { sortBy, groupByType, showFavorites, showUnread, showAvatar, displayMode } = useSelector( + (state: any) => state.sortPreferences + ); + const { isMasterDetail } = useSelector((state: any) => state.app); const dispatch = useDispatch(); useEffect(() => { @@ -36,7 +53,7 @@ const DisplayPrefsView = props => { } }, []); - const setSortPreference = async param => { + const setSortPreference = async (param: Partial) => { try { dispatch(setPreference(param)); await RocketChat.saveSortPreference(param); @@ -47,12 +64,12 @@ const DisplayPrefsView = props => { const sortByName = async () => { logEvent(events.DP_SORT_CHANNELS_BY_NAME); - await setSortPreference({ sortBy: 'alphabetical' }); + await setSortPreference({ sortBy: SortBy.Alphabetical }); }; const sortByActivity = async () => { logEvent(events.DP_SORT_CHANNELS_BY_ACTIVITY); - await setSortPreference({ sortBy: 'activity' }); + await setSortPreference({ sortBy: SortBy.Activity }); }; const toggleGroupByType = async () => { @@ -77,23 +94,23 @@ const DisplayPrefsView = props => { const displayExpanded = async () => { logEvent(events.DP_DISPLAY_EXPANDED); - await setSortPreference({ displayMode: DISPLAY_MODE_EXPANDED }); + await setSortPreference({ displayMode: DisplayMode.Expanded }); }; const displayCondensed = async () => { logEvent(events.DP_DISPLAY_CONDENSED); - await setSortPreference({ displayMode: DISPLAY_MODE_CONDENSED }); + await setSortPreference({ displayMode: DisplayMode.Condensed }); }; - const renderCheckBox = value => ( + const renderCheckBox = (value: boolean) => ( ); - const renderAvatarSwitch = value => ( + const renderAvatarSwitch = (value: boolean) => ( toggleAvatar()} testID='display-pref-view-avatar-switch' /> ); - const renderRadio = value => ( + const renderRadio = (value: boolean) => ( { left={() => } title='Expanded' testID='display-pref-view-expanded' - right={() => renderRadio(displayMode === DISPLAY_MODE_EXPANDED)} + right={() => renderRadio(displayMode === DisplayMode.Expanded)} onPress={displayExpanded} /> @@ -119,7 +136,7 @@ const DisplayPrefsView = props => { left={() => } title='Condensed' testID='display-pref-view-condensed' - right={() => renderRadio(displayMode === DISPLAY_MODE_CONDENSED)} + right={() => renderRadio(displayMode === DisplayMode.Condensed)} onPress={displayCondensed} /> @@ -139,7 +156,7 @@ const DisplayPrefsView = props => { testID='display-pref-view-activity' left={() => } onPress={sortByActivity} - right={() => renderRadio(sortBy === 'activity')} + right={() => renderRadio(sortBy === SortBy.Activity)} /> { testID='display-pref-view-name' left={() => } onPress={sortByName} - right={() => renderRadio(sortBy === 'alphabetical')} + right={() => renderRadio(sortBy === SortBy.Alphabetical)} /> @@ -184,9 +201,6 @@ const DisplayPrefsView = props => { ); }; -DisplayPrefsView.propTypes = { - navigation: PropTypes.object, - isMasterDetail: PropTypes.bool -}; +DisplayPrefsView.propTypes = {}; export default DisplayPrefsView; diff --git a/app/views/MessagesView/index.tsx b/app/views/MessagesView/index.tsx index 14532051b..c9e3d601d 100644 --- a/app/views/MessagesView/index.tsx +++ b/app/views/MessagesView/index.tsx @@ -20,7 +20,7 @@ import SafeAreaView from '../../containers/SafeAreaView'; import getThreadName from '../../lib/methods/getThreadName'; import styles from './styles'; import { ChatsStackParamList } from '../../stacks/types'; -import { IRoom, RoomType } from '../../definitions/IRoom'; +import { ISubscription, SubscriptionType } from '../../definitions/ISubscription'; interface IMessagesViewProps { user: { @@ -40,10 +40,10 @@ interface IMessagesViewProps { } interface IRoomInfoParam { - room: IRoom; + room: ISubscription; member: any; rid: string; - t: RoomType; + t: SubscriptionType; joined: boolean; } @@ -72,13 +72,13 @@ interface IMessageItem { interface IParams { rid: string; - t: RoomType; + t: SubscriptionType; tmid?: string; message?: string; name?: string; fname?: string; prid?: string; - room: IRoom; + room: ISubscription; jumpToMessageId?: string; jumpToThreadId?: string; roomUserId?: string; @@ -86,7 +86,7 @@ interface IParams { class MessagesView extends React.Component { private rid: string; - private t: RoomType; + private t: SubscriptionType; private content: any; private room: any; @@ -158,7 +158,7 @@ class MessagesView extends React.Component { ...params, tmid: item.tmid, name: await getThreadName(this.rid, item.tmid, item._id), - t: RoomType.THREAD + t: SubscriptionType.THREAD }; navigation.push('RoomView', params); } else { diff --git a/app/views/NewServerView/ServerInput/Item.tsx b/app/views/NewServerView/ServerInput/Item.tsx index 9fb44719e..cc8a9e3a7 100644 --- a/app/views/NewServerView/ServerInput/Item.tsx +++ b/app/views/NewServerView/ServerInput/Item.tsx @@ -6,7 +6,7 @@ import { themes } from '../../../constants/colors'; import { CustomIcon } from '../../../lib/Icons'; import sharedStyles from '../../Styles'; import Touch from '../../../utils/touch'; -import { IServer } from '../index'; +import { TServerHistory } from '../../../definitions/IServerHistory'; const styles = StyleSheet.create({ container: { @@ -28,10 +28,10 @@ const styles = StyleSheet.create({ }); interface IItem { - item: IServer; + item: TServerHistory; theme: string; onPress(url: string): void; - onDelete(item: IServer): void; + onDelete(item: TServerHistory): void; } const Item = ({ item, theme, onPress, onDelete }: IItem): JSX.Element => ( diff --git a/app/views/NewServerView/ServerInput/index.tsx b/app/views/NewServerView/ServerInput/index.tsx index 1da151367..e2b14fd69 100644 --- a/app/views/NewServerView/ServerInput/index.tsx +++ b/app/views/NewServerView/ServerInput/index.tsx @@ -5,8 +5,8 @@ import TextInput from '../../../containers/TextInput'; import * as List from '../../../containers/List'; import { themes } from '../../../constants/colors'; import I18n from '../../../i18n'; +import { TServerHistory } from '../../../definitions/IServerHistory'; import Item from './Item'; -import { IServer } from '../index'; const styles = StyleSheet.create({ container: { @@ -33,8 +33,8 @@ interface IServerInput extends TextInputProps { theme: string; serversHistory: any[]; onSubmit(): void; - onDelete(item: IServer): void; - onPressServerHistory(serverHistory: IServer): void; + onDelete(item: TServerHistory): void; + onPressServerHistory(serverHistory: TServerHistory): void; } const ServerInput = ({ diff --git a/app/views/NewServerView/index.tsx b/app/views/NewServerView/index.tsx index aaacdf90f..53594d9c0 100644 --- a/app/views/NewServerView/index.tsx +++ b/app/views/NewServerView/index.tsx @@ -8,7 +8,6 @@ import { TouchableOpacity } from 'react-native-gesture-handler'; import Orientation from 'react-native-orientation-locker'; import { StackNavigationProp } from '@react-navigation/stack'; import { Dispatch } from 'redux'; -import Model from '@nozbe/watermelondb/Model'; import UserPreferences from '../../lib/userPreferences'; import EventEmitter from '../../utils/events'; @@ -34,6 +33,7 @@ import { verticalScale, moderateScale } from '../../utils/scaling'; import { withDimensions } from '../../dimensions'; import ServerInput from './ServerInput'; import { OutsideParamList } from '../../stacks/types'; +import { TServerHistory } from '../../definitions/IServerHistory'; const styles = StyleSheet.create({ onboardingImage: { @@ -68,11 +68,6 @@ const styles = StyleSheet.create({ } }); -export interface IServer extends Model { - url: string; - username: string; -} - interface INewServerView { navigation: StackNavigationProp; theme: string; @@ -90,7 +85,7 @@ interface IState { text: string; connectingOpen: boolean; certificate: any; - serversHistory: IServer[]; + serversHistory: TServerHistory[]; } interface ISubmitParams { @@ -166,7 +161,7 @@ class NewServerView extends React.Component { const likeString = sanitizeLikeString(text); whereClause = [...whereClause, Q.where('url', Q.like(`%${likeString}%`))]; } - const serversHistory = (await serversHistoryCollection.query(...whereClause).fetch()) as IServer[]; + const serversHistory = (await serversHistoryCollection.query(...whereClause).fetch()) as TServerHistory[]; this.setState({ serversHistory }); } catch { // Do nothing @@ -190,7 +185,7 @@ class NewServerView extends React.Component { connectServer(server); }; - onPressServerHistory = (serverHistory: IServer) => { + onPressServerHistory = (serverHistory: TServerHistory) => { this.setState({ text: serverHistory.url }, () => this.submit({ fromServerHistory: true, username: serverHistory?.username })); }; @@ -283,14 +278,14 @@ class NewServerView extends React.Component { }); }; - deleteServerHistory = async (item: IServer) => { + deleteServerHistory = async (item: TServerHistory) => { const db = database.servers; try { await db.write(async () => { await item.destroyPermanently(); }); this.setState((prevstate: IState) => ({ - serversHistory: prevstate.serversHistory.filter((server: IServer) => server.id !== item.id) + serversHistory: prevstate.serversHistory.filter((server: TServerHistory) => server.id !== item.id) })); } catch { // Nothing diff --git a/app/views/RoomInfoView/Direct.js b/app/views/RoomInfoView/Direct.js index 7bc962d69..cc6d8f393 100644 --- a/app/views/RoomInfoView/Direct.js +++ b/app/views/RoomInfoView/Direct.js @@ -15,8 +15,8 @@ const Roles = ({ roles, theme }) => {roles.map(role => role ? ( - - {role} + + {role} ) : null )} diff --git a/app/views/RoomMembersView/index.js b/app/views/RoomMembersView/index.js index 9a93d1cae..3f936fba6 100644 --- a/app/views/RoomMembersView/index.js +++ b/app/views/RoomMembersView/index.js @@ -246,7 +246,6 @@ class RoomMembersView extends React.Component { const userId = selectedUser._id; const result = await RocketChat.removeTeamMember({ teamId: room.teamId, - teamName: room.name, userId, ...(selected && { rooms: selected }) }); diff --git a/app/views/RoomsListView/index.js b/app/views/RoomsListView/index.js index 55e2b1f8b..5ff76d818 100644 --- a/app/views/RoomsListView/index.js +++ b/app/views/RoomsListView/index.js @@ -51,7 +51,6 @@ import { getInquiryQueueSelector } from '../../ee/omnichannel/selectors/inquiry' import { changeLivechatStatus, isOmnichannelStatusAvailable } from '../../ee/omnichannel/lib'; import { DISPLAY_MODE_CONDENSED } from '../../constants/constantDisplayMode'; import { RootEnum } from '../../definitions'; - import styles from './styles'; import ServerDropdown from './ServerDropdown'; import ListHeader from './ListHeader'; @@ -455,7 +454,7 @@ class RoomsListView extends React.Component { const defaultWhereClause = [Q.where('archived', false), Q.where('open', true)]; - if (sortBy === 'alphabetical') { + if (sortBy === SortBy.Alphabetical) { defaultWhereClause.push(Q.experimentalSortBy(`${this.useRealName ? 'fname' : 'name'}`, Q.asc)); } else { defaultWhereClause.push(Q.experimentalSortBy('room_updated_at', Q.desc)); @@ -975,7 +974,7 @@ class RoomsListView extends React.Component { const { loading, chats, search, searching } = this.state; const { theme, refreshing, displayMode } = this.props; - const height = displayMode === DISPLAY_MODE_CONDENSED ? ROW_HEIGHT_CONDENSED : ROW_HEIGHT; + const height = displayMode === DisplayMode.Condensed ? ROW_HEIGHT_CONDENSED : ROW_HEIGHT; if (loading) { return ; diff --git a/app/views/SearchMessagesView/index.tsx b/app/views/SearchMessagesView/index.tsx index a85df6745..7bc3c1738 100644 --- a/app/views/SearchMessagesView/index.tsx +++ b/app/views/SearchMessagesView/index.tsx @@ -6,7 +6,7 @@ import { Q } from '@nozbe/watermelondb'; import { connect } from 'react-redux'; import { dequal } from 'dequal'; -import { IRoom, RoomType } from '../../definitions/IRoom'; +import { ISubscription, SubscriptionType } from '../../definitions/ISubscription'; import { IAttachment } from '../../definitions/IAttachment'; import RCTextInput from '../../containers/TextInput'; import ActivityIndicator from '../../containers/ActivityIndicator'; @@ -42,10 +42,10 @@ interface ISearchMessagesViewState { } interface IRoomInfoParam { - room: IRoom; + room: ISubscription; member: any; rid: string; - t: RoomType; + t: SubscriptionType; joined: boolean; } diff --git a/app/views/ShareView/index.tsx b/app/views/ShareView/index.tsx index a3ad287aa..d77ba022b 100644 --- a/app/views/ShareView/index.tsx +++ b/app/views/ShareView/index.tsx @@ -28,7 +28,7 @@ import Preview from './Preview'; import Header from './Header'; import styles from './styles'; import { IAttachment } from './interfaces'; -import { IRoom } from '../../definitions/IRoom'; +import { ISubscription } from '../../definitions/ISubscription'; interface IShareViewState { selected: IAttachment; @@ -36,7 +36,7 @@ interface IShareViewState { readOnly: boolean; attachments: IAttachment[]; text: string; - room: IRoom; + room: ISubscription; thread: any; // change maxFileSize: number; mediaAllowList: number; diff --git a/package.json b/package.json index a0fd6d506..00851cb26 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,6 @@ "@rocket.chat/react-native-fast-image": "^8.2.0", "@rocket.chat/sdk": "RocketChat/Rocket.Chat.js.SDK#mobile", "@rocket.chat/ui-kit": "0.13.0", - "@types/url-parse": "^1.4.4", "bytebuffer": "^5.0.1", "color2k": "1.2.4", "commonmark": "git+https://github.com/RocketChat/commonmark.js.git", @@ -83,7 +82,7 @@ "react-native-bootsplash": "3.2.4", "react-native-config-reader": "^4.1.1", "react-native-console-time-polyfill": "1.2.3", - "react-native-device-info": "8.1.3", + "react-native-device-info": "8.4.8", "react-native-document-picker": "5.2.0", "react-native-easy-grid": "^0.2.2", "react-native-easy-toast": "^1.2.0", @@ -154,6 +153,7 @@ "@types/react-native-scrollable-tab-view": "^0.10.2", "@types/react-redux": "^7.1.18", "@types/react-test-renderer": "^17.0.1", + "@types/url-parse": "^1.4.6", "@typescript-eslint/eslint-plugin": "^4.28.3", "@typescript-eslint/parser": "^4.28.5", "axios": "0.21.1", diff --git a/storybook/stories/RoomItem.js b/storybook/stories/RoomItem.js index 1538c118a..e6ae40e7b 100644 --- a/storybook/stories/RoomItem.js +++ b/storybook/stories/RoomItem.js @@ -7,7 +7,7 @@ import { Provider } from 'react-redux'; import { themes } from '../../app/constants/colors'; import RoomItemComponent from '../../app/presentation/RoomItem/RoomItem'; import { longText } from '../utils'; -import { DISPLAY_MODE_CONDENSED, DISPLAY_MODE_EXPANDED } from '../../app/constants/constantDisplayMode'; +import { DisplayMode } from '../../app/constants/constantDisplayMode'; import { store } from './index'; const baseUrl = 'https://open.rocket.chat'; @@ -32,7 +32,7 @@ const RoomItem = props => ( width={width} theme={_theme} showAvatar - displayMode={DISPLAY_MODE_EXPANDED} + displayMode={DisplayMode.Expanded} {...updatedAt} {...props} /> @@ -132,10 +132,10 @@ stories.add('Last Message', () => ( stories.add('Condensed Room Item', () => ( <> - - + + - + )); @@ -146,11 +146,11 @@ stories.add('Condensed Room Item without Avatar', () => ( alert tunread={[1]} lastMessage={lastMessage} - displayMode={DISPLAY_MODE_CONDENSED} + displayMode={DisplayMode.Condensed} showAvatar={false} /> - - + + )); @@ -161,7 +161,7 @@ stories.add('Expanded Room Item without Avatar', () => ( alert tunread={[1]} lastMessage={lastMessage} - displayMode={DISPLAY_MODE_EXPANDED} + displayMode={DisplayMode.Expanded} showAvatar={false} /> ( alert tunread={[1]} lastMessage={lastMessage} - displayMode={DISPLAY_MODE_EXPANDED} + displayMode={DisplayMode.Expanded} showAvatar={false} /> ( showLastMessage alert lastMessage={lastMessage} - displayMode={DISPLAY_MODE_EXPANDED} + displayMode={DisplayMode.Expanded} showAvatar={false} /> diff --git a/yarn.lock b/yarn.lock index 05a0d4385..2713d13ad 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4511,10 +4511,10 @@ dependencies: source-map "^0.6.1" -"@types/url-parse@^1.4.4": - version "1.4.4" - resolved "https://registry.yarnpkg.com/@types/url-parse/-/url-parse-1.4.4.tgz#ebeb0ec8b581318739cf73e9f9b186f610764255" - integrity sha512-KtQLad12+4T/NfSxpoDhmr22+fig3T7/08QCgmutYA6QSznSRmEtuL95GrhVV40/0otTEdFc+etRcCTqhh1q5Q== +"@types/url-parse@^1.4.6": + version "1.4.6" + resolved "https://registry.yarnpkg.com/@types/url-parse/-/url-parse-1.4.6.tgz#46b044f24ee5200c3b1ef6a98214d1d451f4dab8" + integrity sha512-Xo6pU78oG9NNk5UJaumUXzrwu9hPiVN2N83mcdXQ1C3/R037fMPlVCh+LqP/2BELXMnlQH0sKec0u33ZnktqHQ== "@types/webpack-env@^1.15.0": version "1.15.2" @@ -14288,10 +14288,10 @@ react-native-console-time-polyfill@1.2.3: resolved "https://registry.yarnpkg.com/react-native-console-time-polyfill/-/react-native-console-time-polyfill-1.2.3.tgz#1039dab1bb9e2d8040f5e19de68e0da781dc9b60" integrity sha512-C7CUb1c6GsCssqvjtRuqVqnGwlfEHXxXDvCUuGNbq/gpZZt+9YbZD3ODmXBDxis3tDQA0k1lbT1VMTqWQw9rDg== -react-native-device-info@8.1.3: - version "8.1.3" - resolved "https://registry.yarnpkg.com/react-native-device-info/-/react-native-device-info-8.1.3.tgz#022fc01372632bf80c0a6d201aab53344efc715f" - integrity sha512-73e3wiGFL8DvIXEd8x4Aq+mO8mZvHARwfYorIEu+X0trLHY92bP5Ict8DJHDjCQ0+HtAvpA4Wda2VoUVN1zh6Q== +react-native-device-info@8.4.8: + version "8.4.8" + resolved "https://registry.yarnpkg.com/react-native-device-info/-/react-native-device-info-8.4.8.tgz#fc92ae423e47db6cfbf30c30012e09cee63727fa" + integrity sha512-92676ZWHZHsPM/EW1ulgb2MuVfjYfMWRTWMbLcrCsipkcMaZ9Traz5mpsnCS7KZpsOksnvUinzDIjsct2XGc6Q== react-native-document-picker@5.2.0: version "5.2.0"