Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3359525
D13753.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D13753.diff
View Options
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
@@ -6,6 +6,8 @@
import { ActivityIndicator, TouchableOpacity, View } from 'react-native';
import { EditThreadAvatarContext } from 'lib/components/base-edit-thread-avatar-provider.react.js';
+import { getCommunity } from 'lib/shared/thread-utils.js';
+import type { CommunityInfo } from 'lib/types/community-types.js';
import type {
ThreadInfo,
RawThreadInfo,
@@ -22,6 +24,7 @@
EmojiThreadAvatarCreationRouteName,
ThreadAvatarCameraModalRouteName,
} from '../navigation/route-names.js';
+import { useSelector } from '../redux/redux-utils.js';
import { useStyles } from '../themes/colors.js';
type Props = {
@@ -32,6 +35,14 @@
const styles = useStyles(unboundStyles);
const { threadInfo, disabled } = props;
+ const communityID = getCommunity(threadInfo);
+ const communityInfo: ?CommunityInfo = useSelector(state => {
+ if (!communityID) {
+ return null;
+ }
+ return state.communityStore.communityInfos[communityID];
+ });
+
const editThreadAvatarContext = React.useContext(EditThreadAvatarContext);
invariant(editThreadAvatarContext, 'editThreadAvatarContext should be set');
const { threadAvatarSaveInProgress } = editThreadAvatarContext;
@@ -64,6 +75,11 @@
});
}, [navigate, threadInfo]);
+ const setFarcasterThreadAvatar = React.useCallback(
+ () => nativeSetThreadAvatar(threadInfo.id, { type: 'farcaster' }),
+ [nativeSetThreadAvatar, threadInfo.id],
+ );
+
const removeAvatar = React.useCallback(
() => nativeSetThreadAvatar(threadInfo.id, { type: 'remove' }),
[nativeSetThreadAvatar, threadInfo.id],
@@ -76,6 +92,13 @@
{ id: 'camera', onPress: navigateToCamera },
];
+ if (communityInfo?.farcasterChannelID) {
+ configOptions.push({
+ id: 'farcaster',
+ onPress: setFarcasterThreadAvatar,
+ });
+ }
+
if (threadInfo.avatar) {
configOptions.push({ id: 'remove', onPress: removeAvatar });
}
@@ -87,6 +110,8 @@
removeAvatar,
selectFromGallery,
threadInfo.avatar,
+ communityInfo?.farcasterChannelID,
+ setFarcasterThreadAvatar,
]);
const showAvatarActionSheet = useShowAvatarActionSheet(actionSheetConfig);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 9:34 AM (21 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2573956
Default Alt Text
D13753.diff (2 KB)
Attached To
Mode
D13753: [native] let user select farcaster thread avatar
Attached
Detach File
Event Timeline
Log In to Comment