Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions android/buildscript-gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,19 @@ org.jetbrains.kotlin:kotlin-gradle-plugins-bom:2.0.21=classpath
org.jetbrains.kotlin:kotlin-klib-commonizer-api:2.0.21=classpath
org.jetbrains.kotlin:kotlin-native-utils:2.0.21=classpath
org.jetbrains.kotlin:kotlin-reflect:1.9.20=classpath
org.jetbrains.kotlin:kotlin-stdlib-common:2.0.21=classpath
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.20=classpath
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.20=classpath
org.jetbrains.kotlin:kotlin-stdlib:2.0.21=classpath
org.jetbrains.kotlin:kotlin-tooling-core:2.0.21=classpath
org.jetbrains.kotlin:kotlin-util-io:2.0.21=classpath
org.jetbrains.kotlin:kotlin-util-klib:2.0.21=classpath
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4=classpath
org.jetbrains.kotlinx:kotlinx-serialization-bom:1.6.3=classpath
org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.6.3=classpath
org.jetbrains.kotlinx:kotlinx-serialization-core:1.6.3=classpath
org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.6.3=classpath
org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3=classpath
org.jetbrains:annotations:23.0.0=classpath
org.jvnet.staxex:stax-ex:1.8.1=classpath
org.ow2.asm:asm-analysis:9.6=classpath
Expand Down
5 changes: 4 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"name": "Mattermost",
"displayName": "Mattermost"
"displayName": "Mattermost",
"plugins": [
"expo-web-browser"
]
}
26 changes: 14 additions & 12 deletions app/components/expo_image/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import Animated from 'react-native-reanimated';
import {useServerUrl} from '@context/server';
import {urlSafeBase64Encode} from '@utils/security';

import type {SharedRefType} from 'expo';

type ExpoImagePropsWithId = ImageProps & {id: string};
type ExpoImagePropsMemoryOnly = ImageProps & {cachePolicy: 'memory'; id?: string};
type ExpoImageProps = ExpoImagePropsWithId | ExpoImagePropsMemoryOnly;
Expand All @@ -25,13 +27,13 @@ const ExpoImage = forwardRef<Image, ExpoImageProps>(({id, ...props}, ref) => {
* for filesystem path compatibility (avoiding special characters in directory names).
*/
const cachePath = useMemo(() => urlSafeBase64Encode(serverUrl), [serverUrl]);
const source: ImageSource = useMemo(() => {
if (typeof props.source === 'number') {
const source: ImageSource | string | number | ImageSource[] | string[] | SharedRefType<'image'> | null | undefined = useMemo(() => {
if (typeof props.source === 'number' || typeof props.source === 'string' || Array.isArray(props.source) || !props.source) {
return props.source;
}

// Only add cacheKey and cachePath if id is provided (i.e., not memory-only caching)
if (id) {
if (id && typeof props.source === 'object' && 'uri' in props.source) {
return {
...props.source,
cacheKey: id,
Expand All @@ -43,13 +45,13 @@ const ExpoImage = forwardRef<Image, ExpoImageProps>(({id, ...props}, ref) => {
}, [id, props.source, cachePath]);

// Process placeholder to add cachePath and cacheKey if it has a uri
const placeholder: ImageSource | undefined = useMemo(() => {
if (!props.placeholder || typeof props.placeholder === 'number' || typeof props.placeholder === 'string') {
const placeholder: ImageSource | string | number | ImageSource[] | string[] | SharedRefType<'image'> | null | undefined = useMemo(() => {
if (!props.placeholder || typeof props.placeholder === 'number' || typeof props.placeholder === 'string' || Array.isArray(props.placeholder)) {
return props.placeholder;
}

// If placeholder has a uri and id is provided, add cachePath and cacheKey
if (props.placeholder.uri && id) {
if (typeof props.placeholder === 'object' && 'uri' in props.placeholder && props.placeholder.uri && id) {
return {
...props.placeholder,
cacheKey: `${id}-thumb`,
Expand All @@ -74,13 +76,13 @@ ExpoImage.displayName = 'ExpoImage';
const ExpoImageBackground = ({id, ...props}: ExpoImageBackgroundProps) => {
const serverUrl = useServerUrl();
const cachePath = useMemo(() => urlSafeBase64Encode(serverUrl), [serverUrl]);
const source: ImageSource = useMemo(() => {
if (typeof props.source === 'number') {
const source: ImageSource | string | number | ImageSource[] | string[] | SharedRefType<'image'> | null | undefined = useMemo(() => {
if (typeof props.source === 'number' || typeof props.source === 'string' || Array.isArray(props.source) || !props.source) {
return props.source;
}

// Only add cacheKey and cachePath if id is provided (i.e., not memory-only caching)
if (id) {
if (id && typeof props.source === 'object' && 'uri' in props.source) {
return {
...props.source,
cacheKey: id,
Expand All @@ -92,13 +94,13 @@ const ExpoImageBackground = ({id, ...props}: ExpoImageBackgroundProps) => {
}, [id, props.source, cachePath]);

// Process placeholder to add cachePath and cacheKey if it has a uri
const placeholder: ImageSource | undefined = useMemo(() => {
if (!props.placeholder || typeof props.placeholder === 'number' || typeof props.placeholder === 'string') {
const placeholder: ImageSource | string | number | ImageSource[] | string[] | SharedRefType<'image'> | null | undefined = useMemo(() => {
if (!props.placeholder || typeof props.placeholder === 'number' || typeof props.placeholder === 'string' || Array.isArray(props.placeholder)) {
return props.placeholder;
}

// If placeholder has a uri and id is provided, add cachePath and cacheKey
if (props.placeholder.uri && id) {
if (typeof props.placeholder === 'object' && 'uri' in props.placeholder && props.placeholder.uri && id) {
return {
...props.placeholder,
cacheKey: `${id}-thumb`,
Expand Down
Loading