Adds error states to story images
This commit is contained in:
parent
782838c591
commit
fcf7406dd4
12 changed files with 158 additions and 21 deletions
|
@ -3,6 +3,7 @@
|
|||
|
||||
import type { AttachmentType } from '../types/Attachment';
|
||||
import {
|
||||
hasFailed,
|
||||
hasNotResolved,
|
||||
isDownloaded,
|
||||
isGIF,
|
||||
|
@ -18,6 +19,10 @@ const MIN_TEXT_DURATION = 3 * SECOND;
|
|||
export async function getStoryDuration(
|
||||
attachment: AttachmentType
|
||||
): Promise<number | undefined> {
|
||||
if (hasFailed(attachment)) {
|
||||
return DEFAULT_DURATION;
|
||||
}
|
||||
|
||||
if (!isDownloaded(attachment) || hasNotResolved(attachment)) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue