Files
openchamber-android-native/lib/time_zone.dart
T
blumia b65498d73e feat: stats page, and the client becomes Chamber Go
- 全部功能 gains 统计 (Stats): ranges Today/7/30/90 days/all time, a
  project scope (reusing the shared project sheet, plus "All projects"),
  session/prompt/token/cost/active-days/streak tiles, a daily activity
  chart (weekly past 92 days), token composition, efficiency tiles, model
  ranking by tokens/cost/steps and on-request tool-call stats; data comes
  from /api/experimental/session/stats and the day buckets use the device's
  IANA zone (a small platform channel; desktop falls back to UTC)
- the model bars draw a full-width track with a left-aligned fill, so a
  small token share reads as a sliver instead of an empty bar
- AI token strings read 词元 (not 令牌) in Chinese
- the client's display name is Chamber Go (launcher, iOS, Linux window,
  About), package unchanged; pairing/login labels and the user-agent
  follow, so a newly paired device shows "Chamber Go" on the web client's
  "Connect to this server" list
- bump to 0.5.6
2026-11-26 17:18:09 +08:00

22 lines
789 B
Dart

// The device's IANA time zone, which the statistics API wants for bucketing
// days. Dart only exposes the abbreviation ("CST"), and Guava/ICU's zone id
// lives on the Android side; the desktop build has no zone plugin, so it
// falls back to UTC (the UI still works, only the day boundaries shift).
import 'package:flutter/services.dart';
const _channel = MethodChannel('openchamber/device');
String? _cached;
Future<String> deviceTimeZone() async {
final cached = _cached;
if (cached != null) return cached;
try {
final name = await _channel.invokeMethod<String>('ianaTimeZone');
if (name != null && name.isNotEmpty) return _cached = name;
} catch (_) {
// No handler (desktop) or a platform failure: UTC keeps the request valid.
}
return _cached = 'UTC';
}