로그아웃 즉시 처리 · 푸시 토큰 정리 순서
This commit is contained in:
@@ -369,31 +369,20 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
Future<void> _notice(String message) => showAlertDialog(context, message);
|
||||
|
||||
/// 확인 팝업(취소 · 실행) — 시안 `554:24669` · `374:14364` · `554:23257`.
|
||||
/// 푸시 정리를 **먼저** 한다. 보안 규칙이 `users/{uid}` 쓰기를 `isSelf(uid)` 로 막아,
|
||||
/// 로그아웃 뒤에는 이 기기 토큰을 지울 수 없다. 정리는 확인 버튼이 진행 중으로 바뀐
|
||||
/// 채 돌고, 실패하든 [_cleanupTimeout] 안에 끝나지 않든 로그아웃은 한다 — 토픽 해제 ·
|
||||
/// 토큰 쓰기가 응답 없이 멈추면 signOut 에 닿지 못해 첫 확인이 무시된 것처럼
|
||||
/// 보였다(10/6 실기기 2회).
|
||||
/// 토큰 제거는 signOut 전에 기다린다(내부 상한 2초) — 남으면 다음 사용자가 개인 알림을 받는다.
|
||||
/// 토픽 해지는 [PushMessaging] 이 들고 있다가 다음 로그인의 구독 전에 기다린다(10/6 실기기).
|
||||
Future<void> _logout() async {
|
||||
final l10n = context.l10n;
|
||||
final ok = await showConfirmDialog(
|
||||
context,
|
||||
l10n.settingsLogoutConfirm,
|
||||
confirmLabel: l10n.settingsLogout,
|
||||
onConfirm: () async {
|
||||
try {
|
||||
await widget.push?.clearOnSignOut().timeout(_cleanupTimeout);
|
||||
} on Object catch (error) {
|
||||
debugPrint('[Settings] push cleanup skipped: ${error.runtimeType}');
|
||||
}
|
||||
},
|
||||
);
|
||||
if (ok) await widget.auth?.signOut();
|
||||
if (!ok) return;
|
||||
await widget.push?.clearOnSignOut();
|
||||
await widget.auth?.signOut();
|
||||
}
|
||||
|
||||
/// 로그아웃 전 정리의 상한. 넘기면 정리를 두고 로그아웃한다.
|
||||
static const _cleanupTimeout = Duration(seconds: 3);
|
||||
|
||||
Future<bool> _confirm({
|
||||
required String title,
|
||||
String? body,
|
||||
|
||||
Reference in New Issue
Block a user