Page MenuHomePhabricator

D13753.diff
No OneTemporary

D13753.diff

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

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)

Event Timeline