Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class ShareActionHandlerModule(reactContext: ReactApplicationContext) :
val shareObject = JSONObject(shareObjectString)
val content = shareObject.optString("content")
val mimeType = shareObject.optString("mimeType")
val fileUriPath = "file://$content"
val timestamp = System.currentTimeMillis()

val file = File(content)
Expand All @@ -53,6 +52,8 @@ class ShareActionHandlerModule(reactContext: ReactApplicationContext) :

val identifier = file.name
var aspectRatio = 0.0f
val fileUri = android.net.Uri.fromFile(file)
val fileUriPath = fileUri.toString()

if (mimeType.startsWith("image/")) {
val options = BitmapFactory.Options().apply { inJustDecodeBounds = true }
Expand Down
2 changes: 1 addition & 1 deletion ios/RCTShareActionHandlerModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ - (NSDictionary *)processSingleFile:(NSString *)filePath {
} else if ([mimeType hasPrefix:@"image/"]) {
aspectRatio = [self imageAspectRatio:fileURL];
}
fileContent = [@"file://" stringByAppendingString:filePath];
fileContent = [fileURL absoluteString];
}

NSString *identifier = [self uniqueIdentifierForFilePath:filePath];
Expand Down
8 changes: 6 additions & 2 deletions src/components/AttachmentPreview.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {Str} from 'expensify-common';
import {ResizeMode, Video} from 'expo-av';
import React, {useState} from 'react';
import React, {useMemo, useState} from 'react';
import {View} from 'react-native';
import useThemeStyles from '@hooks/useThemeStyles';
import {cleanFileName, getFileName} from '@libs/fileDownload/FileUtils';
import variables from '@styles/variables';
import {checkIsFileImage} from './Attachments/AttachmentView';
import DefaultAttachmentView from './Attachments/AttachmentView/DefaultAttachmentView';
Expand All @@ -29,9 +30,12 @@ type AttachmentPreviewProps = {
function AttachmentPreview({source, aspectRatio = 1, onPress, onLoadError}: AttachmentPreviewProps) {
const styles = useThemeStyles();

const fileName = source.split('/').pop() ?? undefined;
const fillStyle = aspectRatio < 1 ? styles.h100 : styles.w100;
const [isEncryptedPDF, setIsEncryptedPDF] = useState(false);
const fileName = useMemo(() => {
const rawFileName = getFileName(source);
return cleanFileName(rawFileName);
}, [source]);

if (typeof source === 'string' && Str.isVideo(source)) {
return (
Expand Down
Loading