Changeset View
Changeset View
Standalone View
Standalone View
lib/types/media-types.js
// @flow | // @flow | ||||
import type { Shape } from './core.js'; | import type { Shape } from './core.js'; | ||||
import { type Platform } from './device-types.js'; | import { type Platform } from './device-types.js'; | ||||
export type Dimensions = $ReadOnly<{ | export type Dimensions = $ReadOnly<{ | ||||
+height: number, | +height: number, | ||||
+width: number, | +width: number, | ||||
}>; | }>; | ||||
export type MediaType = 'photo' | 'video'; | export type MediaType = 'photo' | 'video'; | ||||
export type EncryptedMediaType = 'encrypted_photo' | 'encrypted_video'; | export type EncryptedMediaType = 'encrypted_photo' | 'encrypted_video'; | ||||
export type Image = { | |||||
+id: string, | |||||
+uri: string, | |||||
+type: 'photo', | |||||
+dimensions: Dimensions, | |||||
// stored on native only during creation in case retry needed after state lost | |||||
+localMediaSelection?: NativeMediaSelection, | |||||
}; | |||||
export type EncryptedImage = { | |||||
+id: string, | |||||
// a media URI for keyserver uploads / blob holder for Blob service uploads | |||||
+holder: string, | |||||
+encryptionKey: string, | |||||
+type: 'encrypted_photo', | |||||
+dimensions: Dimensions, | |||||
}; | |||||
export type Video = { | |||||
+id: string, | |||||
+uri: string, | |||||
+type: 'video', | |||||
+dimensions: Dimensions, | |||||
+loop?: boolean, | |||||
+thumbnailID: string, | |||||
+thumbnailURI: string, | |||||
// stored on native only during creation in case retry needed after state lost | |||||
+localMediaSelection?: NativeMediaSelection, | |||||
}; | |||||
export type EncryptedVideo = { | |||||
+id: string, | |||||
// a media URI for keyserver uploads / blob holder for Blob service uploads | |||||
+holder: string, | |||||
+encryptionKey: string, | |||||
+type: 'encrypted_video', | |||||
+dimensions: Dimensions, | |||||
+loop?: boolean, | |||||
+thumbnailID: string, | |||||
+thumbnailHolder: string, | |||||
+thumbnailEncryptionKey: string, | |||||
}; | |||||
export type Media = Image | Video | EncryptedImage | EncryptedVideo; | |||||
export type AvatarMediaInfo = { | export type AvatarMediaInfo = { | ||||
+type: 'photo', | +type: 'photo', | ||||
+uri: string, | +uri: string, | ||||
}; | }; | ||||
export type ClientDBMediaInfo = { | export type ClientDBMediaInfo = { | ||||
+id: string, | +id: string, | ||||
+uri: string, | +uri: string, | ||||
▲ Show 20 Lines • Show All 522 Lines • ▼ Show 20 Lines | |||||
export type MediaMissionResult = MediaMissionFailure | { +success: true }; | export type MediaMissionResult = MediaMissionFailure | { +success: true }; | ||||
export type MediaMission = { | export type MediaMission = { | ||||
+steps: $ReadOnlyArray<MediaMissionStep>, | +steps: $ReadOnlyArray<MediaMissionStep>, | ||||
+result: MediaMissionResult, | +result: MediaMissionResult, | ||||
+userTime: number, | +userTime: number, | ||||
+totalTime: number, | +totalTime: number, | ||||
}; | }; | ||||
export type Image = { | |||||
+id: string, | |||||
+uri: string, | |||||
+type: 'photo', | |||||
+dimensions: Dimensions, | |||||
// stored on native only during creation in case retry needed after state lost | |||||
+localMediaSelection?: NativeMediaSelection, | |||||
}; | |||||
export type EncryptedImage = { | |||||
+id: string, | |||||
// a media URI for keyserver uploads / blob holder for Blob service uploads | |||||
+holder: string, | |||||
+encryptionKey: string, | |||||
+type: 'encrypted_photo', | |||||
+dimensions: Dimensions, | |||||
}; | |||||
export type Video = { | |||||
+id: string, | |||||
+uri: string, | |||||
+type: 'video', | |||||
+dimensions: Dimensions, | |||||
+loop?: boolean, | |||||
+thumbnailID: string, | |||||
+thumbnailURI: string, | |||||
// stored on native only during creation in case retry needed after state lost | |||||
+localMediaSelection?: NativeMediaSelection, | |||||
}; | |||||
export type EncryptedVideo = { | |||||
+id: string, | |||||
// a media URI for keyserver uploads / blob holder for Blob service uploads | |||||
+holder: string, | |||||
+encryptionKey: string, | |||||
+type: 'encrypted_video', | |||||
+dimensions: Dimensions, | |||||
+loop?: boolean, | |||||
+thumbnailID: string, | |||||
+thumbnailHolder: string, | |||||
+thumbnailEncryptionKey: string, | |||||
}; | |||||
export type Media = Image | Video | EncryptedImage | EncryptedVideo; |