2025-03-16 23:06:38 +00:00
|
|
|
import 'package:camera/camera.dart';
|
2025-12-26 21:08:39 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2025-10-19 00:45:17 +00:00
|
|
|
import 'package:twonly/src/database/twonly.db.dart';
|
2025-10-22 22:35:28 +00:00
|
|
|
import 'package:twonly/src/model/json/userdata.dart';
|
2025-05-30 15:24:02 +00:00
|
|
|
import 'package:twonly/src/services/api.service.dart';
|
2025-11-06 17:40:22 +00:00
|
|
|
import 'package:twonly/src/services/subscription.service.dart';
|
2025-02-09 17:02:52 +00:00
|
|
|
|
2025-05-30 15:24:02 +00:00
|
|
|
late ApiService apiService;
|
2025-03-09 20:46:06 +00:00
|
|
|
|
|
|
|
|
// uses for background notification
|
2025-10-19 00:45:17 +00:00
|
|
|
late TwonlyDB twonlyDB;
|
2025-03-16 23:06:38 +00:00
|
|
|
|
|
|
|
|
List<CameraDescription> gCameras = <CameraDescription>[];
|
2025-06-19 08:22:16 +00:00
|
|
|
|
2025-10-22 22:35:28 +00:00
|
|
|
// Cached UserData in the memory. Every time the user data is changed the `updateUserdata` function is called,
|
|
|
|
|
// which will update this global variable. The variable is set in the main.dart and after the user has registered in the register.view.dart
|
|
|
|
|
late UserData gUser;
|
|
|
|
|
|
2025-06-19 08:22:16 +00:00
|
|
|
// The following global function can be called from anywhere to update
|
|
|
|
|
// the UI when something changed. The callbacks will be set by
|
|
|
|
|
// App widget.
|
|
|
|
|
|
|
|
|
|
// This callback called by the apiProvider
|
2025-07-14 22:38:23 +00:00
|
|
|
void Function({required bool isConnected}) globalCallbackConnectionState = ({
|
2026-02-12 22:04:17 +00:00
|
|
|
required isConnected,
|
2025-07-14 22:38:23 +00:00
|
|
|
}) {};
|
|
|
|
|
void Function() globalCallbackAppIsOutdated = () {};
|
2025-07-18 21:43:22 +00:00
|
|
|
void Function() globalCallbackNewDeviceRegistered = () {};
|
2026-02-12 22:04:17 +00:00
|
|
|
void Function(SubscriptionPlan plan) globalCallbackUpdatePlan = (plan) {};
|
2025-06-19 08:22:16 +00:00
|
|
|
|
2025-11-03 10:22:22 +00:00
|
|
|
Map<String, VoidCallback> globalUserDataChangedCallBack = {};
|
|
|
|
|
|
2025-06-19 08:22:16 +00:00
|
|
|
bool globalIsAppInBackground = true;
|
2026-03-14 14:05:10 +00:00
|
|
|
bool globalIsInBackgroundTask = false;
|
2025-11-09 23:04:44 +00:00
|
|
|
bool globalAllowErrorTrackingViaSentry = false;
|
2026-03-14 14:05:10 +00:00
|
|
|
bool globalGotMessageFromServer = false;
|
2025-11-18 21:56:42 +00:00
|
|
|
|
|
|
|
|
late String globalApplicationCacheDirectory;
|
|
|
|
|
late String globalApplicationSupportDirectory;
|
2025-12-26 21:08:39 +00:00
|
|
|
|
|
|
|
|
final GlobalKey<ScaffoldMessengerState> globalRootScaffoldMessengerKey =
|
|
|
|
|
GlobalKey<ScaffoldMessengerState>();
|