fix update image on account screen when updating profile image (#7978)
This commit is contained in:
parent
663f9ba01a
commit
83e4aba522
3 changed files with 5 additions and 3 deletions
|
|
@ -13,6 +13,7 @@ import {ACCOUNT_OUTLINE_IMAGE} from '@constants/profile';
|
|||
import {useServerUrl} from '@context/server';
|
||||
import {useTheme} from '@context/theme';
|
||||
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';
|
||||
import {getLastPictureUpdate} from '@utils/user';
|
||||
|
||||
import type UserModel from '@typings/database/models/servers/user';
|
||||
|
||||
|
|
@ -42,6 +43,7 @@ const Image = ({author, forwardRef, iconSize, size, source, url}: Props) => {
|
|||
serverUrl = url || serverUrl;
|
||||
|
||||
const style = getStyleSheet(theme);
|
||||
const lastPictureUpdateAt = author ? getLastPictureUpdate(author) : 0;
|
||||
const fIStyle = useMemo(() => ({
|
||||
borderRadius: size / 2,
|
||||
backgroundColor: theme.centerChannelBg,
|
||||
|
|
@ -56,7 +58,7 @@ const Image = ({author, forwardRef, iconSize, size, source, url}: Props) => {
|
|||
|
||||
const pictureUrl = buildProfileImageUrlFromUser(serverUrl, author);
|
||||
return source ?? {uri: buildAbsoluteUrl(serverUrl, pictureUrl)};
|
||||
}, [author, serverUrl, source]);
|
||||
}, [author, serverUrl, source, lastPictureUpdateAt]);
|
||||
|
||||
if (typeof source === 'string') {
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ const EditProfilePicture = ({user, onUpdateProfilePicture}: ChangeProfilePicture
|
|||
let prefix = '';
|
||||
if (pictureUrl.includes('/api/')) {
|
||||
prefix = serverUrl;
|
||||
} else if (Platform.OS === 'android' && !pictureUrl.startsWith('content://') && !pictureUrl.startsWith('http://') && !pictureUrl.startsWith('https://')) {
|
||||
} else if (Platform.OS === 'android' && !pictureUrl.startsWith('content://') && !pictureUrl.startsWith('http://') && !pictureUrl.startsWith('https://') && !pictureUrl.startsWith('file://')) {
|
||||
prefix = 'file://';
|
||||
}
|
||||
|
||||
|
|
|
|||
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -6,7 +6,7 @@
|
|||
"packages": {
|
||||
"": {
|
||||
"name": "mattermost-mobile",
|
||||
"version": "2.16.0",
|
||||
"version": "2.17.0",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache 2.0",
|
||||
"dependencies": {
|
||||
|
|
|
|||
Loading…
Reference in a new issue