Skip to content

Commit

Permalink
feat(native-app): fix sharing for android (#16446)
Browse files Browse the repository at this point in the history
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
thoreyjona and kodiakhq[bot] authored Oct 18, 2024
1 parent 3936331 commit 1972eb3
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
4 changes: 2 additions & 2 deletions apps/native/app/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1552,7 +1552,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- RNShare (7.1.1):
- RNShare (10.2.1):
- React-Core
- RNSVG (15.2.0):
- React-Core
Expand Down Expand Up @@ -2031,7 +2031,7 @@ SPEC CHECKSUMS:
RNKeychain: ff836453cba46938e0e9e4c22e43d43fa2c90333
RNQuickAction: 6d404a869dc872cde841ad3147416a670d13fa93
RNReanimated: f9192536fa8a312c737eaf15c905f78831193ef1
RNShare: a22398d8d02336133e28bf8b6e0b47b31abade41
RNShare: 0fad69ae2d71de9d1f7b9a43acf876886a6cb99c
RNSVG: 43b64ed39c14ce830d840903774154ca0c1f27ec
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
SSZipArchive: 62d4947b08730e4cda640473b0066d209ff033c9
Expand Down
2 changes: 1 addition & 1 deletion apps/native/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"react-native-quick-actions": "0.3.13",
"react-native-quick-base64": "2.1.2",
"react-native-reanimated": "3.12.1",
"react-native-share": "7.1.1",
"react-native-share": "10.2.1",
"react-native-spotlight-search": "2.0.0",
"react-native-svg": "15.2.0",
"react-native-vision-camera": "4.5.1",
Expand Down
20 changes: 12 additions & 8 deletions apps/native/app/src/screens/document-detail/utils/share-file.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface ShareFileProps {
pdfUrl?: string
}

export const shareFile = ({ document, pdfUrl }: ShareFileProps) => {
export const shareFile = async ({ document, pdfUrl }: ShareFileProps) => {
if (!document || !document.subject || !document.sender) {
return
}
Expand All @@ -18,11 +18,15 @@ export const shareFile = ({ document, pdfUrl }: ShareFileProps) => {
authStore.setState({ noLockScreenUntilNextAppStateActive: true })
}

Share.open({
title: document.subject,
subject: document.subject,
message: `${document.sender.name} \n ${document.subject}`,
type: pdfUrl ? 'application/pdf' : undefined,
url: pdfUrl ? `file://${pdfUrl}` : document.downloadUrl!,
})
try {
await Share.open({
title: document.subject,
subject: document.subject,
message: `${document.sender.name} \n ${document.subject}`,
type: pdfUrl ? 'application/pdf' : undefined,
url: pdfUrl ? `file://${pdfUrl}` : document.downloadUrl!,
})
} catch (error) {
// noop
}
}
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13287,7 +13287,7 @@ __metadata:
react-native-quick-actions: 0.3.13
react-native-quick-base64: 2.1.2
react-native-reanimated: 3.12.1
react-native-share: 7.1.1
react-native-share: 10.2.1
react-native-spotlight-search: 2.0.0
react-native-svg: 15.2.0
react-native-vision-camera: 4.5.1
Expand Down Expand Up @@ -49210,10 +49210,10 @@ __metadata:
languageName: node
linkType: hard

"react-native-share@npm:7.1.1":
version: 7.1.1
resolution: "react-native-share@npm:7.1.1"
checksum: f391e3797f1570d55922216546b096d2af386d025e6f98a1aca24142b0f51dc6c6d494c048a7a81f82947570e2d483c80467e2960b1a061961f98dfcea0f078e
"react-native-share@npm:10.2.1":
version: 10.2.1
resolution: "react-native-share@npm:10.2.1"
checksum: 9dd4e0329b344668e04ff5421ab982e319dc3ba988d0b7990a619bd1c551beb6012623abe238a80e427f86f2bb03dd21b7afc0e957ee7348e0bd9fb39956912e
languageName: node
linkType: hard

Expand Down

0 comments on commit 1972eb3

Please sign in to comment.