From 83e4aba522519bde6a3871d068dc7806fd193f6c Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Fri, 31 May 2024 22:44:31 +0800 Subject: [PATCH] fix update image on account screen when updating profile image (#7978) --- app/components/profile_picture/image.tsx | 4 +++- app/screens/edit_profile/components/edit_profile_picture.tsx | 2 +- package-lock.json | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/components/profile_picture/image.tsx b/app/components/profile_picture/image.tsx index d3cb77a3f..2b01b6800 100644 --- a/app/components/profile_picture/image.tsx +++ b/app/components/profile_picture/image.tsx @@ -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 ( diff --git a/app/screens/edit_profile/components/edit_profile_picture.tsx b/app/screens/edit_profile/components/edit_profile_picture.tsx index a4f602006..a7b064231 100644 --- a/app/screens/edit_profile/components/edit_profile_picture.tsx +++ b/app/screens/edit_profile/components/edit_profile_picture.tsx @@ -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://'; } diff --git a/package-lock.json b/package-lock.json index 29d4eba22..836fd9365 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "mattermost-mobile", - "version": "2.16.0", + "version": "2.17.0", "hasInstallScript": true, "license": "Apache 2.0", "dependencies": {