f655adfbea
Migrate app code into canonical feature slices, add phone-only AI digest scheduling and review, wire local notification/background task support, and cover the flow with tests.
64 lines
2.0 KiB
Dart
64 lines
2.0 KiB
Dart
/// Application-level runtime configuration.
|
|
class AppConfig {
|
|
AppConfig._();
|
|
|
|
static const String _defaultBaseUrl = String.fromEnvironment(
|
|
'BACKEND_BASE_URL',
|
|
defaultValue: 'https://api.example.com',
|
|
);
|
|
|
|
static String? _baseUrlOverride;
|
|
|
|
static const String _defaultSentryDsn = String.fromEnvironment(
|
|
'SENTRY_DSN',
|
|
defaultValue: '',
|
|
);
|
|
|
|
/// Returns the configured backend base URL.
|
|
static String get backendBaseUrl {
|
|
final String? override = _baseUrlOverride;
|
|
if (override != null && override.trim().isNotEmpty) {
|
|
return override.trim();
|
|
}
|
|
return _defaultBaseUrl;
|
|
}
|
|
|
|
/// Enables fake backend implementation for local/offline development.
|
|
static bool get useFakeBackend =>
|
|
const bool.fromEnvironment('USE_FAKE_BACKEND', defaultValue: true);
|
|
|
|
/// Enables Hive local persistence store instead of shared_preferences.
|
|
static bool get useHiveLocalDb =>
|
|
const bool.fromEnvironment('USE_HIVE_LOCAL_DB', defaultValue: true);
|
|
|
|
/// Enables periodic startup/resume sync triggers while authenticated.
|
|
static bool get enableBackgroundSync =>
|
|
const bool.fromEnvironment('ENABLE_BACKGROUND_SYNC', defaultValue: true);
|
|
|
|
/// Enables local notifications runtime for reminder delivery.
|
|
static bool get enableLocalNotifications => const bool.fromEnvironment(
|
|
'ENABLE_LOCAL_NOTIFICATIONS',
|
|
defaultValue: true,
|
|
);
|
|
|
|
/// Enables inbound share-intake pipeline for WhatsApp text shares.
|
|
static bool get enableWhatsAppShareIntake => const bool.fromEnvironment(
|
|
'ENABLE_WHATSAPP_SHARE_INTAKE',
|
|
defaultValue: true,
|
|
);
|
|
|
|
/// Interval used for periodic background sync ticks.
|
|
static int get backgroundSyncIntervalSeconds => const int.fromEnvironment(
|
|
'BACKGROUND_SYNC_INTERVAL_SECONDS',
|
|
defaultValue: 180,
|
|
);
|
|
|
|
/// Optional Sentry DSN for release crash/error reporting.
|
|
static String get sentryDsn => _defaultSentryDsn.trim();
|
|
|
|
/// Runtime override for backend URL (e.g. local settings screen).
|
|
static void overrideBackendBaseUrl(String? baseUrl) {
|
|
_baseUrlOverride = baseUrl;
|
|
}
|
|
}
|