forked from Ivasoft/mattermost-mobile
* MM-30164 fix safe area insets
* Fix unit test setup mock for react-native-device-info
* Add insets for edit profile screen
* Fix about screen
* Fix theme screen
* Lock phone screen to portrait
* fix unit tests
* Fix autocomplete layout
(cherry picked from commit dcaaaee44c)
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
47 lines
1.7 KiB
JavaScript
47 lines
1.7 KiB
JavaScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {bindActionCreators} from 'redux';
|
|
import {connect} from 'react-redux';
|
|
import {createSelector} from 'reselect';
|
|
|
|
import {getAutocompleteCommands, getCommandAutocompleteSuggestions} from '@mm-redux/actions/integrations';
|
|
import {getAutocompleteCommandsList, getCommandAutocompleteSuggestionsList} from '@mm-redux/selectors/entities/integrations';
|
|
import {getTheme} from '@mm-redux/selectors/entities/preferences';
|
|
import {getCurrentTeamId} from '@mm-redux/selectors/entities/teams';
|
|
|
|
import SlashSuggestion from './slash_suggestion';
|
|
|
|
// TODO: Remove when all below commands have been implemented
|
|
const COMMANDS_TO_IMPLEMENT_LATER = ['collapse', 'expand', 'join', 'open', 'leave', 'logout', 'msg', 'grpmsg'];
|
|
const NON_MOBILE_COMMANDS = ['rename', 'invite_people', 'shortcuts', 'search', 'help', 'settings', 'remove'];
|
|
|
|
const COMMANDS_TO_HIDE_ON_MOBILE = [...COMMANDS_TO_IMPLEMENT_LATER, ...NON_MOBILE_COMMANDS];
|
|
|
|
const mobileCommandsSelector = createSelector(
|
|
getAutocompleteCommandsList,
|
|
(commands) => {
|
|
return commands.filter((command) => !COMMANDS_TO_HIDE_ON_MOBILE.includes(command.trigger));
|
|
},
|
|
);
|
|
|
|
function mapStateToProps(state) {
|
|
return {
|
|
commands: mobileCommandsSelector(state),
|
|
currentTeamId: getCurrentTeamId(state),
|
|
theme: getTheme(state),
|
|
suggestions: getCommandAutocompleteSuggestionsList(state),
|
|
};
|
|
}
|
|
|
|
function mapDispatchToProps(dispatch) {
|
|
return {
|
|
actions: bindActionCreators({
|
|
getAutocompleteCommands,
|
|
getCommandAutocompleteSuggestions,
|
|
}, dispatch),
|
|
};
|
|
}
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(SlashSuggestion);
|