Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2903482
D12663.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
D12663.diff
View Options
diff --git a/native/chat/settings/thread-settings-notifications.react.js b/native/chat/settings/thread-settings-notifications.react.js
--- a/native/chat/settings/thread-settings-notifications.react.js
+++ b/native/chat/settings/thread-settings-notifications.react.js
@@ -153,19 +153,21 @@
onSave,
isSidebar,
canPromoteSidebar,
+ parentThreadIsInBackground,
} = useThreadSettingsNotifications(threadInfo, goBack);
React.useEffect(() => {
setOptions({
- headerRight: () => (
- <HeaderRightTextButton
- label="Save"
- onPress={onSave}
- disabled={saveButtonDisabled}
- />
- ),
+ headerRight: () =>
+ parentThreadIsInBackground ? null : (
+ <HeaderRightTextButton
+ label="Save"
+ onPress={onSave}
+ disabled={saveButtonDisabled}
+ />
+ ),
});
- }, [saveButtonDisabled, onSave, setOptions]);
+ }, [saveButtonDisabled, onSave, setOptions, parentThreadIsInBackground]);
const styles = useStyles(unboundStyles);
@@ -256,39 +258,77 @@
styles.noticeTextContainer,
]);
- return (
- <View style={styles.container}>
- <View style={styles.enumSettingsOptionContainer}>
- <EnumSettingsOption
- name={threadSettingsNotificationsCopy.FOCUSED}
- enumValue={notificationSettings === 'focused'}
- onEnumValuePress={onFocusedSelected}
- description={allNotificationsDescription}
- icon={allNotificationsIllustration}
- />
- </View>
- <View style={styles.enumSettingsOptionContainer}>
- <EnumSettingsOption
- name={threadSettingsNotificationsCopy.BADGE_ONLY}
- enumValue={notificationSettings === 'badge-only'}
- onEnumValuePress={onBadgeOnlySelected}
- description={badgeOnlyDescription}
- icon={badgeOnlyIllustration}
- />
- </View>
- <View style={styles.enumSettingsOptionContainer}>
- <EnumSettingsOption
- name={threadSettingsNotificationsCopy.BACKGROUND}
- enumValue={notificationSettings === 'background'}
- onEnumValuePress={onBackgroundSelected}
- description={mutedDescription}
- icon={mutedIllustration}
- disabled={isSidebar}
- />
+ const threadSettingsNotifications = React.useMemo(() => {
+ if (parentThreadIsInBackground) {
+ return (
+ <View style={styles.parentThreadIsInBackgroundNoticeContainerStyle}>
+ <Text style={styles.parentThreadIsInBackgroundNoticeText}>
+ {threadSettingsNotificationsCopy.PARENT_THREAD_IS_BACKGROUND}
+ </Text>
+ <Text style={styles.parentThreadIsInBackgroundNoticeText}>
+ {canPromoteSidebar
+ ? threadSettingsNotificationsCopy.PARENT_THREAD_IS_BACKGROUND_CAN_PROMOTE
+ : threadSettingsNotificationsCopy.PARENT_THREAD_IS_BACKGROUND_CAN_NOT_PROMOTE}
+ </Text>
+ </View>
+ );
+ }
+
+ return (
+ <View style={styles.container}>
+ <View style={styles.enumSettingsOptionContainer}>
+ <EnumSettingsOption
+ name={threadSettingsNotificationsCopy.FOCUSED}
+ enumValue={notificationSettings === 'focused'}
+ onEnumValuePress={onFocusedSelected}
+ description={allNotificationsDescription}
+ icon={allNotificationsIllustration}
+ />
+ </View>
+ <View style={styles.enumSettingsOptionContainer}>
+ <EnumSettingsOption
+ name={threadSettingsNotificationsCopy.BADGE_ONLY}
+ enumValue={notificationSettings === 'badge-only'}
+ onEnumValuePress={onBadgeOnlySelected}
+ description={badgeOnlyDescription}
+ icon={badgeOnlyIllustration}
+ />
+ </View>
+ <View style={styles.enumSettingsOptionContainer}>
+ <EnumSettingsOption
+ name={threadSettingsNotificationsCopy.BACKGROUND}
+ enumValue={notificationSettings === 'background'}
+ onEnumValuePress={onBackgroundSelected}
+ description={mutedDescription}
+ icon={mutedIllustration}
+ disabled={isSidebar}
+ />
+ </View>
+ {noticeText}
</View>
- {noticeText}
- </View>
- );
+ );
+ }, [
+ allNotificationsDescription,
+ allNotificationsIllustration,
+ badgeOnlyDescription,
+ badgeOnlyIllustration,
+ canPromoteSidebar,
+ isSidebar,
+ mutedDescription,
+ mutedIllustration,
+ noticeText,
+ notificationSettings,
+ onBackgroundSelected,
+ onBadgeOnlySelected,
+ onFocusedSelected,
+ parentThreadIsInBackground,
+ styles.container,
+ styles.enumSettingsOptionContainer,
+ styles.parentThreadIsInBackgroundNoticeContainerStyle,
+ styles.parentThreadIsInBackgroundNoticeText,
+ ]);
+
+ return threadSettingsNotifications;
}
const unboundStyles = {
@@ -331,6 +371,18 @@
lineHeight: 18,
marginVertical: 8,
},
+ parentThreadIsInBackgroundNoticeContainerStyle: {
+ backgroundColor: 'panelForeground',
+ paddingHorizontal: 16,
+ paddingVertical: 8,
+ },
+ parentThreadIsInBackgroundNoticeText: {
+ color: 'panelForegroundSecondaryLabel',
+ fontSize: 16,
+ lineHeight: 20,
+ textAlign: 'left',
+ marginVertical: 8,
+ },
};
export default ThreadSettingsNotifications;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 6, 10:37 PM (22 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2251174
Default Alt Text
D12663.diff (5 KB)
Attached To
Mode
D12663: [native] update thread notif settings ui to handle case when parent thread is in background
Attached
Detach File
Event Timeline
Log In to Comment