Adds error states to story images

This commit is contained in:
Josh Perez 2022-08-03 20:38:41 -04:00 committed by GitHub
parent 782838c591
commit fcf7406dd4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 158 additions and 21 deletions

View file

@ -34,6 +34,7 @@ import { replaceIndex } from '../../util/replaceIndex';
import { sendDeleteForEveryoneMessage } from '../../util/sendDeleteForEveryoneMessage';
import { showToast } from '../../util/showToast';
import {
hasFailed,
hasNotResolved,
isDownloaded,
isDownloading,
@ -378,7 +379,10 @@ function markStoryRead(
return;
}
if (!isDownloaded(matchingStory.attachment)) {
if (
!isDownloaded(matchingStory.attachment) &&
!hasFailed(matchingStory.attachment)
) {
return;
}
@ -449,6 +453,10 @@ function queueStoryDownload(
return;
}
if (hasFailed(attachment)) {
return;
}
if (isDownloaded(attachment)) {
if (!attachment.path) {
return;
@ -1001,6 +1009,8 @@ export function reducer(
const hasAttachmentDownloaded =
!isDownloaded(prevStory.attachment) &&
isDownloaded(newStory.attachment);
const hasAttachmentFailed =
hasFailed(newStory.attachment) && !hasFailed(prevStory.attachment);
const readStatusChanged = prevStory.readStatus !== newStory.readStatus;
const reactionsChanged =
prevStory.reactions?.length !== newStory.reactions?.length;
@ -1014,6 +1024,7 @@ export function reducer(
const shouldReplace =
isDownloadingAttachment ||
hasAttachmentDownloaded ||
hasAttachmentFailed ||
hasBeenDeleted ||
hasSendStateChanged ||
readStatusChanged ||