Skip to content

fix: playing video in image gallery even when thumb_url not present #2466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 1, 2024
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
4 changes: 2 additions & 2 deletions examples/TypeScriptMessaging/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1503,8 +1503,8 @@ SPEC CHECKSUMS:
RNSVG: ba3e7232f45e34b7b47e74472386cf4e1a676d0a
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
TOCropViewController: edfd4f25713d56905ad1e0b9f5be3fbe0f59c863
Yoga: 1b901a6d6eeba4e8a2e8f308f708691cdb5db312
Yoga: 64cd2a583ead952b0315d5135bf39e053ae9be70

PODFILE CHECKSUM: 90406e1e85c82b37484f5d746afa45c0637bb4b3

COCOAPODS: 1.14.3
COCOAPODS: 1.15.2
25 changes: 5 additions & 20 deletions examples/TypeScriptMessaging/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7189,10 +7189,10 @@ statuses@~1.5.0:
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==

stream-chat-react-native-core@5.24.0:
version "5.24.0"
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.24.0.tgz#425a06d2ad70efa322b8b4a6293de820fee9bb7d"
integrity sha512-HAGMjx69vfPLW8qOVKlcmQGTHDE3NBNi5H2mrf72J/mkSPtmFjMfC3/ZWY9RPwjdUyBMkUCv85ZN0n92sNHn6w==
stream-chat-react-native-core@5.26.0:
version "5.26.0"
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.26.0.tgz#b081bde25585a9f571ac7bb2dc8c910e4ddc99c5"
integrity sha512-Sh5MufLMn6JlEDiML+xDwa5EaCkegHMhKTXdBxfbtbbxaBl1WDOhpwgR6ROIyvGt8nuJ4NQOzRseiNCyXpibXA==
dependencies:
"@babel/runtime" "^7.12.5"
"@gorhom/bottom-sheet" "4.4.8"
Expand All @@ -7207,7 +7207,7 @@ stream-chat-react-native-core@5.24.0:
path "0.12.7"
react-native-markdown-package "1.8.2"
react-native-url-polyfill "^1.3.0"
stream-chat "8.15.0"
stream-chat "8.17.0"

"stream-chat-react-native-core@link:../../package":
version "0.0.0"
Expand All @@ -7222,21 +7222,6 @@ stream-chat-react-native-devtools@^1.1.0:
version "0.0.0"
uid ""

stream-chat@8.15.0:
version "8.15.0"
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.15.0.tgz#37d84768b24e32fcea85b29165e05cb2d5cae517"
integrity sha512-6qrV0pL5dBkqPslpoSkBLjrgiMtFaOvUChue7j3VafhogXGLpu4j6ACPWq3Lrj9XJGfJkOwfT7LyqEhwfmajgQ==
dependencies:
"@babel/runtime" "^7.16.3"
"@types/jsonwebtoken" "~9.0.0"
"@types/ws" "^7.4.0"
axios "^1.6.0"
base64-js "^1.5.1"
form-data "^4.0.0"
isomorphic-ws "^4.0.1"
jsonwebtoken "~9.0.0"
ws "^7.4.4"

stream-chat@8.17.0:
version "8.17.0"
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.17.0.tgz#01c4aacbcdb5dd734b088e70f40cd42a0bcd0fb7"
Expand Down
8 changes: 4 additions & 4 deletions package/native-package/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4391,10 +4391,10 @@ statuses@~1.5.0:
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==

stream-chat-react-native-core@5.25.0:
version "5.25.0"
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.25.0.tgz#a70ce7fde1d324b233738e31dea7c5d27598af39"
integrity sha512-awONq/IuUdMpKZHXjTC3YP6LbYNjCwcIHFPmbXkTXCl3AA2646cgwzBNruaDkO0H8hpsiXXmlOESXSmFoP7r6w==
stream-chat-react-native-core@5.26.0:
version "5.26.0"
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.26.0.tgz#b081bde25585a9f571ac7bb2dc8c910e4ddc99c5"
integrity sha512-Sh5MufLMn6JlEDiML+xDwa5EaCkegHMhKTXdBxfbtbbxaBl1WDOhpwgR6ROIyvGt8nuJ4NQOzRseiNCyXpibXA==
dependencies:
"@babel/runtime" "^7.12.5"
"@gorhom/bottom-sheet" "4.4.8"
Expand Down
18 changes: 9 additions & 9 deletions package/src/components/Attachment/Gallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -309,15 +309,15 @@ const GalleryThumbnail = <
};

const defaultOnPress = () => {
if ((thumbnail.type === 'video' && !thumbnail.thumb_url) || !thumbnail.url) {
return;
}
if (thumbnail.type === 'video' && !isVideoPackageAvailable()) {
// This condition is kinda unreachable, since we render videos as file attachment if the video
// library is not installed. But doesn't hurt to have extra safeguard, in case of some customizations.
openUrlSafely(thumbnail.url);
} else {
openImageViewer();
// If file type is video and the url is defined then try to open the file.
if (thumbnail.type === 'video' && thumbnail.url) {
if (isVideoPackageAvailable()) {
openImageViewer();
} else {
// This condition is kinda unreachable, since we render videos as file attachment if the video
// library is not installed. But doesn't hurt to have extra safeguard, in case of some customizations.
openUrlSafely(thumbnail.url);
}
}
};

Expand Down
2 changes: 1 addition & 1 deletion package/src/components/ImageGallery/ImageGallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export const ImageGallery = <
!attachment.title_link &&
!attachment.og_scrape_url &&
getUrlOfImageAttachment(attachment)) ||
((isVideoPackageAvailable() && attachment.type) === 'video' && attachment.thumb_url),
(isVideoPackageAvailable() && attachment.type === 'video'),
)
.reverse() || [];

Expand Down
Loading