Figma 설명 프레임 반영 — 로그인·온보딩·스플래시 · HOME · GALAXY · 퀘스트·이클립스·알림
This commit is contained in:
@@ -4,11 +4,14 @@ import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
|
||||
import 'core/config/feature_flags.dart' show isOlderVersion;
|
||||
import 'core/data/repositories.dart';
|
||||
import 'core/i18n/app_locale.dart';
|
||||
import 'core/ui/adaptive_planet_effects.dart';
|
||||
import 'core/push/push_messaging.dart';
|
||||
import 'core/ui/app_dialog.dart';
|
||||
import 'core/router/app_router.dart';
|
||||
import 'features/home/home_screen.dart' show homeRefreshSignal;
|
||||
import 'core/theme/app_theme.dart';
|
||||
@@ -123,9 +126,42 @@ class _FancakeAppState extends State<FancakeApp> with WidgetsBindingObserver {
|
||||
}
|
||||
}
|
||||
|
||||
/// 업데이트 확인을 마쳤는가 — 앱 실행당 한 번만 안내한다.
|
||||
bool _updateChecked = false;
|
||||
bool _updateChecking = false;
|
||||
|
||||
/// 스플래시 업데이트 확인 — Figma `510:19053` 「앱 버전 정보 · 최신 버전 여부 확인 ·
|
||||
/// 업데이트 안내 노출」. 최신 버전은 운영값 `config/features.latestAppVersion` 이고,
|
||||
/// 값이 없거나 설치 버전을 못 읽으면 안내하지 않는다.
|
||||
Future<void> _checkUpdate() async {
|
||||
final latest = _repos.flags.latestVersion;
|
||||
if (_updateChecked || _updateChecking || latest == null) return;
|
||||
_updateChecking = true;
|
||||
try {
|
||||
final installed = (await PackageInfo.fromPlatform()).version;
|
||||
_updateChecked = true;
|
||||
if (!isOlderVersion(installed, latest)) return;
|
||||
final context = _router.routerDelegate.navigatorKey.currentContext;
|
||||
if (context == null || !context.mounted) {
|
||||
_updateChecked = false; // 화면이 아직 없으면 다음 알림 때 다시 본다.
|
||||
return;
|
||||
}
|
||||
await showAlertDialog(
|
||||
context,
|
||||
context.l10n.updateAvailableTitle,
|
||||
body: context.l10n.updateAvailableBody(latest),
|
||||
);
|
||||
} catch (e) {
|
||||
debugPrint('[FancakeApp] update check: ${e.runtimeType}');
|
||||
} finally {
|
||||
_updateChecking = false;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_repos.flags.addListener(_checkUpdate);
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
widget.auth.addListener(_onAuthChanged);
|
||||
_onAuthChanged();
|
||||
@@ -133,6 +169,7 @@ class _FancakeAppState extends State<FancakeApp> with WidgetsBindingObserver {
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_repos.flags.removeListener(_checkUpdate);
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
_presence?.cancel();
|
||||
widget.auth.removeListener(_onAuthChanged);
|
||||
|
||||
Reference in New Issue
Block a user