change the name from inAlertNotification to highlightTroubleshooting

This commit is contained in:
Reinaldo Neto 2024-02-02 15:04:56 -03:00
parent 54e3fedca6
commit c1a065ab4a
5 changed files with 33 additions and 26 deletions

View File

@ -17,7 +17,7 @@ describe('test troubleshootingNotification reducer', () => {
it('should return correctly value after call troubleshootingNotification action', () => {
const payload: ITroubleshootingNotification = {
deviceNotificationEnabled: true,
inAlertNotification: false,
highlightTroubleshooting: false,
defaultPushGateway: true,
pushGatewayEnabled: true
};

View File

@ -5,14 +5,14 @@ export interface ITroubleshootingNotification {
deviceNotificationEnabled: boolean;
pushGatewayEnabled: boolean;
defaultPushGateway: boolean;
inAlertNotification: boolean;
highlightTroubleshooting: boolean;
}
export const initialState: ITroubleshootingNotification = {
deviceNotificationEnabled: false,
pushGatewayEnabled: false,
defaultPushGateway: false,
inAlertNotification: false
highlightTroubleshooting: false
// TODO: This will be used in the near future when the consumption percentage is implemented on the server.
// consumptionPercentage: 0,
// isCommunityEdition: false,

View File

@ -31,11 +31,16 @@ function* request() {
log(e);
} finally {
// If Any of the items that can have red values: notification settings, CE quota, or gateway connection; the red icon should show.
// Then inAlertNotification has to be true
const inAlertNotification =
// Then highlightTroubleshooting has to be true
const highlightTroubleshooting =
!deviceNotificationEnabled || (compareServerVersion(serverVersion, 'greaterThanOrEqualTo', '6.6.0') && !pushGatewayEnabled);
yield put(
setTroubleshootingNotification({ deviceNotificationEnabled, defaultPushGateway, pushGatewayEnabled, inAlertNotification })
setTroubleshootingNotification({
deviceNotificationEnabled,
defaultPushGateway,
pushGatewayEnabled,
highlightTroubleshooting
})
);
}
}

View File

@ -46,7 +46,7 @@ interface IRightButtonsProps extends Pick<ISubscription, 't'> {
rid?: string;
theme?: TSupportedThemes;
colors?: TColors;
inAlertNotification: boolean;
highlightTroubleshooting: boolean;
}
interface IRigthButtonsState {
@ -95,7 +95,7 @@ class RightButtonsContainer extends Component<IRightButtonsProps, IRigthButtonsS
shouldComponentUpdate(nextProps: IRightButtonsProps, nextState: IRigthButtonsState) {
const { isFollowingThread, tunread, tunreadUser, tunreadGroup } = this.state;
const { teamId, status, joined, omnichannelPermissions, theme, inAlertNotification } = this.props;
const { teamId, status, joined, omnichannelPermissions, theme, highlightTroubleshooting } = this.props;
if (nextProps.teamId !== teamId) {
return true;
}
@ -111,7 +111,7 @@ class RightButtonsContainer extends Component<IRightButtonsProps, IRigthButtonsS
if (nextState.isFollowingThread !== isFollowingThread) {
return true;
}
if (nextProps.inAlertNotification !== inAlertNotification) {
if (nextProps.highlightTroubleshooting !== highlightTroubleshooting) {
return true;
}
if (!dequal(nextProps.omnichannelPermissions, omnichannelPermissions)) {
@ -301,12 +301,12 @@ class RightButtonsContainer extends Component<IRightButtonsProps, IRigthButtonsS
goToNotification = () => {
const { room } = this;
const { rid, navigation, isMasterDetail, inAlertNotification } = this.props;
const { rid, navigation, isMasterDetail, highlightTroubleshooting } = this.props;
if (!rid || !room) {
return;
}
if (!inAlertNotification && room) {
if (!highlightTroubleshooting && room) {
if (isMasterDetail) {
navigation.navigate('ModalStackNavigator', {
screen: 'NotificationPrefView',
@ -357,7 +357,7 @@ class RightButtonsContainer extends Component<IRightButtonsProps, IRigthButtonsS
render() {
const { isFollowingThread, tunread, tunreadUser, tunreadGroup } = this.state;
const { t, tmid, threadsEnabled, rid, colors, inAlertNotification } = this.props;
const { t, tmid, threadsEnabled, rid, colors, highlightTroubleshooting } = this.props;
if (t === 'l') {
if (!this.isOmnichannelPreview()) {
@ -383,7 +383,7 @@ class RightButtonsContainer extends Component<IRightButtonsProps, IRigthButtonsS
return (
<HeaderButton.Container>
<HeaderButton.Item
color={inAlertNotification ? colors!.fontDanger : colors!.headerTintColor}
color={highlightTroubleshooting ? colors!.fontDanger : colors!.headerTintColor}
iconName='notification-disabled'
onPress={this.goToNotification}
testID='room-view-push-troubleshoot'
@ -408,7 +408,7 @@ const mapStateToProps = (state: IApplicationState) => ({
threadsEnabled: state.settings.Threads_enabled as boolean,
isMasterDetail: state.app.isMasterDetail,
livechatRequestComment: state.settings.Livechat_request_comment_when_closing_conversation as boolean,
inAlertNotification: state.troubleshootingNotification.inAlertNotification
highlightTroubleshooting: state.troubleshootingNotification.highlightTroubleshooting
});
export default connect(mapStateToProps)(withTheme(RightButtonsContainer));

View File

@ -92,7 +92,7 @@ interface IRoomsListViewProps {
createPrivateChannelPermission: [];
createDiscussionPermission: [];
serverVersion: string;
inAlertNotification: boolean;
highlightTroubleshooting: boolean;
}
interface IRoomsListViewState {
@ -147,7 +147,7 @@ const shouldUpdateProps = [
'createPublicChannelPermission',
'createPrivateChannelPermission',
'createDiscussionPermission',
'inAlertNotification',
'highlightTroubleshooting',
'supportedVersionsStatus'
];
@ -335,7 +335,7 @@ class RoomsListView extends React.Component<IRoomsListViewProps, IRoomsListViewS
createDiscussionPermission,
showAvatar,
displayMode,
inAlertNotification,
highlightTroubleshooting,
supportedVersionsStatus
} = this.props;
const { item } = this.state;
@ -360,7 +360,7 @@ class RoomsListView extends React.Component<IRoomsListViewProps, IRoomsListViewS
insets.left !== prevProps.insets.left ||
insets.right !== prevProps.insets.right ||
notificationPresenceCap !== prevProps.notificationPresenceCap ||
inAlertNotification !== prevProps.inAlertNotification ||
highlightTroubleshooting !== prevProps.highlightTroubleshooting ||
supportedVersionsStatus !== prevProps.supportedVersionsStatus
) {
this.setHeader();
@ -414,7 +414,7 @@ class RoomsListView extends React.Component<IRoomsListViewProps, IRoomsListViewS
getHeader = (): StackNavigationOptions => {
const { searching, canCreateRoom } = this.state;
const { navigation, isMasterDetail, notificationPresenceCap, inAlertNotification, supportedVersionsStatus, theme } =
const { navigation, isMasterDetail, notificationPresenceCap, highlightTroubleshooting, supportedVersionsStatus, theme } =
this.props;
if (searching) {
return {
@ -462,12 +462,14 @@ class RoomsListView extends React.Component<IRoomsListViewProps, IRoomsListViewS
headerTitle: () => <RoomsListHeaderView />,
headerRight: () => (
<HeaderButton.Container>
<HeaderButton.Item
iconName='notification-disabled'
onPress={this.goPushTroubleshoot}
testID='rooms-list-view-push-troubleshoot'
color={inAlertNotification ? themes[theme].fontDanger : themes[theme].headerTintColor}
/>
{highlightTroubleshooting ? (
<HeaderButton.Item
iconName='notification-disabled'
onPress={this.goPushTroubleshoot}
testID='rooms-list-view-push-troubleshoot'
color={themes[theme].fontDanger}
/>
) : null}
{canCreateRoom ? (
<HeaderButton.Item
iconName='create'
@ -1028,7 +1030,7 @@ const mapStateToProps = (state: IApplicationState) => ({
createPrivateChannelPermission: state.permissions['create-p'],
createDiscussionPermission: state.permissions['start-discussion'],
serverVersion: state.server.version,
inAlertNotification: state.troubleshootingNotification.inAlertNotification
highlightTroubleshooting: state.troubleshootingNotification.highlightTroubleshooting
});
export default connect(mapStateToProps)(withDimensions(withTheme(withSafeAreaInsets(RoomsListView))));