Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3756976
D9668.id33052.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D9668.id33052.diff
View Options
diff --git a/lib/types/media-types.js b/lib/types/media-types.js
--- a/lib/types/media-types.js
+++ b/lib/types/media-types.js
@@ -2,6 +2,7 @@
import t, { type TInterface, type TUnion } from 'tcomb';
+import type { ClientEncryptedImageAvatar } from './avatar-types';
import type { Shape } from './core.js';
import { type Platform } from './device-types.js';
import { tShape, tString, tID } from '../utils/validation-utils.js';
@@ -21,10 +22,12 @@
export type EncryptedMediaType = 'encrypted_photo' | 'encrypted_video';
-export type AvatarMediaInfo = {
- +type: 'photo',
- +uri: string,
-};
+export type AvatarMediaInfo =
+ | ClientEncryptedImageAvatar
+ | {
+ +type: 'photo',
+ +uri: string,
+ };
export type ClientDBMediaInfo = {
+id: string,
diff --git a/native/avatars/avatar.react.js b/native/avatars/avatar.react.js
--- a/native/avatars/avatar.react.js
+++ b/native/avatars/avatar.react.js
@@ -67,32 +67,32 @@
}, [size]);
const avatar = React.useMemo(() => {
- if (avatarInfo.type === 'image') {
- const avatarMediaInfo = {
- type: 'photo',
- uri: avatarInfo.uri,
- };
-
+ if (avatarInfo.type !== 'image' && avatarInfo.type !== 'encrypted_image') {
return (
- <View style={[containerSizeStyle, styles.imageContainer]}>
- <Multimedia mediaInfo={avatarMediaInfo} spinnerColor="white" />
+ <View style={emojiContainerStyle}>
+ <Text style={emojiSizeStyle}>{avatarInfo.emoji}</Text>
</View>
);
}
+ let avatarMediaInfo;
+ if (avatarInfo.type === 'encrypted_image') {
+ avatarMediaInfo = avatarInfo;
+ } else if (avatarInfo.type === 'image') {
+ avatarMediaInfo = {
+ type: 'photo',
+ uri: avatarInfo.uri,
+ };
+ } else {
+ return null;
+ }
+
return (
- <View style={emojiContainerStyle}>
- <Text style={emojiSizeStyle}>{avatarInfo.emoji}</Text>
+ <View style={[containerSizeStyle, styles.imageContainer]}>
+ <Multimedia mediaInfo={avatarMediaInfo} spinnerColor="white" />
</View>
);
- }, [
- avatarInfo.emoji,
- avatarInfo.type,
- avatarInfo.uri,
- containerSizeStyle,
- emojiContainerStyle,
- emojiSizeStyle,
- ]);
+ }, [avatarInfo, containerSizeStyle, emojiContainerStyle, emojiSizeStyle]);
return avatar;
}
diff --git a/native/media/multimedia.react.js b/native/media/multimedia.react.js
--- a/native/media/multimedia.react.js
+++ b/native/media/multimedia.react.js
@@ -203,6 +203,14 @@
encryptionKey: mediaInfo.thumbnailEncryptionKey,
thumbHash: mediaInfo.thumbnailThumbHash,
};
+ } else if (mediaInfo.type === 'encrypted_image') {
+ const { blobURI, encryptionKey, thumbHash } = mediaInfo;
+ return {
+ kind: 'encrypted',
+ blobURI,
+ encryptionKey,
+ thumbHash,
+ };
} else {
invariant(false, 'Invalid mediaInfo type');
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 11, 6:48 AM (19 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2860864
Default Alt Text
D9668.id33052.diff (2 KB)
Attached To
Mode
D9668: [native] Support displaying encrypted avatars
Attached
Detach File
Event Timeline
Log In to Comment