퀘스트 제목 다국어 · HOME 다시 읽기 · 내 퀘스트 검토 중·반려됨 구분

This commit is contained in:
Sn-Kinos
2026-10-06 01:22:28 +09:00
parent cf3dd06774
commit 83d9c1e8d4
10 changed files with 139 additions and 26 deletions
+17
View File
@@ -169,6 +169,23 @@ extension SnapshotReader on Map<String, dynamic> {
return value is String && value.isNotEmpty ? value : fallback;
}
/// 다국어 필드 — 문자열이거나 언어별 지도(`{ko: …, en: …}`, 운영 Quest 제목 등).
/// 지도면 지금 앱 언어(`zh-CN` · `zh`) → ko → en → 아무 값 순으로 고른다.
String textOr(String key, [String fallback = '']) {
final value = this[key];
if (value is! Map) return strOr(key, fallback);
final map = Map<String, dynamic>.from(value);
final tag = appL10n.localeName.replaceAll('_', '-');
for (final k in [tag, tag.split('-').first, 'ko', 'en']) {
final v = map.strOr(k);
if (v.isNotEmpty) return v;
}
return map.values.whereType<String>().firstWhere(
(v) => v.isNotEmpty,
orElse: () => fallback,
);
}
bool boolOr(String key, [bool fallback = false]) {
final value = this[key];
return value is bool ? value : fallback;
+11 -5
View File
@@ -98,6 +98,7 @@ GoRouter buildRouter(AuthRepository auth, {Repositories? repositories}) {
final linker = repos.linker(auth.providers);
return GoRouter(
initialLocation: appTabs.first.path,
observers: [HomeRefreshObserver()],
refreshListenable: auth,
redirect: (context, state) {
final at = state.matchedLocation;
@@ -151,6 +152,7 @@ GoRouter buildRouter(AuthRepository auth, {Repositories? repositories}) {
builder: (_, _, shell) => AppShell(shell: shell, flags: repos.flags),
branches: [
StatefulShellBranch(
observers: [HomeRefreshObserver()],
routes: [
GoRoute(
path: appTabs[0].path,
@@ -259,11 +261,15 @@ class AppShell extends StatelessWidget {
child: NavigationBar(
// 숨긴 탭에 머무는 동안(딥링크 등)에는 선택 표시를 첫 탭으로 둔다.
selectedIndex: selected < 0 ? 0 : selected,
onDestinationSelected: (i) => shell.goBranch(
branches[i],
// initialLocation: true 를 주면 이미 열려 있는 탭을 다시 누를 때 루트로 되돌아간다.
initialLocation: branches[i] == shell.currentIndex,
),
onDestinationSelected: (i) {
// 다른 탭에서 HOME 으로 돌아오면 다시 읽는다(HOME 은 탭 전환으로 다시 만들어지지 않는다).
if (branches[i] == 0 && shell.currentIndex != 0) homeRefreshSignal.value++;
shell.goBranch(
branches[i],
// initialLocation: true 를 주면 이미 열려 있는 탭을 다시 누를 때 루트로 되돌아간다.
initialLocation: branches[i] == shell.currentIndex,
);
},
destinations: [
for (final tab in tabs)
NavigationDestination(