* Detox/E2E: Add e2e tests for channel notification preference * Fixed unit snap files * Moved e2e to notifications and updated formatting * Added basic snapshot tests * Update app/components/radio_button/radio_button_group.test.js Co-authored-by: Elias Nahum <nahumhbl@gmail.com> * Update app/components/radio_button/radio_button_group.test.js Co-authored-by: Elias Nahum <nahumhbl@gmail.com> * Update app/components/radio_button/radio_button_group.test.js Co-authored-by: Elias Nahum <nahumhbl@gmail.com> * Update app/components/sidebars/settings/drawer_item.test.js Co-authored-by: Elias Nahum <nahumhbl@gmail.com> * Update app/screens/channel_info/edit_channel/edit_channel.tsx Co-authored-by: Elias Nahum <nahumhbl@gmail.com> * Update app/screens/channel_info/notification_preference/notification_preference.test.js Co-authored-by: Elias Nahum <nahumhbl@gmail.com> * Update app/screens/channel_info/notification_preference/notification_preference.tsx Co-authored-by: Elias Nahum <nahumhbl@gmail.com> * Update app/components/radio_button/radio_button_group.test.js Co-authored-by: Elias Nahum <nahumhbl@gmail.com> * Fix radio button group snap file * Simplified element call * Rename channel sidebar to main sidebar * Rename drawer button files * Update app/components/sidebars/settings/settings_sidebar.test.js Co-authored-by: Elias Nahum <nahumhbl@gmail.com> * Update app/screens/channel_info/channel_info_row.test.js Co-authored-by: Elias Nahum <nahumhbl@gmail.com> * Update comments Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
83 lines
2.5 KiB
JavaScript
83 lines
2.5 KiB
JavaScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import React from 'react';
|
|
import {
|
|
ScrollView,
|
|
View,
|
|
} from 'react-native';
|
|
|
|
import FormattedText from 'app/components/formatted_text';
|
|
import RadioButtonGroup from 'app/components/radio_button';
|
|
import StatusBar from 'app/components/status_bar';
|
|
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
|
|
import ChannelNotificationPreferenceBase from './channel_notification_preference_base';
|
|
|
|
export default class ChannelNotificationPreferenceAndroid extends ChannelNotificationPreferenceBase {
|
|
getRadioItems = () => {
|
|
const {intl} = this.context;
|
|
const items = this.getItems();
|
|
const radioItems = [];
|
|
items.forEach((element) => {
|
|
const e = {
|
|
label: intl.formatMessage({
|
|
id: element.id,
|
|
defaultMessage: element.defaultMessage,
|
|
}, element.labelValues),
|
|
value: element.value,
|
|
checked: element.checked,
|
|
};
|
|
radioItems.push(e);
|
|
});
|
|
return radioItems;
|
|
}
|
|
|
|
render() {
|
|
const {theme} = this.props;
|
|
const style = getStyleSheet(theme);
|
|
|
|
const options = this.getRadioItems();
|
|
|
|
return (
|
|
<View
|
|
testID='channel_notification_preference.screen'
|
|
style={style.container}
|
|
>
|
|
<StatusBar/>
|
|
<FormattedText
|
|
id='channel_notifications.preference.header'
|
|
defaultMessage='Send Notifications'
|
|
style={style.header}
|
|
/>
|
|
<ScrollView
|
|
contentContainerStyle={style.wrapper}
|
|
alwaysBounceVertical={false}
|
|
>
|
|
<RadioButtonGroup
|
|
name='pushSettings'
|
|
onSelect={this.handlePress}
|
|
options={options}
|
|
/>
|
|
</ScrollView>
|
|
</View>
|
|
);
|
|
}
|
|
}
|
|
|
|
const getStyleSheet = makeStyleSheetFromTheme((theme) => {
|
|
return {
|
|
container: {
|
|
flex: 1,
|
|
backgroundColor: changeOpacity(theme.centerChannelBg, 0.03),
|
|
},
|
|
wrapper: {
|
|
marginLeft: 16,
|
|
},
|
|
header: {
|
|
color: changeOpacity(theme.centerChannelColor, 0.56),
|
|
fontSize: 13,
|
|
marginTop: 10,
|
|
padding: 16,
|
|
},
|
|
};
|
|
});
|