Adds error states to story images
This commit is contained in:
parent
782838c591
commit
fcf7406dd4
12 changed files with 158 additions and 21 deletions
|
@ -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 ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue