Page MenuHomePhabricator

D12666.diff
No OneTemporary

D12666.diff

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

Mime Type
text/plain
Expires
Mon, Nov 25, 2:28 AM (21 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2578028
Default Alt Text
D12666.diff (5 KB)

Event Timeline