workaround for stale profile image

This commit is contained in:
balzack 2024-09-21 22:38:55 -07:00
parent 2ef4d337d2
commit cfa20fda43
5 changed files with 34 additions and 5 deletions

View File

@ -23,7 +23,16 @@ export const styles = StyleSheet.create({
width: 48,
height: 48,
},
logo: {
logoUnset: {
aspectRatio: 1,
resizeMode: 'contain',
borderRadius: 4,
width: null,
height: null,
borderWidth: 1,
borderColor: '#888888',
},
logoSet: {
aspectRatio: 1,
resizeMode: 'contain',
borderRadius: 4,

View File

@ -12,7 +12,12 @@ export function Identity({ openSettings }) {
<SafeAreaView style={styles.identity}>
<TouchableOpacity style={styles.identityData} activeOpacity={1} onPress={() => setMenu(true)}>
<View style={styles.image}>
<Image style={styles.logo} resizeMode={'contain'} source={{ uri: state.imageUrl }} />
{state.profile.imageSet && (
<Image style={styles.logoSet} resizeMode={'contain'} source={state.imageUrl} />
)}
{!state.profile.imageSet && (
<Image style={styles.logoUnset} resizeMode={'contain'} source={state.imageUrl} />
)}
</View>
<View style={styles.details}>
{state.profile.name && (

View File

@ -29,8 +29,9 @@ export function useIdentity() {
updateState({
profile,
profileSet: true,
imageUrl: identity.getProfileImageUrl(),
imageUrl: { uri: identity.getProfileImageUrl() },
})
}
identity.addProfileListener(setProfile)
return () => {

View File

@ -79,7 +79,16 @@ export const styles = StyleSheet.create({
marginTop: 16,
marginBottom: 8,
},
logo: {
logoSet: {
aspectRatio: 1,
resizeMode: 'contain',
borderRadius: 8,
width: null,
height: null,
borderWidth: 1,
borderColor: Colors.primary,
},
logoUnset: {
aspectRatio: 1,
resizeMode: 'contain',
borderRadius: 8,

View File

@ -52,7 +52,12 @@ export function Settings() {
<SafeAreaView style={styles.settings}>
<Text style={styles.header} adjustsFontSizeToFit={true} numberOfLines={1}>{`${state.profile.handle}${state.profile.node ? '/' + state.profile.node : ''}`}</Text>
<View style={styles.image}>
<Image style={styles.logo} resizeMode={'contain'} source={{ uri: state.imageUrl }} />
{!state.profile.imageSet && (
<Image style={styles.logoUnset} resizeMode={'contain'} source={{ uri: state.imageUrl }} />
)}
{state.profile.imageSet && (
<Image style={styles.logoSet} resizeMode={'contain'} source={{ uri: state.imageUrl }} />
)}
<View style={styles.editBar}>
<TouchableOpacity onPress={selectImage}>
<Surface style={styles.editBorder} elevation={0}>