Page MenuHomePhorge

D15247.1765128818.diff
No OneTemporary

Size
5 KB
Referenced Files
None
Subscribers
None

D15247.1765128818.diff

diff --git a/lib/shared/threads/protocols/dm-thread-protocol.js b/lib/shared/threads/protocols/dm-thread-protocol.js
--- a/lib/shared/threads/protocols/dm-thread-protocol.js
+++ b/lib/shared/threads/protocols/dm-thread-protocol.js
@@ -930,6 +930,7 @@
description: true,
color: true,
},
+ supportsBackgroundNotifs: true,
});
function pendingThreadType(numberOfOtherMembers: number) {
diff --git a/lib/shared/threads/protocols/farcaster-thread-protocol.js b/lib/shared/threads/protocols/farcaster-thread-protocol.js
--- a/lib/shared/threads/protocols/farcaster-thread-protocol.js
+++ b/lib/shared/threads/protocols/farcaster-thread-protocol.js
@@ -359,6 +359,7 @@
// Farcaster threads do not support color changes
color: false,
},
+ supportsBackgroundNotifs: false,
};
export { farcasterThreadProtocol };
diff --git a/lib/shared/threads/protocols/keyserver-thread-protocol.js b/lib/shared/threads/protocols/keyserver-thread-protocol.js
--- a/lib/shared/threads/protocols/keyserver-thread-protocol.js
+++ b/lib/shared/threads/protocols/keyserver-thread-protocol.js
@@ -687,6 +687,7 @@
description: true,
color: true,
},
+ supportsBackgroundNotifs: true,
});
function pendingThreadType(numberOfOtherMembers: number) {
diff --git a/lib/shared/threads/thread-spec.js b/lib/shared/threads/thread-spec.js
--- a/lib/shared/threads/thread-spec.js
+++ b/lib/shared/threads/thread-spec.js
@@ -437,6 +437,7 @@
+description: boolean,
+color: boolean,
},
+ +supportsBackgroundNotifs: boolean,
};
export type ThreadSpec<
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
@@ -7,6 +7,7 @@
threadSettingsNotificationsCopy,
useThreadSettingsNotifications,
} from 'lib/shared/thread-settings-notifications-utils.js';
+import { threadSpecs } from 'lib/shared/threads/thread-specs.js';
import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js';
import EnumSettingsOption from '../../components/enum-settings-option.react.js';
@@ -218,6 +219,30 @@
[notificationSettings],
);
+ const notifCountOnlySetting = React.useMemo(() => {
+ if (!threadSpecs[threadInfo.type].protocol().supportsBackgroundNotifs) {
+ return null;
+ }
+ return (
+ <View style={styles.enumSettingsOptionContainer}>
+ <EnumSettingsOption
+ name={threadSettingsNotificationsCopy.NOTIF_COUNT_ONLY}
+ enumValue={notificationSettings === 'notif-count-only'}
+ onEnumValuePress={onNotifCountOnlySelected}
+ description={notifCountOnlyDescription}
+ icon={notifCountOnlyIllustration}
+ />
+ </View>
+ );
+ }, [
+ notifCountOnlyDescription,
+ notifCountOnlyIllustration,
+ notificationSettings,
+ onNotifCountOnlySelected,
+ styles.enumSettingsOptionContainer,
+ threadInfo.type,
+ ]);
+
const threadSettingsNotifications = React.useMemo(() => {
return (
<View style={styles.container}>
@@ -230,15 +255,7 @@
icon={allNotificationsIllustration}
/>
</View>
- <View style={styles.enumSettingsOptionContainer}>
- <EnumSettingsOption
- name={threadSettingsNotificationsCopy.NOTIF_COUNT_ONLY}
- enumValue={notificationSettings === 'notif-count-only'}
- onEnumValuePress={onNotifCountOnlySelected}
- description={notifCountOnlyDescription}
- icon={notifCountOnlyIllustration}
- />
- </View>
+ {notifCountOnlySetting}
<View style={styles.enumSettingsOptionContainer}>
<EnumSettingsOption
name={threadSettingsNotificationsCopy.MUTED}
@@ -257,9 +274,7 @@
onHomeSelected,
allNotificationsDescription,
allNotificationsIllustration,
- onNotifCountOnlySelected,
- notifCountOnlyDescription,
- notifCountOnlyIllustration,
+ notifCountOnlySetting,
onMutedSelected,
mutedDescription,
mutedIllustration,
diff --git a/web/modals/threads/notifications/notifications-modal.react.js b/web/modals/threads/notifications/notifications-modal.react.js
--- a/web/modals/threads/notifications/notifications-modal.react.js
+++ b/web/modals/threads/notifications/notifications-modal.react.js
@@ -7,6 +7,7 @@
threadSettingsNotificationsCopy,
useThreadSettingsNotifications,
} from 'lib/shared/thread-settings-notifications-utils.js';
+import { threadSpecs } from 'lib/shared/threads/thread-specs.js';
import css from './notifications-modal.css';
import AllNotifsIllustration from '../../../assets/all-notifs.react.js';
@@ -105,6 +106,9 @@
const isNotifyCountOnlySelected = notificationSettings === 'notif-count-only';
const notifCountOnlyItem = React.useMemo(() => {
+ if (!threadSpecs[threadInfo.type].protocol().supportsBackgroundNotifs) {
+ return null;
+ }
const icon = <BadgeNotifsIllustration />;
return (
<EnumSettingsOption
@@ -115,7 +119,7 @@
onSelect={onNotifCountOnlySelected}
/>
);
- }, [isNotifyCountOnlySelected, onNotifCountOnlySelected]);
+ }, [isNotifyCountOnlySelected, onNotifCountOnlySelected, threadInfo]);
const isMutedSelected = notificationSettings === 'muted';
const backgroundItem = React.useMemo(() => {

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 7, 5:33 PM (17 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5845196
Default Alt Text
D15247.1765128818.diff (5 KB)

Event Timeline