가입 시 약관 동의 단계 추가 — 필수·선택 항목 구분 · 개인정보처리방침 고지 · 동의 기록 저장

This commit is contained in:
Sn-Kinos
2026-10-11 23:43:25 +09:00
parent 9119b3beaa
commit c40bde2cd0
9 changed files with 564 additions and 51 deletions
+16 -6
View File
@@ -6,6 +6,7 @@ import '../theme/tokens.dart';
import '../ui/app_icons.dart';
import '../../features/auth/auth_repository.dart';
import '../../features/auth/login_screen.dart';
import '../../features/auth/signup_screens.dart';
import '../../features/galaxy/galaxy_screen.dart';
import '../../features/home/home_screen.dart';
import '../../features/inside/inside_screen.dart';
@@ -77,19 +78,24 @@ List<AppTab> visibleTabs(FeatureFlags flags) => [
const String loginPath = '/login';
/// 5탭 셸 라우트 + 온보딩(로그인) 라우트.
/// 가입 약관 — 동의 기록(`termsAgreedAt`)이 없는 계정은 셸 대신 여기로 온다.
const String termsPath = '/terms';
/// 5탭 셸 라우트 + 로그인 · 가입 약관 라우트.
///
/// 온보딩 나머지 화면(S-A-INTRO · S-A-TERMS · S-A-PROFILE · S-A-ARTIST ·
/// S-A-PLANET-NEW · S-A-PERMS)은 3주차 범위라 아직 라우트가 없다.
/// 로그인 → (동의 기록이 없으면) 약관([termsPath]) → 셸. 가입 · 로그인 버튼이나 제공자와
/// 무관하게 약관 동의 없이 셸에 들어가지 못한다.
GoRouter buildRouter(AuthRepository auth, {FeatureFlags? flags}) {
final featureFlags = flags ?? FeatureFlags();
return GoRouter(
initialLocation: appTabs.first.path,
refreshListenable: auth,
redirect: (context, state) {
final atLogin = state.matchedLocation == loginPath;
if (!auth.isSignedIn) return atLogin ? null : loginPath;
if (atLogin) return appTabs.first.path;
final at = state.matchedLocation;
if (!auth.isSignedIn) return at == loginPath ? null : loginPath;
if (auth.terms != TermsGate.done)
return at == termsPath ? null : termsPath;
if (at == loginPath || at == termsPath) return appTabs.first.path;
return null;
},
routes: [
@@ -97,6 +103,10 @@ GoRouter buildRouter(AuthRepository auth, {FeatureFlags? flags}) {
path: loginPath,
builder: (_, _) => LoginScreen(auth: auth),
),
GoRoute(
path: termsPath,
builder: (_, _) => SignupTermsGate(auth: auth),
),
StatefulShellRoute.indexedStack(
builder: (_, _, shell) => AppShell(shell: shell, flags: featureFlags),
branches: [