Skip to content

Commit

Permalink
[lib] rename useFarcasterAvatarURL -> useFarcasterUserAvatarURL
Browse files Browse the repository at this point in the history
Summary:
Depends on D13722

just a rename before I introduce a useFarcasterChannelAvatarURL hook later in stack

Test Plan: flow

Reviewers: ashoat

Reviewed By: ashoat

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D13723
  • Loading branch information
vdhanan committed Oct 17, 2024
1 parent 3e02e91 commit 3902a11
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/hooks/fc-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function useFCNames<T: ?BaseFCInfo>(
);
}

function useFarcasterAvatarURL(fid: ?string): ?string {
function useFarcasterUserAvatarURL(fid: ?string): ?string {
const neynarClientContext = React.useContext(NeynarClientContext);
const fcCache = neynarClientContext?.fcCache;

Expand Down Expand Up @@ -181,4 +181,4 @@ function useFarcasterAvatarURL(fid: ?string): ?string {
}, [fid, cachedAvatarURL, farcasterAvatarURL]);
}

export { useFCNames, useFarcasterAvatarURL };
export { useFCNames, useFarcasterUserAvatarURL };
4 changes: 2 additions & 2 deletions lib/shared/avatar-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { selectedThreadColors } from './color-utils.js';
import { threadOtherMembers } from './thread-utils.js';
import genesis from '../facts/genesis.js';
import { useENSAvatar } from '../hooks/ens-cache.js';
import { useFarcasterAvatarURL } from '../hooks/fc-cache.js';
import { useFarcasterUserAvatarURL } from '../hooks/fc-cache.js';
import type {
ClientAvatar,
ClientEmojiAvatar,
Expand Down Expand Up @@ -331,7 +331,7 @@ function useResolvedUserAvatar(
const ensAvatarURI = useENSAvatar(ethAddress);

const fid = usernameAndFID?.farcasterID;
const farcasterAvatarURL = useFarcasterAvatarURL(fid);
const farcasterAvatarURL = useFarcasterUserAvatarURL(fid);

const resolvedAvatar = React.useMemo(() => {
if (userAvatarInfo.type !== 'ens' && userAvatarInfo.type !== 'farcaster') {
Expand Down
4 changes: 2 additions & 2 deletions native/avatars/edit-user-avatar.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ActivityIndicator, TouchableOpacity, View } from 'react-native';

import { EditUserAvatarContext } from 'lib/components/edit-user-avatar-provider.react.js';
import { useENSAvatar } from 'lib/hooks/ens-cache.js';
import { useFarcasterAvatarURL } from 'lib/hooks/fc-cache.js';
import { useFarcasterUserAvatarURL } from 'lib/hooks/fc-cache.js';
import { getETHAddressForUserInfo } from 'lib/shared/account-utils.js';
import type { GenericUserInfoWithAvatar } from 'lib/types/avatar-types.js';

Expand Down Expand Up @@ -59,7 +59,7 @@ function EditUserAvatar(props: Props): React.Node {
const ensAvatarURI = fetchedENSAvatarURI ?? props.prefetchedENSAvatarURI;

const fid = props.fid;
const fetchedFarcasterAvatarURL = useFarcasterAvatarURL(fid);
const fetchedFarcasterAvatarURL = useFarcasterUserAvatarURL(fid);
const farcasterAvatarURL =
fetchedFarcasterAvatarURL ?? props.prefetchedFarcasterAvatarURL;

Expand Down
4 changes: 2 additions & 2 deletions web/avatars/edit-user-avatar-menu.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { EditUserAvatarContext } from 'lib/components/edit-user-avatar-provider.
import { useModalContext } from 'lib/components/modal-provider.react.js';
import SWMansionIcon from 'lib/components/swmansion-icon.react.js';
import { useENSAvatar } from 'lib/hooks/ens-cache.js';
import { useFarcasterAvatarURL } from 'lib/hooks/fc-cache.js';
import { useFarcasterUserAvatarURL } from 'lib/hooks/fc-cache.js';
import { getETHAddressForUserInfo } from 'lib/shared/account-utils.js';
import { useCurrentUserFID } from 'lib/utils/farcaster-utils.js';

Expand All @@ -34,7 +34,7 @@ function EditUserAvatarMenu(): React.Node {
[currentUserInfo],
);
const ensAvatarURI: ?string = useENSAvatar(ethAddress);
const farcasterAvatarURL = useFarcasterAvatarURL(currentUserFID);
const farcasterAvatarURL = useFarcasterUserAvatarURL(currentUserFID);

const editUserAvatarContext = React.useContext(EditUserAvatarContext);
invariant(editUserAvatarContext, 'editUserAvatarContext should be set');
Expand Down

0 comments on commit 3902a11

Please sign in to comment.