diff --git a/app/definitions/IRoom.ts b/app/definitions/IRoom.ts index 40f9b290f..895f1c8c1 100644 --- a/app/definitions/IRoom.ts +++ b/app/definitions/IRoom.ts @@ -59,6 +59,20 @@ export interface IRoom { waitingResponse?: boolean; } +export interface IRoomSettings { + roomName?: string; + roomAvatar?: string; + roomDescription?: string; + roomTopic?: string; + roomAnnouncement?: string; + roomType?: SubscriptionType; + readOnly?: boolean; + reactWhenReadOnly?: boolean; + systemMessages?: string[]; + joinCode?: string; + encrypted?: boolean; +} + export enum OmnichannelSourceType { WIDGET = 'widget', EMAIL = 'email', diff --git a/app/views/RoomInfoEditView/index.tsx b/app/views/RoomInfoEditView/index.tsx index 578f479a3..0dd518b01 100644 --- a/app/views/RoomInfoEditView/index.tsx +++ b/app/views/RoomInfoEditView/index.tsx @@ -1,11 +1,12 @@ +import React from 'react'; import { Q } from '@nozbe/watermelondb'; import { BLOCK_CONTEXT } from '@rocket.chat/ui-kit'; import { dequal } from 'dequal'; import isEmpty from 'lodash/isEmpty'; -import React from 'react'; import { Alert, Keyboard, ScrollView, Text, TextInput, TouchableOpacity, View } from 'react-native'; import ImagePicker, { Image } from 'react-native-image-crop-picker'; import { connect } from 'react-redux'; +import { Subscription } from 'rxjs'; import { deleteRoom } from '../../actions/room'; import { themes } from '../../lib/constants'; @@ -16,7 +17,15 @@ import StatusBar from '../../containers/StatusBar'; import RCTextInput from '../../containers/TextInput'; import { LISTENER } from '../../containers/Toast'; import { MultiSelect } from '../../containers/UIKit/MultiSelect'; -import { IApplicationState, IBaseScreen, ISubscription, SubscriptionType, TSubscriptionModel, IAvatar } from '../../definitions'; +import { + IApplicationState, + IBaseScreen, + IRoomSettings, + ISubscription, + SubscriptionType, + TSubscriptionModel, + IAvatar +} from '../../definitions'; import { ERoomType } from '../../definitions/ERoomType'; import I18n from '../../i18n'; import database from '../../lib/database'; @@ -25,7 +34,7 @@ import KeyboardView from '../../containers/KeyboardView'; import { TSupportedPermissions } from '../../reducers/permissions'; import { ModalStackParamList } from '../../stacks/MasterDetailStack/types'; import { ChatsStackParamList } from '../../stacks/types'; -import { TSupportedThemes, withTheme } from '../../theme'; +import { withTheme } from '../../theme'; import EventEmitter from '../../utils/events'; import { showConfirmationAlert, showErrorAlert } from '../../utils/info'; import log, { events, logEvent } from '../../utils/log'; @@ -62,7 +71,6 @@ interface IRoomInfoEditViewState { interface IRoomInfoEditViewProps extends IBaseScreen { serverVersion?: string; encryptionEnabled: boolean; - theme: TSupportedThemes; setReadOnlyPermission: string[]; setReactWhenReadOnlyPermission: string[]; archiveRoomPermission: string[]; @@ -70,18 +78,17 @@ interface IRoomInfoEditViewProps extends IBaseScreen { randomValue = random(15); - private querySubscription: any; // Observable dont have unsubscribe prop - private room!: TSubscriptionModel; - private name!: TextInput | null; - private description!: TextInput | null; - private topic!: TextInput | null; - private announcement!: TextInput | null; - private joinCode!: TextInput | null; + private querySubscription: Subscription | undefined; + private room: TSubscriptionModel; + private name: TextInput | null | undefined; + private description: TextInput | null | undefined; + private topic: TextInput | null | undefined; + private announcement: TextInput | null | undefined; + private joinCode: TextInput | null | undefined; static navigationOptions = () => ({ title: I18n.t('Room_Info_Edit') @@ -89,6 +96,7 @@ class RoomInfoEditView extends React.Component { const { route, @@ -269,7 +276,7 @@ class RoomInfoEditView extends React.Component