Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3358369
D12666.id42002.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D12666.id42002.diff
View Options
diff --git a/native/chat/settings/thread-settings-home-notifs.react.js b/native/chat/settings/thread-settings-home-notifs.react.js
deleted file mode 100644
--- a/native/chat/settings/thread-settings-home-notifs.react.js
+++ /dev/null
@@ -1,118 +0,0 @@
-// @flow
-
-import * as React from 'react';
-import { Switch, View } from 'react-native';
-
-import {
- updateSubscriptionActionTypes,
- useUpdateSubscription,
-} from 'lib/actions/user-actions.js';
-import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js';
-import type {
- SubscriptionUpdateRequest,
- SubscriptionUpdateResult,
-} from 'lib/types/subscription-types.js';
-import {
- type DispatchActionPromise,
- useDispatchActionPromise,
-} from 'lib/utils/redux-promise-utils.js';
-
-import SingleLine from '../../components/single-line.react.js';
-import { useStyles } from '../../themes/colors.js';
-
-const unboundStyles = {
- currentValue: {
- alignItems: 'flex-end',
- margin: 0,
- paddingLeft: 4,
- paddingRight: 0,
- paddingVertical: 0,
- },
- label: {
- color: 'panelForegroundTertiaryLabel',
- fontSize: 16,
- flex: 1,
- },
- row: {
- alignItems: 'center',
- backgroundColor: 'panelForeground',
- flexDirection: 'row',
- paddingHorizontal: 24,
- paddingVertical: 3,
- },
-};
-
-type BaseProps = {
- +threadInfo: ThreadInfo,
-};
-type Props = {
- ...BaseProps,
- // Redux state
- +styles: $ReadOnly<typeof unboundStyles>,
- // Redux dispatch functions
- +dispatchActionPromise: DispatchActionPromise,
- // async functions that hit server APIs
- +updateSubscription: (
- subscriptionUpdate: SubscriptionUpdateRequest,
- ) => Promise<SubscriptionUpdateResult>,
-};
-type State = {
- +currentValue: boolean,
-};
-class ThreadSettingsHomeNotifs extends React.PureComponent<Props, State> {
- constructor(props: Props) {
- super(props);
- this.state = {
- currentValue: !props.threadInfo.currentUser.subscription.home,
- };
- }
-
- render(): React.Node {
- const componentLabel = 'Background';
- return (
- <View style={this.props.styles.row}>
- <SingleLine style={this.props.styles.label} adjustsFontSizeToFit={true}>
- {componentLabel}
- </SingleLine>
- <View style={this.props.styles.currentValue}>
- <Switch
- value={this.state.currentValue}
- onValueChange={this.onValueChange}
- />
- </View>
- </View>
- );
- }
-
- onValueChange = (value: boolean) => {
- this.setState({ currentValue: value });
- void this.props.dispatchActionPromise(
- updateSubscriptionActionTypes,
- this.props.updateSubscription({
- threadID: this.props.threadInfo.id,
- updatedFields: {
- home: !value,
- },
- }),
- );
- };
-}
-
-const ConnectedThreadSettingsHomeNotifs: React.ComponentType<BaseProps> =
- React.memo<BaseProps>(function ConnectedThreadSettingsHomeNotifs(
- props: BaseProps,
- ) {
- const styles = useStyles(unboundStyles);
- const dispatchActionPromise = useDispatchActionPromise();
- const callUpdateSubscription = useUpdateSubscription();
- return (
- <ThreadSettingsHomeNotifs
- {...props}
- styles={styles}
- dispatchActionPromise={dispatchActionPromise}
- updateSubscription={callUpdateSubscription}
- />
- );
- });
-
-export default ConnectedThreadSettingsHomeNotifs;
diff --git a/native/chat/settings/thread-settings.react.js b/native/chat/settings/thread-settings.react.js
--- a/native/chat/settings/thread-settings.react.js
+++ b/native/chat/settings/thread-settings.react.js
@@ -66,7 +66,6 @@
import ThreadSettingsDeleteThread from './thread-settings-delete-thread.react.js';
import ThreadSettingsDescription from './thread-settings-description.react.js';
import ThreadSettingsEditRelationship from './thread-settings-edit-relationship.react.js';
-import ThreadSettingsHomeNotifs from './thread-settings-home-notifs.react.js';
import ThreadSettingsLeaveThread from './thread-settings-leave-thread.react.js';
import {
ThreadSettingsAddMember,
@@ -191,11 +190,6 @@
+threadInfo: ResolvedThreadInfo,
+navigate: ThreadSettingsNavigate,
}
- | {
- +itemType: 'homeNotifs',
- +key: string,
- +threadInfo: ResolvedThreadInfo,
- }
| {
+itemType: 'seeMore',
+key: string,
@@ -468,13 +462,6 @@
threadInfo,
navigate,
});
- if (threadInfo.type !== threadTypes.SIDEBAR) {
- listData.push({
- itemType: 'homeNotifs',
- key: 'homeNotifs',
- threadInfo,
- });
- }
listData.push({
itemType: 'footer',
key: 'notificationsFooter',
@@ -1003,8 +990,6 @@
navigate={item.navigate}
/>
);
- } else if (item.itemType === 'homeNotifs') {
- return <ThreadSettingsHomeNotifs threadInfo={item.threadInfo} />;
} else if (item.itemType === 'seeMore') {
return <ThreadSettingsSeeMore onPress={item.onPress} />;
} else if (item.itemType === 'childThread') {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 4:27 AM (20 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2578028
Default Alt Text
D12666.id42002.diff (5 KB)
Attached To
Mode
D12666: [native] deprecate ThreadSettingsHomeNotifs
Attached
Detach File
Event Timeline
Log In to Comment