mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2026-05-19 04:40:32 -05:00
da85aedefb
Implement the missing Flutter data layer so release builds compile: Dio ApiClient for /api/v1 (timer, time entries, projects, tasks, finance, time-off, users/me), JSON models, Hive LocalStorage, and offline SyncService queue. Add OpenTelemetry (opentelemetry package) with initMobileOpenTelemetry() reading OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_EXPORTER_OTLP_TOKEN via --dart-define, matching server OTLP base URL and Basic auth behavior. Instrument login token validation, timer start/stop, and sync pending. Fix SyncUseCase to import storage SyncService, use trusted insecure hosts, and call syncAll(). GitHub Actions (build-mobile.yml, cd-release.yml): run flutter test; pass OTLP secrets into flutter build apk/appbundle/ios; switch iOS CI to release simulator builds and package build/ios/iphonesimulator/Runner.app to avoid requiring an Apple Development Team for generic device builds. .gitignore: allow tracking mobile/lib/data/ despite the repo-wide data/ ignore rule.
26 lines
646 B
Dart
26 lines
646 B
Dart
import 'package:flutter/foundation.dart';
|
|
|
|
@immutable
|
|
class UserPrefs {
|
|
final String dateFormatKey;
|
|
final String timeFormatKey;
|
|
final String timezone;
|
|
|
|
const UserPrefs({
|
|
this.dateFormatKey = 'YYYY-MM-DD',
|
|
this.timeFormatKey = '24h',
|
|
this.timezone = 'UTC',
|
|
});
|
|
|
|
factory UserPrefs.fromJson(Map<String, dynamic>? json) {
|
|
if (json == null || json.isEmpty) {
|
|
return const UserPrefs();
|
|
}
|
|
return UserPrefs(
|
|
dateFormatKey: (json['date_format'] ?? 'YYYY-MM-DD').toString(),
|
|
timeFormatKey: (json['time_format'] ?? '24h').toString(),
|
|
timezone: (json['timezone'] ?? 'UTC').toString(),
|
|
);
|
|
}
|
|
}
|