mattermost-mobile/app/utils/navigation/index.ts
Elias Nahum 4573732fd2
[Gekidou] channel quick actions (#6288)
* Add hitSlop to navigation header right buttons

* Fix channel_item info muted style

* Fix team switch when global threads

* Wrap WS channel events in try/catch

* Group Box component and Animated Group Box

* SlideUpPanelItem style

* Fix return value of setCurrentTeamAndChannelId

* Add observeChannelSettings and include channel settings in prepareDeleteChannel

* update OPTIONS_HEIGHT reference in find channels quick options

* Fix DM limit in channel list

* Fix category header style and translate default categories

* Add snackbar for unmute/favorite/unfavorite

* Add toggleFavoriteChannel remote action

* Add makeDirectChannelVisible remote action

* Use makeDirectChannelVisible in switchToChannelById and update toggleMuteChannel snackbar

* Add channel actions common components

* Update channel intro to use channel action common components

* Rename ChannelDetails screen to ChannelInfo

* Add channel quick actions

* Update localization strings

* Fix addChannelToDefaultCategory

* Leave channel

* Add localization strings

* Fix snackBar screen event listener

* Feedback review
2022-05-19 14:30:55 -04:00

65 lines
2.3 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {IntlShape} from 'react-intl';
import {Alert} from 'react-native';
import {Navigation, Options} from 'react-native-navigation';
import {Screens} from '@constants';
export const appearanceControlledScreens = new Set([Screens.SERVER, Screens.LOGIN, Screens.FORGOT_PASSWORD, Screens.MFA, Screens.SSO]);
export function mergeNavigationOptions(componentId: string, options: Options) {
Navigation.mergeOptions(componentId, options);
}
export function alertTeamRemove(displayName: string, intl: IntlShape) {
Alert.alert(
intl.formatMessage({
id: 'alert.removed_from_team.title',
defaultMessage: 'Removed from team',
}),
intl.formatMessage({
id: 'alert.removed_from_team.description',
defaultMessage: 'You have been removed from team {displayName}.',
}, {displayName}),
[{
style: 'cancel',
text: intl.formatMessage({id: 'mobile.oauth.something_wrong.okButton', defaultMessage: 'OK'}),
}],
);
}
export function alertChannelRemove(displayName: string, intl: IntlShape) {
Alert.alert(
intl.formatMessage({
id: 'alert.removed_from_channel.title',
defaultMessage: 'Removed from channel',
}),
intl.formatMessage({
id: 'alert.removed_from_channel.description',
defaultMessage: 'You have been removed from channel {displayName}.',
}, {displayName}),
[{
style: 'cancel',
text: intl.formatMessage({id: 'mobile.oauth.something_wrong.okButton', defaultMessage: 'OK'}),
}],
);
}
export function alertChannelArchived(displayName: string, intl: IntlShape) {
Alert.alert(
intl.formatMessage({
id: 'alert.channel_deleted.title',
defaultMessage: 'Archived channel',
}),
intl.formatMessage({
id: 'alert.channel_deleted.description',
defaultMessage: 'The channel {displayName} has been archived.',
}, {displayName}),
[{
style: 'cancel',
text: intl.formatMessage({id: 'mobile.oauth.something_wrong.okButton', defaultMessage: 'OK'}),
}],
);
}