feat: 웹이 앱(웹뷰 셸) 안인지 알아보고 앱 브리지로 구글 로그인·위치·공유를 처리 — user agent NalssigakApp/ 로 감지, 공유 이미지는 JPEG 로 줄여 전달, 앱 안에서는 설치 배너 숨김 (GA app_launch android_app, app_bridge_error, platform android_app)

This commit is contained in:
skkim committed 2026-11-13 13:45:52 +09:00
1 parent c8287b4bf3
commit 2a94ebe85b
9 files changed
+204 -19

No files matched your search

+24 -1
View File
@@ -30,7 +30,7 @@ import {
} from '@nalssigak/shared/api/client/@tanstack/react-query.gen'
import { AuthProvider, ReportReason, type CommentData, type Factor, type ResAuth, type ResCommentList, type ResIndexDetail } from '@nalssigak/shared/api/client/types.gen'
import { track } from '../lib/analytics'
import { IS_TOSS, tossLogin, tossShare } from '../lib/platform'
import { appShare, IS_APP, IS_TOSS, tossLogin, tossShare } from '../lib/platform'
import { cx } from '../lib/utils'
import { useAuth } from './authContext'
import { ago, articleMeta, AVATAR_COLORS, cardBg, CHARACTERS, dateRange, loadOf, MOODS, shortDay } from '@nalssigak/shared/lib'
@@ -694,6 +694,29 @@ function ShareSheet({ share }: { share: SharePayload }) {
)
return
}
if (IS_APP) {
// 앱 웹뷰는 navigator.share 가 없어, 이미지를 줄여 앱에 넘기고 앱의 공유창으로 보낸다. 링크도 복사해 둔다
const copied = navigator.clipboard?.writeText(url).then(
() => true,
(e: unknown) => {
console.error('[share] copy link', e)
return false
},
)
appShare(image.blob, file.name, share.title).then(
async () => {
setToast((await copied) ? '보냈어요. 링크도 복사해 뒀어요' : '보냈어요')
track('share', { content_type: 'image', item_id: share.title, method: 'share_sheet', ratio: SHARE_SIZES[size].ratio })
reward()
},
(e: unknown) => {
console.error('[share] app', e)
track('app_bridge_error', { action: 'share' })
setToast('보내지 못했어요. 한 번 더 눌러 주세요')
},
)
return
}
if (navigator.canShare?.({ files: [file], text, url })) {
const copied = navigator.clipboard?.writeText(url).then(
() => true,