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 @@ -966,6 +966,7 @@ supportsMessageEdit: true, supportsRelationships: true, pinsStoredOnServer: false, + supportsEmojiThreadAvatars: 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 @@ -1117,12 +1117,12 @@ canReactToRobotext: false, supportsThreadRefreshing: true, temporarilyDisabledFeatures: { - changingThreadAvatar: true, pinningMessages: false, }, supportsMessageEdit: false, supportsRelationships: false, pinsStoredOnServer: false, + supportsEmojiThreadAvatars: false, }; function pendingThreadType(numberOfOtherMembers: number) { 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 @@ -784,6 +784,7 @@ supportsMessageEdit: true, supportsRelationships: true, pinsStoredOnServer: true, + supportsEmojiThreadAvatars: 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 @@ -590,12 +590,12 @@ +canReactToRobotext: boolean, +supportsThreadRefreshing: boolean, +temporarilyDisabledFeatures?: { - +changingThreadAvatar?: boolean, +pinningMessages?: boolean, }, +supportsMessageEdit: boolean, +supportsRelationships: boolean, +pinsStoredOnServer: boolean, + +supportsEmojiThreadAvatars: boolean, }; export type ThreadSpec< diff --git a/native/avatars/avatar-hooks.js b/native/avatars/avatar-hooks.js --- a/native/avatars/avatar-hooks.js +++ b/native/avatars/avatar-hooks.js @@ -443,7 +443,7 @@ return selectFromGalleryAndUpdateThreadAvatar; } -type ShowAvatarActionSheetOptions = { +export type ShowAvatarActionSheetOptions = { +id: 'emoji' | 'image' | 'camera' | 'ens' | 'farcaster' | 'cancel' | 'remove', +onPress?: () => mixed, }; diff --git a/native/avatars/edit-thread-avatar.react.js b/native/avatars/edit-thread-avatar.react.js --- a/native/avatars/edit-thread-avatar.react.js +++ b/native/avatars/edit-thread-avatar.react.js @@ -15,6 +15,7 @@ } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { + type ShowAvatarActionSheetOptions, useNativeSetThreadAvatar, useSelectFromGalleryAndUpdateThreadAvatar, useShowAvatarActionSheet, @@ -87,11 +88,19 @@ ); const actionSheetConfig = React.useMemo(() => { - const configOptions = [ - { id: 'emoji', onPress: navigateToThreadEmojiAvatarCreation }, + const configOptions: Array = []; + + if (threadSpecs[threadInfo.type].protocol().supportsEmojiThreadAvatars) { + configOptions.push({ + id: 'emoji', + onPress: navigateToThreadEmojiAvatarCreation, + }); + } + + configOptions.push( { id: 'image', onPress: selectFromGallery }, { id: 'camera', onPress: navigateToCamera }, - ]; + ); if (communityInfo?.farcasterChannelID) { configOptions.push({ @@ -106,21 +115,18 @@ return configOptions; }, [ - navigateToCamera, - navigateToThreadEmojiAvatarCreation, - removeAvatar, - selectFromGallery, + threadInfo.type, threadInfo.avatar, + selectFromGallery, + navigateToCamera, communityInfo?.farcasterChannelID, + navigateToThreadEmojiAvatarCreation, setFarcasterThreadAvatar, + removeAvatar, ]); const showAvatarActionSheet = useShowAvatarActionSheet(actionSheetConfig); - const isChangingAvatarDisabled = - threadSpecs[threadInfo.type].protocol().temporarilyDisabledFeatures - ?.changingThreadAvatar; - let spinner; if (threadAvatarSaveInProgress) { spinner = ( @@ -130,13 +136,11 @@ ); } - const isDisabled = disabled || isChangingAvatarDisabled; - return ( - + {spinner} - {!isDisabled ? : null} + {!disabled ? : null} ); } diff --git a/web/avatars/edit-thread-avatar-menu.react.js b/web/avatars/edit-thread-avatar-menu.react.js --- a/web/avatars/edit-thread-avatar-menu.react.js +++ b/web/avatars/edit-thread-avatar-menu.react.js @@ -140,7 +140,11 @@ ); const menuItems = React.useMemo(() => { - const items = [emojiMenuItem, imageMenuItem]; + const items = []; + if (threadSpecs[threadInfo.type].protocol().supportsEmojiThreadAvatars) { + items.push(emojiMenuItem); + } + items.push(imageMenuItem); if (communityInfo?.farcasterChannelID) { items.push(farcasterMenuItem); } @@ -155,6 +159,7 @@ imageMenuItem, removeMenuItem, threadInfo.avatar, + threadInfo.type, ]); return ( diff --git a/web/avatars/edit-thread-avatar.react.js b/web/avatars/edit-thread-avatar.react.js --- a/web/avatars/edit-thread-avatar.react.js +++ b/web/avatars/edit-thread-avatar.react.js @@ -30,15 +30,12 @@ ); const protocol = threadSpecs[threadInfo.type].protocol(); const threadSupportAvatarEdit = protocol.supportedThreadSettings.avatar; - const isChangingAvatarDisabled = - protocol.temporarilyDisabledFeatures?.changingThreadAvatar; let editThreadAvatarMenu; if ( canEditThreadAvatar && !threadAvatarSaveInProgress && - threadSupportAvatarEdit && - !isChangingAvatarDisabled + threadSupportAvatarEdit ) { editThreadAvatarMenu = ; }