From 78944554a89bb3900eac4e9a27474754188fbf3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Espino=20Garc=C3=ADa?= Date: Fri, 27 Jan 2023 08:10:05 +0100 Subject: [PATCH] Fix pdf upload and pdf download from search results (#6984) --- .../file_options/option_menus/option_menus.tsx | 12 ++++++------ .../home/search/results/file_options/toasts.tsx | 2 +- app/utils/file/file_picker/index.ts | 2 +- ios/Mattermost.xcodeproj/project.pbxproj | 14 +++++++------- ios/Podfile.lock | 4 ++-- package-lock.json | 14 +++++++------- package.json | 2 +- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/app/screens/home/search/results/file_options/option_menus/option_menus.tsx b/app/screens/home/search/results/file_options/option_menus/option_menus.tsx index ce0d2be8a..948603c3f 100644 --- a/app/screens/home/search/results/file_options/option_menus/option_menus.tsx +++ b/app/screens/home/search/results/file_options/option_menus/option_menus.tsx @@ -27,24 +27,24 @@ const OptionMenus = ({ const isTablet = useIsTablet(); const intl = useIntl(); - const handleDownload = useCallback(() => { + const handleDownload = useCallback(async () => { if (!isTablet) { - dismissBottomSheet(); + await dismissBottomSheet(); } setAction('downloading'); }, [setAction]); - const handleCopyLink = useCallback(() => { + const handleCopyLink = useCallback(async () => { if (!isTablet) { - dismissBottomSheet(); + await dismissBottomSheet(); } setAction('copying'); }, [setAction]); - const handlePermalink = useCallback(() => { + const handlePermalink = useCallback(async () => { if (fileInfo.post_id) { if (!isTablet) { - dismissBottomSheet(); + await dismissBottomSheet(); } showPermalink(serverUrl, '', fileInfo.post_id); setAction('opening'); diff --git a/app/screens/home/search/results/file_options/toasts.tsx b/app/screens/home/search/results/file_options/toasts.tsx index 7aad769a3..8c789a8f8 100644 --- a/app/screens/home/search/results/file_options/toasts.tsx +++ b/app/screens/home/search/results/file_options/toasts.tsx @@ -17,7 +17,7 @@ const Toasts = ({ fileInfo, setAction, }: Props) => { - const galleryItem = {...fileInfo, type: 'image'} as GalleryItemType; + const galleryItem = {...fileInfo, type: fileInfo?.mime_type.startsWith('image/') ? 'image' : 'file'} as GalleryItemType; switch (action) { case 'downloading': diff --git a/app/utils/file/file_picker/index.ts b/app/utils/file/file_picker/index.ts index dcfbef5d0..86e07730f 100644 --- a/app/utils/file/file_picker/index.ts +++ b/app/utils/file/file_picker/index.ts @@ -227,10 +227,10 @@ export default class FilePickerUtil { let uri: string = doc.uri; if (Platform.OS === 'android') { - // For android we need to retrieve the realPath in case the file being imported is from the cloud if (doc.fileCopyUri) { uri = doc.fileCopyUri; } else { + // For android we need to retrieve the realPath in case the file being imported is from the cloud const newUri = await MattermostManaged.getFilePath(doc.uri); uri = newUri?.filePath; if (uri === undefined) { diff --git a/ios/Mattermost.xcodeproj/project.pbxproj b/ios/Mattermost.xcodeproj/project.pbxproj index 973b4ab70..8a68311f9 100644 --- a/ios/Mattermost.xcodeproj/project.pbxproj +++ b/ios/Mattermost.xcodeproj/project.pbxproj @@ -806,8 +806,8 @@ ); mainGroup = 83CBB9F61A601CBA00E9B192; packageReferences = ( - 7FD4822A2864D73300A5B18B /* XCRemoteSwiftPackageReference "OpenGraph" */, - 27C667A129523ECA00E590D5 /* XCRemoteSwiftPackageReference "sentry-cocoa" */, + 7FD4822A2864D73300A5B18B /* XCRemoteSwiftPackageReference "OpenGraph.git" */, + 27C667A129523ECA00E590D5 /* XCRemoteSwiftPackageReference "sentry-cocoa.git" */, ); productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; projectDirPath = ""; @@ -1531,7 +1531,7 @@ /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ - 27C667A129523ECA00E590D5 /* XCRemoteSwiftPackageReference "sentry-cocoa" */ = { + 27C667A129523ECA00E590D5 /* XCRemoteSwiftPackageReference "sentry-cocoa.git" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/getsentry/sentry-cocoa.git"; requirement = { @@ -1539,7 +1539,7 @@ kind = branch; }; }; - 7FD4822A2864D73300A5B18B /* XCRemoteSwiftPackageReference "OpenGraph" */ = { + 7FD4822A2864D73300A5B18B /* XCRemoteSwiftPackageReference "OpenGraph.git" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/satoshi-takano/OpenGraph.git"; requirement = { @@ -1552,12 +1552,12 @@ /* Begin XCSwiftPackageProductDependency section */ 27C667A229523ECA00E590D5 /* Sentry */ = { isa = XCSwiftPackageProductDependency; - package = 27C667A129523ECA00E590D5 /* XCRemoteSwiftPackageReference "sentry-cocoa" */; + package = 27C667A129523ECA00E590D5 /* XCRemoteSwiftPackageReference "sentry-cocoa.git" */; productName = Sentry; }; 27C667A429523F0A00E590D5 /* Sentry */ = { isa = XCSwiftPackageProductDependency; - package = 27C667A129523ECA00E590D5 /* XCRemoteSwiftPackageReference "sentry-cocoa" */; + package = 27C667A129523ECA00E590D5 /* XCRemoteSwiftPackageReference "sentry-cocoa.git" */; productName = Sentry; }; 49AE370026D4455D00EF4E52 /* Gekidou */ = { @@ -1574,7 +1574,7 @@ }; 7FD4822B2864D73300A5B18B /* OpenGraph */ = { isa = XCSwiftPackageProductDependency; - package = 7FD4822A2864D73300A5B18B /* XCRemoteSwiftPackageReference "OpenGraph" */; + package = 7FD4822A2864D73300A5B18B /* XCRemoteSwiftPackageReference "OpenGraph.git" */; productName = OpenGraph; }; /* End XCSwiftPackageProductDependency section */ diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 7e3da8c5a..40c118d4b 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -360,7 +360,7 @@ PODS: - SwiftyJSON (~> 5.0) - react-native-notifications (4.3.3): - React-Core - - react-native-paste-input (0.6.0): + - react-native-paste-input (0.6.1): - React-Core - Swime (= 3.0.6) - react-native-safe-area-context (4.5.0): @@ -944,7 +944,7 @@ SPEC CHECKSUMS: react-native-netinfo: 2517ad504b3d303e90d7a431b0fcaef76d207983 react-native-network-client: 88b7ef8ef937352db3cfdbea939dc55397c64b9f react-native-notifications: 83b4fd4a127a6c918fc846cae90da60f84819e44 - react-native-paste-input: 5182843692fd2ec72be50f241a38a49796e225d7 + react-native-paste-input: fb7156dc75960c9895ddd9b9d68eeb874c9f323a react-native-safe-area-context: 39c2d8be3328df5d437ac1700f4f3a4f75716acc react-native-turbo-mailer: fa3f18b5a274fa32ebe43af125caf041f7cc4cbf react-native-video: c26780b224543c62d5e1b2a7244a5cd1b50e8253 diff --git a/package-lock.json b/package-lock.json index 99125e530..77431e09c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "@mattermost/compass-icons": "0.1.35", "@mattermost/react-native-emm": "1.3.4", "@mattermost/react-native-network-client": "1.1.0", - "@mattermost/react-native-paste-input": "0.6.0", + "@mattermost/react-native-paste-input": "0.6.1", "@mattermost/react-native-turbo-log": "0.2.2", "@mattermost/react-native-turbo-mailer": "0.2.3", "@msgpack/msgpack": "2.8.0", @@ -3254,9 +3254,9 @@ } }, "node_modules/@mattermost/react-native-paste-input": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/@mattermost/react-native-paste-input/-/react-native-paste-input-0.6.0.tgz", - "integrity": "sha512-Hy4w8RaiiXl2AKcLXT0FjJJsh4FXtLiWCxfh6zaBtCkx7jsr4d9xwJ/zqrnjv0jkG7XbRUCp40dgNBpWYZ1pyQ==", + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/@mattermost/react-native-paste-input/-/react-native-paste-input-0.6.1.tgz", + "integrity": "sha512-622pc7+h+HNFxhOYuHfXG72D1EmjA+84lsDVKITB01IfE4F0xQYyT1LlCr0GVgUePUI5TXMv6xA1j4izAN+jQQ==", "dependencies": { "semver": "7.3.8" }, @@ -24302,9 +24302,9 @@ } }, "@mattermost/react-native-paste-input": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/@mattermost/react-native-paste-input/-/react-native-paste-input-0.6.0.tgz", - "integrity": "sha512-Hy4w8RaiiXl2AKcLXT0FjJJsh4FXtLiWCxfh6zaBtCkx7jsr4d9xwJ/zqrnjv0jkG7XbRUCp40dgNBpWYZ1pyQ==", + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/@mattermost/react-native-paste-input/-/react-native-paste-input-0.6.1.tgz", + "integrity": "sha512-622pc7+h+HNFxhOYuHfXG72D1EmjA+84lsDVKITB01IfE4F0xQYyT1LlCr0GVgUePUI5TXMv6xA1j4izAN+jQQ==", "requires": { "semver": "7.3.8" } diff --git a/package.json b/package.json index 85313d4a5..c786fbcca 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@mattermost/compass-icons": "0.1.35", "@mattermost/react-native-emm": "1.3.4", "@mattermost/react-native-network-client": "1.1.0", - "@mattermost/react-native-paste-input": "0.6.0", + "@mattermost/react-native-paste-input": "0.6.1", "@mattermost/react-native-turbo-log": "0.2.2", "@mattermost/react-native-turbo-mailer": "0.2.3", "@msgpack/msgpack": "2.8.0",