mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-05-25 03:42:13 +00:00
fix: media file not opened if downloaded
This commit is contained in:
parent
a29af4c914
commit
eed5d292c6
3 changed files with 38 additions and 37 deletions
|
|
@ -203,7 +203,8 @@ class _UserListItem extends State<GroupListItemComp> {
|
|||
await startDownloadMedia(mediaFile, true);
|
||||
return;
|
||||
}
|
||||
if (mediaFile.downloadState! == DownloadState.ready) {
|
||||
if (mediaFile.downloadState! == DownloadState.ready ||
|
||||
mediaFile.downloadState! == DownloadState.downloaded) {
|
||||
if (!mounted) return;
|
||||
await context.push(
|
||||
Routes.chatsMediaViewer,
|
||||
|
|
|
|||
|
|
@ -88,7 +88,9 @@ class _ChatMediaEntryState extends State<ChatMediaEntry> {
|
|||
}
|
||||
|
||||
Future<void> onTap() async {
|
||||
if (widget.mediaService.mediaFile.downloadState == DownloadState.ready &&
|
||||
if ((widget.mediaService.mediaFile.downloadState == DownloadState.ready ||
|
||||
widget.mediaService.mediaFile.downloadState ==
|
||||
DownloadState.downloaded) &&
|
||||
widget.message.openedAt == null) {
|
||||
if (!mounted) return;
|
||||
await Navigator.push(
|
||||
|
|
|
|||
|
|
@ -107,11 +107,9 @@ class _MediaViewerViewState extends State<MediaViewerView> {
|
|||
final Mutex _messageUpdateLock = Mutex();
|
||||
|
||||
Future<void> asyncLoadNextMedia(bool firstRun) async {
|
||||
final messages = twonlyDB.messagesDao.watchMediaNotOpened(
|
||||
widget.group.groupId,
|
||||
);
|
||||
|
||||
_subscription = messages.listen((messages) async {
|
||||
_subscription = twonlyDB.messagesDao
|
||||
.watchMediaNotOpened(widget.group.groupId)
|
||||
.listen((messages) async {
|
||||
await _messageUpdateLock.protect(() async {
|
||||
for (final msg in messages) {
|
||||
if (_alreadyOpenedMediaIds.contains(msg.mediaId)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue