Changeset View
Changeset View
Standalone View
Standalone View
native/media/multimedia.react.js
Show First 20 Lines • Show All 164 Lines • ▼ Show 20 Lines | if (source.kind === 'uri') { | ||||
this.inputState.reportURIDisplayed(source.uri, isLoaded); | this.inputState.reportURIDisplayed(source.uri, isLoaded); | ||||
} | } | ||||
}; | }; | ||||
// ESLint doesn't recognize that invariant always throws | // ESLint doesn't recognize that invariant always throws | ||||
// eslint-disable-next-line consistent-return | // eslint-disable-next-line consistent-return | ||||
static sourceFromMediaInfo(mediaInfo: MediaInfo | AvatarMediaInfo): Source { | static sourceFromMediaInfo(mediaInfo: MediaInfo | AvatarMediaInfo): Source { | ||||
if (mediaInfo.type === 'photo') { | if (mediaInfo.type === 'photo') { | ||||
return { kind: 'uri', uri: mediaInfo.uri }; | return { | ||||
kind: 'uri', | |||||
uri: mediaInfo.uri, | |||||
thumbHash: mediaInfo.thumbHash, | |||||
}; | |||||
} else if (mediaInfo.type === 'video') { | } else if (mediaInfo.type === 'video') { | ||||
return { kind: 'uri', uri: mediaInfo.thumbnailURI }; | return { | ||||
kind: 'uri', | |||||
uri: mediaInfo.thumbnailURI, | |||||
thumbHash: mediaInfo.thumbnailThumbHash, | |||||
}; | |||||
} else if (mediaInfo.type === 'encrypted_photo') { | } else if (mediaInfo.type === 'encrypted_photo') { | ||||
return { | return { | ||||
kind: 'encrypted', | kind: 'encrypted', | ||||
holder: mediaInfo.holder, | holder: mediaInfo.holder, | ||||
encryptionKey: mediaInfo.encryptionKey, | encryptionKey: mediaInfo.encryptionKey, | ||||
thumbHash: mediaInfo.thumbHash, | |||||
}; | }; | ||||
} else if (mediaInfo.type === 'encrypted_video') { | } else if (mediaInfo.type === 'encrypted_video') { | ||||
return { | return { | ||||
kind: 'encrypted', | kind: 'encrypted', | ||||
holder: mediaInfo.thumbnailHolder, | holder: mediaInfo.thumbnailHolder, | ||||
encryptionKey: mediaInfo.thumbnailEncryptionKey, | encryptionKey: mediaInfo.thumbnailEncryptionKey, | ||||
thumbHash: mediaInfo.thumbnailThumbHash, | |||||
}; | }; | ||||
} else { | } else { | ||||
invariant(false, 'Invalid mediaInfo type'); | invariant(false, 'Invalid mediaInfo type'); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
const styles = StyleSheet.create({ | const styles = StyleSheet.create({ | ||||
Show All 19 Lines |