Figma 설명 프레임 반영 — 로그인·온보딩·스플래시 · HOME · GALAXY · 퀘스트·이클립스·알림
This commit is contained in:
@@ -27,9 +27,18 @@ class FeatureFlags extends ChangeNotifier {
|
||||
/// STATION 탭 노출 스위치. 문서의 `stationEnabled`(bool) 하나를 읽는다.
|
||||
static const String stationKey = 'stationEnabled';
|
||||
|
||||
/// 운영 중인 최신 앱 버전(문자열 `x.y.z`). 스플래시 업데이트 확인 — Figma `510:19053`
|
||||
/// 「앱 버전 정보 · 최신 버전 여부 확인 · 업데이트 안내 노출」. 로그인 전에 읽어야 해서
|
||||
/// 같은 공개 문서에 둔다. 값이 없으면 안내를 띄우지 않는다.
|
||||
static const String latestVersionKey = 'latestAppVersion';
|
||||
|
||||
StreamSubscription<Map<String, Object?>>? _subscription;
|
||||
|
||||
bool _stationTab = false;
|
||||
String? _latestVersion;
|
||||
|
||||
/// 운영 최신 버전. 문서에 없거나 문자열이 아니면 null.
|
||||
String? get latestVersion => _latestVersion;
|
||||
|
||||
/// 하단 탭에 STATION 을 그릴 것인가. 기본 false.
|
||||
bool get stationTab => _stationTab;
|
||||
@@ -37,8 +46,13 @@ class FeatureFlags extends ChangeNotifier {
|
||||
void _apply(Map<String, Object?> data) {
|
||||
// 타입까지 확인한다. 누가 문자열 "true" 를 넣어도 켜지지 않는다.
|
||||
final next = data[stationKey] == true;
|
||||
if (next == _stationTab) return;
|
||||
final latest = switch (data[latestVersionKey]) {
|
||||
final String v when v.trim().isNotEmpty => v.trim(),
|
||||
_ => null,
|
||||
};
|
||||
if (next == _stationTab && latest == _latestVersion) return;
|
||||
_stationTab = next;
|
||||
_latestVersion = latest;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
@@ -54,3 +68,21 @@ class FeatureFlags extends ChangeNotifier {
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/// [installed] 가 [latest] 보다 낮은가 — 점으로 나눈 숫자를 앞에서부터 비교한다(`0.5.0` < `0.10.0`).
|
||||
/// 빌드 번호(`+7`)와 숫자가 아닌 꼬리는 무시한다. 읽을 수 없는 값이면 false(안내하지 않음).
|
||||
bool isOlderVersion(String installed, String latest) {
|
||||
List<int>? parse(String v) {
|
||||
final parts = v.split('+').first.split('.');
|
||||
final nums = [for (final p in parts) int.tryParse(p.trim())];
|
||||
return nums.any((n) => n == null) ? null : nums.cast<int>();
|
||||
}
|
||||
|
||||
final a = parse(installed), b = parse(latest);
|
||||
if (a == null || b == null) return false;
|
||||
for (var i = 0; i < a.length || i < b.length; i++) {
|
||||
final x = i < a.length ? a[i] : 0, y = i < b.length ? b[i] : 0;
|
||||
if (x != y) return x < y;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user