Changeset View
Changeset View
Standalone View
Standalone View
lib/types/messages/media.js
Show All 26 Lines | export type MediaMessageInfo = { | ||||
+id?: string, // null if local copy without ID yet | +id?: string, // null if local copy without ID yet | ||||
+localID?: string, // for optimistic creations | +localID?: string, // for optimistic creations | ||||
+threadID: string, | +threadID: string, | ||||
+creator: RelativeUserInfo, | +creator: RelativeUserInfo, | ||||
+time: number, // millisecond timestamp | +time: number, // millisecond timestamp | ||||
+media: $ReadOnlyArray<Media>, | +media: $ReadOnlyArray<Media>, | ||||
}; | }; | ||||
export type MediaMessageServerDBContent = | export type PhotoMessageServerDBContent = { | ||||
| { | |||||
+type: 'photo', | +type: 'photo', | ||||
+uploadID: string, | +uploadID: string, | ||||
} | }; | ||||
| { | export type VideoMessageServerDBContent = { | ||||
+type: 'video', | +type: 'video', | ||||
+uploadID: string, | +uploadID: string, | ||||
+thumbnailUploadID: string, | +thumbnailUploadID: string, | ||||
}; | }; | ||||
export type MediaMessageServerDBContent = | |||||
| PhotoMessageServerDBContent | |||||
| VideoMessageServerDBContent; | |||||
function getUploadIDsFromMediaMessageServerDBContents( | function getUploadIDsFromMediaMessageServerDBContents( | ||||
mediaMessageContents: $ReadOnlyArray<MediaMessageServerDBContent>, | mediaMessageContents: $ReadOnlyArray<MediaMessageServerDBContent>, | ||||
): $ReadOnlyArray<string> { | ): $ReadOnlyArray<string> { | ||||
const uploadIDs: string[] = []; | const uploadIDs: string[] = []; | ||||
for (const mediaContent of mediaMessageContents) { | for (const mediaContent of mediaMessageContents) { | ||||
uploadIDs.push(mediaContent.uploadID); | uploadIDs.push(mediaContent.uploadID); | ||||
if (mediaContent.type === 'video') { | if (mediaContent.type === 'video') { | ||||
Show All 27 Lines |