fix: 앱 공유하기가 느리던 것 — 앱에서는 공유 이미지를 처음부터 JPEG 로 만들어, 누른 뒤 PNG 를 읽어 다시 JPEG 로 줄이던 4초가 0.14초가 됨 (일반 웹은 PNG 그대로)

This commit is contained in:
skkim committed 2026-11-13 17:17:03 +09:00
1 parent b03a3d501d
commit d880307d85
3 files changed
+15 -7

No files matched your search

+2 -2
View File
@@ -654,7 +654,7 @@ function ShareSheet({ share }: { share: SharePayload }) {
if (images[size] || failed[size]) return
let alive = true
const today = new Date().toLocaleDateString('ko-KR', { month: 'long', day: 'numeric', weekday: 'long' })
shareImage(size === 'square' && share.square ? share.square : share.slides, { size, sky: kind, sub: `${region.name} · ${today}`, host: new URL(SITE_URL).host }).then(
shareImage(size === 'square' && share.square ? share.square : share.slides, { size, sky: kind, sub: `${region.name} · ${today}`, host: new URL(SITE_URL).host, format: IS_APP ? 'jpeg' : 'png' }).then(
(blob) => {
if (!alive) return
const src = URL.createObjectURL(blob)
@@ -679,7 +679,7 @@ function ShareSheet({ share }: { share: SharePayload }) {
// 휴대폰은 공유창에 이미지와 링크를 같이 넘기고, 이미지만 받는 앱이 있어 링크도 복사해 둔다. 공유창이 없으면 이미지를 내려받고 링크를 복사한다
const send = () => {
if (!image) return
const file = new File([image.blob], `nalssigak-${SHARE_SIZES[size].ratio.replace(':', 'x')}.png`, { type: 'image/png' })
const file = new File([image.blob], `nalssigak-${SHARE_SIZES[size].ratio.replace(':', 'x')}.${image.blob.type === 'image/jpeg' ? 'jpg' : 'png'}`, { type: image.blob.type })
if (IS_TOSS) {
tossShare(image.blob, file.name, share.title).then(
(r) => {