Revert "Remove layout glitch-soc settings"

Reverts 0d61985713. Re-enables the ability to toggle between single/multi column ui.
This commit is contained in:
jwbjnwolf
2024-01-19 10:19:42 +00:00
committed by Laura Hausmann
parent 3962700726
commit 915034f6a6
5 changed files with 61 additions and 8 deletions
@@ -79,6 +79,7 @@ const mapStateToProps = state => ({
hasComposingText: state.getIn(['compose', 'text']).trim().length !== 0,
hasMediaAttachments: state.getIn(['compose', 'media_attachments']).size > 0,
canUploadMore: !state.getIn(['compose', 'media_attachments']).some(x => ['audio', 'video'].includes(x.get('type'))) && state.getIn(['compose', 'media_attachments']).size < 4,
layout_local_setting: state.getIn(['local_settings', 'layout']),
isWide: state.getIn(['local_settings', 'stretch']),
dropdownMenuIsOpen: state.dropdownMenu.openId !== null,
unreadNotifications: state.getIn(['notifications', 'unread']),
@@ -259,6 +260,7 @@ class UI extends Component {
static propTypes = {
dispatch: PropTypes.func.isRequired,
children: PropTypes.node,
layout_local_setting: PropTypes.string,
isWide: PropTypes.bool,
systemFontUi: PropTypes.bool,
isComposing: PropTypes.bool,
@@ -383,7 +385,7 @@ class UI extends Component {
});
handleResize = () => {
const layout = layoutFromWindow();
const layout = layoutFromWindow(this.props.layout_local_setting);
if (layout !== this.props.layout) {
this.handleLayoutChange.cancel();
@@ -447,6 +449,19 @@ class UI extends Component {
}
}
UNSAFE_componentWillReceiveProps (nextProps) {
if (nextProps.layout_local_setting !== this.props.layout_local_setting) {
const layout = layoutFromWindow(nextProps.layout_local_setting);
if (layout !== this.props.layout) {
this.handleLayoutChange.cancel();
this.props.dispatch(changeLayout(layout));
} else {
this.handleLayoutChange();
}
}
}
componentDidUpdate (prevProps) {
if (this.props.unreadNotifications !== prevProps.unreadNotifications ||
this.props.showFaviconBadge !== prevProps.showFaviconBadge) {