2019-03-12 16:23:06 +00:00
|
|
|
import React, { Component } from 'react';
|
2021-11-10 20:14:45 +00:00
|
|
|
import { DrawerNavigationProp } from '@react-navigation/drawer';
|
|
|
|
import { DrawerNavigationState } from '@react-navigation/native';
|
2023-02-14 13:47:56 +00:00
|
|
|
import { Alert, ScrollView, Text, TouchableWithoutFeedback, View, Linking } from 'react-native';
|
2019-03-12 16:23:06 +00:00
|
|
|
import { connect } from 'react-redux';
|
2021-02-26 16:01:45 +00:00
|
|
|
import { dequal } from 'dequal';
|
2023-02-14 13:47:56 +00:00
|
|
|
import { Dispatch } from 'redux';
|
2021-09-13 20:41:05 +00:00
|
|
|
|
2019-03-12 16:23:06 +00:00
|
|
|
import Avatar from '../../containers/Avatar';
|
|
|
|
import Status from '../../containers/Status/Status';
|
2022-06-06 14:17:51 +00:00
|
|
|
import { events, logEvent } from '../../lib/methods/helpers/log';
|
2019-03-12 16:23:06 +00:00
|
|
|
import I18n from '../../i18n';
|
2022-06-06 14:17:51 +00:00
|
|
|
import scrollPersistTaps from '../../lib/methods/helpers/scrollPersistTaps';
|
2023-02-14 13:47:56 +00:00
|
|
|
import userPreferences from '../../lib/methods/userPreferences';
|
2022-05-02 19:21:15 +00:00
|
|
|
import { CustomIcon } from '../../containers/CustomIcon';
|
2023-02-14 13:47:56 +00:00
|
|
|
import { NOTIFICATION_PRESENCE_CAP, STATUS_COLORS, themes } from '../../lib/constants';
|
2022-04-12 16:27:05 +00:00
|
|
|
import { TSupportedThemes, withTheme } from '../../theme';
|
2020-02-11 14:09:14 +00:00
|
|
|
import { getUserSelector } from '../../selectors/login';
|
2020-06-15 14:00:46 +00:00
|
|
|
import SafeAreaView from '../../containers/SafeAreaView';
|
2022-04-07 13:22:19 +00:00
|
|
|
import Navigation from '../../lib/navigation/appNavigation';
|
2021-09-13 20:41:05 +00:00
|
|
|
import SidebarItem from './SidebarItem';
|
|
|
|
import styles from './styles';
|
2021-12-03 19:27:57 +00:00
|
|
|
import { DrawerParamList } from '../../stacks/types';
|
2023-10-19 13:38:57 +00:00
|
|
|
import { IApplicationState, IUser, TSVStatus } from '../../definitions';
|
2022-05-07 01:19:27 +00:00
|
|
|
import * as List from '../../containers/List';
|
2023-10-19 13:38:57 +00:00
|
|
|
import { IActionSheetProvider, showActionSheetRef, withActionSheet } from '../../containers/ActionSheet';
|
2023-02-14 13:47:56 +00:00
|
|
|
import { setNotificationPresenceCap } from '../../actions/app';
|
2023-10-19 13:38:57 +00:00
|
|
|
import { SupportedVersionsWarning } from '../../containers/SupportedVersions';
|
2021-11-10 20:14:45 +00:00
|
|
|
|
|
|
|
interface ISidebarState {
|
|
|
|
showStatus: boolean;
|
|
|
|
}
|
2019-03-12 16:23:06 +00:00
|
|
|
|
2021-11-10 20:14:45 +00:00
|
|
|
interface ISidebarProps {
|
|
|
|
baseUrl: string;
|
2022-05-07 01:19:27 +00:00
|
|
|
navigation?: DrawerNavigationProp<DrawerParamList>;
|
2023-02-14 13:47:56 +00:00
|
|
|
dispatch: Dispatch;
|
2022-05-07 01:19:27 +00:00
|
|
|
state?: DrawerNavigationState<DrawerParamList>;
|
2021-11-10 20:14:45 +00:00
|
|
|
Site_Name: string;
|
2022-04-07 16:27:45 +00:00
|
|
|
user: IUser;
|
2022-09-30 14:50:33 +00:00
|
|
|
theme?: TSupportedThemes;
|
2021-11-10 20:14:45 +00:00
|
|
|
loadingServer: boolean;
|
|
|
|
useRealName: boolean;
|
|
|
|
allowStatusMessage: boolean;
|
2023-02-14 13:47:56 +00:00
|
|
|
notificationPresenceCap: boolean;
|
|
|
|
Presence_broadcast_disabled: boolean;
|
2023-10-19 13:38:57 +00:00
|
|
|
supportedVersionsStatus: TSVStatus;
|
2021-11-10 20:14:45 +00:00
|
|
|
isMasterDetail: boolean;
|
|
|
|
viewStatisticsPermission: string[];
|
|
|
|
viewRoomAdministrationPermission: string[];
|
|
|
|
viewUserAdministrationPermission: string[];
|
|
|
|
viewPrivilegedSettingPermission: string[];
|
2023-10-19 13:38:57 +00:00
|
|
|
showActionSheet: IActionSheetProvider['showActionSheet'];
|
2021-11-10 20:14:45 +00:00
|
|
|
}
|
2019-03-12 16:23:06 +00:00
|
|
|
|
2021-11-10 20:14:45 +00:00
|
|
|
class Sidebar extends Component<ISidebarProps, ISidebarState> {
|
|
|
|
constructor(props: ISidebarProps) {
|
2019-03-12 16:23:06 +00:00
|
|
|
super(props);
|
|
|
|
this.state = {
|
2021-02-25 16:41:44 +00:00
|
|
|
showStatus: false
|
2019-03-12 16:23:06 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-11-10 20:14:45 +00:00
|
|
|
shouldComponentUpdate(nextProps: ISidebarProps, nextState: ISidebarState) {
|
|
|
|
const { showStatus } = this.state;
|
2019-03-12 16:23:06 +00:00
|
|
|
const {
|
2021-09-13 20:41:05 +00:00
|
|
|
Site_Name,
|
|
|
|
user,
|
|
|
|
baseUrl,
|
|
|
|
state,
|
|
|
|
isMasterDetail,
|
2023-02-14 13:47:56 +00:00
|
|
|
notificationPresenceCap,
|
2021-09-13 20:41:05 +00:00
|
|
|
useRealName,
|
|
|
|
theme,
|
2023-02-14 13:47:56 +00:00
|
|
|
Presence_broadcast_disabled,
|
2021-09-13 20:41:05 +00:00
|
|
|
viewStatisticsPermission,
|
|
|
|
viewRoomAdministrationPermission,
|
|
|
|
viewUserAdministrationPermission,
|
|
|
|
viewPrivilegedSettingPermission
|
2019-03-12 16:23:06 +00:00
|
|
|
} = this.props;
|
2020-06-15 14:00:46 +00:00
|
|
|
// Drawer navigation state
|
|
|
|
if (state?.index !== nextProps.state?.index) {
|
|
|
|
return true;
|
|
|
|
}
|
2019-03-12 16:23:06 +00:00
|
|
|
if (nextState.showStatus !== showStatus) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (nextProps.Site_Name !== Site_Name) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (nextProps.Site_Name !== Site_Name) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (nextProps.baseUrl !== baseUrl) {
|
|
|
|
return true;
|
|
|
|
}
|
2019-12-04 16:39:53 +00:00
|
|
|
if (nextProps.theme !== theme) {
|
|
|
|
return true;
|
|
|
|
}
|
2021-02-26 16:01:45 +00:00
|
|
|
if (!dequal(nextProps.user, user)) {
|
2020-10-30 13:12:02 +00:00
|
|
|
return true;
|
2019-03-12 16:23:06 +00:00
|
|
|
}
|
2020-06-15 14:00:46 +00:00
|
|
|
if (nextProps.isMasterDetail !== isMasterDetail) {
|
2019-11-25 20:01:17 +00:00
|
|
|
return true;
|
|
|
|
}
|
2023-02-14 13:47:56 +00:00
|
|
|
if (nextProps.notificationPresenceCap !== notificationPresenceCap) {
|
|
|
|
return true;
|
|
|
|
}
|
2020-02-21 16:13:05 +00:00
|
|
|
if (nextProps.useRealName !== useRealName) {
|
|
|
|
return true;
|
|
|
|
}
|
2023-02-14 13:47:56 +00:00
|
|
|
if (nextProps.Presence_broadcast_disabled !== Presence_broadcast_disabled) {
|
|
|
|
return true;
|
|
|
|
}
|
2021-02-26 16:01:45 +00:00
|
|
|
if (!dequal(nextProps.viewStatisticsPermission, viewStatisticsPermission)) {
|
2021-02-25 16:41:44 +00:00
|
|
|
return true;
|
|
|
|
}
|
2021-02-26 16:01:45 +00:00
|
|
|
if (!dequal(nextProps.viewRoomAdministrationPermission, viewRoomAdministrationPermission)) {
|
2021-02-25 16:41:44 +00:00
|
|
|
return true;
|
|
|
|
}
|
2021-02-26 16:01:45 +00:00
|
|
|
if (!dequal(nextProps.viewUserAdministrationPermission, viewUserAdministrationPermission)) {
|
2021-02-25 16:41:44 +00:00
|
|
|
return true;
|
|
|
|
}
|
2021-02-26 16:01:45 +00:00
|
|
|
if (!dequal(nextProps.viewPrivilegedSettingPermission, viewPrivilegedSettingPermission)) {
|
2021-02-25 16:41:44 +00:00
|
|
|
return true;
|
|
|
|
}
|
2019-03-12 16:23:06 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-02-25 16:41:44 +00:00
|
|
|
getIsAdmin() {
|
|
|
|
const {
|
2021-09-13 20:41:05 +00:00
|
|
|
user,
|
|
|
|
viewStatisticsPermission,
|
|
|
|
viewRoomAdministrationPermission,
|
|
|
|
viewUserAdministrationPermission,
|
|
|
|
viewPrivilegedSettingPermission
|
2021-02-25 16:41:44 +00:00
|
|
|
} = this.props;
|
2019-09-16 20:26:32 +00:00
|
|
|
const { roles } = user;
|
2021-09-13 20:41:05 +00:00
|
|
|
const allPermissions = [
|
|
|
|
viewStatisticsPermission,
|
|
|
|
viewRoomAdministrationPermission,
|
|
|
|
viewUserAdministrationPermission,
|
|
|
|
viewPrivilegedSettingPermission
|
|
|
|
];
|
2021-02-25 16:41:44 +00:00
|
|
|
let isAdmin = false;
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
if (roles) {
|
2021-11-10 20:14:45 +00:00
|
|
|
isAdmin = allPermissions.reduce((result: boolean, permission) => {
|
2021-02-25 16:41:44 +00:00
|
|
|
if (permission) {
|
2021-09-13 20:41:05 +00:00
|
|
|
return result || permission.some(r => roles.indexOf(r) !== -1);
|
2021-02-25 16:41:44 +00:00
|
|
|
}
|
|
|
|
return result;
|
2021-09-13 20:41:05 +00:00
|
|
|
}, false);
|
2019-09-16 20:26:32 +00:00
|
|
|
}
|
2021-02-25 16:41:44 +00:00
|
|
|
return isAdmin;
|
2019-03-12 16:23:06 +00:00
|
|
|
}
|
|
|
|
|
2021-11-10 20:14:45 +00:00
|
|
|
sidebarNavigate = (route: string) => {
|
|
|
|
// @ts-ignore
|
2021-09-13 20:41:05 +00:00
|
|
|
logEvent(events[`SIDEBAR_GO_${route.replace('StackNavigator', '').replace('View', '').toUpperCase()}`]);
|
2020-08-19 17:09:36 +00:00
|
|
|
Navigation.navigate(route);
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2019-09-16 20:26:32 +00:00
|
|
|
|
2020-06-15 14:00:46 +00:00
|
|
|
get currentItemKey() {
|
|
|
|
const { state } = this.props;
|
2020-07-08 17:00:23 +00:00
|
|
|
return state?.routeNames[state?.index];
|
2020-06-15 14:00:46 +00:00
|
|
|
}
|
|
|
|
|
2020-07-08 19:40:10 +00:00
|
|
|
onPressUser = () => {
|
|
|
|
const { navigation, isMasterDetail } = this.props;
|
|
|
|
if (isMasterDetail) {
|
|
|
|
return;
|
|
|
|
}
|
2022-05-07 01:19:27 +00:00
|
|
|
navigation?.closeDrawer();
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2020-07-08 19:40:10 +00:00
|
|
|
|
2023-02-14 13:47:56 +00:00
|
|
|
onPressLearnMorePresenceCap = () => {
|
|
|
|
Linking.openURL('https://go.rocket.chat/i/presence-cap-learn-more');
|
|
|
|
};
|
|
|
|
|
|
|
|
onPressPresenceLearnMore = () => {
|
|
|
|
const { dispatch } = this.props;
|
|
|
|
dispatch(setNotificationPresenceCap(false));
|
|
|
|
userPreferences.setBool(NOTIFICATION_PRESENCE_CAP, false);
|
|
|
|
|
|
|
|
Alert.alert(
|
|
|
|
I18n.t('Presence_Cap_Warning_Title'),
|
|
|
|
I18n.t('Presence_Cap_Warning_Description'),
|
|
|
|
[
|
|
|
|
{
|
|
|
|
text: I18n.t('Learn_more'),
|
|
|
|
onPress: this.onPressLearnMorePresenceCap,
|
|
|
|
style: 'cancel'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: I18n.t('Close'),
|
|
|
|
style: 'default'
|
|
|
|
}
|
|
|
|
],
|
|
|
|
{ cancelable: false }
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2023-10-19 13:38:57 +00:00
|
|
|
onPressSupportedVersionsWarning = () => {
|
|
|
|
const { isMasterDetail } = this.props;
|
|
|
|
if (isMasterDetail) {
|
|
|
|
Navigation.navigate('ModalStackNavigator', { screen: 'SupportedVersionsWarning' });
|
|
|
|
} else {
|
|
|
|
showActionSheetRef({ children: <SupportedVersionsWarning /> });
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-06-15 14:00:46 +00:00
|
|
|
renderAdmin = () => {
|
|
|
|
const { theme, isMasterDetail } = this.props;
|
2021-02-25 16:41:44 +00:00
|
|
|
if (!this.getIsAdmin()) {
|
2020-06-15 14:00:46 +00:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
const routeName = isMasterDetail ? 'AdminPanelView' : 'AdminPanelStackNavigator';
|
|
|
|
return (
|
|
|
|
<>
|
2022-05-07 01:19:27 +00:00
|
|
|
<List.Separator />
|
2020-06-15 14:00:46 +00:00
|
|
|
<SidebarItem
|
|
|
|
text={I18n.t('Admin_Panel')}
|
2022-09-30 14:50:33 +00:00
|
|
|
left={<CustomIcon name='settings' size={20} color={themes[theme!].titleText} />}
|
2020-07-30 13:26:17 +00:00
|
|
|
onPress={() => this.sidebarNavigate(routeName)}
|
2021-06-22 19:41:55 +00:00
|
|
|
testID='sidebar-admin'
|
2022-09-30 14:50:33 +00:00
|
|
|
theme={theme!}
|
2020-06-15 14:00:46 +00:00
|
|
|
current={this.currentItemKey === routeName}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
);
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2020-06-15 14:00:46 +00:00
|
|
|
|
|
|
|
renderNavigation = () => {
|
|
|
|
const { theme } = this.props;
|
2019-03-12 16:23:06 +00:00
|
|
|
return (
|
2019-09-24 20:26:56 +00:00
|
|
|
<>
|
2019-03-12 16:23:06 +00:00
|
|
|
<SidebarItem
|
|
|
|
text={I18n.t('Chats')}
|
2022-09-30 14:50:33 +00:00
|
|
|
left={<CustomIcon name='message' size={20} color={themes[theme!].titleText} />}
|
2020-06-15 14:00:46 +00:00
|
|
|
onPress={() => this.sidebarNavigate('ChatsStackNavigator')}
|
2019-03-12 16:23:06 +00:00
|
|
|
testID='sidebar-chats'
|
2022-09-30 14:50:33 +00:00
|
|
|
theme={theme!}
|
2020-06-15 14:00:46 +00:00
|
|
|
current={this.currentItemKey === 'ChatsStackNavigator'}
|
2019-03-12 16:23:06 +00:00
|
|
|
/>
|
|
|
|
<SidebarItem
|
|
|
|
text={I18n.t('Profile')}
|
2022-09-30 14:50:33 +00:00
|
|
|
left={<CustomIcon name='user' size={20} color={themes[theme!].titleText} />}
|
2020-06-15 14:00:46 +00:00
|
|
|
onPress={() => this.sidebarNavigate('ProfileStackNavigator')}
|
2019-03-12 16:23:06 +00:00
|
|
|
testID='sidebar-profile'
|
2022-09-30 14:50:33 +00:00
|
|
|
theme={theme!}
|
2020-06-15 14:00:46 +00:00
|
|
|
current={this.currentItemKey === 'ProfileStackNavigator'}
|
2021-10-06 20:30:10 +00:00
|
|
|
/>
|
|
|
|
<SidebarItem
|
|
|
|
text={I18n.t('Display')}
|
2022-09-30 14:50:33 +00:00
|
|
|
left={<CustomIcon name='sort' size={20} color={themes[theme!].titleText} />}
|
2021-10-06 20:30:10 +00:00
|
|
|
onPress={() => this.sidebarNavigate('DisplayPrefStackNavigator')}
|
|
|
|
testID='sidebar-display'
|
2022-09-30 14:50:33 +00:00
|
|
|
theme={theme!}
|
2021-10-06 20:30:10 +00:00
|
|
|
current={this.currentItemKey === 'DisplayPrefStackNavigator'}
|
2019-03-12 16:23:06 +00:00
|
|
|
/>
|
|
|
|
<SidebarItem
|
|
|
|
text={I18n.t('Settings')}
|
2022-09-30 14:50:33 +00:00
|
|
|
left={<CustomIcon name='administration' size={20} color={themes[theme!].titleText} />}
|
2020-06-15 14:00:46 +00:00
|
|
|
onPress={() => this.sidebarNavigate('SettingsStackNavigator')}
|
2019-03-12 16:23:06 +00:00
|
|
|
testID='sidebar-settings'
|
2022-09-30 14:50:33 +00:00
|
|
|
theme={theme!}
|
2020-06-15 14:00:46 +00:00
|
|
|
current={this.currentItemKey === 'SettingsStackNavigator'}
|
2019-03-12 16:23:06 +00:00
|
|
|
/>
|
2020-06-15 14:00:46 +00:00
|
|
|
{this.renderAdmin()}
|
2019-09-24 20:26:56 +00:00
|
|
|
</>
|
2019-03-12 16:23:06 +00:00
|
|
|
);
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2019-03-12 16:23:06 +00:00
|
|
|
|
2020-03-30 20:19:01 +00:00
|
|
|
renderCustomStatus = () => {
|
2023-02-14 13:47:56 +00:00
|
|
|
const { user, theme, Presence_broadcast_disabled, notificationPresenceCap } = this.props;
|
|
|
|
|
|
|
|
let status = user?.status;
|
|
|
|
if (Presence_broadcast_disabled) {
|
|
|
|
status = 'disabled';
|
|
|
|
}
|
|
|
|
|
|
|
|
let right: React.ReactElement | undefined = <CustomIcon name='edit' size={20} color={themes[theme!].titleText} />;
|
|
|
|
if (notificationPresenceCap) {
|
|
|
|
right = <View style={[styles.customStatusDisabled, { backgroundColor: STATUS_COLORS.disabled }]} />;
|
|
|
|
} else if (Presence_broadcast_disabled) {
|
|
|
|
right = undefined;
|
|
|
|
}
|
|
|
|
|
2019-03-12 16:23:06 +00:00
|
|
|
return (
|
2020-03-30 20:19:01 +00:00
|
|
|
<SidebarItem
|
|
|
|
text={user.statusText || I18n.t('Edit_Status')}
|
2023-02-14 13:47:56 +00:00
|
|
|
left={<Status size={24} status={status} />}
|
2022-09-30 14:50:33 +00:00
|
|
|
theme={theme!}
|
2023-02-14 13:47:56 +00:00
|
|
|
right={right}
|
|
|
|
onPress={() => (Presence_broadcast_disabled ? this.onPressPresenceLearnMore() : this.sidebarNavigate('StatusView'))}
|
2022-05-31 16:50:10 +00:00
|
|
|
testID={`sidebar-custom-status-${user.status}`}
|
2019-03-12 16:23:06 +00:00
|
|
|
/>
|
|
|
|
);
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2019-03-12 16:23:06 +00:00
|
|
|
|
2023-10-19 13:38:57 +00:00
|
|
|
renderSupportedVersionsWarn = () => {
|
|
|
|
const { theme, supportedVersionsStatus } = this.props;
|
|
|
|
if (supportedVersionsStatus === 'warn') {
|
|
|
|
return (
|
|
|
|
<SidebarItem
|
|
|
|
text={I18n.t('Supported_versions_warning_update_required')}
|
|
|
|
textColor={themes[theme!].dangerColor}
|
|
|
|
left={<CustomIcon name='warning' size={20} color={themes[theme!].dangerColor} />}
|
|
|
|
theme={theme!}
|
|
|
|
onPress={() => this.onPressSupportedVersionsWarning()}
|
|
|
|
testID={`sidebar-supported-versions-warn`}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
};
|
|
|
|
|
2019-03-12 16:23:06 +00:00
|
|
|
render() {
|
2021-09-13 20:41:05 +00:00
|
|
|
const { user, Site_Name, baseUrl, useRealName, allowStatusMessage, isMasterDetail, theme } = this.props;
|
2019-03-12 16:23:06 +00:00
|
|
|
|
|
|
|
if (!user) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return (
|
2022-09-30 14:50:33 +00:00
|
|
|
<SafeAreaView testID='sidebar-view' style={{ backgroundColor: themes[theme!].focusedBackground }} vertical={isMasterDetail}>
|
2019-12-04 16:39:53 +00:00
|
|
|
<ScrollView
|
|
|
|
style={[
|
|
|
|
styles.container,
|
|
|
|
{
|
2022-09-30 14:50:33 +00:00
|
|
|
backgroundColor: isMasterDetail ? themes[theme!].backgroundColor : themes[theme!].focusedBackground
|
2019-12-04 16:39:53 +00:00
|
|
|
}
|
|
|
|
]}
|
2022-08-08 21:02:08 +00:00
|
|
|
{...scrollPersistTaps}
|
|
|
|
>
|
2020-07-08 19:40:10 +00:00
|
|
|
<TouchableWithoutFeedback onPress={this.onPressUser} testID='sidebar-close-drawer'>
|
2021-11-10 20:14:45 +00:00
|
|
|
<View style={styles.header}>
|
2021-09-13 20:41:05 +00:00
|
|
|
<Avatar text={user.username} style={styles.avatar} size={30} />
|
2020-06-15 14:00:46 +00:00
|
|
|
<View style={styles.headerTextContainer}>
|
|
|
|
<View style={styles.headerUsername}>
|
2022-09-30 14:50:33 +00:00
|
|
|
<Text numberOfLines={1} style={[styles.username, { color: themes[theme!].titleText }]}>
|
2021-09-13 20:41:05 +00:00
|
|
|
{useRealName ? user.name : user.username}
|
|
|
|
</Text>
|
2020-06-15 14:00:46 +00:00
|
|
|
</View>
|
|
|
|
<Text
|
2022-09-30 14:50:33 +00:00
|
|
|
style={[styles.currentServerText, { color: themes[theme!].titleText }]}
|
2020-06-15 14:00:46 +00:00
|
|
|
numberOfLines={1}
|
2022-08-08 21:02:08 +00:00
|
|
|
accessibilityLabel={`Connected to ${baseUrl}`}
|
|
|
|
>
|
2021-09-13 20:41:05 +00:00
|
|
|
{Site_Name}
|
2020-06-15 14:00:46 +00:00
|
|
|
</Text>
|
2019-03-12 16:23:06 +00:00
|
|
|
</View>
|
|
|
|
</View>
|
2020-06-15 14:00:46 +00:00
|
|
|
</TouchableWithoutFeedback>
|
2019-03-12 16:23:06 +00:00
|
|
|
|
2023-10-19 13:38:57 +00:00
|
|
|
<List.Separator />
|
|
|
|
{this.renderSupportedVersionsWarn()}
|
|
|
|
|
2022-05-07 01:19:27 +00:00
|
|
|
<List.Separator />
|
2019-03-12 16:23:06 +00:00
|
|
|
|
2020-03-30 20:19:01 +00:00
|
|
|
{allowStatusMessage ? this.renderCustomStatus() : null}
|
2020-06-15 14:00:46 +00:00
|
|
|
{!isMasterDetail ? (
|
2020-03-30 20:19:01 +00:00
|
|
|
<>
|
2022-05-07 01:19:27 +00:00
|
|
|
<List.Separator />
|
2020-03-30 20:19:01 +00:00
|
|
|
{this.renderNavigation()}
|
2022-05-07 01:19:27 +00:00
|
|
|
<List.Separator />
|
2020-03-30 20:19:01 +00:00
|
|
|
</>
|
2020-06-15 14:00:46 +00:00
|
|
|
) : (
|
2021-09-13 20:41:05 +00:00
|
|
|
<>{this.renderAdmin()}</>
|
2020-06-15 14:00:46 +00:00
|
|
|
)}
|
2019-03-12 16:23:06 +00:00
|
|
|
</ScrollView>
|
|
|
|
</SafeAreaView>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2019-08-07 13:51:34 +00:00
|
|
|
|
2022-05-07 01:19:27 +00:00
|
|
|
const mapStateToProps = (state: IApplicationState) => ({
|
|
|
|
Site_Name: state.settings.Site_Name as string,
|
2020-02-11 14:09:14 +00:00
|
|
|
user: getUserSelector(state),
|
|
|
|
baseUrl: state.server.server,
|
2020-02-21 16:13:05 +00:00
|
|
|
loadingServer: state.server.loading,
|
2022-05-07 01:19:27 +00:00
|
|
|
useRealName: state.settings.UI_Use_Real_Name as boolean,
|
|
|
|
allowStatusMessage: state.settings.Accounts_AllowUserStatusMessageChange as boolean,
|
2023-02-14 13:47:56 +00:00
|
|
|
Presence_broadcast_disabled: state.settings.Presence_broadcast_disabled as boolean,
|
|
|
|
notificationPresenceCap: state.app.notificationPresenceCap,
|
2023-10-19 13:38:57 +00:00
|
|
|
supportedVersionsStatus: state.supportedVersions.status,
|
2021-02-25 16:41:44 +00:00
|
|
|
isMasterDetail: state.app.isMasterDetail,
|
2022-05-07 01:19:27 +00:00
|
|
|
viewStatisticsPermission: state.permissions['view-statistics'] as string[],
|
|
|
|
viewRoomAdministrationPermission: state.permissions['view-room-administration'] as string[],
|
|
|
|
viewUserAdministrationPermission: state.permissions['view-user-administration'] as string[],
|
|
|
|
viewPrivilegedSettingPermission: state.permissions['view-privileged-setting'] as string[]
|
2019-08-07 13:51:34 +00:00
|
|
|
});
|
|
|
|
|
2023-10-19 13:38:57 +00:00
|
|
|
export default connect(mapStateToProps)(withActionSheet(withTheme(Sidebar)));
|