fix(cloud-sync): drop the previous account's cached tier when signing in as someone else
Switching accounts without a sign-out skipped resetToFree, and if the subscription lookup then failed the new account kept the old one's Pro badge and ad decision, persisted across restarts.
This commit is contained in:
parent
6fef05a39f
commit
9cf3fd7317
2 changed files with 31 additions and 2 deletions
|
|
@ -426,9 +426,13 @@ class CloudSyncService extends EventEmitter {
|
|||
|
||||
// 2) Supabase `subscriptions` 테이블에서 현재 티어 가져와 LicenseService에 동기화
|
||||
// (빅뱅 Phase 4 — 티어 enforcement)
|
||||
// 다른 계정으로 바로 바뀌는 경우엔 이전 계정의 캐시 티어를 먼저 버린다 — 조회가 실패하면
|
||||
// 이전 계정의 Pro 배지·광고 판정이 새 계정에 남고, 저장값이라 재시작 후에도 이어졌다.
|
||||
const switchedAccount = openUserId !== null && openUserId !== userId
|
||||
try {
|
||||
const tier = await this._fetchSubscriptionTier(userId)
|
||||
const { getLicenseService } = await import('./LicenseService')
|
||||
if (switchedAccount) getLicenseService().resetToFree()
|
||||
const tier = await this._fetchSubscriptionTier(userId)
|
||||
getLicenseService().syncFromCloud(tier)
|
||||
} catch (err) {
|
||||
logger.warn(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue