Page MenuHomePhabricator

D9167.id32469.diff
No OneTemporary

D9167.id32469.diff

diff --git a/lib/types/avatar-types.js b/lib/types/avatar-types.js
--- a/lib/types/avatar-types.js
+++ b/lib/types/avatar-types.js
@@ -24,6 +24,11 @@
+uploadID: string,
};
+export type EncryptedImageAvatarDBContent = {
+ +type: 'encrypted-image',
+ +uploadID: string,
+};
+
export type ENSAvatarDBContent = {
+type: 'ens',
};
@@ -33,6 +38,7 @@
export type AvatarDBContent =
| EmojiAvatarDBContent
| ImageAvatarDBContent
+ | EncryptedImageAvatarDBContent
| ENSAvatarDBContent;
export type UpdateUserAvatarRemoveRequest = { +type: 'remove' };
@@ -53,12 +59,20 @@
uri: t.String,
});
+export type ClientEncryptedImageAvatar = {
+ +type: 'encrypted-image',
+ +blobURI: string,
+ +encryptionKey: string,
+ +thumbHash: ?string,
+};
+
export type ClientENSAvatar = ENSAvatarDBContent;
const clientENSAvatarValidator = ensAvatarDBContentValidator;
export type ClientAvatar =
| ClientEmojiAvatar
| ClientImageAvatar
+ | ClientEncryptedImageAvatar
| ClientENSAvatar;
export const clientAvatarValidator: TUnion<ClientAvatar> = t.union([
clientEmojiAvatarValidator,
@@ -66,7 +80,10 @@
clientENSAvatarValidator,
]);
-export type ResolvedClientAvatar = ClientEmojiAvatar | ClientImageAvatar;
+export type ResolvedClientAvatar =
+ | ClientEmojiAvatar
+ | ClientImageAvatar
+ | ClientEncryptedImageAvatar;
export type UpdateUserAvatarResponse = {
+updates: CreateUpdatesResult,
diff --git a/native/account/registration/avatar-selection.react.js b/native/account/registration/avatar-selection.react.js
--- a/native/account/registration/avatar-selection.react.js
+++ b/native/account/registration/avatar-selection.react.js
@@ -91,7 +91,8 @@
} else if (selection.updateUserAvatarRequest.type !== 'remove') {
const clientRequest = selection.updateUserAvatarRequest;
invariant(
- clientRequest.type !== 'image',
+ clientRequest.type !== 'image' &&
+ clientRequest.type !== 'encrypted-image',
'image avatars need to be uploaded',
);
const newAvatarData = {

File Metadata

Mime Type
text/plain
Expires
Sat, Jan 11, 6:44 AM (20 h, 22 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2860856
Default Alt Text
D9167.id32469.diff (2 KB)

Event Timeline