mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-05-25 11:32:13 +00:00
38 lines
1.1 KiB
Dart
38 lines
1.1 KiB
Dart
import 'dart:async';
|
|
import 'package:camera/camera.dart';
|
|
import 'package:path_provider/path_provider.dart';
|
|
import 'package:twonly/src/utils/log.dart';
|
|
|
|
class AppEnvironment {
|
|
static late String cacheDir;
|
|
static late String supportDir;
|
|
|
|
static bool _isInitialized = false;
|
|
|
|
static bool _isInitialized = false;
|
|
|
|
// will be loaded in the main_camera_controller.dart
|
|
static List<CameraDescription> cameras = [];
|
|
|
|
static Future<void> init() async {
|
|
if (_isInitialized) return;
|
|
cacheDir = (await getApplicationCacheDirectory()).path;
|
|
supportDir = (await getApplicationSupportDirectory()).path;
|
|
Log.init();
|
|
_isInitialized = true;
|
|
}
|
|
|
|
static void initTesting({String? customCacheDir, String? customSupportDir}) {
|
|
cacheDir = customCacheDir ?? '/tmp/twonly_cache';
|
|
supportDir = customSupportDir ?? '/tmp/twonly_support';
|
|
_isInitialized = true;
|
|
}
|
|
}
|
|
|
|
class AppState {
|
|
static bool isAppInBackground = true;
|
|
static bool isInBackgroundTask = false;
|
|
static bool allowErrorTrackingViaSentry = false;
|
|
static bool gotMessageFromServer = false;
|
|
static int latestAppVersionId = 113;
|
|
}
|