feat(desktop): SaaS [3.5] 로컬 모드 = entry point (빅뱅 Phase 1.5)
비즈니스 모델 수정: - 무료 로컬 모드 = 사용자 onboarding funnel 입구 (킬러 피처, 회원가입 0) - 유료 클라우드 SaaS = 수익화 (OAuth 로그인 + pro + premium 모델 + sync) - 이전 세션 SaaS [2] OAuth 강제 게이트 철회 db/index.ts: - LOCAL_USER_ID = '_local' 상수 export - openLocal() 헬퍼 — userData/users/_local/d3ro.db - isLocalMode() 헬퍼 bootstrap.ts: - database step 복원 (critical). openLocal() 호출로 앱 시작 시 로컬 DB 자동 오픈 — 로그인 없이 즉시 메인 UI 진입 가능 CloudSyncService._onSignOut(): - closeCurrent() 후 openLocal() 호출 — 로그아웃 시 로컬 모드 DB로 복귀 - 앱은 계속 로컬 모드로 동작 (entry point 철학) App.tsx: - AuthGate 상태머신 제거 (loading/login-required/authenticated/legacy) - LoginScreen import 제거, 항상 AppLayout 렌더 - LoginScreen.tsx 파일은 유지 (추후 Welcome 화면 재활용 가능) 검증: - desktop tsc --noEmit ✅ - desktop build ✅ - dev 런타임: [bootstrap] local database opened → Main window shown - users/_local/d3ro.db 파일 생성 확인
This commit is contained in:
parent
816f527592
commit
1a01cea33c
5 changed files with 102 additions and 91 deletions
|
|
@ -14,7 +14,7 @@ import {
|
|||
import { eq, gt } from 'drizzle-orm'
|
||||
import { getLogger } from './LoggerService'
|
||||
import { configGet, isSupabaseBuildTimeConfigured } from './ConfigService'
|
||||
import { getDatabase, openForUser, closeCurrent } from '../db'
|
||||
import { getDatabase, openForUser, openLocal, closeCurrent } from '../db'
|
||||
import { history, dictionary, meetingSessions, meetingMemos, meetingDocuments } from '../db/schema'
|
||||
import { D3ROError, ErrorCode } from '@d3ro/core/errors'
|
||||
|
||||
|
|
@ -219,12 +219,22 @@ class CloudSyncService extends EventEmitter {
|
|||
this._session = null
|
||||
this._clearStoredRefreshToken()
|
||||
|
||||
// 5) renderer에 auth-changed(null) emit — 게이트가 LoginScreen으로 복귀
|
||||
this.emit('auth-changed', { user: null })
|
||||
|
||||
// 6) DB close — 여기 이후엔 getDatabase() throw
|
||||
// 5) 사용자 DB 닫고 로컬 모드 DB로 복귀
|
||||
// — 로그아웃 후에도 앱은 익명 로컬 모드로 계속 동작 (entry point 철학)
|
||||
closeCurrent()
|
||||
logger.info('Signed out and database closed')
|
||||
try {
|
||||
const { dbPath } = openLocal()
|
||||
logger.info(`[signOut] Reverted to local DB: ${dbPath}`)
|
||||
} catch (err) {
|
||||
logger.error(
|
||||
`[signOut] Local DB reopen failed: ${err instanceof Error ? err.message : String(err)}`
|
||||
)
|
||||
}
|
||||
|
||||
// 6) renderer에 auth-changed(null) emit — Settings는 다시 로그인 화면으로,
|
||||
// 메인 UI는 로컬 모드로 계속 동작
|
||||
this.emit('auth-changed', { user: null })
|
||||
logger.info('Signed out — continuing in local mode')
|
||||
}
|
||||
|
||||
// ── 상태 조회 ──────────────────────────────────────────
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue