Skip to content

Commit

Permalink
fix: missing base64 when uploading picture
Browse files Browse the repository at this point in the history
  • Loading branch information
letehaha committed Jan 23, 2024
1 parent d090376 commit 74cab3b
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 37 deletions.
4 changes: 3 additions & 1 deletion src/components/EditPicture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export const EditPicture = ({
allowsEditing: true,
aspect: [1, 1],
quality: 0.5,
base64: true,
exif: false,
});

Expand All @@ -153,10 +154,11 @@ export const EditPicture = ({
if (!asset) {
throw new Error("Failed to get image asset");
}
const filename = `${domain}-${+Date.now()}.jpg`;

const image = asset.uri.startsWith("data:image")
? asset.uri
: asset.base64 || undefined;

if (!image) {
throw new Error("Failed to get image");
}
Expand Down
12 changes: 6 additions & 6 deletions src/locales/en/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ msgstr ""

#: src/components/CreateSubdomainModal.tsx:92
#: src/components/DeleteModal.tsx:92
#: src/components/EditPicture.tsx:217
#: src/components/EditPicture.tsx:219
#: src/components/TransferModal.tsx:109
msgid "Cancel"
msgstr ""
Expand All @@ -137,7 +137,7 @@ msgstr ""
msgid "Change language"
msgstr ""

#: src/components/EditPicture.tsx:181
#: src/components/EditPicture.tsx:183
msgid "Change profile picture"
msgstr ""

Expand Down Expand Up @@ -444,7 +444,7 @@ msgstr ""
msgid "New {domain}.sol owner"
msgstr ""

#: src/components/EditPicture.tsx:206
#: src/components/EditPicture.tsx:208
msgid "New picture URL"
msgstr ""

Expand Down Expand Up @@ -501,7 +501,7 @@ msgstr ""
msgid "Pic"
msgstr ""

#: src/components/EditPicture.tsx:204
#: src/components/EditPicture.tsx:206
msgid "Picture URL"
msgstr ""

Expand Down Expand Up @@ -564,7 +564,7 @@ msgstr ""
msgid "Revert"
msgstr ""

#: src/components/EditPicture.tsx:224
#: src/components/EditPicture.tsx:226
#: src/screens/DomainView.tsx:689
msgid "Save"
msgstr ""
Expand Down Expand Up @@ -764,7 +764,7 @@ msgstr ""
msgid "Unwrap your domain from NFT"
msgstr ""

#: src/components/EditPicture.tsx:198
#: src/components/EditPicture.tsx:200
msgid "Upload a picture..."
msgstr ""

Expand Down
12 changes: 6 additions & 6 deletions src/locales/es/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ msgstr "Al hacer clic en \"{actionName}\", se te pedirá una confirmación desde

#: src/components/CreateSubdomainModal.tsx:92
#: src/components/DeleteModal.tsx:92
#: src/components/EditPicture.tsx:217
#: src/components/EditPicture.tsx:219
#: src/components/TransferModal.tsx:109
msgid "Cancel"
msgstr "Cancelar"
Expand All @@ -103,7 +103,7 @@ msgstr "Carrito"
msgid "Change language"
msgstr "Cambiar idioma"

#: src/components/EditPicture.tsx:181
#: src/components/EditPicture.tsx:183
msgid "Change profile picture"
msgstr "Cambiar foto de perfil"

Expand Down Expand Up @@ -361,7 +361,7 @@ msgstr ""
msgid "New {domain}.sol owner"
msgstr "Nuevo propietario de {domain}.sol"

#: src/components/EditPicture.tsx:206
#: src/components/EditPicture.tsx:208
msgid "New picture URL"
msgstr "Nueva URL de imagen"

Expand Down Expand Up @@ -410,7 +410,7 @@ msgstr "Se requiere permiso para acceder al álbum de fotos"
msgid "Pic"
msgstr "Foto"

#: src/components/EditPicture.tsx:204
#: src/components/EditPicture.tsx:206
msgid "Picture URL"
msgstr "URL de la foto"

Expand Down Expand Up @@ -469,7 +469,7 @@ msgstr "Descuento de registro"
msgid "Revert"
msgstr "Revertir"

#: src/components/EditPicture.tsx:224
#: src/components/EditPicture.tsx:226
#: src/screens/DomainView.tsx:689
msgid "Save"
msgstr "Guardar"
Expand Down Expand Up @@ -612,7 +612,7 @@ msgstr "Desenvolver NFT"
msgid "Unwrap your domain from NFT"
msgstr "Desenvolver tu dominio del NFT"

#: src/components/EditPicture.tsx:198
#: src/components/EditPicture.tsx:200
msgid "Upload a picture..."
msgstr "Subir una imagen..."

Expand Down
12 changes: 6 additions & 6 deletions src/locales/fr/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ msgstr "En cliquant sur \"{actionName}\", votre portefeuille vous demandera une

#: src/components/CreateSubdomainModal.tsx:92
#: src/components/DeleteModal.tsx:92
#: src/components/EditPicture.tsx:217
#: src/components/EditPicture.tsx:219
#: src/components/TransferModal.tsx:109
msgid "Cancel"
msgstr "Annuler"
Expand All @@ -105,7 +105,7 @@ msgstr "Panier"
msgid "Change language"
msgstr "Changez la langue"

#: src/components/EditPicture.tsx:181
#: src/components/EditPicture.tsx:183
msgid "Change profile picture"
msgstr "Changez votre photo de profil"

Expand Down Expand Up @@ -381,7 +381,7 @@ msgstr ""
"\n"
""

#: src/components/EditPicture.tsx:206
#: src/components/EditPicture.tsx:208
msgid "New picture URL"
msgstr "Nouvelle photo de profil"

Expand Down Expand Up @@ -436,7 +436,7 @@ msgstr ""
msgid "Pic"
msgstr "Photo"

#: src/components/EditPicture.tsx:204
#: src/components/EditPicture.tsx:206
msgid "Picture URL"
msgstr "URL de la photo"

Expand Down Expand Up @@ -495,7 +495,7 @@ msgstr "Remise sur l'enregistrement"
msgid "Revert"
msgstr "Annuler"

#: src/components/EditPicture.tsx:224
#: src/components/EditPicture.tsx:226
#: src/screens/DomainView.tsx:689
msgid "Save"
msgstr "Sauvegarder"
Expand Down Expand Up @@ -638,7 +638,7 @@ msgstr "Désenvelopper le NFT"
msgid "Unwrap your domain from NFT"
msgstr "Désenveloppez votre domaine du NFT"

#: src/components/EditPicture.tsx:198
#: src/components/EditPicture.tsx:200
msgid "Upload a picture..."
msgstr "Téléchargez une photo..."

Expand Down
12 changes: 6 additions & 6 deletions src/locales/kr/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ msgstr "{actionName}\"을(를) 클릭하면 지갑에서 승인 확인을 받게

#: src/components/CreateSubdomainModal.tsx:92
#: src/components/DeleteModal.tsx:92
#: src/components/EditPicture.tsx:217
#: src/components/EditPicture.tsx:219
#: src/components/TransferModal.tsx:109
msgid "Cancel"
msgstr "취소"
Expand All @@ -139,7 +139,7 @@ msgstr "장바구니"
msgid "Change language"
msgstr "언어 변경"

#: src/components/EditPicture.tsx:181
#: src/components/EditPicture.tsx:183
msgid "Change profile picture"
msgstr "프로필 사진 변경"

Expand Down Expand Up @@ -448,7 +448,7 @@ msgstr ""
msgid "New {domain}.sol owner"
msgstr "새로운 {domain}.sol 소유자"

#: src/components/EditPicture.tsx:206
#: src/components/EditPicture.tsx:208
msgid "New picture URL"
msgstr "사진 업로드 URL"

Expand Down Expand Up @@ -509,7 +509,7 @@ msgstr "사진 앨범에 접근하기 위한 권한이 필요합니다"
msgid "Pic"
msgstr "사진"

#: src/components/EditPicture.tsx:204
#: src/components/EditPicture.tsx:206
msgid "Picture URL"
msgstr "사진 URL"

Expand Down Expand Up @@ -572,7 +572,7 @@ msgstr "등록 할인"
msgid "Revert"
msgstr "취소"

#: src/components/EditPicture.tsx:224
#: src/components/EditPicture.tsx:226
#: src/screens/DomainView.tsx:689
msgid "Save"
msgstr "저장"
Expand Down Expand Up @@ -767,7 +767,7 @@ msgstr "NFT 언랩하기"
msgid "Unwrap your domain from NFT"
msgstr "NFT에서 도메인을 언랩하기"

#: src/components/EditPicture.tsx:198
#: src/components/EditPicture.tsx:200
msgid "Upload a picture..."
msgstr "사진 업로드..."

Expand Down
12 changes: 6 additions & 6 deletions src/locales/tr/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ msgstr "\"{actionName}\"ya tıklayınca cüzdan onayı vermeniz istenecektir. "

#: src/components/CreateSubdomainModal.tsx:92
#: src/components/DeleteModal.tsx:92
#: src/components/EditPicture.tsx:217
#: src/components/EditPicture.tsx:219
#: src/components/TransferModal.tsx:109
msgid "Cancel"
msgstr "İptal"
Expand All @@ -103,7 +103,7 @@ msgstr "Araç"
msgid "Change language"
msgstr "Dili değiştir"

#: src/components/EditPicture.tsx:181
#: src/components/EditPicture.tsx:183
msgid "Change profile picture"
msgstr "Profil resmini değiştir"

Expand Down Expand Up @@ -361,7 +361,7 @@ msgstr ""
msgid "New {domain}.sol owner"
msgstr "{domain}.sol'un yeni sahibi"

#: src/components/EditPicture.tsx:206
#: src/components/EditPicture.tsx:208
msgid "New picture URL"
msgstr "Yeni resim URL'si"

Expand Down Expand Up @@ -410,7 +410,7 @@ msgstr "Fotoğraf albümüne erişim izni gereklidir"
msgid "Pic"
msgstr "Resim"

#: src/components/EditPicture.tsx:204
#: src/components/EditPicture.tsx:206
msgid "Picture URL"
msgstr "Resim URL'si"

Expand Down Expand Up @@ -469,7 +469,7 @@ msgstr "Kaydetme indirimi"
msgid "Revert"
msgstr "Eski haline getir"

#: src/components/EditPicture.tsx:224
#: src/components/EditPicture.tsx:226
#: src/screens/DomainView.tsx:689
msgid "Save"
msgstr "Kaydet"
Expand Down Expand Up @@ -612,7 +612,7 @@ msgstr "NFT'yi geri katla (unwrapping)"
msgid "Unwrap your domain from NFT"
msgstr "Domaini, NFT'den geri katla (unwrapping)"

#: src/components/EditPicture.tsx:198
#: src/components/EditPicture.tsx:200
msgid "Upload a picture..."
msgstr "Bir resim yükle..."

Expand Down
12 changes: 6 additions & 6 deletions src/locales/zh-Hans/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ msgstr "点击\"{actionName}\",在您的钱包中完成确认"

#: src/components/CreateSubdomainModal.tsx:92
#: src/components/DeleteModal.tsx:92
#: src/components/EditPicture.tsx:217
#: src/components/EditPicture.tsx:219
#: src/components/TransferModal.tsx:109
msgid "Cancel"
msgstr "取消"
Expand All @@ -103,7 +103,7 @@ msgstr "购物车"
msgid "Change language"
msgstr "更换语言"

#: src/components/EditPicture.tsx:181
#: src/components/EditPicture.tsx:183
msgid "Change profile picture"
msgstr "更换个人头像"

Expand Down Expand Up @@ -363,7 +363,7 @@ msgstr ""
msgid "New {domain}.sol owner"
msgstr "新的 {domain}.sol 所有者"

#: src/components/EditPicture.tsx:206
#: src/components/EditPicture.tsx:208
msgid "New picture URL"
msgstr "新的图片网址"

Expand Down Expand Up @@ -412,7 +412,7 @@ msgstr "请求获取相册权限"
msgid "Pic"
msgstr "图片"

#: src/components/EditPicture.tsx:204
#: src/components/EditPicture.tsx:206
msgid "Picture URL"
msgstr "图片网址"

Expand Down Expand Up @@ -471,7 +471,7 @@ msgstr "注册折扣"
msgid "Revert"
msgstr "返回"

#: src/components/EditPicture.tsx:224
#: src/components/EditPicture.tsx:226
#: src/screens/DomainView.tsx:689
msgid "Save"
msgstr "保存"
Expand Down Expand Up @@ -614,7 +614,7 @@ msgstr "将NFT解除封装"
msgid "Unwrap your domain from NFT"
msgstr "将NFT解除封装为你的域名"

#: src/components/EditPicture.tsx:198
#: src/components/EditPicture.tsx:200
msgid "Upload a picture..."
msgstr "上传一张图片..."

Expand Down

0 comments on commit 74cab3b

Please sign in to comment.