Merge branch 'develop' into chore.migrate-redux-server-to-ts
This commit is contained in:
commit
ec6f9fa0df
|
@ -1,8 +0,0 @@
|
||||||
import * as types from './actionsTypes';
|
|
||||||
|
|
||||||
export function deepLinkingOpen(params) {
|
|
||||||
return {
|
|
||||||
type: types.DEEP_LINKING.OPEN,
|
|
||||||
params
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
import { Action } from 'redux';
|
||||||
|
|
||||||
|
import { DEEP_LINKING } from './actionsTypes';
|
||||||
|
|
||||||
|
interface IParams {
|
||||||
|
path: string;
|
||||||
|
rid: string;
|
||||||
|
messageId: string;
|
||||||
|
host: string;
|
||||||
|
isCall: boolean;
|
||||||
|
fullURL: string;
|
||||||
|
type: string;
|
||||||
|
token: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IDeepLinkingOpen extends Action {
|
||||||
|
params: Partial<IParams>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deepLinkingOpen(params: Partial<IParams>): IDeepLinkingOpen {
|
||||||
|
return {
|
||||||
|
type: DEEP_LINKING.OPEN,
|
||||||
|
params
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,15 +0,0 @@
|
||||||
import * as types from './actionsTypes';
|
|
||||||
|
|
||||||
export function setAllPreferences(preferences) {
|
|
||||||
return {
|
|
||||||
type: types.SORT_PREFERENCES.SET_ALL,
|
|
||||||
preferences
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function setPreference(preference) {
|
|
||||||
return {
|
|
||||||
type: types.SORT_PREFERENCES.SET,
|
|
||||||
preference
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
import { Action } from 'redux';
|
||||||
|
|
||||||
|
import { IPreferences } from '../definitions';
|
||||||
|
import { SORT_PREFERENCES } from './actionsTypes';
|
||||||
|
|
||||||
|
interface ISetAllPreferences extends Action {
|
||||||
|
preferences: IPreferences;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ISetPreference extends Action {
|
||||||
|
preference: Partial<IPreferences>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TActionSortPreferences = ISetAllPreferences & ISetPreference;
|
||||||
|
|
||||||
|
export function setAllPreferences(preferences: IPreferences): ISetAllPreferences {
|
||||||
|
return {
|
||||||
|
type: SORT_PREFERENCES.SET_ALL,
|
||||||
|
preferences
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setPreference(preference: Partial<IPreferences>): ISetPreference {
|
||||||
|
return {
|
||||||
|
type: SORT_PREFERENCES.SET,
|
||||||
|
preference
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,21 +0,0 @@
|
||||||
import { USERS_TYPING } from './actionsTypes';
|
|
||||||
|
|
||||||
export function addUserTyping(username) {
|
|
||||||
return {
|
|
||||||
type: USERS_TYPING.ADD,
|
|
||||||
username
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function removeUserTyping(username) {
|
|
||||||
return {
|
|
||||||
type: USERS_TYPING.REMOVE,
|
|
||||||
username
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function clearUserTyping() {
|
|
||||||
return {
|
|
||||||
type: USERS_TYPING.CLEAR
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
import { Action } from 'redux';
|
||||||
|
|
||||||
|
import { USERS_TYPING } from './actionsTypes';
|
||||||
|
|
||||||
|
export interface IUsersTypingGenericAction extends Action {
|
||||||
|
username: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TActionUserTyping = IUsersTypingGenericAction & Action;
|
||||||
|
|
||||||
|
export function addUserTyping(username: string): IUsersTypingGenericAction {
|
||||||
|
return {
|
||||||
|
type: USERS_TYPING.ADD,
|
||||||
|
username
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function removeUserTyping(username: string): IUsersTypingGenericAction {
|
||||||
|
return {
|
||||||
|
type: USERS_TYPING.REMOVE,
|
||||||
|
username
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function clearUserTyping(): Action {
|
||||||
|
return {
|
||||||
|
type: USERS_TYPING.CLEAR
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,10 +1,11 @@
|
||||||
|
import { dequal } from 'dequal';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { dequal } from 'dequal';
|
|
||||||
|
|
||||||
import RoomHeader from './RoomHeader';
|
import { IApplicationState } from '../../definitions';
|
||||||
import { withDimensions } from '../../dimensions';
|
import { withDimensions } from '../../dimensions';
|
||||||
import I18n from '../../i18n';
|
import I18n from '../../i18n';
|
||||||
|
import RoomHeader from './RoomHeader';
|
||||||
|
|
||||||
interface IRoomHeaderContainerProps {
|
interface IRoomHeaderContainerProps {
|
||||||
title: string;
|
title: string;
|
||||||
|
@ -122,8 +123,8 @@ class RoomHeaderContainer extends Component<IRoomHeaderContainerProps, any> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapStateToProps = (state: any, ownProps: any) => {
|
const mapStateToProps = (state: IApplicationState, ownProps: any) => {
|
||||||
let statusText;
|
let statusText = '';
|
||||||
let status = 'offline';
|
let status = 'offline';
|
||||||
const { roomUserId, type, visitor = {}, tmid } = ownProps;
|
const { roomUserId, type, visitor = {}, tmid } = ownProps;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
import { SortBy, DisplayMode } from '../constants/constantDisplayMode';
|
||||||
|
|
||||||
|
export interface IPreferences {
|
||||||
|
sortBy: SortBy;
|
||||||
|
groupByType: boolean;
|
||||||
|
showFavorites: boolean;
|
||||||
|
showUnread: boolean;
|
||||||
|
showAvatar: boolean;
|
||||||
|
displayMode: DisplayMode;
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ export * from './INotification';
|
||||||
export * from './IRoom';
|
export * from './IRoom';
|
||||||
export * from './IServer';
|
export * from './IServer';
|
||||||
export * from './ISubscription';
|
export * from './ISubscription';
|
||||||
|
export * from './IPreferences';
|
||||||
export * from './IServerHistory';
|
export * from './IServerHistory';
|
||||||
|
|
||||||
export interface IBaseScreen<T extends Record<string, object | undefined>, S extends string> {
|
export interface IBaseScreen<T extends Record<string, object | undefined>, S extends string> {
|
||||||
|
|
|
@ -7,6 +7,8 @@ import { TActionInviteLinks } from '../../actions/inviteLinks';
|
||||||
import { IActionRoles } from '../../actions/roles';
|
import { IActionRoles } from '../../actions/roles';
|
||||||
import { TActionSelectedUsers } from '../../actions/selectedUsers';
|
import { TActionSelectedUsers } from '../../actions/selectedUsers';
|
||||||
import { IActionSettings } from '../../actions/settings';
|
import { IActionSettings } from '../../actions/settings';
|
||||||
|
import { TActionSortPreferences } from '../../actions/sortPreferences';
|
||||||
|
import { TActionUserTyping } from '../../actions/usersTyping';
|
||||||
// REDUCERS
|
// REDUCERS
|
||||||
import { IActiveUsers } from '../../reducers/activeUsers';
|
import { IActiveUsers } from '../../reducers/activeUsers';
|
||||||
import { IEncryption } from '../../reducers/encryption';
|
import { IEncryption } from '../../reducers/encryption';
|
||||||
|
@ -47,4 +49,6 @@ export type TApplicationActions = TActionActiveUsers &
|
||||||
IActionRoles &
|
IActionRoles &
|
||||||
IActionSettings &
|
IActionSettings &
|
||||||
TActionEncryption &
|
TActionEncryption &
|
||||||
|
TActionSortPreferences &
|
||||||
|
TActionUserTyping &
|
||||||
TActionServer;
|
TActionServer;
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { SET_ACTIVE_USERS } from '../actions/actionsTypes';
|
||||||
type TUserStatus = 'online' | 'offline';
|
type TUserStatus = 'online' | 'offline';
|
||||||
export interface IActiveUser {
|
export interface IActiveUser {
|
||||||
status: TUserStatus;
|
status: TUserStatus;
|
||||||
statusText?: string;
|
statusText: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IActiveUsers {
|
export interface IActiveUsers {
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
import { IPreferences } from '../definitions';
|
||||||
|
import { setAllPreferences, setPreference } from '../actions/sortPreferences';
|
||||||
|
import { mockedStore } from './mockedStore';
|
||||||
|
import { initialState } from './sortPreferences';
|
||||||
|
import { DisplayMode, SortBy } from '../constants/constantDisplayMode';
|
||||||
|
|
||||||
|
describe('test sortPreferences reducer', () => {
|
||||||
|
it('should return initial state', () => {
|
||||||
|
const state = mockedStore.getState().sortPreferences;
|
||||||
|
expect(state).toEqual(initialState);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correctly value after call setPreference action', () => {
|
||||||
|
const preferences: IPreferences = {
|
||||||
|
displayMode: DisplayMode.Condensed,
|
||||||
|
groupByType: true,
|
||||||
|
showAvatar: true,
|
||||||
|
showFavorites: true,
|
||||||
|
showUnread: true,
|
||||||
|
sortBy: SortBy.Activity
|
||||||
|
};
|
||||||
|
mockedStore.dispatch(setAllPreferences(preferences));
|
||||||
|
const state = mockedStore.getState().sortPreferences;
|
||||||
|
expect(state).toEqual(preferences);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correctly value after call setPreference action', () => {
|
||||||
|
const preference: Partial<IPreferences> = {
|
||||||
|
displayMode: DisplayMode.Expanded
|
||||||
|
};
|
||||||
|
mockedStore.dispatch(setPreference(preference));
|
||||||
|
const { displayMode } = mockedStore.getState().sortPreferences;
|
||||||
|
expect(displayMode).toEqual(DisplayMode.Expanded);
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,7 +1,8 @@
|
||||||
import { SORT_PREFERENCES } from '../actions/actionsTypes';
|
import { SORT_PREFERENCES } from '../actions/actionsTypes';
|
||||||
import { DisplayMode, SortBy } from '../constants/constantDisplayMode';
|
import { DisplayMode, SortBy } from '../constants/constantDisplayMode';
|
||||||
|
import { IPreferences, TApplicationActions } from '../definitions';
|
||||||
|
|
||||||
const initialState = {
|
export const initialState: IPreferences = {
|
||||||
sortBy: SortBy.Activity,
|
sortBy: SortBy.Activity,
|
||||||
groupByType: false,
|
groupByType: false,
|
||||||
showFavorites: false,
|
showFavorites: false,
|
||||||
|
@ -10,7 +11,7 @@ const initialState = {
|
||||||
displayMode: DisplayMode.Expanded
|
displayMode: DisplayMode.Expanded
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (state = initialState, action) => {
|
export default (state = initialState, action: TApplicationActions): IPreferences => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case SORT_PREFERENCES.SET_ALL:
|
case SORT_PREFERENCES.SET_ALL:
|
||||||
return {
|
return {
|
|
@ -0,0 +1,30 @@
|
||||||
|
import { addUserTyping, removeUserTyping, clearUserTyping } from '../actions/usersTyping';
|
||||||
|
import { mockedStore } from './mockedStore';
|
||||||
|
import { initialState } from './usersTyping';
|
||||||
|
|
||||||
|
describe('test usersTyping reducer', () => {
|
||||||
|
it('should return initial state', () => {
|
||||||
|
const state = mockedStore.getState().usersTyping;
|
||||||
|
expect(state).toEqual(initialState);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return modified store after addUserTyping', () => {
|
||||||
|
mockedStore.dispatch(addUserTyping('diego'));
|
||||||
|
mockedStore.dispatch(addUserTyping('carlos'));
|
||||||
|
mockedStore.dispatch(addUserTyping('maria'));
|
||||||
|
const state = mockedStore.getState().usersTyping;
|
||||||
|
expect(state).toEqual(['diego', 'carlos', 'maria']);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return modified store after removeUserTyping', () => {
|
||||||
|
mockedStore.dispatch(removeUserTyping('diego'));
|
||||||
|
const state = mockedStore.getState().usersTyping;
|
||||||
|
expect(state).toEqual(['carlos', 'maria']);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return initial state after reset', () => {
|
||||||
|
mockedStore.dispatch(clearUserTyping());
|
||||||
|
const state = mockedStore.getState().usersTyping;
|
||||||
|
expect(state).toEqual(initialState);
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,8 +1,11 @@
|
||||||
import { USERS_TYPING } from '../actions/actionsTypes';
|
import { USERS_TYPING } from '../actions/actionsTypes';
|
||||||
|
import { TApplicationActions } from '../definitions';
|
||||||
|
|
||||||
const initialState = [];
|
export type IUsersTyping = string[];
|
||||||
|
|
||||||
export default function usersTyping(state = initialState, action) {
|
export const initialState: IUsersTyping = [];
|
||||||
|
|
||||||
|
export default function usersTyping(state = initialState, action: TApplicationActions): IUsersTyping {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case USERS_TYPING.ADD:
|
case USERS_TYPING.ADD:
|
||||||
if (state.findIndex(item => item === action.username) === -1) {
|
if (state.findIndex(item => item === action.username) === -1) {
|
|
@ -1,31 +1,23 @@
|
||||||
|
import { StackNavigationProp } from '@react-navigation/stack';
|
||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import { Switch } from 'react-native';
|
import { Switch } from 'react-native';
|
||||||
import { RadioButton } from 'react-native-ui-lib';
|
import { RadioButton } from 'react-native-ui-lib';
|
||||||
import { StackNavigationProp } from '@react-navigation/stack';
|
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
|
||||||
import { setPreference } from '../actions/sortPreferences';
|
import { setPreference } from '../actions/sortPreferences';
|
||||||
import RocketChat from '../lib/rocketchat';
|
|
||||||
import StatusBar from '../containers/StatusBar';
|
|
||||||
import I18n from '../i18n';
|
|
||||||
import * as List from '../containers/List';
|
|
||||||
import { useTheme } from '../theme';
|
|
||||||
import { themes } from '../constants/colors';
|
import { themes } from '../constants/colors';
|
||||||
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 { DisplayMode, SortBy } from '../constants/constantDisplayMode';
|
import { DisplayMode, SortBy } from '../constants/constantDisplayMode';
|
||||||
|
import * as HeaderButton from '../containers/HeaderButton';
|
||||||
|
import * as List from '../containers/List';
|
||||||
|
import { ICON_SIZE } from '../containers/List/constants';
|
||||||
|
import SafeAreaView from '../containers/SafeAreaView';
|
||||||
|
import StatusBar from '../containers/StatusBar';
|
||||||
|
import { IApplicationState, IPreferences } from '../definitions';
|
||||||
|
import I18n from '../i18n';
|
||||||
|
import RocketChat from '../lib/rocketchat';
|
||||||
import { SettingsStackParamList } from '../stacks/types';
|
import { SettingsStackParamList } from '../stacks/types';
|
||||||
|
import { useTheme } from '../theme';
|
||||||
interface IParam {
|
import log, { events, logEvent } from '../utils/log';
|
||||||
sortBy: SortBy;
|
|
||||||
groupByType: boolean;
|
|
||||||
showFavorites: boolean;
|
|
||||||
showUnread: boolean;
|
|
||||||
showAvatar: boolean;
|
|
||||||
displayMode: DisplayMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IDisplayPrefsView {
|
interface IDisplayPrefsView {
|
||||||
navigation: StackNavigationProp<SettingsStackParamList, 'DisplayPrefsView'>;
|
navigation: StackNavigationProp<SettingsStackParamList, 'DisplayPrefsView'>;
|
||||||
|
@ -36,7 +28,7 @@ const DisplayPrefsView = (props: IDisplayPrefsView): JSX.Element => {
|
||||||
const { theme } = useTheme();
|
const { theme } = useTheme();
|
||||||
|
|
||||||
const { sortBy, groupByType, showFavorites, showUnread, showAvatar, displayMode } = useSelector(
|
const { sortBy, groupByType, showFavorites, showUnread, showAvatar, displayMode } = useSelector(
|
||||||
(state: any) => state.sortPreferences
|
(state: IApplicationState) => state.sortPreferences
|
||||||
);
|
);
|
||||||
const { isMasterDetail } = useSelector((state: any) => state.app);
|
const { isMasterDetail } = useSelector((state: any) => state.app);
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
@ -53,7 +45,7 @@ const DisplayPrefsView = (props: IDisplayPrefsView): JSX.Element => {
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const setSortPreference = async (param: Partial<IParam>) => {
|
const setSortPreference = async (param: Partial<IPreferences>) => {
|
||||||
try {
|
try {
|
||||||
dispatch(setPreference(param));
|
dispatch(setPreference(param));
|
||||||
await RocketChat.saveSortPreference(param);
|
await RocketChat.saveSortPreference(param);
|
||||||
|
|
|
@ -1,36 +1,36 @@
|
||||||
|
import { Q } from '@nozbe/watermelondb';
|
||||||
|
import { HeaderBackButton, StackNavigationOptions, StackNavigationProp } from '@react-navigation/stack';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Alert, FlatList, Keyboard } from 'react-native';
|
import { Alert, FlatList, Keyboard } from 'react-native';
|
||||||
import { RouteProp } from '@react-navigation/native';
|
|
||||||
import { Dispatch } from 'redux';
|
|
||||||
import { Q } from '@nozbe/watermelondb';
|
|
||||||
import { EdgeInsets, withSafeAreaInsets } from 'react-native-safe-area-context';
|
import { EdgeInsets, withSafeAreaInsets } from 'react-native-safe-area-context';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { HeaderBackButton, StackNavigationOptions, StackNavigationProp } from '@react-navigation/stack';
|
|
||||||
|
|
||||||
import StatusBar from '../containers/StatusBar';
|
import { deleteRoom } from '../actions/room';
|
||||||
import RoomHeader from '../containers/RoomHeader';
|
import { themes } from '../constants/colors';
|
||||||
import { withTheme } from '../theme';
|
import { withActionSheet } from '../containers/ActionSheet';
|
||||||
import log, { events, logEvent } from '../utils/log';
|
import ActivityIndicator from '../containers/ActivityIndicator';
|
||||||
import database from '../lib/database';
|
import BackgroundContainer from '../containers/BackgroundContainer';
|
||||||
import { getUserSelector } from '../selectors/login';
|
|
||||||
import { getHeaderTitlePosition } from '../containers/Header';
|
import { getHeaderTitlePosition } from '../containers/Header';
|
||||||
import * as HeaderButton from '../containers/HeaderButton';
|
import * as HeaderButton from '../containers/HeaderButton';
|
||||||
import BackgroundContainer from '../containers/BackgroundContainer';
|
import RoomHeader from '../containers/RoomHeader';
|
||||||
import SafeAreaView from '../containers/SafeAreaView';
|
import SafeAreaView from '../containers/SafeAreaView';
|
||||||
import ActivityIndicator from '../containers/ActivityIndicator';
|
|
||||||
import SearchHeader from '../containers/SearchHeader';
|
import SearchHeader from '../containers/SearchHeader';
|
||||||
import RoomItem, { ROW_HEIGHT } from '../presentation/RoomItem';
|
import StatusBar from '../containers/StatusBar';
|
||||||
import RocketChat from '../lib/rocketchat';
|
import { IApplicationState, IBaseScreen } from '../definitions';
|
||||||
import { withDimensions } from '../dimensions';
|
import { withDimensions } from '../dimensions';
|
||||||
import { isIOS } from '../utils/deviceInfo';
|
|
||||||
import debounce from '../utils/debounce';
|
|
||||||
import { showErrorAlert } from '../utils/info';
|
|
||||||
import { goRoom } from '../utils/goRoom';
|
|
||||||
import I18n from '../i18n';
|
import I18n from '../i18n';
|
||||||
import { withActionSheet } from '../containers/ActionSheet';
|
import database from '../lib/database';
|
||||||
import { deleteRoom as deleteRoomAction } from '../actions/room';
|
|
||||||
import { CustomIcon } from '../lib/Icons';
|
import { CustomIcon } from '../lib/Icons';
|
||||||
import { themes } from '../constants/colors';
|
import RocketChat from '../lib/rocketchat';
|
||||||
|
import RoomItem, { ROW_HEIGHT } from '../presentation/RoomItem';
|
||||||
|
import { getUserSelector } from '../selectors/login';
|
||||||
|
import { ChatsStackParamList } from '../stacks/types';
|
||||||
|
import { withTheme } from '../theme';
|
||||||
|
import debounce from '../utils/debounce';
|
||||||
|
import { isIOS } from '../utils/deviceInfo';
|
||||||
|
import { goRoom } from '../utils/goRoom';
|
||||||
|
import { showErrorAlert } from '../utils/info';
|
||||||
|
import log, { events, logEvent } from '../utils/log';
|
||||||
|
|
||||||
const API_FETCH_COUNT = 25;
|
const API_FETCH_COUNT = 25;
|
||||||
const PERMISSION_DELETE_C = 'delete-c';
|
const PERMISSION_DELETE_C = 'delete-c';
|
||||||
|
@ -78,9 +78,11 @@ interface ITeamChannelsViewState {
|
||||||
showCreate: boolean;
|
showCreate: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ITeamChannelsViewProps {
|
type IProps = Omit<IBaseScreen<ChatsStackParamList, 'TeamChannelsView'>, 'navigation'> & {
|
||||||
route: RouteProp<{ TeamChannelsView: { teamId: string } }, 'TeamChannelsView'>;
|
|
||||||
navigation: StackNavigationProp<any, 'TeamChannelsView'>;
|
navigation: StackNavigationProp<any, 'TeamChannelsView'>;
|
||||||
|
};
|
||||||
|
|
||||||
|
interface ITeamChannelsViewProps extends IProps {
|
||||||
isMasterDetail: boolean;
|
isMasterDetail: boolean;
|
||||||
insets: EdgeInsets;
|
insets: EdgeInsets;
|
||||||
theme: string;
|
theme: string;
|
||||||
|
@ -93,7 +95,6 @@ interface ITeamChannelsViewProps {
|
||||||
deleteCPermission: string[];
|
deleteCPermission: string[];
|
||||||
deletePPermission: string[];
|
deletePPermission: string[];
|
||||||
showActionSheet: (options: any) => void;
|
showActionSheet: (options: any) => void;
|
||||||
deleteRoom: (rid: string, t: string) => void;
|
|
||||||
showAvatar: boolean;
|
showAvatar: boolean;
|
||||||
displayMode: string;
|
displayMode: string;
|
||||||
}
|
}
|
||||||
|
@ -422,7 +423,7 @@ class TeamChannelsView extends React.Component<ITeamChannelsViewProps, ITeamChan
|
||||||
|
|
||||||
delete = (item: IItem) => {
|
delete = (item: IItem) => {
|
||||||
logEvent(events.TC_DELETE_ROOM);
|
logEvent(events.TC_DELETE_ROOM);
|
||||||
const { deleteRoom } = this.props;
|
const { dispatch } = this.props;
|
||||||
|
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
I18n.t('Are_you_sure_question_mark'),
|
I18n.t('Are_you_sure_question_mark'),
|
||||||
|
@ -435,7 +436,7 @@ class TeamChannelsView extends React.Component<ITeamChannelsViewProps, ITeamChan
|
||||||
{
|
{
|
||||||
text: I18n.t('Yes_action_it', { action: I18n.t('delete') }),
|
text: I18n.t('Yes_action_it', { action: I18n.t('delete') }),
|
||||||
style: 'destructive',
|
style: 'destructive',
|
||||||
onPress: () => deleteRoom(item._id, item.t)
|
onPress: () => dispatch(deleteRoom(item._id, item.t))
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
{ cancelable: false }
|
{ cancelable: false }
|
||||||
|
@ -574,7 +575,7 @@ class TeamChannelsView extends React.Component<ITeamChannelsViewProps, ITeamChan
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapStateToProps = (state: any) => ({
|
const mapStateToProps = (state: IApplicationState) => ({
|
||||||
baseUrl: state.server.server,
|
baseUrl: state.server.server,
|
||||||
user: getUserSelector(state),
|
user: getUserSelector(state),
|
||||||
useRealName: state.settings.UI_Use_Real_Name,
|
useRealName: state.settings.UI_Use_Real_Name,
|
||||||
|
@ -589,11 +590,4 @@ const mapStateToProps = (state: any) => ({
|
||||||
displayMode: state.sortPreferences.displayMode
|
displayMode: state.sortPreferences.displayMode
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch: Dispatch) => ({
|
export default connect(mapStateToProps)(withDimensions(withSafeAreaInsets(withTheme(withActionSheet(TeamChannelsView)))));
|
||||||
deleteRoom: (rid: string, t: string) => dispatch(deleteRoomAction(rid, t))
|
|
||||||
});
|
|
||||||
|
|
||||||
export default connect(
|
|
||||||
mapStateToProps,
|
|
||||||
mapDispatchToProps
|
|
||||||
)(withDimensions(withSafeAreaInsets(withTheme(withActionSheet(TeamChannelsView)))));
|
|
||||||
|
|
Loading…
Reference in New Issue