가입 시 약관 동의 단계 추가 — 필수·선택 항목 구분 · 개인정보처리방침 고지 · 동의 기록 저장
This commit is contained in:
+25
-2
@@ -1,14 +1,37 @@
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'app.dart';
|
||||
import 'core/data/backend.dart';
|
||||
import 'core/firebase/firebase_boot.dart';
|
||||
import 'features/auth/auth_repository.dart';
|
||||
import 'features/auth/firebase_auth_session.dart';
|
||||
import 'features/auth/signup_screens.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
// 설정 파일이 없으면 목 모드로 내려간다. 여기서 throw 하지 않는다 — FirebaseBoot 참고.
|
||||
await FirebaseBoot.init();
|
||||
final session = FirebaseBoot.isLive ? FirebaseAuthSession() : null;
|
||||
runApp(FancakeApp(auth: AuthRepository(session: session)));
|
||||
final live = FirebaseBoot.isLive;
|
||||
runApp(
|
||||
FancakeApp(
|
||||
auth: AuthRepository(
|
||||
session: live ? FirebaseAuthSession() : null,
|
||||
needsTerms: live ? _needsTerms : null,
|
||||
recordTerms: live
|
||||
? (agreed) => Backend().call('fnSignupConsent', {
|
||||
'agreed': agreed.toList(),
|
||||
'version': signupTermsVersion,
|
||||
})
|
||||
: null,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 동의 기록(`termsAgreedAt`)이 없으면 약관을 받아야 한다. 갓 생성된 계정은 트리거가 아직
|
||||
/// 사용자 문서를 만들지 않았을 수 있다 — 그래도 동의가 필요하다.
|
||||
Future<bool> _needsTerms(String uid) async {
|
||||
final snap = await FirebaseFirestore.instance.doc('users/$uid').get();
|
||||
return snap.data()?['termsAgreedAt'] == null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user