diff --git a/.gitignore b/.gitignore index 6c31954..002001c 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ .svn/ .swiftpm/ migrate_working_dir/ +android/ # IntelliJ related *.iml diff --git a/android/app/.cxx/RelWithDebInfo/6l395w5m/arm64-v8a/.cmake/api/v1/reply/index-2025-02-26T19-26-48-0182.json b/android/app/.cxx/RelWithDebInfo/6l395w5m/arm64-v8a/.cmake/api/v1/reply/index-2025-02-26T19-26-48-0182.json deleted file mode 100644 index ac8db9d..0000000 --- a/android/app/.cxx/RelWithDebInfo/6l395w5m/arm64-v8a/.cmake/api/v1/reply/index-2025-02-26T19-26-48-0182.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "cmake" : - { - "generator" : - { - "multiConfig" : false, - "name" : "Ninja" - }, - "paths" : - { - "cmake" : "/Users/svencarstensen/Library/Android/sdk/cmake/3.22.1/bin/cmake", - "cpack" : "/Users/svencarstensen/Library/Android/sdk/cmake/3.22.1/bin/cpack", - "ctest" : "/Users/svencarstensen/Library/Android/sdk/cmake/3.22.1/bin/ctest", - "root" : "/Users/svencarstensen/Library/Android/sdk/cmake/3.22.1/share/cmake-3.22" - }, - "version" : - { - "isDirty" : false, - "major" : 3, - "minor" : 22, - "patch" : 1, - "string" : "3.22.1-g37088a8", - "suffix" : "g37088a8" - } - }, - "objects" : - [ - { - "jsonFile" : "codemodel-v2-730fa8c91c7c6cba98c8.json", - "kind" : "codemodel", - "version" : - { - "major" : 2, - "minor" : 3 - } - }, - { - "jsonFile" : "cache-v2-d50372243c9a5f2816d1.json", - "kind" : "cache", - "version" : - { - "major" : 2, - "minor" : 0 - } - }, - { - "jsonFile" : "cmakeFiles-v1-dbb9ccb3b307022eb6d3.json", - "kind" : "cmakeFiles", - "version" : - { - "major" : 1, - "minor" : 0 - } - } - ], - "reply" : - { - "client-agp" : - { - "cache-v2" : - { - "jsonFile" : "cache-v2-d50372243c9a5f2816d1.json", - "kind" : "cache", - "version" : - { - "major" : 2, - "minor" : 0 - } - }, - "cmakeFiles-v1" : - { - "jsonFile" : "cmakeFiles-v1-dbb9ccb3b307022eb6d3.json", - "kind" : "cmakeFiles", - "version" : - { - "major" : 1, - "minor" : 0 - } - }, - "codemodel-v2" : - { - "jsonFile" : "codemodel-v2-730fa8c91c7c6cba98c8.json", - "kind" : "codemodel", - "version" : - { - "major" : 2, - "minor" : 3 - } - } - } - } -} diff --git a/android/app/.cxx/RelWithDebInfo/6l395w5m/arm64-v8a/CMakeFiles/3.22.1-g37088a8/CMakeSystem.cmake b/android/app/.cxx/RelWithDebInfo/6l395w5m/arm64-v8a/CMakeFiles/3.22.1-g37088a8/CMakeSystem.cmake deleted file mode 100644 index 45175f6..0000000 --- a/android/app/.cxx/RelWithDebInfo/6l395w5m/arm64-v8a/CMakeFiles/3.22.1-g37088a8/CMakeSystem.cmake +++ /dev/null @@ -1,15 +0,0 @@ -set(CMAKE_HOST_SYSTEM "Darwin-24.3.0") -set(CMAKE_HOST_SYSTEM_NAME "Darwin") -set(CMAKE_HOST_SYSTEM_VERSION "24.3.0") -set(CMAKE_HOST_SYSTEM_PROCESSOR "arm64") - -include("/Users/svencarstensen/Library/Android/sdk/ndk/26.3.11579264/build/cmake/android.toolchain.cmake") - -set(CMAKE_SYSTEM "Android-1") -set(CMAKE_SYSTEM_NAME "Android") -set(CMAKE_SYSTEM_VERSION "1") -set(CMAKE_SYSTEM_PROCESSOR "aarch64") - -set(CMAKE_CROSSCOMPILING "TRUE") - -set(CMAKE_SYSTEM_LOADED 1) diff --git a/android/app/.cxx/RelWithDebInfo/6l395w5m/armeabi-v7a/.cmake/api/v1/reply/index-2025-02-26T19-26-48-0462.json b/android/app/.cxx/RelWithDebInfo/6l395w5m/armeabi-v7a/.cmake/api/v1/reply/index-2025-02-26T19-26-48-0462.json deleted file mode 100644 index e9fb696..0000000 --- a/android/app/.cxx/RelWithDebInfo/6l395w5m/armeabi-v7a/.cmake/api/v1/reply/index-2025-02-26T19-26-48-0462.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "cmake" : - { - "generator" : - { - "multiConfig" : false, - "name" : "Ninja" - }, - "paths" : - { - "cmake" : "/Users/svencarstensen/Library/Android/sdk/cmake/3.22.1/bin/cmake", - "cpack" : "/Users/svencarstensen/Library/Android/sdk/cmake/3.22.1/bin/cpack", - "ctest" : "/Users/svencarstensen/Library/Android/sdk/cmake/3.22.1/bin/ctest", - "root" : "/Users/svencarstensen/Library/Android/sdk/cmake/3.22.1/share/cmake-3.22" - }, - "version" : - { - "isDirty" : false, - "major" : 3, - "minor" : 22, - "patch" : 1, - "string" : "3.22.1-g37088a8", - "suffix" : "g37088a8" - } - }, - "objects" : - [ - { - "jsonFile" : "codemodel-v2-e9db841d2091564beb48.json", - "kind" : "codemodel", - "version" : - { - "major" : 2, - "minor" : 3 - } - }, - { - "jsonFile" : "cache-v2-edf40734f3397fcbedfd.json", - "kind" : "cache", - "version" : - { - "major" : 2, - "minor" : 0 - } - }, - { - "jsonFile" : "cmakeFiles-v1-04f76f5d5179aa001dbe.json", - "kind" : "cmakeFiles", - "version" : - { - "major" : 1, - "minor" : 0 - } - } - ], - "reply" : - { - "client-agp" : - { - "cache-v2" : - { - "jsonFile" : "cache-v2-edf40734f3397fcbedfd.json", - "kind" : "cache", - "version" : - { - "major" : 2, - "minor" : 0 - } - }, - "cmakeFiles-v1" : - { - "jsonFile" : "cmakeFiles-v1-04f76f5d5179aa001dbe.json", - "kind" : "cmakeFiles", - "version" : - { - "major" : 1, - "minor" : 0 - } - }, - "codemodel-v2" : - { - "jsonFile" : "codemodel-v2-e9db841d2091564beb48.json", - "kind" : "codemodel", - "version" : - { - "major" : 2, - "minor" : 3 - } - } - } - } -} diff --git a/android/app/.cxx/RelWithDebInfo/6l395w5m/armeabi-v7a/CMakeFiles/3.22.1-g37088a8/CMakeSystem.cmake b/android/app/.cxx/RelWithDebInfo/6l395w5m/armeabi-v7a/CMakeFiles/3.22.1-g37088a8/CMakeSystem.cmake deleted file mode 100644 index 8709029..0000000 --- a/android/app/.cxx/RelWithDebInfo/6l395w5m/armeabi-v7a/CMakeFiles/3.22.1-g37088a8/CMakeSystem.cmake +++ /dev/null @@ -1,15 +0,0 @@ -set(CMAKE_HOST_SYSTEM "Darwin-24.3.0") -set(CMAKE_HOST_SYSTEM_NAME "Darwin") -set(CMAKE_HOST_SYSTEM_VERSION "24.3.0") -set(CMAKE_HOST_SYSTEM_PROCESSOR "arm64") - -include("/Users/svencarstensen/Library/Android/sdk/ndk/26.3.11579264/build/cmake/android.toolchain.cmake") - -set(CMAKE_SYSTEM "Android-1") -set(CMAKE_SYSTEM_NAME "Android") -set(CMAKE_SYSTEM_VERSION "1") -set(CMAKE_SYSTEM_PROCESSOR "armv7-a") - -set(CMAKE_CROSSCOMPILING "TRUE") - -set(CMAKE_SYSTEM_LOADED 1) diff --git a/android/app/.cxx/RelWithDebInfo/6l395w5m/x86/.cmake/api/v1/reply/index-2025-02-26T19-26-48-0714.json b/android/app/.cxx/RelWithDebInfo/6l395w5m/x86/.cmake/api/v1/reply/index-2025-02-26T19-26-48-0714.json deleted file mode 100644 index 4600582..0000000 --- a/android/app/.cxx/RelWithDebInfo/6l395w5m/x86/.cmake/api/v1/reply/index-2025-02-26T19-26-48-0714.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "cmake" : - { - "generator" : - { - "multiConfig" : false, - "name" : "Ninja" - }, - "paths" : - { - "cmake" : "/Users/svencarstensen/Library/Android/sdk/cmake/3.22.1/bin/cmake", - "cpack" : "/Users/svencarstensen/Library/Android/sdk/cmake/3.22.1/bin/cpack", - "ctest" : "/Users/svencarstensen/Library/Android/sdk/cmake/3.22.1/bin/ctest", - "root" : "/Users/svencarstensen/Library/Android/sdk/cmake/3.22.1/share/cmake-3.22" - }, - "version" : - { - "isDirty" : false, - "major" : 3, - "minor" : 22, - "patch" : 1, - "string" : "3.22.1-g37088a8", - "suffix" : "g37088a8" - } - }, - "objects" : - [ - { - "jsonFile" : "codemodel-v2-67b951521e487f9d6811.json", - "kind" : "codemodel", - "version" : - { - "major" : 2, - "minor" : 3 - } - }, - { - "jsonFile" : "cache-v2-42ad4ed1b8ed2282a7f0.json", - "kind" : "cache", - "version" : - { - "major" : 2, - "minor" : 0 - } - }, - { - "jsonFile" : "cmakeFiles-v1-946cac3c916784c772b9.json", - "kind" : "cmakeFiles", - "version" : - { - "major" : 1, - "minor" : 0 - } - } - ], - "reply" : - { - "client-agp" : - { - "cache-v2" : - { - "jsonFile" : "cache-v2-42ad4ed1b8ed2282a7f0.json", - "kind" : "cache", - "version" : - { - "major" : 2, - "minor" : 0 - } - }, - "cmakeFiles-v1" : - { - "jsonFile" : "cmakeFiles-v1-946cac3c916784c772b9.json", - "kind" : "cmakeFiles", - "version" : - { - "major" : 1, - "minor" : 0 - } - }, - "codemodel-v2" : - { - "jsonFile" : "codemodel-v2-67b951521e487f9d6811.json", - "kind" : "codemodel", - "version" : - { - "major" : 2, - "minor" : 3 - } - } - } - } -} diff --git a/android/app/.cxx/RelWithDebInfo/6l395w5m/x86/CMakeFiles/3.22.1-g37088a8/CMakeSystem.cmake b/android/app/.cxx/RelWithDebInfo/6l395w5m/x86/CMakeFiles/3.22.1-g37088a8/CMakeSystem.cmake deleted file mode 100644 index 23c0010..0000000 --- a/android/app/.cxx/RelWithDebInfo/6l395w5m/x86/CMakeFiles/3.22.1-g37088a8/CMakeSystem.cmake +++ /dev/null @@ -1,15 +0,0 @@ -set(CMAKE_HOST_SYSTEM "Darwin-24.3.0") -set(CMAKE_HOST_SYSTEM_NAME "Darwin") -set(CMAKE_HOST_SYSTEM_VERSION "24.3.0") -set(CMAKE_HOST_SYSTEM_PROCESSOR "arm64") - -include("/Users/svencarstensen/Library/Android/sdk/ndk/26.3.11579264/build/cmake/android.toolchain.cmake") - -set(CMAKE_SYSTEM "Android-1") -set(CMAKE_SYSTEM_NAME "Android") -set(CMAKE_SYSTEM_VERSION "1") -set(CMAKE_SYSTEM_PROCESSOR "i686") - -set(CMAKE_CROSSCOMPILING "TRUE") - -set(CMAKE_SYSTEM_LOADED 1) diff --git a/android/app/.cxx/RelWithDebInfo/6l395w5m/x86_64/.cmake/api/v1/reply/index-2025-02-26T19-26-49-0857.json b/android/app/.cxx/RelWithDebInfo/6l395w5m/x86_64/.cmake/api/v1/reply/index-2025-02-26T19-26-49-0857.json deleted file mode 100644 index d892624..0000000 --- a/android/app/.cxx/RelWithDebInfo/6l395w5m/x86_64/.cmake/api/v1/reply/index-2025-02-26T19-26-49-0857.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "cmake" : - { - "generator" : - { - "multiConfig" : false, - "name" : "Ninja" - }, - "paths" : - { - "cmake" : "/Users/svencarstensen/Library/Android/sdk/cmake/3.22.1/bin/cmake", - "cpack" : "/Users/svencarstensen/Library/Android/sdk/cmake/3.22.1/bin/cpack", - "ctest" : "/Users/svencarstensen/Library/Android/sdk/cmake/3.22.1/bin/ctest", - "root" : "/Users/svencarstensen/Library/Android/sdk/cmake/3.22.1/share/cmake-3.22" - }, - "version" : - { - "isDirty" : false, - "major" : 3, - "minor" : 22, - "patch" : 1, - "string" : "3.22.1-g37088a8", - "suffix" : "g37088a8" - } - }, - "objects" : - [ - { - "jsonFile" : "codemodel-v2-5a374c9561e5f4c57936.json", - "kind" : "codemodel", - "version" : - { - "major" : 2, - "minor" : 3 - } - }, - { - "jsonFile" : "cache-v2-434c6c8119615dd6fa39.json", - "kind" : "cache", - "version" : - { - "major" : 2, - "minor" : 0 - } - }, - { - "jsonFile" : "cmakeFiles-v1-04e39d9239cb8595d767.json", - "kind" : "cmakeFiles", - "version" : - { - "major" : 1, - "minor" : 0 - } - } - ], - "reply" : - { - "client-agp" : - { - "cache-v2" : - { - "jsonFile" : "cache-v2-434c6c8119615dd6fa39.json", - "kind" : "cache", - "version" : - { - "major" : 2, - "minor" : 0 - } - }, - "cmakeFiles-v1" : - { - "jsonFile" : "cmakeFiles-v1-04e39d9239cb8595d767.json", - "kind" : "cmakeFiles", - "version" : - { - "major" : 1, - "minor" : 0 - } - }, - "codemodel-v2" : - { - "jsonFile" : "codemodel-v2-5a374c9561e5f4c57936.json", - "kind" : "codemodel", - "version" : - { - "major" : 2, - "minor" : 3 - } - } - } - } -} diff --git a/android/app/.cxx/RelWithDebInfo/6l395w5m/x86_64/CMakeFiles/3.22.1-g37088a8/CMakeSystem.cmake b/android/app/.cxx/RelWithDebInfo/6l395w5m/x86_64/CMakeFiles/3.22.1-g37088a8/CMakeSystem.cmake deleted file mode 100644 index f5c04d6..0000000 --- a/android/app/.cxx/RelWithDebInfo/6l395w5m/x86_64/CMakeFiles/3.22.1-g37088a8/CMakeSystem.cmake +++ /dev/null @@ -1,15 +0,0 @@ -set(CMAKE_HOST_SYSTEM "Darwin-24.3.0") -set(CMAKE_HOST_SYSTEM_NAME "Darwin") -set(CMAKE_HOST_SYSTEM_VERSION "24.3.0") -set(CMAKE_HOST_SYSTEM_PROCESSOR "arm64") - -include("/Users/svencarstensen/Library/Android/sdk/ndk/26.3.11579264/build/cmake/android.toolchain.cmake") - -set(CMAKE_SYSTEM "Android-1") -set(CMAKE_SYSTEM_NAME "Android") -set(CMAKE_SYSTEM_VERSION "1") -set(CMAKE_SYSTEM_PROCESSOR "x86_64") - -set(CMAKE_CROSSCOMPILING "TRUE") - -set(CMAKE_SYSTEM_LOADED 1) diff --git a/lib/content_views/approach_area_page.dart b/lib/content_views/approach_area_page.dart index 4d77dae..d9b8cce 100644 --- a/lib/content_views/approach_area_page.dart +++ b/lib/content_views/approach_area_page.dart @@ -195,7 +195,7 @@ class _ApproachAreaPageState extends State with ProducerMixin, if (position != null) { setPosMessage.track = ZipTrack(); - setPosMessage.track!.time = DateTime.now().toIso8601String(); + setPosMessage.track!.time = Util.toUnixMillisUtc(DateTime.now()); setPosMessage.track!.pos = ZipTrackPos(); setPosMessage.track!.pos!.lat = position.latitude; setPosMessage.track!.pos!.long = position.longitude; diff --git a/lib/content_views/assigned_jobs_page.dart b/lib/content_views/assigned_jobs_page.dart index 4cfd520..9790125 100644 --- a/lib/content_views/assigned_jobs_page.dart +++ b/lib/content_views/assigned_jobs_page.dart @@ -231,7 +231,7 @@ class _AssignedJobsPageState extends State with ProducerMixin, message.ver = job.ver.toString(); message.item = item; message.track = Track(); - message.track.time = DateTime.now().toUtc().toIso8601String(); + message.track.time = Util.toUnixMillisUtc(DateTime.now().toUtc()); message.track.pos = FinTaskPos(); message.track.pos!.lat = currentPosition != null ? currentPosition.latitude : 0.0; message.track.pos!.long = currentPosition != null ? currentPosition.longitude : 0.0; diff --git a/lib/content_views/main_page.dart b/lib/content_views/main_page.dart index 168796f..d0569bb 100644 --- a/lib/content_views/main_page.dart +++ b/lib/content_views/main_page.dart @@ -420,7 +420,7 @@ class _MainPageState extends State with ConsumerMixin, ProducerMixin { var logoutMessage = LogoutMessage(); if (position != null) { logoutMessage.pos = LogoutMessagePosition(); - logoutMessage.pos!.time = position.timestamp.toIso8601String(); + logoutMessage.pos!.time = Util.toUnixMillisUtc(position.timestamp); logoutMessage.pos!.lat = position.latitude; logoutMessage.pos!.long = position.longitude; logoutMessage.pos!.acc = position.accuracy.toInt(); diff --git a/lib/content_views/messages_page.dart b/lib/content_views/messages_page.dart index 4434738..0a26714 100644 --- a/lib/content_views/messages_page.dart +++ b/lib/content_views/messages_page.dart @@ -93,7 +93,7 @@ class _MessagesPageState extends State with ProducerMixin { message.text = text.text; message.from = _sid; message.subj = ''; - message.time = now.toUtc().toIso8601String(); + message.time = Util.toUnixMillisUtc(now.toUtc()); message.read = true; message.id = await sbmessage.ChatMessage.getNextId(); @@ -128,8 +128,7 @@ class _MessagesPageState extends State with ProducerMixin { for (var message in messages) { _messages.add(types.TextMessage( author: message.from == _sid ? _user : _central, - createdAt: - DateTime.parse(message.time).toLocal().millisecondsSinceEpoch, + createdAt: message.time * 1000, id: message.id.toString(), text: "${message.subj}\n${message.text}", )); @@ -215,7 +214,7 @@ class _MessagesPageState extends State with ProducerMixin { var chatMessagesShowed = ChatMessagesReceived(); chatMessagesShowed.ids = chatMessageIds; - chatMessagesShowed.time = DateTime.now().toUtc().toIso8601String(); + chatMessagesShowed.time = Util.toUnixMillisUtc(DateTime.now().toUtc()); sendMessage( routingKey: Constants.messageTopicPublishPayload, diff --git a/lib/content_views/task_list_page.dart b/lib/content_views/task_list_page.dart index 3de6b29..173e440 100644 --- a/lib/content_views/task_list_page.dart +++ b/lib/content_views/task_list_page.dart @@ -400,10 +400,9 @@ class _TaskListPageState extends State with ProducerMixin { void _processPickupDeliveryStatusTask(TaskInfo taskInfo) { Util.logInfo('Task ${taskInfo.task.sId} called'); - final currentContext = context; Future.delayed(const Duration(seconds: 1), () async { - if (!mounted) return; - showPickupDeliveryStatusPopup(currentContext, taskInfo, (tourEntry, remark) async { + if (!context.mounted) return; + showPickupDeliveryStatusPopup(MyApp.appNavigatorKey.currentContext!, taskInfo, (tourEntry, remark) async { var answer = await _createAnswerHeader(taskInfo); answer.code = tourEntry!.code; answer.val = remark; @@ -428,10 +427,9 @@ class _TaskListPageState extends State with ProducerMixin { SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft]); - final currentContext = context; Future.delayed(const Duration(seconds: 1), () async { - if (!mounted) return; - showSignaturePopup(currentContext, taskInfo, (String? signature) async { + if (!context.mounted) return; + showSignaturePopup(MyApp.appNavigatorKey.currentContext!, taskInfo, (String? signature) async { MyApp.suppressAcceptDialog = false; SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); @@ -491,12 +489,12 @@ class _TaskListPageState extends State with ProducerMixin { message.trId = widget.tour.id; message.task = Task(); message.task.sId = taskInfo.task.sId; - message.task.time = DateTime.now().toIso8601String(); + message.task.time = Util.toUnixMillisUtc(DateTime.now().toUtc()); var position = await MyApp.getCurrentPosition(); if (position != null) { message.task.pos = FinTaskPos(); - message.task.pos!.time = DateTime.now().toIso8601String(); + message.task.pos!.time = Util.toUnixMillisUtc(position.timestamp); message.task.pos!.lat = position.latitude; message.task.pos!.long = position.longitude; } else { @@ -514,9 +512,10 @@ class _TaskListPageState extends State with ProducerMixin { var finTourTask = FinTourTask(); finTourTask.sId = taskInfo.task.sId; - finTourTask.time = DateTime.now().toIso8601String(); + finTourTask.time = Util.toUnixMillisUtc(DateTime.now().toUtc()); if (position != null) { finTourTask.pos = FinTaskPos(); + finTourTask.pos!.time = Util.toUnixMillisUtc(position.timestamp); finTourTask.pos!.lat = position.latitude; finTourTask.pos!.long = position.longitude; finTourTask.pos!.acc = position.accuracy.toInt(); @@ -535,7 +534,7 @@ class _TaskListPageState extends State with ProducerMixin { var position = await MyApp.getCurrentPosition(); if (position != null) { finTourMessage.track = Track(); - finTourMessage.track!.time = DateTime.now().toIso8601String(); + finTourMessage.track!.time = Util.toUnixMillisUtc(DateTime.now().toUtc()); finTourMessage.track!.pos = FinTaskPos(); finTourMessage.track!.pos!.lat = position.latitude; finTourMessage.track!.pos!.long = position.longitude; diff --git a/lib/main.dart b/lib/main.dart index 6290194..9f26e48 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -426,7 +426,6 @@ class _MainState extends State
with SingleTickerProviderStateMixin, Produc } void _replaceContentView(ContentViewWidget widget) async { - final currentContext = context; Future.delayed(const Duration(seconds: 0), () async { contentStack.clear(); @@ -436,9 +435,8 @@ class _MainState extends State
with SingleTickerProviderStateMixin, Produc }); } - if (mounted) { - _currentTitleWidget = await _currentContent.getHeaderWidget(currentContext); - } + if (!context.mounted) return; + _currentTitleWidget = await _currentContent.getHeaderWidget(MyApp.appNavigatorKey.currentContext!); if (mounted) { setState(() {}); @@ -447,7 +445,6 @@ class _MainState extends State
with SingleTickerProviderStateMixin, Produc } void _popContentView(int count) { - final currentContext = context; Future.delayed(const Duration(seconds: 0), () async { for (int i = 0; i < count - 1; i++) { contentStack.pop(); @@ -457,9 +454,8 @@ class _MainState extends State
with SingleTickerProviderStateMixin, Produc _currentContent = previousContentView; - if (mounted) { - _currentTitleWidget = await _currentContent.getHeaderWidget(currentContext); - } + if (!context.mounted) return; + _currentTitleWidget = await _currentContent.getHeaderWidget(MyApp.appNavigatorKey.currentContext!); if (mounted) { setState(() {}); @@ -468,15 +464,13 @@ class _MainState extends State
with SingleTickerProviderStateMixin, Produc } void _pushContentView(ContentViewWidget widget) { - final currentContext = context; Future.delayed(const Duration(seconds: 0), () async { contentStack.push(_currentContent); _currentContent = widget; - if (mounted) { - _currentTitleWidget = await _currentContent.getHeaderWidget(currentContext); - } + if (!context.mounted) return; + _currentTitleWidget = await _currentContent.getHeaderWidget(MyApp.appNavigatorKey.currentContext!); if (mounted) { setState(() {}); diff --git a/lib/model/chat_message.dart b/lib/model/chat_message.dart index 2ff8483..170c209 100644 --- a/lib/model/chat_message.dart +++ b/lib/model/chat_message.dart @@ -10,7 +10,7 @@ part 'chat_message.g.dart'; class ChatMessage { late Id id; - late String time; + late int time; late String from; diff --git a/lib/model/chat_message.g.dart b/lib/model/chat_message.g.dart index 71ca1a3..4955cf1 100644 --- a/lib/model/chat_message.g.dart +++ b/lib/model/chat_message.g.dart @@ -40,7 +40,7 @@ const ChatMessageSchema = CollectionSchema( r'time': PropertySchema( id: 4, name: r'time', - type: IsarType.string, + type: IsarType.long, ) }, estimateSize: _chatMessageEstimateSize, @@ -66,7 +66,6 @@ int _chatMessageEstimateSize( bytesCount += 3 + object.from.length * 3; bytesCount += 3 + object.subj.length * 3; bytesCount += 3 + object.text.length * 3; - bytesCount += 3 + object.time.length * 3; return bytesCount; } @@ -80,7 +79,7 @@ void _chatMessageSerialize( writer.writeBool(offsets[1], object.read); writer.writeString(offsets[2], object.subj); writer.writeString(offsets[3], object.text); - writer.writeString(offsets[4], object.time); + writer.writeLong(offsets[4], object.time); } ChatMessage _chatMessageDeserialize( @@ -95,7 +94,7 @@ ChatMessage _chatMessageDeserialize( object.read = reader.readBoolOrNull(offsets[1]); object.subj = reader.readString(offsets[2]); object.text = reader.readString(offsets[3]); - object.time = reader.readString(offsets[4]); + object.time = reader.readLong(offsets[4]); return object; } @@ -115,7 +114,7 @@ P _chatMessageDeserializeProp

( case 3: return (reader.readString(offset)) as P; case 4: - return (reader.readString(offset)) as P; + return (reader.readLong(offset)) as P; default: throw IsarError('Unknown property with id $propertyId'); } @@ -688,54 +687,46 @@ extension ChatMessageQueryFilter } QueryBuilder timeEqualTo( - String value, { - bool caseSensitive = true, - }) { + int value) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( property: r'time', value: value, - caseSensitive: caseSensitive, )); }); } QueryBuilder timeGreaterThan( - String value, { + int value, { bool include = false, - bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, property: r'time', value: value, - caseSensitive: caseSensitive, )); }); } QueryBuilder timeLessThan( - String value, { + int value, { bool include = false, - bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, property: r'time', value: value, - caseSensitive: caseSensitive, )); }); } QueryBuilder timeBetween( - String lower, - String upper, { + int lower, + int upper, { bool includeLower = true, bool includeUpper = true, - bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( @@ -744,76 +735,6 @@ extension ChatMessageQueryFilter includeLower: includeLower, upper: upper, includeUpper: includeUpper, - caseSensitive: caseSensitive, - )); - }); - } - - QueryBuilder timeStartsWith( - String value, { - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.startsWith( - property: r'time', - value: value, - caseSensitive: caseSensitive, - )); - }); - } - - QueryBuilder timeEndsWith( - String value, { - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.endsWith( - property: r'time', - value: value, - caseSensitive: caseSensitive, - )); - }); - } - - QueryBuilder timeContains( - String value, - {bool caseSensitive = true}) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.contains( - property: r'time', - value: value, - caseSensitive: caseSensitive, - )); - }); - } - - QueryBuilder timeMatches( - String pattern, - {bool caseSensitive = true}) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.matches( - property: r'time', - wildcard: pattern, - caseSensitive: caseSensitive, - )); - }); - } - - QueryBuilder timeIsEmpty() { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.equalTo( - property: r'time', - value: '', - )); - }); - } - - QueryBuilder - timeIsNotEmpty() { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.greaterThan( - property: r'time', - value: '', )); }); } @@ -992,10 +913,9 @@ extension ChatMessageQueryWhereDistinct }); } - QueryBuilder distinctByTime( - {bool caseSensitive = true}) { + QueryBuilder distinctByTime() { return QueryBuilder.apply(this, (query) { - return query.addDistinctBy(r'time', caseSensitive: caseSensitive); + return query.addDistinctBy(r'time'); }); } } @@ -1032,7 +952,7 @@ extension ChatMessageQueryProperty }); } - QueryBuilder timeProperty() { + QueryBuilder timeProperty() { return QueryBuilder.apply(this, (query) { return query.addPropertyName(r'time'); }); @@ -1045,7 +965,7 @@ extension ChatMessageQueryProperty ChatMessage _$ChatMessageFromJson(Map json) => ChatMessage() ..id = (json['id'] as num).toInt() - ..time = json['time'] as String + ..time = (json['time'] as num).toInt() ..from = json['from'] as String ..subj = json['subj'] as String ..text = json['text'] as String diff --git a/lib/network_messages/accept_job_message.dart b/lib/network_messages/accept_job_message.dart index 410cac3..a3c57e7 100644 --- a/lib/network_messages/accept_job_message.dart +++ b/lib/network_messages/accept_job_message.dart @@ -19,7 +19,7 @@ class Reaction { @JsonSerializable() @JsonSerializable()class Track { - late String time; + late int time; FinTaskPos? pos; diff --git a/lib/network_messages/accept_job_message.g.dart b/lib/network_messages/accept_job_message.g.dart index c36d16e..a24ea09 100644 --- a/lib/network_messages/accept_job_message.g.dart +++ b/lib/network_messages/accept_job_message.g.dart @@ -20,7 +20,7 @@ Map _$ReactionToJson(Reaction instance) => { }; Track _$TrackFromJson(Map json) => Track() - ..time = json['time'] as String + ..time = (json['time'] as num).toInt() ..pos = json['pos'] == null ? null : FinTaskPos.fromJson(json['pos'] as Map); diff --git a/lib/network_messages/chat_message.dart b/lib/network_messages/chat_message.dart index fb691cd..fccb4d7 100644 --- a/lib/network_messages/chat_message.dart +++ b/lib/network_messages/chat_message.dart @@ -20,7 +20,7 @@ class MessageContent late String subj; - late String time; + late int time; MessageContent(); diff --git a/lib/network_messages/chat_message.g.dart b/lib/network_messages/chat_message.g.dart index 5b4bde9..67a2fcd 100644 --- a/lib/network_messages/chat_message.g.dart +++ b/lib/network_messages/chat_message.g.dart @@ -18,7 +18,7 @@ MessageContent _$MessageContentFromJson(Map json) => MessageContent() ..text = json['text'] as String ..subj = json['subj'] as String - ..time = json['time'] as String; + ..time = (json['time'] as num).toInt(); Map _$MessageContentToJson(MessageContent instance) => { diff --git a/lib/network_messages/fin_task_message.dart b/lib/network_messages/fin_task_message.dart index f960a6c..7f83537 100644 --- a/lib/network_messages/fin_task_message.dart +++ b/lib/network_messages/fin_task_message.dart @@ -33,7 +33,7 @@ class Task { @JsonKey(name: 's_id') late int sId; - late String time; + late int time; FinTaskPos? pos; @@ -47,7 +47,7 @@ class Task { @embedded @JsonSerializable() class FinTaskPos { - late String time; + late int time; late double lat; diff --git a/lib/network_messages/fin_task_message.g.dart b/lib/network_messages/fin_task_message.g.dart index bf4e18a..32e20b8 100644 --- a/lib/network_messages/fin_task_message.g.dart +++ b/lib/network_messages/fin_task_message.g.dart @@ -27,6 +27,11 @@ const FinTaskPosSchema = Schema( id: 2, name: r'long', type: IsarType.double, + ), + r'time': PropertySchema( + id: 3, + name: r'time', + type: IsarType.long, ) }, estimateSize: _finTaskPosEstimateSize, @@ -53,6 +58,7 @@ void _finTaskPosSerialize( writer.writeLong(offsets[0], object.acc); writer.writeDouble(offsets[1], object.lat); writer.writeDouble(offsets[2], object.long); + writer.writeLong(offsets[3], object.time); } FinTaskPos _finTaskPosDeserialize( @@ -65,6 +71,7 @@ FinTaskPos _finTaskPosDeserialize( object.acc = reader.readLong(offsets[0]); object.lat = reader.readDouble(offsets[1]); object.long = reader.readDouble(offsets[2]); + object.time = reader.readLong(offsets[3]); return object; } @@ -81,6 +88,8 @@ P _finTaskPosDeserializeProp

( return (reader.readDouble(offset)) as P; case 2: return (reader.readDouble(offset)) as P; + case 3: + return (reader.readLong(offset)) as P; default: throw IsarError('Unknown property with id $propertyId'); } @@ -264,6 +273,59 @@ extension FinTaskPosQueryFilter )); }); } + + QueryBuilder timeEqualTo( + int value) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'time', + value: value, + )); + }); + } + + QueryBuilder timeGreaterThan( + int value, { + bool include = false, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'time', + value: value, + )); + }); + } + + QueryBuilder timeLessThan( + int value, { + bool include = false, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'time', + value: value, + )); + }); + } + + QueryBuilder timeBetween( + int lower, + int upper, { + bool includeLower = true, + bool includeUpper = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'time', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + )); + }); + } } extension FinTaskPosQueryObject @@ -293,7 +355,7 @@ Map _$FinTaskToJson(FinTask instance) => { Task _$TaskFromJson(Map json) => Task() ..sId = (json['s_id'] as num).toInt() - ..time = json['time'] as String + ..time = (json['time'] as num).toInt() ..pos = json['pos'] == null ? null : FinTaskPos.fromJson(json['pos'] as Map); @@ -305,12 +367,14 @@ Map _$TaskToJson(Task instance) => { }; FinTaskPos _$FinTaskPosFromJson(Map json) => FinTaskPos() + ..time = (json['time'] as num).toInt() ..lat = (json['lat'] as num).toDouble() ..long = (json['long'] as num).toDouble() ..acc = (json['acc'] as num).toInt(); Map _$FinTaskPosToJson(FinTaskPos instance) => { + 'time': instance.time, 'lat': instance.lat, 'long': instance.long, 'acc': instance.acc, diff --git a/lib/network_messages/fin_tour_message.dart b/lib/network_messages/fin_tour_message.dart index 05a9195..1ff0e35 100644 --- a/lib/network_messages/fin_tour_message.dart +++ b/lib/network_messages/fin_tour_message.dart @@ -39,7 +39,7 @@ class FinTourTask { @JsonKey(name: 's_id') late int sId; - late String time; + late int time; String? val; diff --git a/lib/network_messages/fin_tour_message.g.dart b/lib/network_messages/fin_tour_message.g.dart index 52cb605..f881f53 100644 --- a/lib/network_messages/fin_tour_message.g.dart +++ b/lib/network_messages/fin_tour_message.g.dart @@ -34,7 +34,7 @@ Map _$FinTourToJson(FinTour instance) => { FinTourTask _$FinTourTaskFromJson(Map json) => FinTourTask() ..sId = (json['s_id'] as num).toInt() - ..time = json['time'] as String + ..time = (json['time'] as num).toInt() ..val = json['val'] as String? ..code = (json['code'] as num?)?.toInt() ..sign = json['sign'] as String? diff --git a/lib/network_messages/logout_message.dart b/lib/network_messages/logout_message.dart index 251bbdf..053f9bf 100644 --- a/lib/network_messages/logout_message.dart +++ b/lib/network_messages/logout_message.dart @@ -15,7 +15,7 @@ class LogoutMessage { @JsonSerializable() class LogoutMessagePosition { - late String time; + late int time; late double lat; diff --git a/lib/network_messages/logout_message.g.dart b/lib/network_messages/logout_message.g.dart index 103d690..5af1416 100644 --- a/lib/network_messages/logout_message.g.dart +++ b/lib/network_messages/logout_message.g.dart @@ -20,7 +20,7 @@ Map _$LogoutMessageToJson(LogoutMessage instance) => LogoutMessagePosition _$LogoutMessagePositionFromJson( Map json) => LogoutMessagePosition() - ..time = json['time'] as String + ..time = (json['time'] as num).toInt() ..lat = (json['lat'] as num).toDouble() ..long = (json['long'] as num).toDouble() ..acc = (json['acc'] as num).toInt(); diff --git a/lib/network_messages/messages_showed.dart b/lib/network_messages/messages_showed.dart index 9e07fe2..731cb6b 100644 --- a/lib/network_messages/messages_showed.dart +++ b/lib/network_messages/messages_showed.dart @@ -6,7 +6,7 @@ part 'messages_showed.g.dart'; class ChatMessagesReceived { late List ids; - late String time; + late int time; ChatMessagesReceived(); diff --git a/lib/network_messages/messages_showed.g.dart b/lib/network_messages/messages_showed.g.dart index 144c588..3c7b25b 100644 --- a/lib/network_messages/messages_showed.g.dart +++ b/lib/network_messages/messages_showed.g.dart @@ -10,7 +10,7 @@ ChatMessagesReceived _$ChatMessagesReceivedFromJson( Map json) => ChatMessagesReceived() ..ids = (json['ids'] as List).map((e) => e as String).toList() - ..time = json['time'] as String; + ..time = (json['time'] as num).toInt(); Map _$ChatMessagesReceivedToJson( ChatMessagesReceived instance) => diff --git a/lib/network_messages/sync_jobs_message.dart b/lib/network_messages/sync_jobs_message.dart index 1ac9caf..477f3e3 100644 --- a/lib/network_messages/sync_jobs_message.dart +++ b/lib/network_messages/sync_jobs_message.dart @@ -46,7 +46,7 @@ class SyncJobMessageJob { @JsonSerializable() class SyncMessagePos { - late String time; + late int time; late double lat; diff --git a/lib/network_messages/sync_jobs_message.g.dart b/lib/network_messages/sync_jobs_message.g.dart index 6ecc957..85df54a 100644 --- a/lib/network_messages/sync_jobs_message.g.dart +++ b/lib/network_messages/sync_jobs_message.g.dart @@ -48,12 +48,14 @@ Map _$SyncJobMessageJobToJson(SyncJobMessageJob instance) => SyncMessagePos _$SyncMessagePosFromJson(Map json) => SyncMessagePos() + ..time = (json['time'] as num).toInt() ..lat = (json['lat'] as num).toDouble() ..long = (json['long'] as num).toDouble() ..acc = (json['acc'] as num).toInt(); Map _$SyncMessagePosToJson(SyncMessagePos instance) => { + 'time': instance.time, 'lat': instance.lat, 'long': instance.long, 'acc': instance.acc, diff --git a/lib/network_messages/track_message.dart b/lib/network_messages/track_message.dart index ef465a3..b0d6234 100644 --- a/lib/network_messages/track_message.dart +++ b/lib/network_messages/track_message.dart @@ -4,7 +4,7 @@ part 'track_message.g.dart'; @JsonSerializable() class TrackPosition { - late String time; + late int time; late double lat; diff --git a/lib/network_messages/track_message.g.dart b/lib/network_messages/track_message.g.dart index 484bd8d..0bca49f 100644 --- a/lib/network_messages/track_message.g.dart +++ b/lib/network_messages/track_message.g.dart @@ -8,7 +8,7 @@ part of 'track_message.dart'; TrackPosition _$TrackPositionFromJson(Map json) => TrackPosition() - ..time = json['time'] as String + ..time = (json['time'] as num).toInt() ..lat = (json['lat'] as num).toDouble() ..long = (json['long'] as num).toDouble() ..acc = (json['acc'] as num).toInt(); diff --git a/lib/network_messages/track_station_message.dart b/lib/network_messages/track_station_message.dart index 62fa69c..00a92d6 100644 --- a/lib/network_messages/track_station_message.dart +++ b/lib/network_messages/track_station_message.dart @@ -8,7 +8,7 @@ class TrackStationMessage { @JsonKey(name: 's_id') late int sid; - late String time; + late int time; FinTaskPos? pos; diff --git a/lib/network_messages/track_station_message.g.dart b/lib/network_messages/track_station_message.g.dart index 5d090bc..b09b032 100644 --- a/lib/network_messages/track_station_message.g.dart +++ b/lib/network_messages/track_station_message.g.dart @@ -9,7 +9,7 @@ part of 'track_station_message.dart'; TrackStationMessage _$TrackStationMessageFromJson(Map json) => TrackStationMessage() ..sid = (json['s_id'] as num).toInt() - ..time = json['time'] as String + ..time = (json['time'] as num).toInt() ..pos = json['pos'] == null ? null : FinTaskPos.fromJson(json['pos'] as Map); diff --git a/lib/network_messages/zip_message.dart b/lib/network_messages/zip_message.dart index 5d1890b..48f276d 100644 --- a/lib/network_messages/zip_message.dart +++ b/lib/network_messages/zip_message.dart @@ -20,7 +20,7 @@ class ZipSetPos { @embedded @JsonSerializable() class ZipTrack { - late String time; + late int time; ZipTrackPos? pos; diff --git a/lib/network_messages/zip_message.g.dart b/lib/network_messages/zip_message.g.dart index 6f6db5e..5130a66 100644 --- a/lib/network_messages/zip_message.g.dart +++ b/lib/network_messages/zip_message.g.dart @@ -274,7 +274,7 @@ const ZipTrackSchema = Schema( r'time': PropertySchema( id: 1, name: r'time', - type: IsarType.string, + type: IsarType.long, ) }, estimateSize: _zipTrackEstimateSize, @@ -297,7 +297,6 @@ int _zipTrackEstimateSize( value, allOffsets[ZipTrackPos]!, allOffsets); } } - bytesCount += 3 + object.time.length * 3; return bytesCount; } @@ -313,7 +312,7 @@ void _zipTrackSerialize( ZipTrackPosSchema.serialize, object.pos, ); - writer.writeString(offsets[1], object.time); + writer.writeLong(offsets[1], object.time); } ZipTrack _zipTrackDeserialize( @@ -328,7 +327,7 @@ ZipTrack _zipTrackDeserialize( ZipTrackPosSchema.deserialize, allOffsets, ); - object.time = reader.readString(offsets[1]); + object.time = reader.readLong(offsets[1]); return object; } @@ -346,7 +345,7 @@ P _zipTrackDeserializeProp

( allOffsets, )) as P; case 1: - return (reader.readString(offset)) as P; + return (reader.readLong(offset)) as P; default: throw IsarError('Unknown property with id $propertyId'); } @@ -371,54 +370,46 @@ extension ZipTrackQueryFilter } QueryBuilder timeEqualTo( - String value, { - bool caseSensitive = true, - }) { + int value) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( property: r'time', value: value, - caseSensitive: caseSensitive, )); }); } QueryBuilder timeGreaterThan( - String value, { + int value, { bool include = false, - bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, property: r'time', value: value, - caseSensitive: caseSensitive, )); }); } QueryBuilder timeLessThan( - String value, { + int value, { bool include = false, - bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, property: r'time', value: value, - caseSensitive: caseSensitive, )); }); } QueryBuilder timeBetween( - String lower, - String upper, { + int lower, + int upper, { bool includeLower = true, bool includeUpper = true, - bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( @@ -427,75 +418,6 @@ extension ZipTrackQueryFilter includeLower: includeLower, upper: upper, includeUpper: includeUpper, - caseSensitive: caseSensitive, - )); - }); - } - - QueryBuilder timeStartsWith( - String value, { - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.startsWith( - property: r'time', - value: value, - caseSensitive: caseSensitive, - )); - }); - } - - QueryBuilder timeEndsWith( - String value, { - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.endsWith( - property: r'time', - value: value, - caseSensitive: caseSensitive, - )); - }); - } - - QueryBuilder timeContains( - String value, - {bool caseSensitive = true}) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.contains( - property: r'time', - value: value, - caseSensitive: caseSensitive, - )); - }); - } - - QueryBuilder timeMatches( - String pattern, - {bool caseSensitive = true}) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.matches( - property: r'time', - wildcard: pattern, - caseSensitive: caseSensitive, - )); - }); - } - - QueryBuilder timeIsEmpty() { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.equalTo( - property: r'time', - value: '', - )); - }); - } - - QueryBuilder timeIsNotEmpty() { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.greaterThan( - property: r'time', - value: '', )); }); } @@ -790,7 +712,7 @@ Map _$ZipSetPosToJson(ZipSetPos instance) => { }; ZipTrack _$ZipTrackFromJson(Map json) => ZipTrack() - ..time = json['time'] as String + ..time = (json['time'] as num).toInt() ..pos = json['pos'] == null ? null : ZipTrackPos.fromJson(json['pos'] as Map); diff --git a/lib/popups/accept_jobs_popup.dart b/lib/popups/accept_jobs_popup.dart index 048f95c..a18f795 100644 --- a/lib/popups/accept_jobs_popup.dart +++ b/lib/popups/accept_jobs_popup.dart @@ -375,7 +375,7 @@ _sendAnswer(SharedMapReference mapReference, Job job, int item) async { message.ver = job.ver.toString(); message.item = item; message.track = Track(); - message.track.time = DateTime.now().toUtc().toIso8601String(); + message.track.time = Util.toUnixMillisUtc(DateTime.now().toUtc()); message.track.pos = FinTaskPos(); message.track.pos!.lat = currentPosition != null ? currentPosition.latitude : 0.0; message.track.pos!.long = currentPosition != null ? currentPosition.longitude : 0.0; diff --git a/lib/tools/mqtt_core.dart b/lib/tools/mqtt_core.dart index 59e60b4..b21c931 100644 --- a/lib/tools/mqtt_core.dart +++ b/lib/tools/mqtt_core.dart @@ -595,7 +595,7 @@ class MqttCore with ProducerMixin, ConsumerMixin { answer.utcUnixTime = DateTime.now().toUtc().millisecondsSinceEpoch ~/ 1000; answer.pos = SyncMessagePos(); - answer.pos!.time = DateTime.now().toUtc().toIso8601String(); + answer.pos!.time = currentPosition != null ? Util.toUnixMillisUtc(currentPosition.timestamp.toUtc()) : 0; answer.pos!.lat = currentPosition != null ? currentPosition.latitude : 0.0; answer.pos!.long = currentPosition != null ? currentPosition.longitude : 0.0; answer.pos!.acc = currentPosition != null ? currentPosition.accuracy.toInt() : 0; @@ -622,7 +622,7 @@ class MqttCore with ProducerMixin, ConsumerMixin { var trackMessage = TrackPosition(); if (position != null) { - trackMessage.time = position.timestamp.toIso8601String(); + trackMessage.time = Util.toUnixMillisUtc(position.timestamp); trackMessage.lat = position.latitude; trackMessage.long = position.longitude; trackMessage.acc = position.accuracy.toInt(); diff --git a/lib/tools/util.dart b/lib/tools/util.dart index ad3e06f..0cb9bdc 100644 --- a/lib/tools/util.dart +++ b/lib/tools/util.dart @@ -18,6 +18,13 @@ import '../Tools/colored_safe_area.dart'; class Util { static late SharedPreferences prefs; + // DateTime → UTC Unix timestamps + static int toUnixMillisUtc(DateTime dt) => dt.toUtc().millisecondsSinceEpoch; + static int nowUnixMillisUtc() => DateTime.now().toUtc().millisecondsSinceEpoch; + // Optional: Unix seconds + static int toUnixSecondsUtc(DateTime dt) => dt.toUtc().millisecondsSinceEpoch ~/ 1000; + + static init() async { prefs = await SharedPreferences.getInstance(); } @@ -427,7 +434,7 @@ Future showMessageDialog(BuildContext context, String title, String messag class DecimalTextInputFormatter extends TextInputFormatter { int maxLength; - + int decimalPlaces; DecimalTextInputFormatter({required this.maxLength, required this.decimalPlaces}); @@ -440,9 +447,9 @@ class DecimalTextInputFormatter extends TextInputFormatter { if (text != "") { RegExp regExp; if (decimalPlaces > 0) { - regExp = RegExp(r'[0-9]+[,]{0,1}[0-9]{0,${' + decimalPlaces.toString() + '}'); + regExp = RegExp(r'[0-9]+[,]{0,1}[0-9]{0,${decimalPlaces}'); } else { - regExp = RegExp(r'[0-9]{0,' + maxLength.toString() +'}'); + regExp = RegExp(r'[0-9]{0,${maxLength}}'); } filteredText = regExp.stringMatch(text); } diff --git a/pubspec.yaml b/pubspec.yaml index 835a12b..fc91471 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 339.0.0+339 +version: 340.0.0+340 environment: sdk: '>=2.19.6 <3.0.0'