From 7da3ddbe247a0b272e615a7bbbe91ba9805cb309 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Thu, 12 Sep 2024 15:16:38 +0100 Subject: [PATCH 1/9] [Video] speculative .vtt file selection fix (#5296) * speculative vtt fix * add logging --- src/view/com/composer/videos/SubtitleFilePicker.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/view/com/composer/videos/SubtitleFilePicker.tsx b/src/view/com/composer/videos/SubtitleFilePicker.tsx index 9e0fe0aeee..beb3f07a86 100644 --- a/src/view/com/composer/videos/SubtitleFilePicker.tsx +++ b/src/view/com/composer/videos/SubtitleFilePicker.tsx @@ -3,6 +3,7 @@ import {View} from 'react-native' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' +import {logger} from '#/logger' import * as Toast from '#/view/com/util/Toast' import {atoms as a} from '#/alf' import {Button, ButtonIcon, ButtonText} from '#/components/Button' @@ -25,9 +26,16 @@ export function SubtitleFilePicker({ const handlePick = (evt: React.ChangeEvent) => { const selectedFile = evt.target.files?.[0] if (selectedFile) { - if (selectedFile.type === 'text/vtt') { + if ( + selectedFile.type === 'text/vtt' || + (selectedFile.type === 'text/plain' && + selectedFile.name.endsWith('.vtt')) + ) { onSelectFile(selectedFile) } else { + logger.error('Invalid subtitle file type', { + safeMessage: `File: ${selectedFile.name} (${selectedFile.type})`, + }) Toast.show(_(msg`Only WebVTT (.vtt) files are supported`)) } } From 4d22adbcf6866fb2995e090b2528bdb5968d7f78 Mon Sep 17 00:00:00 2001 From: Minseo Lee Date: Thu, 12 Sep 2024 23:30:57 +0900 Subject: [PATCH 2/9] Tabular numbers to video timestamp (#5293) --- .../com/util/post-embeds/VideoEmbedInner/TimeIndicator.tsx | 4 ++-- .../com/util/post-embeds/VideoEmbedInner/VideoWebControls.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/view/com/util/post-embeds/VideoEmbedInner/TimeIndicator.tsx b/src/view/com/util/post-embeds/VideoEmbedInner/TimeIndicator.tsx index 6636883f12..be3f907112 100644 --- a/src/view/com/util/post-embeds/VideoEmbedInner/TimeIndicator.tsx +++ b/src/view/com/util/post-embeds/VideoEmbedInner/TimeIndicator.tsx @@ -37,11 +37,11 @@ export function TimeIndicator({time}: {time: number}) { ]}> - {minutes}:{seconds} + {`${minutes}:${seconds}`} ) diff --git a/src/view/com/util/post-embeds/VideoEmbedInner/VideoWebControls.tsx b/src/view/com/util/post-embeds/VideoEmbedInner/VideoWebControls.tsx index bb15db0833..791025f709 100644 --- a/src/view/com/util/post-embeds/VideoEmbedInner/VideoWebControls.tsx +++ b/src/view/com/util/post-embeds/VideoEmbedInner/VideoWebControls.tsx @@ -370,7 +370,7 @@ export function Controls({ onPress={onPressPlayPause} /> - + {formatTime(currentTime)} / {formatTime(duration)} {hasSubtitleTrack && ( From e0d9e75407b053dd3b7a3472f925d8cd4bd92d45 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 12 Sep 2024 15:39:04 +0100 Subject: [PATCH 3/9] Fix notification scroll jump (#5297) --- src/state/queries/notifications/util.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/state/queries/notifications/util.ts b/src/state/queries/notifications/util.ts index e0ee02294e..133d3ebc2e 100644 --- a/src/state/queries/notifications/util.ts +++ b/src/state/queries/notifications/util.ts @@ -175,9 +175,19 @@ async function fetchSubjects( }> { const postUris = new Set() const packUris = new Set() + + const postUrisWithLikes = new Set() + const postUrisWithReposts = new Set() + for (const notif of groupedNotifs) { if (notif.subjectUri?.includes('app.bsky.feed.post')) { postUris.add(notif.subjectUri) + if (notif.type === 'post-like') { + postUrisWithLikes.add(notif.subjectUri) + } + if (notif.type === 'repost') { + postUrisWithReposts.add(notif.subjectUri) + } } else if ( notif.notification.reasonSubject?.includes('app.bsky.graph.starterpack') ) { @@ -206,6 +216,15 @@ async function fetchSubjects( AppBskyFeedPost.validateRecord(post.record).success ) { postsMap.set(post.uri, post) + + // HACK. In some cases, the appview appears to lag behind and returns empty counters. + // To prevent scroll jump due to missing metrics, fill in 1 like/repost instead of 0. + if (post.likeCount === 0 && postUrisWithLikes.has(post.uri)) { + post.likeCount = 1 + } + if (post.repostCount === 0 && postUrisWithReposts.has(post.uri)) { + post.repostCount = 1 + } } } for (const pack of packsChunks.flat()) { From 86abeb80b9e863b0a1d5eaebe725a676cee4ae09 Mon Sep 17 00:00:00 2001 From: Wesley <46491851+wscld@users.noreply.github.com> Date: Thu, 12 Sep 2024 11:59:12 -0300 Subject: [PATCH 4/9] Renaming the Follow button to "Follow back" when followed by user (#5281) * Renaming the follow button to follow back when followed by user * Fixing conditions and reusing existing translation --- src/screens/Profile/Header/ProfileHeaderStandard.tsx | 2 ++ src/view/com/profile/FollowButton.tsx | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/screens/Profile/Header/ProfileHeaderStandard.tsx b/src/screens/Profile/Header/ProfileHeaderStandard.tsx index cf5fcb97e3..846fa4424b 100644 --- a/src/screens/Profile/Header/ProfileHeaderStandard.tsx +++ b/src/screens/Profile/Header/ProfileHeaderStandard.tsx @@ -219,6 +219,8 @@ let ProfileHeaderStandard = ({ {profile.viewer?.following ? ( Following + ) : profile.viewer?.followedBy ? ( + Follow Back ) : ( Follow )} diff --git a/src/view/com/profile/FollowButton.tsx b/src/view/com/profile/FollowButton.tsx index 42adea3cfc..aaa5d3454d 100644 --- a/src/view/com/profile/FollowButton.tsx +++ b/src/view/com/profile/FollowButton.tsx @@ -61,7 +61,7 @@ export function FollowButton({ label={_(msg({message: 'Unfollow', context: 'action'}))} /> ) - } else { + } else if (!profile.viewer.followedBy) { return (