Files
TimeTracker/mobile/lib/data/models/user_prefs.dart
T
Dries Peeters da85aedefb feat(mobile): add data layer, OTLP telemetry, and CI build fixes
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.
2026-03-28 18:01:10 +01:00

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(),
);
}
}