From 07783fb401466c77159432e137defd2bbcd93c78 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Sun, 25 May 2025 22:10:51 +0100 Subject: [PATCH 01/42] feat: move app files to app folder, create basic server in server folder --- .idea/caches/deviceStreaming.xml | 679 ++++++++++++++++++ .idea/libraries/Dart_SDK.xml | 19 + .idea/libraries/Flutter_Plugins.xml | 7 + .idea/libraries/KotlinJavaRuntime.xml | 15 + .idea/modules.xml | 9 + .../{main_dart.xml => app_main_dart.xml} | 4 +- .idea/vcs.xml | 12 + android/dispatch_android.iml | 31 + app/.gitignore | 227 ++++++ .metadata => app/.metadata | 0 README.md => app/README.md | 0 .../analysis_options.yaml | 0 {android => app/android}/.gitignore | 0 {android => app/android}/app/build.gradle.kts | 0 .../app/src/debug/AndroidManifest.xml | 0 .../android}/app/src/main/AndroidManifest.xml | 0 .../com/example/dispatch/MainActivity.kt | 0 .../res/drawable-v21/launch_background.xml | 0 .../main/res/drawable/launch_background.xml | 0 .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin .../app/src/main/res/values-night/styles.xml | 0 .../app/src/main/res/values/styles.xml | 0 .../app/src/profile/AndroidManifest.xml | 0 {android => app/android}/build.gradle.kts | 0 {android => app/android}/gradle.properties | 0 .../gradle/wrapper/gradle-wrapper.properties | 0 {android => app/android}/settings.gradle.kts | 0 {assets => app/assets}/images/dca.jpg | Bin {assets => app/assets}/images/dca.png | Bin {assets => app/assets}/images/hems-car.jpg | Bin {assets => app/assets}/images/hems-car.png | Bin {assets => app/assets}/images/rrv.png | Bin {assets => app/assets}/images/tvaa.jpg | Bin {ios => app/ios}/.gitignore | 0 .../ios}/Flutter/AppFrameworkInfo.plist | 0 {ios => app/ios}/Flutter/Debug.xcconfig | 0 {ios => app/ios}/Flutter/Release.xcconfig | 0 .../ios}/Runner.xcodeproj/project.pbxproj | 0 .../contents.xcworkspacedata | 0 .../xcshareddata/IDEWorkspaceChecks.plist | 0 .../xcshareddata/WorkspaceSettings.xcsettings | 0 .../xcshareddata/xcschemes/Runner.xcscheme | 0 .../contents.xcworkspacedata | 0 .../xcshareddata/IDEWorkspaceChecks.plist | 0 .../xcshareddata/WorkspaceSettings.xcsettings | 0 {ios => app/ios}/Runner/AppDelegate.swift | 0 .../AppIcon.appiconset/Contents.json | 0 .../Icon-App-1024x1024@1x.png | Bin .../AppIcon.appiconset/Icon-App-20x20@1x.png | Bin .../AppIcon.appiconset/Icon-App-20x20@2x.png | Bin .../AppIcon.appiconset/Icon-App-20x20@3x.png | Bin .../AppIcon.appiconset/Icon-App-29x29@1x.png | Bin .../AppIcon.appiconset/Icon-App-29x29@2x.png | Bin .../AppIcon.appiconset/Icon-App-29x29@3x.png | Bin .../AppIcon.appiconset/Icon-App-40x40@1x.png | Bin .../AppIcon.appiconset/Icon-App-40x40@2x.png | Bin .../AppIcon.appiconset/Icon-App-40x40@3x.png | Bin .../AppIcon.appiconset/Icon-App-60x60@2x.png | Bin .../AppIcon.appiconset/Icon-App-60x60@3x.png | Bin .../AppIcon.appiconset/Icon-App-76x76@1x.png | Bin .../AppIcon.appiconset/Icon-App-76x76@2x.png | Bin .../Icon-App-83.5x83.5@2x.png | Bin .../LaunchImage.imageset/Contents.json | 0 .../LaunchImage.imageset/LaunchImage.png | Bin .../LaunchImage.imageset/LaunchImage@2x.png | Bin .../LaunchImage.imageset/LaunchImage@3x.png | Bin .../LaunchImage.imageset/README.md | 0 .../Runner/Base.lproj/LaunchScreen.storyboard | 0 .../ios}/Runner/Base.lproj/Main.storyboard | 0 {ios => app/ios}/Runner/Info.plist | 0 .../ios}/Runner/Runner-Bridging-Header.h | 0 .../ios}/RunnerTests/RunnerTests.swift | 0 {lib => app/lib}/api/.gitignore | 0 {lib => app/lib}/api/env.dart | 0 {lib => app/lib}/api/maps/geocoding.dart | 0 {lib => app/lib}/config/dependencies.dart | 0 .../repositories/auth/auth_repository.dart | 0 .../auth/auth_repository_dev.dart | 0 .../repositories/event/event_repository.dart | 0 .../event/event_repository_local.dart | 0 .../repositories/unit/unit_repository.dart | 0 .../data/services/local_data_service.dart | 0 {lib => app/lib}/domain/models/event.dart | 0 {lib => app/lib}/domain/models/noc.dart | 0 {lib => app/lib}/domain/models/status.dart | 0 {lib => app/lib}/domain/models/unit/unit.dart | 0 .../lib}/domain/models/unit/unit_status.dart | 0 {lib => app/lib}/domain/models/user/user.dart | 0 {lib => app/lib}/main.dart | 0 {lib => app/lib}/map.dart | 0 {lib => app/lib}/routing/router.dart | 0 {lib => app/lib}/routing/routes.dart | 0 {lib => app/lib}/ui/home/view_models/.gitkeep | 0 .../ui/home/view_models/home_viewmodel.dart | 0 .../lib}/ui/home/widgets/home_screen.dart | 0 {lib => app/lib}/utils/result.dart | 0 {linux => app/linux}/.gitignore | 0 {linux => app/linux}/CMakeLists.txt | 0 {linux => app/linux}/flutter/CMakeLists.txt | 0 .../flutter/generated_plugin_registrant.cc | 0 .../flutter/generated_plugin_registrant.h | 0 .../linux}/flutter/generated_plugins.cmake | 0 {linux => app/linux}/runner/CMakeLists.txt | 0 {linux => app/linux}/runner/main.cc | 0 {linux => app/linux}/runner/my_application.cc | 0 {linux => app/linux}/runner/my_application.h | 0 {macos => app/macos}/.gitignore | 0 .../macos}/Flutter/Flutter-Debug.xcconfig | 0 .../macos}/Flutter/Flutter-Release.xcconfig | 0 .../Flutter/GeneratedPluginRegistrant.swift | 0 .../macos}/Runner.xcodeproj/project.pbxproj | 0 .../xcshareddata/IDEWorkspaceChecks.plist | 0 .../xcshareddata/xcschemes/Runner.xcscheme | 0 .../contents.xcworkspacedata | 0 .../xcshareddata/IDEWorkspaceChecks.plist | 0 {macos => app/macos}/Runner/AppDelegate.swift | 0 .../AppIcon.appiconset/Contents.json | 0 .../AppIcon.appiconset/app_icon_1024.png | Bin .../AppIcon.appiconset/app_icon_128.png | Bin .../AppIcon.appiconset/app_icon_16.png | Bin .../AppIcon.appiconset/app_icon_256.png | Bin .../AppIcon.appiconset/app_icon_32.png | Bin .../AppIcon.appiconset/app_icon_512.png | Bin .../AppIcon.appiconset/app_icon_64.png | Bin .../macos}/Runner/Base.lproj/MainMenu.xib | 0 .../macos}/Runner/Configs/AppInfo.xcconfig | 0 .../macos}/Runner/Configs/Debug.xcconfig | 0 .../macos}/Runner/Configs/Release.xcconfig | 0 .../macos}/Runner/Configs/Warnings.xcconfig | 0 .../macos}/Runner/DebugProfile.entitlements | 0 {macos => app/macos}/Runner/Info.plist | 0 .../macos}/Runner/MainFlutterWindow.swift | 0 .../macos}/Runner/Release.entitlements | 0 .../macos}/RunnerTests/RunnerTests.swift | 0 app/pubspec.yaml | 98 +++ {test => app/test}/widget_test.dart | 0 {web => app/web}/favicon.png | Bin {web => app/web}/icons/Icon-192.png | Bin {web => app/web}/icons/Icon-512.png | Bin {web => app/web}/icons/Icon-maskable-192.png | Bin {web => app/web}/icons/Icon-maskable-512.png | Bin {web => app/web}/index.html | 0 {web => app/web}/manifest.json | 0 {windows => app/windows}/.gitignore | 0 {windows => app/windows}/CMakeLists.txt | 0 .../windows}/flutter/CMakeLists.txt | 0 .../flutter/generated_plugin_registrant.cc | 0 .../flutter/generated_plugin_registrant.h | 0 .../windows}/flutter/generated_plugins.cmake | 0 .../windows}/runner/CMakeLists.txt | 0 {windows => app/windows}/runner/Runner.rc | 0 .../windows}/runner/flutter_window.cpp | 0 .../windows}/runner/flutter_window.h | 0 {windows => app/windows}/runner/main.cpp | 0 {windows => app/windows}/runner/resource.h | 0 .../windows}/runner/resources/app_icon.ico | Bin .../windows}/runner/runner.exe.manifest | 0 {windows => app/windows}/runner/utils.cpp | 0 {windows => app/windows}/runner/utils.h | 0 .../windows}/runner/win32_window.cpp | 0 .../windows}/runner/win32_window.h | 0 dispatch.iml | 29 + pubspec.yaml | 104 +-- server/.gitignore | 7 + server/CHANGELOG.md | 3 + server/README.md | 39 + server/analysis_options.yaml | 30 + server/example/server_example.dart | 6 + server/lib/server.dart | 8 + server/lib/src/server_base.dart | 59 ++ server/pubspec.yaml | 18 + server/test/server_test.dart | 15 + 176 files changed, 1326 insertions(+), 93 deletions(-) create mode 100644 .idea/caches/deviceStreaming.xml create mode 100644 .idea/libraries/Dart_SDK.xml create mode 100644 .idea/libraries/Flutter_Plugins.xml create mode 100644 .idea/libraries/KotlinJavaRuntime.xml create mode 100644 .idea/modules.xml rename .idea/runConfigurations/{main_dart.xml => app_main_dart.xml} (51%) create mode 100644 .idea/vcs.xml create mode 100644 android/dispatch_android.iml create mode 100644 app/.gitignore rename .metadata => app/.metadata (100%) rename README.md => app/README.md (100%) rename analysis_options.yaml => app/analysis_options.yaml (100%) rename {android => app/android}/.gitignore (100%) rename {android => app/android}/app/build.gradle.kts (100%) rename {android => app/android}/app/src/debug/AndroidManifest.xml (100%) rename {android => app/android}/app/src/main/AndroidManifest.xml (100%) rename {android => app/android}/app/src/main/kotlin/com/example/dispatch/MainActivity.kt (100%) rename {android => app/android}/app/src/main/res/drawable-v21/launch_background.xml (100%) rename {android => app/android}/app/src/main/res/drawable/launch_background.xml (100%) rename {android => app/android}/app/src/main/res/mipmap-hdpi/ic_launcher.png (100%) rename {android => app/android}/app/src/main/res/mipmap-mdpi/ic_launcher.png (100%) rename {android => app/android}/app/src/main/res/mipmap-xhdpi/ic_launcher.png (100%) rename {android => app/android}/app/src/main/res/mipmap-xxhdpi/ic_launcher.png (100%) rename {android => app/android}/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png (100%) rename {android => app/android}/app/src/main/res/values-night/styles.xml (100%) rename {android => app/android}/app/src/main/res/values/styles.xml (100%) rename {android => app/android}/app/src/profile/AndroidManifest.xml (100%) rename {android => app/android}/build.gradle.kts (100%) rename {android => app/android}/gradle.properties (100%) rename {android => app/android}/gradle/wrapper/gradle-wrapper.properties (100%) rename {android => app/android}/settings.gradle.kts (100%) rename {assets => app/assets}/images/dca.jpg (100%) rename {assets => app/assets}/images/dca.png (100%) rename {assets => app/assets}/images/hems-car.jpg (100%) rename {assets => app/assets}/images/hems-car.png (100%) rename {assets => app/assets}/images/rrv.png (100%) rename {assets => app/assets}/images/tvaa.jpg (100%) rename {ios => app/ios}/.gitignore (100%) rename {ios => app/ios}/Flutter/AppFrameworkInfo.plist (100%) rename {ios => app/ios}/Flutter/Debug.xcconfig (100%) rename {ios => app/ios}/Flutter/Release.xcconfig (100%) rename {ios => app/ios}/Runner.xcodeproj/project.pbxproj (100%) rename {ios => app/ios}/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata (100%) rename {ios => app/ios}/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (100%) rename {ios => app/ios}/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings (100%) rename {ios => app/ios}/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme (100%) rename {ios => app/ios}/Runner.xcworkspace/contents.xcworkspacedata (100%) rename {ios => app/ios}/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (100%) rename {ios => app/ios}/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings (100%) rename {ios => app/ios}/Runner/AppDelegate.swift (100%) rename {ios => app/ios}/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json (100%) rename {ios => app/ios}/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png (100%) rename {ios => app/ios}/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png (100%) rename {ios => app/ios}/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png (100%) rename {ios => app/ios}/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png (100%) rename {ios => app/ios}/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png (100%) rename {ios => app/ios}/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png (100%) rename {ios => app/ios}/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png (100%) rename {ios => app/ios}/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png (100%) rename {ios => app/ios}/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png (100%) rename {ios => app/ios}/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png (100%) rename {ios => app/ios}/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png (100%) rename {ios => app/ios}/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png (100%) rename {ios => app/ios}/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png (100%) rename {ios => app/ios}/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png (100%) rename {ios => app/ios}/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png (100%) rename {ios => app/ios}/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json (100%) rename {ios => app/ios}/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png (100%) rename {ios => app/ios}/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png (100%) rename {ios => app/ios}/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png (100%) rename {ios => app/ios}/Runner/Assets.xcassets/LaunchImage.imageset/README.md (100%) rename {ios => app/ios}/Runner/Base.lproj/LaunchScreen.storyboard (100%) rename {ios => app/ios}/Runner/Base.lproj/Main.storyboard (100%) rename {ios => app/ios}/Runner/Info.plist (100%) rename {ios => app/ios}/Runner/Runner-Bridging-Header.h (100%) rename {ios => app/ios}/RunnerTests/RunnerTests.swift (100%) rename {lib => app/lib}/api/.gitignore (100%) rename {lib => app/lib}/api/env.dart (100%) rename {lib => app/lib}/api/maps/geocoding.dart (100%) rename {lib => app/lib}/config/dependencies.dart (100%) rename {lib => app/lib}/data/repositories/auth/auth_repository.dart (100%) rename {lib => app/lib}/data/repositories/auth/auth_repository_dev.dart (100%) rename {lib => app/lib}/data/repositories/event/event_repository.dart (100%) rename {lib => app/lib}/data/repositories/event/event_repository_local.dart (100%) rename {lib => app/lib}/data/repositories/unit/unit_repository.dart (100%) rename {lib => app/lib}/data/services/local_data_service.dart (100%) rename {lib => app/lib}/domain/models/event.dart (100%) rename {lib => app/lib}/domain/models/noc.dart (100%) rename {lib => app/lib}/domain/models/status.dart (100%) rename {lib => app/lib}/domain/models/unit/unit.dart (100%) rename {lib => app/lib}/domain/models/unit/unit_status.dart (100%) rename {lib => app/lib}/domain/models/user/user.dart (100%) rename {lib => app/lib}/main.dart (100%) rename {lib => app/lib}/map.dart (100%) rename {lib => app/lib}/routing/router.dart (100%) rename {lib => app/lib}/routing/routes.dart (100%) rename {lib => app/lib}/ui/home/view_models/.gitkeep (100%) rename {lib => app/lib}/ui/home/view_models/home_viewmodel.dart (100%) rename {lib => app/lib}/ui/home/widgets/home_screen.dart (100%) rename {lib => app/lib}/utils/result.dart (100%) rename {linux => app/linux}/.gitignore (100%) rename {linux => app/linux}/CMakeLists.txt (100%) rename {linux => app/linux}/flutter/CMakeLists.txt (100%) rename {linux => app/linux}/flutter/generated_plugin_registrant.cc (100%) rename {linux => app/linux}/flutter/generated_plugin_registrant.h (100%) rename {linux => app/linux}/flutter/generated_plugins.cmake (100%) rename {linux => app/linux}/runner/CMakeLists.txt (100%) rename {linux => app/linux}/runner/main.cc (100%) rename {linux => app/linux}/runner/my_application.cc (100%) rename {linux => app/linux}/runner/my_application.h (100%) rename {macos => app/macos}/.gitignore (100%) rename {macos => app/macos}/Flutter/Flutter-Debug.xcconfig (100%) rename {macos => app/macos}/Flutter/Flutter-Release.xcconfig (100%) rename {macos => app/macos}/Flutter/GeneratedPluginRegistrant.swift (100%) rename {macos => app/macos}/Runner.xcodeproj/project.pbxproj (100%) rename {macos => app/macos}/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (100%) rename {macos => app/macos}/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme (100%) rename {macos => app/macos}/Runner.xcworkspace/contents.xcworkspacedata (100%) rename {macos => app/macos}/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (100%) rename {macos => app/macos}/Runner/AppDelegate.swift (100%) rename {macos => app/macos}/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json (100%) rename {macos => app/macos}/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png (100%) rename {macos => app/macos}/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png (100%) rename {macos => app/macos}/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png (100%) rename {macos => app/macos}/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png (100%) rename {macos => app/macos}/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png (100%) rename {macos => app/macos}/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png (100%) rename {macos => app/macos}/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png (100%) rename {macos => app/macos}/Runner/Base.lproj/MainMenu.xib (100%) rename {macos => app/macos}/Runner/Configs/AppInfo.xcconfig (100%) rename {macos => app/macos}/Runner/Configs/Debug.xcconfig (100%) rename {macos => app/macos}/Runner/Configs/Release.xcconfig (100%) rename {macos => app/macos}/Runner/Configs/Warnings.xcconfig (100%) rename {macos => app/macos}/Runner/DebugProfile.entitlements (100%) rename {macos => app/macos}/Runner/Info.plist (100%) rename {macos => app/macos}/Runner/MainFlutterWindow.swift (100%) rename {macos => app/macos}/Runner/Release.entitlements (100%) rename {macos => app/macos}/RunnerTests/RunnerTests.swift (100%) create mode 100644 app/pubspec.yaml rename {test => app/test}/widget_test.dart (100%) rename {web => app/web}/favicon.png (100%) rename {web => app/web}/icons/Icon-192.png (100%) rename {web => app/web}/icons/Icon-512.png (100%) rename {web => app/web}/icons/Icon-maskable-192.png (100%) rename {web => app/web}/icons/Icon-maskable-512.png (100%) rename {web => app/web}/index.html (100%) rename {web => app/web}/manifest.json (100%) rename {windows => app/windows}/.gitignore (100%) rename {windows => app/windows}/CMakeLists.txt (100%) rename {windows => app/windows}/flutter/CMakeLists.txt (100%) rename {windows => app/windows}/flutter/generated_plugin_registrant.cc (100%) rename {windows => app/windows}/flutter/generated_plugin_registrant.h (100%) rename {windows => app/windows}/flutter/generated_plugins.cmake (100%) rename {windows => app/windows}/runner/CMakeLists.txt (100%) rename {windows => app/windows}/runner/Runner.rc (100%) rename {windows => app/windows}/runner/flutter_window.cpp (100%) rename {windows => app/windows}/runner/flutter_window.h (100%) rename {windows => app/windows}/runner/main.cpp (100%) rename {windows => app/windows}/runner/resource.h (100%) rename {windows => app/windows}/runner/resources/app_icon.ico (100%) rename {windows => app/windows}/runner/runner.exe.manifest (100%) rename {windows => app/windows}/runner/utils.cpp (100%) rename {windows => app/windows}/runner/utils.h (100%) rename {windows => app/windows}/runner/win32_window.cpp (100%) rename {windows => app/windows}/runner/win32_window.h (100%) create mode 100644 dispatch.iml create mode 100644 server/.gitignore create mode 100644 server/CHANGELOG.md create mode 100644 server/README.md create mode 100644 server/analysis_options.yaml create mode 100644 server/example/server_example.dart create mode 100644 server/lib/server.dart create mode 100644 server/lib/src/server_base.dart create mode 100644 server/pubspec.yaml create mode 100644 server/test/server_test.dart diff --git a/.idea/caches/deviceStreaming.xml b/.idea/caches/deviceStreaming.xml new file mode 100644 index 0000000..61a0a4a --- /dev/null +++ b/.idea/caches/deviceStreaming.xml @@ -0,0 +1,679 @@ + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml new file mode 100644 index 0000000..3447a85 --- /dev/null +++ b/.idea/libraries/Dart_SDK.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Flutter_Plugins.xml b/.idea/libraries/Flutter_Plugins.xml new file mode 100644 index 0000000..b0f6971 --- /dev/null +++ b/.idea/libraries/Flutter_Plugins.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/KotlinJavaRuntime.xml b/.idea/libraries/KotlinJavaRuntime.xml new file mode 100644 index 0000000..2b96ac4 --- /dev/null +++ b/.idea/libraries/KotlinJavaRuntime.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..8f3fc05 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.idea/runConfigurations/main_dart.xml b/.idea/runConfigurations/app_main_dart.xml similarity index 51% rename from .idea/runConfigurations/main_dart.xml rename to .idea/runConfigurations/app_main_dart.xml index 9d4cd1e..05640dc 100644 --- a/.idea/runConfigurations/main_dart.xml +++ b/.idea/runConfigurations/app_main_dart.xml @@ -1,7 +1,7 @@ - + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..4c6280e --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/android/dispatch_android.iml b/android/dispatch_android.iml new file mode 100644 index 0000000..f00ee02 --- /dev/null +++ b/android/dispatch_android.iml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..6550ed7 --- /dev/null +++ b/app/.gitignore @@ -0,0 +1,227 @@ +# Created by https://www.toptal.com/developers/gitignore/api/dart,flutter,androidstudio +# Edit at https://www.toptal.com/developers/gitignore?templates=dart,flutter,androidstudio + +### Dart ### +# See https://www.dartlang.org/guides/libraries/private-files + +# Files and directories created by pub +.dart_tool/ +.packages +build/ +# If you're building an application, you may want to check-in your pubspec.lock +pubspec.lock + +# Directory created by dartdoc +# If you don't generate documentation locally you can remove this line. +doc/api/ + +# dotenv environment variables file +.env* + +# Avoid committing generated Javascript files: +*.dart.js +*.info.json # Produced by the --dump-info flag. +*.js # When generated by dart2js. Don't specify *.js if your + # project includes source files written in JavaScript. +*.js_ +*.js.deps +*.js.map + +.flutter-plugins +.flutter-plugins-dependencies + +### Dart Patch ### +# dotenv environment variables file +.env + +### Flutter ### +# Flutter/Dart/Pub related +**/doc/api/ +.fvm/flutter_sdk +.pub-cache/ +.pub/ +coverage/ +lib/generated_plugin_registrant.dart +# For library packages, don’t commit the pubspec.lock file. +# Regenerating the pubspec.lock file lets you test your package against the latest compatible versions of its dependencies. +# See https://dart.dev/guides/libraries/private-files#pubspeclock +#pubspec.lock + +# Android related +**/android/**/gradle-wrapper.jar +**/android/.gradle +**/android/captures/ +**/android/gradlew +**/android/gradlew.bat +**/android/key.properties +**/android/local.properties +**/android/**/GeneratedPluginRegistrant.java + +# iOS/XCode related +**/ios/**/*.mode1v3 +**/ios/**/*.mode2v3 +**/ios/**/*.moved-aside +**/ios/**/*.pbxuser +**/ios/**/*.perspectivev3 +**/ios/**/*sync/ +**/ios/**/.sconsign.dblite +**/ios/**/.tags* +**/ios/**/.vagrant/ +**/ios/**/DerivedData/ +**/ios/**/Icon? +**/ios/**/Pods/ +**/ios/**/.symlinks/ +**/ios/**/profile +**/ios/**/xcuserdata +**/ios/.generated/ +**/ios/Flutter/.last_build_id +**/ios/Flutter/App.framework +**/ios/Flutter/Flutter.framework +**/ios/Flutter/Flutter.podspec +**/ios/Flutter/Generated.xcconfig +**/ios/Flutter/app.flx +**/ios/Flutter/app.zip +**/ios/Flutter/flutter_assets/ +**/ios/Flutter/flutter_export_environment.sh +**/ios/ServiceDefinitions.json +**/ios/Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!**/ios/**/default.mode1v3 +!**/ios/**/default.mode2v3 +!**/ios/**/default.pbxuser +!**/ios/**/default.perspectivev3 +!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages + +### AndroidStudio ### +# Covers files to be ignored for android development using Android Studio. + +# Built application files +*.apk +*.ap_ +*.aab + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ +out/ + +# Gradle files +.gradle +.gradle/ + +# Signing files +.signing/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Android Studio +/*/build/ +/*/local.properties +/*/out +/*/*/build +/*/*/production +captures/ +.navigation/ +*.ipr +*~ +*.swp + +# Keystore files +*.jks +*.keystore + +# Google Services (e.g. APIs or Firebase) +# google-services.json + +# Android Patch +gen-external-apklibs + +# External native build folder generated in Android Studio 2.2 and later +.externalNativeBuild + +# NDK +obj/ + +# IntelliJ IDEA +*.iml +*.iws +/out/ + +# User-specific configurations +.idea/caches/ +.idea/libraries/ +.idea/shelf/ +.idea/workspace.xml +.idea/tasks.xml +.idea/.name +.idea/compiler.xml +.idea/copyright/profiles_settings.xml +.idea/encodings.xml +.idea/misc.xml +.idea/modules.xml +.idea/scopes/scope_settings.xml +.idea/dictionaries +.idea/vcs.xml +.idea/jsLibraryMappings.xml +.idea/datasources.xml +.idea/dataSources.ids +.idea/sqlDataSources.xml +.idea/dynamic.xml +.idea/uiDesigner.xml +.idea/assetWizardSettings.xml +.idea/gradle.xml +.idea/jarRepositories.xml +.idea/navEditor.xml + +# Legacy Eclipse project files +.classpath +.project +.cproject +.settings/ + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.war +*.ear + +# virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml) +hs_err_pid* + +## Plugin-specific files: + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Mongo Explorer plugin +.idea/mongoSettings.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +### AndroidStudio Patch ### + +!/gradle/wrapper/gradle-wrapper.jar + +# End of https://www.toptal.com/developers/gitignore/api/dart,flutter,androidstudio \ No newline at end of file diff --git a/.metadata b/app/.metadata similarity index 100% rename from .metadata rename to app/.metadata diff --git a/README.md b/app/README.md similarity index 100% rename from README.md rename to app/README.md diff --git a/analysis_options.yaml b/app/analysis_options.yaml similarity index 100% rename from analysis_options.yaml rename to app/analysis_options.yaml diff --git a/android/.gitignore b/app/android/.gitignore similarity index 100% rename from android/.gitignore rename to app/android/.gitignore diff --git a/android/app/build.gradle.kts b/app/android/app/build.gradle.kts similarity index 100% rename from android/app/build.gradle.kts rename to app/android/app/build.gradle.kts diff --git a/android/app/src/debug/AndroidManifest.xml b/app/android/app/src/debug/AndroidManifest.xml similarity index 100% rename from android/app/src/debug/AndroidManifest.xml rename to app/android/app/src/debug/AndroidManifest.xml diff --git a/android/app/src/main/AndroidManifest.xml b/app/android/app/src/main/AndroidManifest.xml similarity index 100% rename from android/app/src/main/AndroidManifest.xml rename to app/android/app/src/main/AndroidManifest.xml diff --git a/android/app/src/main/kotlin/com/example/dispatch/MainActivity.kt b/app/android/app/src/main/kotlin/com/example/dispatch/MainActivity.kt similarity index 100% rename from android/app/src/main/kotlin/com/example/dispatch/MainActivity.kt rename to app/android/app/src/main/kotlin/com/example/dispatch/MainActivity.kt diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/app/android/app/src/main/res/drawable-v21/launch_background.xml similarity index 100% rename from android/app/src/main/res/drawable-v21/launch_background.xml rename to app/android/app/src/main/res/drawable-v21/launch_background.xml diff --git a/android/app/src/main/res/drawable/launch_background.xml b/app/android/app/src/main/res/drawable/launch_background.xml similarity index 100% rename from android/app/src/main/res/drawable/launch_background.xml rename to app/android/app/src/main/res/drawable/launch_background.xml diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from android/app/src/main/res/mipmap-hdpi/ic_launcher.png rename to app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from android/app/src/main/res/mipmap-mdpi/ic_launcher.png rename to app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from android/app/src/main/res/mipmap-xhdpi/ic_launcher.png rename to app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png rename to app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/android/app/src/main/res/values-night/styles.xml b/app/android/app/src/main/res/values-night/styles.xml similarity index 100% rename from android/app/src/main/res/values-night/styles.xml rename to app/android/app/src/main/res/values-night/styles.xml diff --git a/android/app/src/main/res/values/styles.xml b/app/android/app/src/main/res/values/styles.xml similarity index 100% rename from android/app/src/main/res/values/styles.xml rename to app/android/app/src/main/res/values/styles.xml diff --git a/android/app/src/profile/AndroidManifest.xml b/app/android/app/src/profile/AndroidManifest.xml similarity index 100% rename from android/app/src/profile/AndroidManifest.xml rename to app/android/app/src/profile/AndroidManifest.xml diff --git a/android/build.gradle.kts b/app/android/build.gradle.kts similarity index 100% rename from android/build.gradle.kts rename to app/android/build.gradle.kts diff --git a/android/gradle.properties b/app/android/gradle.properties similarity index 100% rename from android/gradle.properties rename to app/android/gradle.properties diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/app/android/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from android/gradle/wrapper/gradle-wrapper.properties rename to app/android/gradle/wrapper/gradle-wrapper.properties diff --git a/android/settings.gradle.kts b/app/android/settings.gradle.kts similarity index 100% rename from android/settings.gradle.kts rename to app/android/settings.gradle.kts diff --git a/assets/images/dca.jpg b/app/assets/images/dca.jpg similarity index 100% rename from assets/images/dca.jpg rename to app/assets/images/dca.jpg diff --git a/assets/images/dca.png b/app/assets/images/dca.png similarity index 100% rename from assets/images/dca.png rename to app/assets/images/dca.png diff --git a/assets/images/hems-car.jpg b/app/assets/images/hems-car.jpg similarity index 100% rename from assets/images/hems-car.jpg rename to app/assets/images/hems-car.jpg diff --git a/assets/images/hems-car.png b/app/assets/images/hems-car.png similarity index 100% rename from assets/images/hems-car.png rename to app/assets/images/hems-car.png diff --git a/assets/images/rrv.png b/app/assets/images/rrv.png similarity index 100% rename from assets/images/rrv.png rename to app/assets/images/rrv.png diff --git a/assets/images/tvaa.jpg b/app/assets/images/tvaa.jpg similarity index 100% rename from assets/images/tvaa.jpg rename to app/assets/images/tvaa.jpg diff --git a/ios/.gitignore b/app/ios/.gitignore similarity index 100% rename from ios/.gitignore rename to app/ios/.gitignore diff --git a/ios/Flutter/AppFrameworkInfo.plist b/app/ios/Flutter/AppFrameworkInfo.plist similarity index 100% rename from ios/Flutter/AppFrameworkInfo.plist rename to app/ios/Flutter/AppFrameworkInfo.plist diff --git a/ios/Flutter/Debug.xcconfig b/app/ios/Flutter/Debug.xcconfig similarity index 100% rename from ios/Flutter/Debug.xcconfig rename to app/ios/Flutter/Debug.xcconfig diff --git a/ios/Flutter/Release.xcconfig b/app/ios/Flutter/Release.xcconfig similarity index 100% rename from ios/Flutter/Release.xcconfig rename to app/ios/Flutter/Release.xcconfig diff --git a/ios/Runner.xcodeproj/project.pbxproj b/app/ios/Runner.xcodeproj/project.pbxproj similarity index 100% rename from ios/Runner.xcodeproj/project.pbxproj rename to app/ios/Runner.xcodeproj/project.pbxproj diff --git a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/app/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to app/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings similarity index 100% rename from ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings rename to app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/app/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme similarity index 100% rename from ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme rename to app/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/app/ios/Runner.xcworkspace/contents.xcworkspacedata similarity index 100% rename from ios/Runner.xcworkspace/contents.xcworkspacedata rename to app/ios/Runner.xcworkspace/contents.xcworkspacedata diff --git a/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/app/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to app/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/app/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings similarity index 100% rename from ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings rename to app/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings diff --git a/ios/Runner/AppDelegate.swift b/app/ios/Runner/AppDelegate.swift similarity index 100% rename from ios/Runner/AppDelegate.swift rename to app/ios/Runner/AppDelegate.swift diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json rename to app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png similarity index 100% rename from ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png rename to app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png similarity index 100% rename from ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png rename to app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png similarity index 100% rename from ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png rename to app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png similarity index 100% rename from ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png rename to app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png similarity index 100% rename from ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png rename to app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png similarity index 100% rename from ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png rename to app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png similarity index 100% rename from ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png rename to app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png similarity index 100% rename from ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png rename to app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png similarity index 100% rename from ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png rename to app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png similarity index 100% rename from ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png rename to app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png similarity index 100% rename from ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png rename to app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png similarity index 100% rename from ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png rename to app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png similarity index 100% rename from ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png rename to app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png similarity index 100% rename from ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png rename to app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png similarity index 100% rename from ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png rename to app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/app/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json similarity index 100% rename from ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json rename to app/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png similarity index 100% rename from ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png rename to app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png similarity index 100% rename from ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png rename to app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png similarity index 100% rename from ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png rename to app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/app/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md similarity index 100% rename from ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md rename to app/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md diff --git a/ios/Runner/Base.lproj/LaunchScreen.storyboard b/app/ios/Runner/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from ios/Runner/Base.lproj/LaunchScreen.storyboard rename to app/ios/Runner/Base.lproj/LaunchScreen.storyboard diff --git a/ios/Runner/Base.lproj/Main.storyboard b/app/ios/Runner/Base.lproj/Main.storyboard similarity index 100% rename from ios/Runner/Base.lproj/Main.storyboard rename to app/ios/Runner/Base.lproj/Main.storyboard diff --git a/ios/Runner/Info.plist b/app/ios/Runner/Info.plist similarity index 100% rename from ios/Runner/Info.plist rename to app/ios/Runner/Info.plist diff --git a/ios/Runner/Runner-Bridging-Header.h b/app/ios/Runner/Runner-Bridging-Header.h similarity index 100% rename from ios/Runner/Runner-Bridging-Header.h rename to app/ios/Runner/Runner-Bridging-Header.h diff --git a/ios/RunnerTests/RunnerTests.swift b/app/ios/RunnerTests/RunnerTests.swift similarity index 100% rename from ios/RunnerTests/RunnerTests.swift rename to app/ios/RunnerTests/RunnerTests.swift diff --git a/lib/api/.gitignore b/app/lib/api/.gitignore similarity index 100% rename from lib/api/.gitignore rename to app/lib/api/.gitignore diff --git a/lib/api/env.dart b/app/lib/api/env.dart similarity index 100% rename from lib/api/env.dart rename to app/lib/api/env.dart diff --git a/lib/api/maps/geocoding.dart b/app/lib/api/maps/geocoding.dart similarity index 100% rename from lib/api/maps/geocoding.dart rename to app/lib/api/maps/geocoding.dart diff --git a/lib/config/dependencies.dart b/app/lib/config/dependencies.dart similarity index 100% rename from lib/config/dependencies.dart rename to app/lib/config/dependencies.dart diff --git a/lib/data/repositories/auth/auth_repository.dart b/app/lib/data/repositories/auth/auth_repository.dart similarity index 100% rename from lib/data/repositories/auth/auth_repository.dart rename to app/lib/data/repositories/auth/auth_repository.dart diff --git a/lib/data/repositories/auth/auth_repository_dev.dart b/app/lib/data/repositories/auth/auth_repository_dev.dart similarity index 100% rename from lib/data/repositories/auth/auth_repository_dev.dart rename to app/lib/data/repositories/auth/auth_repository_dev.dart diff --git a/lib/data/repositories/event/event_repository.dart b/app/lib/data/repositories/event/event_repository.dart similarity index 100% rename from lib/data/repositories/event/event_repository.dart rename to app/lib/data/repositories/event/event_repository.dart diff --git a/lib/data/repositories/event/event_repository_local.dart b/app/lib/data/repositories/event/event_repository_local.dart similarity index 100% rename from lib/data/repositories/event/event_repository_local.dart rename to app/lib/data/repositories/event/event_repository_local.dart diff --git a/lib/data/repositories/unit/unit_repository.dart b/app/lib/data/repositories/unit/unit_repository.dart similarity index 100% rename from lib/data/repositories/unit/unit_repository.dart rename to app/lib/data/repositories/unit/unit_repository.dart diff --git a/lib/data/services/local_data_service.dart b/app/lib/data/services/local_data_service.dart similarity index 100% rename from lib/data/services/local_data_service.dart rename to app/lib/data/services/local_data_service.dart diff --git a/lib/domain/models/event.dart b/app/lib/domain/models/event.dart similarity index 100% rename from lib/domain/models/event.dart rename to app/lib/domain/models/event.dart diff --git a/lib/domain/models/noc.dart b/app/lib/domain/models/noc.dart similarity index 100% rename from lib/domain/models/noc.dart rename to app/lib/domain/models/noc.dart diff --git a/lib/domain/models/status.dart b/app/lib/domain/models/status.dart similarity index 100% rename from lib/domain/models/status.dart rename to app/lib/domain/models/status.dart diff --git a/lib/domain/models/unit/unit.dart b/app/lib/domain/models/unit/unit.dart similarity index 100% rename from lib/domain/models/unit/unit.dart rename to app/lib/domain/models/unit/unit.dart diff --git a/lib/domain/models/unit/unit_status.dart b/app/lib/domain/models/unit/unit_status.dart similarity index 100% rename from lib/domain/models/unit/unit_status.dart rename to app/lib/domain/models/unit/unit_status.dart diff --git a/lib/domain/models/user/user.dart b/app/lib/domain/models/user/user.dart similarity index 100% rename from lib/domain/models/user/user.dart rename to app/lib/domain/models/user/user.dart diff --git a/lib/main.dart b/app/lib/main.dart similarity index 100% rename from lib/main.dart rename to app/lib/main.dart diff --git a/lib/map.dart b/app/lib/map.dart similarity index 100% rename from lib/map.dart rename to app/lib/map.dart diff --git a/lib/routing/router.dart b/app/lib/routing/router.dart similarity index 100% rename from lib/routing/router.dart rename to app/lib/routing/router.dart diff --git a/lib/routing/routes.dart b/app/lib/routing/routes.dart similarity index 100% rename from lib/routing/routes.dart rename to app/lib/routing/routes.dart diff --git a/lib/ui/home/view_models/.gitkeep b/app/lib/ui/home/view_models/.gitkeep similarity index 100% rename from lib/ui/home/view_models/.gitkeep rename to app/lib/ui/home/view_models/.gitkeep diff --git a/lib/ui/home/view_models/home_viewmodel.dart b/app/lib/ui/home/view_models/home_viewmodel.dart similarity index 100% rename from lib/ui/home/view_models/home_viewmodel.dart rename to app/lib/ui/home/view_models/home_viewmodel.dart diff --git a/lib/ui/home/widgets/home_screen.dart b/app/lib/ui/home/widgets/home_screen.dart similarity index 100% rename from lib/ui/home/widgets/home_screen.dart rename to app/lib/ui/home/widgets/home_screen.dart diff --git a/lib/utils/result.dart b/app/lib/utils/result.dart similarity index 100% rename from lib/utils/result.dart rename to app/lib/utils/result.dart diff --git a/linux/.gitignore b/app/linux/.gitignore similarity index 100% rename from linux/.gitignore rename to app/linux/.gitignore diff --git a/linux/CMakeLists.txt b/app/linux/CMakeLists.txt similarity index 100% rename from linux/CMakeLists.txt rename to app/linux/CMakeLists.txt diff --git a/linux/flutter/CMakeLists.txt b/app/linux/flutter/CMakeLists.txt similarity index 100% rename from linux/flutter/CMakeLists.txt rename to app/linux/flutter/CMakeLists.txt diff --git a/linux/flutter/generated_plugin_registrant.cc b/app/linux/flutter/generated_plugin_registrant.cc similarity index 100% rename from linux/flutter/generated_plugin_registrant.cc rename to app/linux/flutter/generated_plugin_registrant.cc diff --git a/linux/flutter/generated_plugin_registrant.h b/app/linux/flutter/generated_plugin_registrant.h similarity index 100% rename from linux/flutter/generated_plugin_registrant.h rename to app/linux/flutter/generated_plugin_registrant.h diff --git a/linux/flutter/generated_plugins.cmake b/app/linux/flutter/generated_plugins.cmake similarity index 100% rename from linux/flutter/generated_plugins.cmake rename to app/linux/flutter/generated_plugins.cmake diff --git a/linux/runner/CMakeLists.txt b/app/linux/runner/CMakeLists.txt similarity index 100% rename from linux/runner/CMakeLists.txt rename to app/linux/runner/CMakeLists.txt diff --git a/linux/runner/main.cc b/app/linux/runner/main.cc similarity index 100% rename from linux/runner/main.cc rename to app/linux/runner/main.cc diff --git a/linux/runner/my_application.cc b/app/linux/runner/my_application.cc similarity index 100% rename from linux/runner/my_application.cc rename to app/linux/runner/my_application.cc diff --git a/linux/runner/my_application.h b/app/linux/runner/my_application.h similarity index 100% rename from linux/runner/my_application.h rename to app/linux/runner/my_application.h diff --git a/macos/.gitignore b/app/macos/.gitignore similarity index 100% rename from macos/.gitignore rename to app/macos/.gitignore diff --git a/macos/Flutter/Flutter-Debug.xcconfig b/app/macos/Flutter/Flutter-Debug.xcconfig similarity index 100% rename from macos/Flutter/Flutter-Debug.xcconfig rename to app/macos/Flutter/Flutter-Debug.xcconfig diff --git a/macos/Flutter/Flutter-Release.xcconfig b/app/macos/Flutter/Flutter-Release.xcconfig similarity index 100% rename from macos/Flutter/Flutter-Release.xcconfig rename to app/macos/Flutter/Flutter-Release.xcconfig diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/app/macos/Flutter/GeneratedPluginRegistrant.swift similarity index 100% rename from macos/Flutter/GeneratedPluginRegistrant.swift rename to app/macos/Flutter/GeneratedPluginRegistrant.swift diff --git a/macos/Runner.xcodeproj/project.pbxproj b/app/macos/Runner.xcodeproj/project.pbxproj similarity index 100% rename from macos/Runner.xcodeproj/project.pbxproj rename to app/macos/Runner.xcodeproj/project.pbxproj diff --git a/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/app/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to app/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/app/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme similarity index 100% rename from macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme rename to app/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme diff --git a/macos/Runner.xcworkspace/contents.xcworkspacedata b/app/macos/Runner.xcworkspace/contents.xcworkspacedata similarity index 100% rename from macos/Runner.xcworkspace/contents.xcworkspacedata rename to app/macos/Runner.xcworkspace/contents.xcworkspacedata diff --git a/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/app/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to app/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/macos/Runner/AppDelegate.swift b/app/macos/Runner/AppDelegate.swift similarity index 100% rename from macos/Runner/AppDelegate.swift rename to app/macos/Runner/AppDelegate.swift diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/app/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json rename to app/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png similarity index 100% rename from macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png rename to app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png similarity index 100% rename from macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png rename to app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png similarity index 100% rename from macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png rename to app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png similarity index 100% rename from macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png rename to app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png similarity index 100% rename from macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png rename to app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png similarity index 100% rename from macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png rename to app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png similarity index 100% rename from macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png rename to app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png diff --git a/macos/Runner/Base.lproj/MainMenu.xib b/app/macos/Runner/Base.lproj/MainMenu.xib similarity index 100% rename from macos/Runner/Base.lproj/MainMenu.xib rename to app/macos/Runner/Base.lproj/MainMenu.xib diff --git a/macos/Runner/Configs/AppInfo.xcconfig b/app/macos/Runner/Configs/AppInfo.xcconfig similarity index 100% rename from macos/Runner/Configs/AppInfo.xcconfig rename to app/macos/Runner/Configs/AppInfo.xcconfig diff --git a/macos/Runner/Configs/Debug.xcconfig b/app/macos/Runner/Configs/Debug.xcconfig similarity index 100% rename from macos/Runner/Configs/Debug.xcconfig rename to app/macos/Runner/Configs/Debug.xcconfig diff --git a/macos/Runner/Configs/Release.xcconfig b/app/macos/Runner/Configs/Release.xcconfig similarity index 100% rename from macos/Runner/Configs/Release.xcconfig rename to app/macos/Runner/Configs/Release.xcconfig diff --git a/macos/Runner/Configs/Warnings.xcconfig b/app/macos/Runner/Configs/Warnings.xcconfig similarity index 100% rename from macos/Runner/Configs/Warnings.xcconfig rename to app/macos/Runner/Configs/Warnings.xcconfig diff --git a/macos/Runner/DebugProfile.entitlements b/app/macos/Runner/DebugProfile.entitlements similarity index 100% rename from macos/Runner/DebugProfile.entitlements rename to app/macos/Runner/DebugProfile.entitlements diff --git a/macos/Runner/Info.plist b/app/macos/Runner/Info.plist similarity index 100% rename from macos/Runner/Info.plist rename to app/macos/Runner/Info.plist diff --git a/macos/Runner/MainFlutterWindow.swift b/app/macos/Runner/MainFlutterWindow.swift similarity index 100% rename from macos/Runner/MainFlutterWindow.swift rename to app/macos/Runner/MainFlutterWindow.swift diff --git a/macos/Runner/Release.entitlements b/app/macos/Runner/Release.entitlements similarity index 100% rename from macos/Runner/Release.entitlements rename to app/macos/Runner/Release.entitlements diff --git a/macos/RunnerTests/RunnerTests.swift b/app/macos/RunnerTests/RunnerTests.swift similarity index 100% rename from macos/RunnerTests/RunnerTests.swift rename to app/macos/RunnerTests/RunnerTests.swift diff --git a/app/pubspec.yaml b/app/pubspec.yaml new file mode 100644 index 0000000..5e37143 --- /dev/null +++ b/app/pubspec.yaml @@ -0,0 +1,98 @@ +name: dispatch +description: "A Flutter app to simulate ambulance dispatching." +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# 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: 1.0.0+1 + +resolution: workspace +environment: + sdk: ^3.8.0 + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.8 + google_maps_flutter: ^2.12.1 + flutter_google_maps_webservices: ^1.1.1 + provider: ^6.1.5 + go_router: ^15.1.1 + gap: ^3.0.1 + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^5.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + assets: + - assets/images/ + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/to/resolution-aware-images + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/to/asset-from-package + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/to/font-from-package diff --git a/test/widget_test.dart b/app/test/widget_test.dart similarity index 100% rename from test/widget_test.dart rename to app/test/widget_test.dart diff --git a/web/favicon.png b/app/web/favicon.png similarity index 100% rename from web/favicon.png rename to app/web/favicon.png diff --git a/web/icons/Icon-192.png b/app/web/icons/Icon-192.png similarity index 100% rename from web/icons/Icon-192.png rename to app/web/icons/Icon-192.png diff --git a/web/icons/Icon-512.png b/app/web/icons/Icon-512.png similarity index 100% rename from web/icons/Icon-512.png rename to app/web/icons/Icon-512.png diff --git a/web/icons/Icon-maskable-192.png b/app/web/icons/Icon-maskable-192.png similarity index 100% rename from web/icons/Icon-maskable-192.png rename to app/web/icons/Icon-maskable-192.png diff --git a/web/icons/Icon-maskable-512.png b/app/web/icons/Icon-maskable-512.png similarity index 100% rename from web/icons/Icon-maskable-512.png rename to app/web/icons/Icon-maskable-512.png diff --git a/web/index.html b/app/web/index.html similarity index 100% rename from web/index.html rename to app/web/index.html diff --git a/web/manifest.json b/app/web/manifest.json similarity index 100% rename from web/manifest.json rename to app/web/manifest.json diff --git a/windows/.gitignore b/app/windows/.gitignore similarity index 100% rename from windows/.gitignore rename to app/windows/.gitignore diff --git a/windows/CMakeLists.txt b/app/windows/CMakeLists.txt similarity index 100% rename from windows/CMakeLists.txt rename to app/windows/CMakeLists.txt diff --git a/windows/flutter/CMakeLists.txt b/app/windows/flutter/CMakeLists.txt similarity index 100% rename from windows/flutter/CMakeLists.txt rename to app/windows/flutter/CMakeLists.txt diff --git a/windows/flutter/generated_plugin_registrant.cc b/app/windows/flutter/generated_plugin_registrant.cc similarity index 100% rename from windows/flutter/generated_plugin_registrant.cc rename to app/windows/flutter/generated_plugin_registrant.cc diff --git a/windows/flutter/generated_plugin_registrant.h b/app/windows/flutter/generated_plugin_registrant.h similarity index 100% rename from windows/flutter/generated_plugin_registrant.h rename to app/windows/flutter/generated_plugin_registrant.h diff --git a/windows/flutter/generated_plugins.cmake b/app/windows/flutter/generated_plugins.cmake similarity index 100% rename from windows/flutter/generated_plugins.cmake rename to app/windows/flutter/generated_plugins.cmake diff --git a/windows/runner/CMakeLists.txt b/app/windows/runner/CMakeLists.txt similarity index 100% rename from windows/runner/CMakeLists.txt rename to app/windows/runner/CMakeLists.txt diff --git a/windows/runner/Runner.rc b/app/windows/runner/Runner.rc similarity index 100% rename from windows/runner/Runner.rc rename to app/windows/runner/Runner.rc diff --git a/windows/runner/flutter_window.cpp b/app/windows/runner/flutter_window.cpp similarity index 100% rename from windows/runner/flutter_window.cpp rename to app/windows/runner/flutter_window.cpp diff --git a/windows/runner/flutter_window.h b/app/windows/runner/flutter_window.h similarity index 100% rename from windows/runner/flutter_window.h rename to app/windows/runner/flutter_window.h diff --git a/windows/runner/main.cpp b/app/windows/runner/main.cpp similarity index 100% rename from windows/runner/main.cpp rename to app/windows/runner/main.cpp diff --git a/windows/runner/resource.h b/app/windows/runner/resource.h similarity index 100% rename from windows/runner/resource.h rename to app/windows/runner/resource.h diff --git a/windows/runner/resources/app_icon.ico b/app/windows/runner/resources/app_icon.ico similarity index 100% rename from windows/runner/resources/app_icon.ico rename to app/windows/runner/resources/app_icon.ico diff --git a/windows/runner/runner.exe.manifest b/app/windows/runner/runner.exe.manifest similarity index 100% rename from windows/runner/runner.exe.manifest rename to app/windows/runner/runner.exe.manifest diff --git a/windows/runner/utils.cpp b/app/windows/runner/utils.cpp similarity index 100% rename from windows/runner/utils.cpp rename to app/windows/runner/utils.cpp diff --git a/windows/runner/utils.h b/app/windows/runner/utils.h similarity index 100% rename from windows/runner/utils.h rename to app/windows/runner/utils.h diff --git a/windows/runner/win32_window.cpp b/app/windows/runner/win32_window.cpp similarity index 100% rename from windows/runner/win32_window.cpp rename to app/windows/runner/win32_window.cpp diff --git a/windows/runner/win32_window.h b/app/windows/runner/win32_window.h similarity index 100% rename from windows/runner/win32_window.h rename to app/windows/runner/win32_window.h diff --git a/dispatch.iml b/dispatch.iml new file mode 100644 index 0000000..3bdd1ca --- /dev/null +++ b/dispatch.iml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 6527efe..fed2bdd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,97 +1,19 @@ -name: dispatch -description: "A new Flutter project." -# The following line prevents the package from being accidentally published to -# pub.dev using `flutter pub publish`. This is preferred for private packages. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev +name: dispatch_suite +description: The dispatch app and server. +version: 0.1.0 +# repository: https://github.com/weasdown/dispatch +publish_to: none -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# In Android, build-name is used as versionName while build-number used as versionCode. -# Read more about Android versioning at https://developer.android.com/studio/publish/versioning -# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. -# Read more about iOS versioning at -# 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: 1.0.0+1 +workspace: + - app + - server environment: - sdk: ^3.7.2 + sdk: ^3.8.0 -# Dependencies specify other packages that your package needs in order to work. -# To automatically upgrade your package dependencies to the latest versions -# consider running `flutter pub upgrade --major-versions`. Alternatively, -# dependencies can be manually updated by changing the version numbers below to -# the latest version available on pub.dev. To see which dependencies have newer -# versions available, run `flutter pub outdated`. -dependencies: - flutter: - sdk: flutter - - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^1.0.8 - google_maps_flutter: ^2.12.1 - flutter_google_maps_webservices: ^1.1.1 - provider: ^6.1.5 - go_router: ^15.1.1 - gap: ^3.0.1 +# Add regular dependencies here. + # path: ^1.8.0 dev_dependencies: - flutter_test: - sdk: flutter - - # The "flutter_lints" package below contains a set of recommended lints to - # encourage good coding practices. The lint set provided by the package is - # activated in the `analysis_options.yaml` file located at the root of your - # package. See that file for information about deactivating specific lint - # rules and activating additional ones. - flutter_lints: ^5.0.0 - -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - -# The following section is specific to Flutter packages. -flutter: - - # The following line ensures that the Material Icons font is - # included with your application, so that you can use the icons in - # the material Icons class. - uses-material-design: true - - # To add assets to your application, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - - assets: - - assets/images/ - - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/to/resolution-aware-images - - # For details regarding adding assets from package dependencies, see - # https://flutter.dev/to/asset-from-package - - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/to/font-from-package + lints: ^5.0.0 + test: ^1.24.0 diff --git a/server/.gitignore b/server/.gitignore new file mode 100644 index 0000000..3cceda5 --- /dev/null +++ b/server/.gitignore @@ -0,0 +1,7 @@ +# https://dart.dev/guides/libraries/private-files +# Created by `dart pub` +.dart_tool/ + +# Avoid committing pubspec.lock for library packages; see +# https://dart.dev/guides/libraries/private-files#pubspeclock. +pubspec.lock diff --git a/server/CHANGELOG.md b/server/CHANGELOG.md new file mode 100644 index 0000000..effe43c --- /dev/null +++ b/server/CHANGELOG.md @@ -0,0 +1,3 @@ +## 1.0.0 + +- Initial version. diff --git a/server/README.md b/server/README.md new file mode 100644 index 0000000..8831761 --- /dev/null +++ b/server/README.md @@ -0,0 +1,39 @@ + + +TODO: Put a short description of the package here that helps potential users +know whether this package might be useful for them. + +## Features + +TODO: List what your package can do. Maybe include images, gifs, or videos. + +## Getting started + +TODO: List prerequisites and provide or point to information on how to +start using the package. + +## Usage + +TODO: Include short and useful examples for package users. Add longer examples +to `/example` folder. + +```dart +const like = 'sample'; +``` + +## Additional information + +TODO: Tell users more about the package: where to find more information, how to +contribute to the package, how to file issues, what response they can expect +from the package authors, and more. diff --git a/server/analysis_options.yaml b/server/analysis_options.yaml new file mode 100644 index 0000000..dee8927 --- /dev/null +++ b/server/analysis_options.yaml @@ -0,0 +1,30 @@ +# This file configures the static analysis results for your project (errors, +# warnings, and lints). +# +# This enables the 'recommended' set of lints from `package:lints`. +# This set helps identify many issues that may lead to problems when running +# or consuming Dart code, and enforces writing Dart using a single, idiomatic +# style and format. +# +# If you want a smaller set of lints you can change this to specify +# 'package:lints/core.yaml'. These are just the most critical lints +# (the recommended set includes the core lints). +# The core lints are also what is used by pub.dev for scoring packages. + +include: package:lints/recommended.yaml + +# Uncomment the following section to specify additional rules. + +# linter: +# rules: +# - camel_case_types + +# analyzer: +# exclude: +# - path/to/excluded/files/** + +# For more information about the core and recommended set of lints, see +# https://dart.dev/go/core-lints + +# For additional information about configuring this file, see +# https://dart.dev/guides/language/analysis-options diff --git a/server/example/server_example.dart b/server/example/server_example.dart new file mode 100644 index 0000000..b32a4ff --- /dev/null +++ b/server/example/server_example.dart @@ -0,0 +1,6 @@ +import 'package:server/server.dart'; + +void main() { + WebSocketServer server = WebSocketServer(); + print(server); +} diff --git a/server/lib/server.dart b/server/lib/server.dart new file mode 100644 index 0000000..e343fbd --- /dev/null +++ b/server/lib/server.dart @@ -0,0 +1,8 @@ +/// Support for doing something awesome. +/// +/// More dartdocs go here. +library; + +export 'src/server_base.dart'; + +// TODO: Export any libraries intended for clients of this package. diff --git a/server/lib/src/server_base.dart b/server/lib/src/server_base.dart new file mode 100644 index 0000000..7e12c67 --- /dev/null +++ b/server/lib/src/server_base.dart @@ -0,0 +1,59 @@ +import 'dart:convert'; +import 'dart:io'; +import 'package:shelf/shelf.dart' show Handler; +import 'package:shelf/shelf_io.dart' as shelf_io; +import 'package:shelf_web_socket/shelf_web_socket.dart'; + +/// A server that provides a WebSocket connection. +class WebSocketServer { + WebSocketServer._({String? host, int? port}) + : host = host ?? _defaultHost, + _port = port ?? _defaultPort; + + /// Creates a server without immediately running it. + WebSocketServer.pending({String? host, int? port}) + : this._(host: host, port: port); + + /// Creates a server and immediately runs it. + factory WebSocketServer({String? host, int? port}) => + WebSocketServer._(host: host, port: port).._serve(); + + @Deprecated('messageFromJSON is pending removal.') + static Map messageFromJSON(String message) { + try { + return jsonDecode(message); + } on FormatException { + throw ArgumentError('message is not a valid JSON.'); + } + } + + static final Handler coreHandler = webSocketHandler((webSocket, _) { + webSocket.stream.listen((message) async { + print('Received message: $message'); + + Map messageJSON = messageFromJSON(message); + print('Message JSON: $messageJSON'); + + // TODO implement response. + final String response = 'A placeholder response'; + + // Send the response back to the sender. + webSocket.sink.add(json.encode({'response': response})); + }); + }); + + static const String _defaultHost = 'localhost'; + + static const int _defaultPort = 8080; + + final String host; + + final int _port; + + // FIXME refactor so server is higher-level than dart:io's HttpServer. Currently crashes when run on web because HttpServer isn't supported on web. + Future _serve() async => + shelf_io.serve(coreHandler, host, _port).then((HttpServer server) { + print('Serving at ws://${server.address.host}:${server.port}'); + return server; + }); +} diff --git a/server/pubspec.yaml b/server/pubspec.yaml new file mode 100644 index 0000000..81fa91f --- /dev/null +++ b/server/pubspec.yaml @@ -0,0 +1,18 @@ +name: server +description: A starting point for Dart libraries or applications. +version: 1.0.0 +# repository: https://github.com/my_org/my_repo + +resolution: workspace +environment: + sdk: ^3.8.0 + +# Add regular dependencies here. +dependencies: + shelf: ^1.4.2 + shelf_web_socket: ^3.0.0 + # path: ^1.8.0 + +dev_dependencies: + lints: ^5.0.0 + test: ^1.24.0 diff --git a/server/test/server_test.dart b/server/test/server_test.dart new file mode 100644 index 0000000..edfae9b --- /dev/null +++ b/server/test/server_test.dart @@ -0,0 +1,15 @@ +import 'package:server/server.dart'; +import 'package:test/test.dart'; + +void main() { + group('A group of tests', () { + setUp(() { + // Additional setup goes here. + }); + + test('First Test', () { + WebSocketServer server = WebSocketServer(); + print(server); + }); + }); +} From c917e4556e5f741a9dcbd186114f227f448db79d Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Sun, 25 May 2025 22:12:29 +0100 Subject: [PATCH 02/42] refactor: rename server_base.dart to web_socket_server.dart --- server/lib/server.dart | 2 +- server/lib/src/{server_base.dart => web_socket_server.dart} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename server/lib/src/{server_base.dart => web_socket_server.dart} (100%) diff --git a/server/lib/server.dart b/server/lib/server.dart index e343fbd..25dd4fe 100644 --- a/server/lib/server.dart +++ b/server/lib/server.dart @@ -3,6 +3,6 @@ /// More dartdocs go here. library; -export 'src/server_base.dart'; +export 'src/web_socket_server.dart'; // TODO: Export any libraries intended for clients of this package. diff --git a/server/lib/src/server_base.dart b/server/lib/src/web_socket_server.dart similarity index 100% rename from server/lib/src/server_base.dart rename to server/lib/src/web_socket_server.dart From ee569d00ade4997fdec532de32d8173493b2536a Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Sun, 25 May 2025 22:13:55 +0100 Subject: [PATCH 03/42] style: auto-formatting --- server/lib/src/web_socket_server.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/server/lib/src/web_socket_server.dart b/server/lib/src/web_socket_server.dart index 7e12c67..9a201d9 100644 --- a/server/lib/src/web_socket_server.dart +++ b/server/lib/src/web_socket_server.dart @@ -1,5 +1,6 @@ import 'dart:convert'; import 'dart:io'; + import 'package:shelf/shelf.dart' show Handler; import 'package:shelf/shelf_io.dart' as shelf_io; import 'package:shelf_web_socket/shelf_web_socket.dart'; From 25fe6eae7600b07a1beced3d39be567455c38d59 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Sun, 25 May 2025 22:18:51 +0100 Subject: [PATCH 04/42] refactor: rename unnamed constructor to run() --- server/example/server_example.dart | 2 +- server/lib/src/web_socket_server.dart | 2 +- server/test/server_test.dart | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/example/server_example.dart b/server/example/server_example.dart index b32a4ff..1c1fdcd 100644 --- a/server/example/server_example.dart +++ b/server/example/server_example.dart @@ -1,6 +1,6 @@ import 'package:server/server.dart'; void main() { - WebSocketServer server = WebSocketServer(); + WebSocketServer server = WebSocketServer.run(); print(server); } diff --git a/server/lib/src/web_socket_server.dart b/server/lib/src/web_socket_server.dart index 9a201d9..50a2eec 100644 --- a/server/lib/src/web_socket_server.dart +++ b/server/lib/src/web_socket_server.dart @@ -16,7 +16,7 @@ class WebSocketServer { : this._(host: host, port: port); /// Creates a server and immediately runs it. - factory WebSocketServer({String? host, int? port}) => + factory WebSocketServer.run({String? host, int? port}) => WebSocketServer._(host: host, port: port).._serve(); @Deprecated('messageFromJSON is pending removal.') diff --git a/server/test/server_test.dart b/server/test/server_test.dart index edfae9b..dc8d0f1 100644 --- a/server/test/server_test.dart +++ b/server/test/server_test.dart @@ -8,7 +8,7 @@ void main() { }); test('First Test', () { - WebSocketServer server = WebSocketServer(); + WebSocketServer server = WebSocketServer.run(); print(server); }); }); From 6118ca9d091843eb5fc4567c49153c9b8a22dc55 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Sun, 25 May 2025 22:19:36 +0100 Subject: [PATCH 05/42] feat: add main.dart entrypoint for server package --- server/lib/main.dart | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 server/lib/main.dart diff --git a/server/lib/main.dart b/server/lib/main.dart new file mode 100644 index 0000000..82e0a9d --- /dev/null +++ b/server/lib/main.dart @@ -0,0 +1,5 @@ +import 'package:server/server.dart'; + +void main() { + WebSocketServer.run(); +} From 11f87164e923369450871a783762a3f1af6ea4ba Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Sun, 25 May 2025 22:26:16 +0100 Subject: [PATCH 06/42] fix: correct dispatch app version to 0.1.0 from 1.0.0 --- app/pubspec.yaml | 2 +- server/pubspec.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/pubspec.yaml b/app/pubspec.yaml index 5e37143..d061a47 100644 --- a/app/pubspec.yaml +++ b/app/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: 1.0.0+1 +version: 0.1.0+1 resolution: workspace environment: diff --git a/server/pubspec.yaml b/server/pubspec.yaml index 81fa91f..c70f65b 100644 --- a/server/pubspec.yaml +++ b/server/pubspec.yaml @@ -9,6 +9,7 @@ environment: # Add regular dependencies here. dependencies: + dispatch: ^0.1.0+1 shelf: ^1.4.2 shelf_web_socket: ^3.0.0 # path: ^1.8.0 From e9e591d0862948541f9512858f8487dbd8900568 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Sun, 25 May 2025 22:27:54 +0100 Subject: [PATCH 07/42] feat: add _units list in WebSocketServer --- server/lib/src/web_socket_server.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/lib/src/web_socket_server.dart b/server/lib/src/web_socket_server.dart index 50a2eec..25b85e4 100644 --- a/server/lib/src/web_socket_server.dart +++ b/server/lib/src/web_socket_server.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'dart:io'; +import 'package:dispatch/domain/models/unit/unit.dart'; import 'package:shelf/shelf.dart' show Handler; import 'package:shelf/shelf_io.dart' as shelf_io; import 'package:shelf_web_socket/shelf_web_socket.dart'; @@ -9,7 +10,8 @@ import 'package:shelf_web_socket/shelf_web_socket.dart'; class WebSocketServer { WebSocketServer._({String? host, int? port}) : host = host ?? _defaultHost, - _port = port ?? _defaultPort; + _port = port ?? _defaultPort, + _units = []; /// Creates a server without immediately running it. WebSocketServer.pending({String? host, int? port}) @@ -51,6 +53,8 @@ class WebSocketServer { final int _port; + List _units; + // FIXME refactor so server is higher-level than dart:io's HttpServer. Currently crashes when run on web because HttpServer isn't supported on web. Future _serve() async => shelf_io.serve(coreHandler, host, _port).then((HttpServer server) { From a0368a51282485069230aaf5c5146022753463ec Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Sun, 25 May 2025 22:28:10 +0100 Subject: [PATCH 08/42] feat: add placeholder WebSocketServer.units getter --- server/lib/src/web_socket_server.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/lib/src/web_socket_server.dart b/server/lib/src/web_socket_server.dart index 25b85e4..c0e99b9 100644 --- a/server/lib/src/web_socket_server.dart +++ b/server/lib/src/web_socket_server.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'dart:io'; import 'package:dispatch/domain/models/unit/unit.dart'; +import 'package:dispatch/utils/result.dart'; import 'package:shelf/shelf.dart' show Handler; import 'package:shelf/shelf_io.dart' as shelf_io; import 'package:shelf_web_socket/shelf_web_socket.dart'; @@ -49,6 +50,9 @@ class WebSocketServer { static const int _defaultPort = 8080; + /// Gets all the [Unit]s currently connected to (but not necessarily logged in to) this server. + Future>> get units async => Future(() => Result.ok(_units)); + final String host; final int _port; From a34ea82af0f7dfa6318c21424260ae8e4db82881 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Sun, 25 May 2025 22:33:55 +0100 Subject: [PATCH 09/42] style: sort WebSocketServer members alphabetically --- server/lib/src/web_socket_server.dart | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/server/lib/src/web_socket_server.dart b/server/lib/src/web_socket_server.dart index c0e99b9..68a3cfd 100644 --- a/server/lib/src/web_socket_server.dart +++ b/server/lib/src/web_socket_server.dart @@ -22,15 +22,6 @@ class WebSocketServer { factory WebSocketServer.run({String? host, int? port}) => WebSocketServer._(host: host, port: port).._serve(); - @Deprecated('messageFromJSON is pending removal.') - static Map messageFromJSON(String message) { - try { - return jsonDecode(message); - } on FormatException { - throw ArgumentError('message is not a valid JSON.'); - } - } - static final Handler coreHandler = webSocketHandler((webSocket, _) { webSocket.stream.listen((message) async { print('Received message: $message'); @@ -50,14 +41,18 @@ class WebSocketServer { static const int _defaultPort = 8080; - /// Gets all the [Unit]s currently connected to (but not necessarily logged in to) this server. - Future>> get units async => Future(() => Result.ok(_units)); - final String host; - final int _port; + @Deprecated('messageFromJSON is pending removal.') + static Map messageFromJSON(String message) { + try { + return jsonDecode(message); + } on FormatException { + throw ArgumentError('message is not a valid JSON.'); + } + } - List _units; + final int _port; // FIXME refactor so server is higher-level than dart:io's HttpServer. Currently crashes when run on web because HttpServer isn't supported on web. Future _serve() async => @@ -65,4 +60,9 @@ class WebSocketServer { print('Serving at ws://${server.address.host}:${server.port}'); return server; }); + + List _units; + + /// Gets all the [Unit]s currently connected to (but not necessarily logged in to) this server. + Future>> get units async => Future(() => Result.ok(_units)); } From ac39a8d1534c4cebcdff341134e76ce9d720df6e Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Sun, 25 May 2025 22:34:38 +0100 Subject: [PATCH 10/42] revert: comment out Deprecated annotation on WebSocketServer.messageFromJSON() --- server/lib/src/web_socket_server.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/lib/src/web_socket_server.dart b/server/lib/src/web_socket_server.dart index 68a3cfd..776df15 100644 --- a/server/lib/src/web_socket_server.dart +++ b/server/lib/src/web_socket_server.dart @@ -43,7 +43,7 @@ class WebSocketServer { final String host; - @Deprecated('messageFromJSON is pending removal.') + // @Deprecated('messageFromJSON is pending removal.') static Map messageFromJSON(String message) { try { return jsonDecode(message); From 077e8c1a0aa595a0488b3246a580224c02603c56 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Sun, 25 May 2025 22:37:38 +0100 Subject: [PATCH 11/42] feat: add Events storage in WebSocketServer --- server/lib/src/web_socket_server.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/lib/src/web_socket_server.dart b/server/lib/src/web_socket_server.dart index 776df15..992fe11 100644 --- a/server/lib/src/web_socket_server.dart +++ b/server/lib/src/web_socket_server.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'dart:io'; +import 'package:dispatch/domain/models/event.dart'; import 'package:dispatch/domain/models/unit/unit.dart'; import 'package:dispatch/utils/result.dart'; import 'package:shelf/shelf.dart' show Handler; @@ -12,6 +13,7 @@ class WebSocketServer { WebSocketServer._({String? host, int? port}) : host = host ?? _defaultHost, _port = port ?? _defaultPort, + _events = [], _units = []; /// Creates a server without immediately running it. @@ -41,6 +43,8 @@ class WebSocketServer { static const int _defaultPort = 8080; + List _events; + final String host; // @Deprecated('messageFromJSON is pending removal.') From 27e2bf3eeaf916b0286470f9a506465acca01cc0 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Sun, 25 May 2025 22:40:38 +0100 Subject: [PATCH 12/42] feat: add WebSocketServer.add() method --- server/lib/src/web_socket_server.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/lib/src/web_socket_server.dart b/server/lib/src/web_socket_server.dart index 992fe11..29a9d10 100644 --- a/server/lib/src/web_socket_server.dart +++ b/server/lib/src/web_socket_server.dart @@ -24,6 +24,13 @@ class WebSocketServer { factory WebSocketServer.run({String? host, int? port}) => WebSocketServer._(host: host, port: port).._serve(); + /// Adds an item to its respective list. + Future> add(T item) => switch (T) { + Unit _ => Future(() => Result.ok(_units.add(item as Unit))), + Event _ => Future(() => Result.ok(_events.add(item as Event))), + _ => throw TypeError(), + }; + static final Handler coreHandler = webSocketHandler((webSocket, _) { webSocket.stream.listen((message) async { print('Received message: $message'); From edb60baa6589b1a58464c834bf853f9f7b989039 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Sun, 25 May 2025 22:45:41 +0100 Subject: [PATCH 13/42] feat: add example units and events --- server/lib/default_data.dart | 17 +++++++++++++++++ server/pubspec.yaml | 1 + 2 files changed, 18 insertions(+) create mode 100644 server/lib/default_data.dart diff --git a/server/lib/default_data.dart b/server/lib/default_data.dart new file mode 100644 index 0000000..6ab322b --- /dev/null +++ b/server/lib/default_data.dart @@ -0,0 +1,17 @@ +import 'package:dispatch/domain/models/event.dart'; +import 'package:dispatch/domain/models/unit/unit.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; + +/// Some example [Unit]s. +List defaultUnits = [ + Unit(callsign: 'NA312', location: LatLng(51.5, 0.51)), + Unit(callsign: 'NA212', location: LatLng(51.7, 0.54)), + Unit(callsign: 'NR101', location: LatLng(52.5, 0.46)), + Unit(callsign: 'NT497', location: LatLng(51.0, 0.034)), +]; + +/// Some example [Event]s. +List defaultEvents = [ + Event.preAlert(id: 12345, address: '22 Barley Street, Oxford'), + Event.preAlert(id: 12455, address: '153 Acacia Avenue, Milton Keynes'), +]; diff --git a/server/pubspec.yaml b/server/pubspec.yaml index c70f65b..a6e63bd 100644 --- a/server/pubspec.yaml +++ b/server/pubspec.yaml @@ -10,6 +10,7 @@ environment: # Add regular dependencies here. dependencies: dispatch: ^0.1.0+1 + google_maps_flutter: ^2.12.2 shelf: ^1.4.2 shelf_web_socket: ^3.0.0 # path: ^1.8.0 From 3db3f73efd933c00e4ddb3b854693e302349b879 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Sun, 25 May 2025 22:46:22 +0100 Subject: [PATCH 14/42] feat: use example units and events --- server/lib/src/web_socket_server.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/lib/src/web_socket_server.dart b/server/lib/src/web_socket_server.dart index 29a9d10..6086602 100644 --- a/server/lib/src/web_socket_server.dart +++ b/server/lib/src/web_socket_server.dart @@ -4,6 +4,7 @@ import 'dart:io'; import 'package:dispatch/domain/models/event.dart'; import 'package:dispatch/domain/models/unit/unit.dart'; import 'package:dispatch/utils/result.dart'; +import 'package:server/default_data.dart'; import 'package:shelf/shelf.dart' show Handler; import 'package:shelf/shelf_io.dart' as shelf_io; import 'package:shelf_web_socket/shelf_web_socket.dart'; @@ -13,8 +14,8 @@ class WebSocketServer { WebSocketServer._({String? host, int? port}) : host = host ?? _defaultHost, _port = port ?? _defaultPort, - _events = [], - _units = []; + _events = defaultEvents, + _units = defaultUnits; /// Creates a server without immediately running it. WebSocketServer.pending({String? host, int? port}) From 91ba2e001c76f537747f0229788a70287198c657 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Sun, 25 May 2025 23:27:32 +0100 Subject: [PATCH 15/42] refactor: move event.dart into new event folder, split out parts dependent on flutter/material.dart --- .../repositories/event/event_repository.dart | 2 +- .../event/event_repository_local.dart | 2 +- app/lib/domain/models/event/category.dart | 28 +++++++ .../domain/models/event/category_colour.dart | 12 +++ app/lib/domain/models/{ => event}/event.dart | 79 ++----------------- .../domain/models/event/event_list_model.dart | 38 +++++++++ app/lib/domain/models/noc.dart | 2 +- app/lib/domain/models/status.dart | 2 +- app/lib/domain/models/unit/unit.dart | 42 +++++----- app/lib/main.dart | 5 +- app/lib/map.dart | 11 ++- .../ui/home/view_models/home_viewmodel.dart | 3 +- server/lib/src/web_socket_server.dart | 18 +++-- 13 files changed, 136 insertions(+), 108 deletions(-) create mode 100644 app/lib/domain/models/event/category.dart create mode 100644 app/lib/domain/models/event/category_colour.dart rename app/lib/domain/models/{ => event}/event.dart (74%) create mode 100644 app/lib/domain/models/event/event_list_model.dart diff --git a/app/lib/data/repositories/event/event_repository.dart b/app/lib/data/repositories/event/event_repository.dart index 03f88c4..6f2bcd2 100644 --- a/app/lib/data/repositories/event/event_repository.dart +++ b/app/lib/data/repositories/event/event_repository.dart @@ -1,4 +1,4 @@ -import '../../../domain/models/event.dart'; +import '../../../domain/models/event/event.dart'; import '../../../utils/result.dart'; /// Data source for events. diff --git a/app/lib/data/repositories/event/event_repository_local.dart b/app/lib/data/repositories/event/event_repository_local.dart index f595ef3..530bb9f 100644 --- a/app/lib/data/repositories/event/event_repository_local.dart +++ b/app/lib/data/repositories/event/event_repository_local.dart @@ -1,4 +1,4 @@ -import '../../../domain/models/event.dart'; +import '../../../domain/models/event/event.dart'; import '../../../domain/models/status.dart'; import '../../../utils/result.dart'; import '../../services/local_data_service.dart'; diff --git a/app/lib/domain/models/event/category.dart b/app/lib/domain/models/event/category.dart new file mode 100644 index 0000000..4c551e3 --- /dev/null +++ b/app/lib/domain/models/event/category.dart @@ -0,0 +1,28 @@ +import '../status.dart'; + +/// The category assigned to an [Event]. +enum Category { + one('1'), + two('2'), + three('3'), + four('4'), + none('0'); + + const Category(this.number); + + List get nocs => switch (this) { + Category.one => catOneNOCs, + Category.two => catTwoNOCs, + Category.three => catThreeNOCs, + Category.four => catFourNOCs, + Category.none => List.empty(), + }; + + final String number; + + @override + String toString() => switch (this) { + Category.none => '', + _ => 'C$number', + }; +} diff --git a/app/lib/domain/models/event/category_colour.dart b/app/lib/domain/models/event/category_colour.dart new file mode 100644 index 0000000..f8de8de --- /dev/null +++ b/app/lib/domain/models/event/category_colour.dart @@ -0,0 +1,12 @@ +import 'package:dispatch/domain/models/event/category.dart'; +import 'package:flutter/material.dart'; + +extension CategoryColour on Category { + Color get colour => switch (this) { + Category.one => Colors.purple, + Category.two => Colors.red, + Category.three => Colors.yellow, + Category.four => Colors.green, + Category.none => Colors.grey, + }; +} diff --git a/app/lib/domain/models/event.dart b/app/lib/domain/models/event/event.dart similarity index 74% rename from app/lib/domain/models/event.dart rename to app/lib/domain/models/event/event.dart index 282b69e..be95cd6 100644 --- a/app/lib/domain/models/event.dart +++ b/app/lib/domain/models/event/event.dart @@ -1,14 +1,14 @@ -import 'dart:collection'; - -import 'package:flutter/material.dart'; +// import 'package:flutter/material.dart'; // import 'package:flutter_google_maps_webservices/geocoding.dart'; // import 'package:google_maps_flutter/google_maps_flutter.dart'; // import '../../../api/maps/geocoding.dart'; // import '../../map.dart'; -import 'status.dart'; -import 'unit/unit.dart'; +// import 'package:flutter/foundation.dart'; +import '../status.dart'; +import '../unit/unit.dart'; +import 'category.dart'; /// An emergency event that the ambulance service has become aware of. class Event { @@ -192,10 +192,9 @@ class Event { // return Marker( // markerId: MarkerId(id), // position: LatLng(lat, lng), - // icon: - // (_iconAsset != null) - // ? markerIcon(_iconAsset!) - // : BitmapDescriptor.defaultMarker, + // icon: (_iconAsset != null) + // ? markerIcon(_iconAsset!) + // : BitmapDescriptor.defaultMarker, // infoWindow: InfoWindow( // title: 'Event $id (cat ${category.number})', // snippet: address, @@ -211,65 +210,3 @@ class Event { Status status; } - -/// Storage for all the events that units will respond to. -class EventListModel extends ChangeNotifier { - EventListModel({required List events}) { - _events.addAll(events); - } - - EventListModel.blank(); - - /// Internal, private state of the event list. - final List _events = []; - - /// An unmodifiable view of the events in the event list. - UnmodifiableListView get events => UnmodifiableListView(_events); - - /// The current total number of events. - int get numEvents => _events.length; - - /// Adds [event] to event list. This and [removeAll] are the only ways to - /// modify the event list from the outside. - void add(Event event) { - _events.add(event); - // This call tells the widgets that are listening to this model to rebuild. - notifyListeners(); - } - - /// Removes all events from the event list. - void removeAll() { - _events.clear(); - // This call tells the widgets that are listening to this model to rebuild. - notifyListeners(); - } -} - -/// The category assigned to an [Event]. -enum Category { - one('1', Colors.purple), - two('2', Colors.red), - three('3', Colors.yellow), - four('4', Colors.green), - none('0', Colors.grey); - - const Category(this.number, this.colour); - - final Color colour; - - List get nocs => switch (this) { - Category.one => catOneNOCs, - Category.two => catTwoNOCs, - Category.three => catThreeNOCs, - Category.four => catFourNOCs, - Category.none => List.empty(), - }; - - final String number; - - @override - String toString() => switch (this) { - Category.none => '', - _ => 'C$number', - }; -} diff --git a/app/lib/domain/models/event/event_list_model.dart b/app/lib/domain/models/event/event_list_model.dart new file mode 100644 index 0000000..088efe1 --- /dev/null +++ b/app/lib/domain/models/event/event_list_model.dart @@ -0,0 +1,38 @@ +import 'dart:collection'; + +import 'package:flutter/foundation.dart'; + +import 'event.dart'; + +/// Storage for all the events that units will respond to. +class EventListModel extends ChangeNotifier { + EventListModel({required List events}) { + _events.addAll(events); + } + + EventListModel.blank(); + + /// Internal, private state of the event list. + final List _events = []; + + /// An unmodifiable view of the events in the event list. + UnmodifiableListView get events => UnmodifiableListView(_events); + + /// The current total number of events. + int get numEvents => _events.length; + + /// Adds [event] to event list. This and [removeAll] are the only ways to + /// modify the event list from the outside. + void add(Event event) { + _events.add(event); + // This call tells the widgets that are listening to this model to rebuild. + notifyListeners(); + } + + /// Removes all events from the event list. + void removeAll() { + _events.clear(); + // This call tells the widgets that are listening to this model to rebuild. + notifyListeners(); + } +} diff --git a/app/lib/domain/models/noc.dart b/app/lib/domain/models/noc.dart index 2b1e453..e8a958b 100644 --- a/app/lib/domain/models/noc.dart +++ b/app/lib/domain/models/noc.dart @@ -1,4 +1,4 @@ -import 'event.dart'; +import 'event/category.dart'; import 'status.dart'; final class Cat1NOC extends NOC { diff --git a/app/lib/domain/models/status.dart b/app/lib/domain/models/status.dart index 91cd3e4..16c8bbe 100644 --- a/app/lib/domain/models/status.dart +++ b/app/lib/domain/models/status.dart @@ -1,4 +1,4 @@ -import 'event.dart'; +import 'event/category.dart'; interface class Status { const Status(this.category, this.description); diff --git a/app/lib/domain/models/unit/unit.dart b/app/lib/domain/models/unit/unit.dart index d3a185a..bf11fd4 100644 --- a/app/lib/domain/models/unit/unit.dart +++ b/app/lib/domain/models/unit/unit.dart @@ -1,6 +1,5 @@ -import 'package:google_maps_flutter/google_maps_flutter.dart'; - -import '../../../map.dart'; +// import 'package:google_maps_flutter/google_maps_flutter.dart' as maps; +import 'package:latlng/latlng.dart'; /// An ambulance vehicle, air ambulance or other resource. class Unit { @@ -13,27 +12,30 @@ class Unit { /// A unique identifier for this resource. final String callsign; - /// Path to the image used as this [Event]'s icon. - String get _iconAsset => switch (vehicleType) { - VehicleType.dca => 'assets/images/dca.png', - VehicleType.rrv => 'assets/images/rrv.png', - VehicleType.helicopter => 'assets/images/tvaa.jpg', - VehicleType.criticalCareCar => 'assets/images/hems-car.png', - }; + // /// Path to the image used as this [Event]'s icon. + // String get _iconAsset => switch (vehicleType) { + // VehicleType.dca => 'assets/images/dca.png', + // VehicleType.rrv => 'assets/images/rrv.png', + // VehicleType.helicopter => 'assets/images/tvaa.jpg', + // VehicleType.criticalCareCar => 'assets/images/hems-car.png', + // }; /// The current latitude and longitude of this unit. LatLng location; - /// Gets a [Marker] for showing this [Unit] on a map. - Marker get mapMarker => Marker( - markerId: MarkerId(callsign), - position: LatLng(location.latitude, location.longitude), - icon: markerIcon(_iconAsset), - infoWindow: InfoWindow( - title: '$callsign (${vehicleType.name})', - snippet: location.toString(), - ), - ); + // /// Gets a [Marker] for showing this [Unit] on a map. + // maps.Marker get mapMarker => maps.Marker( + // markerId: maps.MarkerId(callsign), + // position: maps.LatLng( + // location.latitude.degrees, + // location.longitude.degrees, + // ), + // icon: markerIcon(_iconAsset), + // infoWindow: maps.InfoWindow( + // title: '$callsign (${vehicleType.name})', + // snippet: location.toString(), + // ), + // ); /// The type of vehicle that this is. final VehicleType vehicleType; diff --git a/app/lib/main.dart b/app/lib/main.dart index 5a72d7e..438b7f2 100644 --- a/app/lib/main.dart +++ b/app/lib/main.dart @@ -3,10 +3,7 @@ import 'package:provider/provider.dart'; import 'api/env.dart'; import 'config/dependencies.dart'; -// import 'data/services/local_data_service.dart'; -import 'domain/models/event.dart'; -// import 'domain/models/unit.dart'; -// import 'map.dart'; +import 'domain/models/event/event_list_model.dart'; import 'routing/router.dart'; void main() async { diff --git a/app/lib/map.dart b/app/lib/map.dart index 8f459ba..0e39100 100644 --- a/app/lib/map.dart +++ b/app/lib/map.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'domain/models/event.dart'; +import 'domain/models/event/event.dart'; import 'domain/models/unit/unit.dart'; /// A page that displays a Google Maps map. @@ -41,7 +41,14 @@ class _MapPageState extends State { Set get _markers => { // FIXME fix event markers // ...(showEvents) ? widget.events.map((Event event) => event.mapMarker) : {}, - ...(showUnits) ? widget.units.map((Unit unit) => unit.mapMarker) : {}, + ...(showUnits) + ? widget.units.map( + (Unit unit) => + // FIXME fix Marker + Marker(markerId: MarkerId('PLACEHOLDER ID')), + // unit.mapMarker + ) + : {}, }; Future _onMapCreated(GoogleMapController controller) async { diff --git a/app/lib/ui/home/view_models/home_viewmodel.dart b/app/lib/ui/home/view_models/home_viewmodel.dart index c6f151e..de0dcac 100644 --- a/app/lib/ui/home/view_models/home_viewmodel.dart +++ b/app/lib/ui/home/view_models/home_viewmodel.dart @@ -1,7 +1,8 @@ import 'package:flutter/material.dart'; import '../../../data/repositories/event/event_repository.dart'; -import '../../../domain/models/event.dart'; +import '../../../domain/models/event/category_colour.dart'; +import '../../../domain/models/event/event.dart'; import '../../../utils/result.dart'; class HomeViewModel extends ChangeNotifier { diff --git a/server/lib/src/web_socket_server.dart b/server/lib/src/web_socket_server.dart index 6086602..1ccc3c7 100644 --- a/server/lib/src/web_socket_server.dart +++ b/server/lib/src/web_socket_server.dart @@ -1,10 +1,10 @@ import 'dart:convert'; import 'dart:io'; -import 'package:dispatch/domain/models/event.dart'; +import 'package:dispatch/data/services/local_data_service.dart'; +import 'package:dispatch/domain/models/event/event.dart'; import 'package:dispatch/domain/models/unit/unit.dart'; import 'package:dispatch/utils/result.dart'; -import 'package:server/default_data.dart'; import 'package:shelf/shelf.dart' show Handler; import 'package:shelf/shelf_io.dart' as shelf_io; import 'package:shelf_web_socket/shelf_web_socket.dart'; @@ -14,8 +14,10 @@ class WebSocketServer { WebSocketServer._({String? host, int? port}) : host = host ?? _defaultHost, _port = port ?? _defaultPort, - _events = defaultEvents, - _units = defaultUnits; + _localDataService = LocalDataService() { + _events = _localDataService.events; + _units = _localDataService.units; + } /// Creates a server without immediately running it. WebSocketServer.pending({String? host, int? port}) @@ -51,10 +53,12 @@ class WebSocketServer { static const int _defaultPort = 8080; - List _events; + List _events = []; final String host; + LocalDataService _localDataService; + // @Deprecated('messageFromJSON is pending removal.') static Map messageFromJSON(String message) { try { @@ -70,10 +74,12 @@ class WebSocketServer { Future _serve() async => shelf_io.serve(coreHandler, host, _port).then((HttpServer server) { print('Serving at ws://${server.address.host}:${server.port}'); + print('\t- Current units: $_units'); + print('\t- Current events: $_events'); return server; }); - List _units; + List _units = []; /// Gets all the [Unit]s currently connected to (but not necessarily logged in to) this server. Future>> get units async => Future(() => Result.ok(_units)); From c2735b800df8d0f83e321a9d215e3ac885a24933 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Sun, 25 May 2025 23:27:53 +0100 Subject: [PATCH 16/42] refactor: delete default_data.dart --- server/lib/default_data.dart | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 server/lib/default_data.dart diff --git a/server/lib/default_data.dart b/server/lib/default_data.dart deleted file mode 100644 index 6ab322b..0000000 --- a/server/lib/default_data.dart +++ /dev/null @@ -1,17 +0,0 @@ -import 'package:dispatch/domain/models/event.dart'; -import 'package:dispatch/domain/models/unit/unit.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; - -/// Some example [Unit]s. -List defaultUnits = [ - Unit(callsign: 'NA312', location: LatLng(51.5, 0.51)), - Unit(callsign: 'NA212', location: LatLng(51.7, 0.54)), - Unit(callsign: 'NR101', location: LatLng(52.5, 0.46)), - Unit(callsign: 'NT497', location: LatLng(51.0, 0.034)), -]; - -/// Some example [Event]s. -List defaultEvents = [ - Event.preAlert(id: 12345, address: '22 Barley Street, Oxford'), - Event.preAlert(id: 12455, address: '153 Acacia Avenue, Milton Keynes'), -]; From 34e6a56d98bebae242c78ae93ffa83d9f9a7b897 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Sun, 25 May 2025 23:28:21 +0100 Subject: [PATCH 17/42] refactor: remove dependency of LocalDataService on flutter/material.dart --- app/lib/data/services/local_data_service.dart | 34 ++++++++++++++----- app/pubspec.yaml | 1 + server/pubspec.yaml | 1 + 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/app/lib/data/services/local_data_service.dart b/app/lib/data/services/local_data_service.dart index 137ae5a..89f6051 100644 --- a/app/lib/data/services/local_data_service.dart +++ b/app/lib/data/services/local_data_service.dart @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:latlng/latlng.dart'; -import '../../domain/models/event.dart'; +import '../../domain/models/event/event.dart'; import '../../domain/models/noc.dart'; import '../../domain/models/unit/unit.dart'; import '../../domain/models/user/user.dart'; @@ -28,29 +28,47 @@ class LocalDataService { final List _defaultUnits = [ Unit( callsign: 'NA136', - location: LatLng(51.607539604000266, -1.237806756282358), + location: LatLng( + Angle.degree(51.607539604000266), + Angle.degree(-1.237806756282358), + ), ), Unit( callsign: 'NA283', - location: LatLng(51.616072911907786, -1.2536017723108663), + location: LatLng( + Angle.degree(51.616072911907786), + Angle.degree(-1.2536017723108663), + ), ), Unit( callsign: 'NA072', - location: LatLng(51.8296012219854, -1.3134667111590494), + location: LatLng( + Angle.degree(51.8296012219854), + Angle.degree(-1.3134667111590494), + ), ), Unit( callsign: 'NT431', - location: LatLng(51.397809576171085, -1.3230646597735394), + location: LatLng( + Angle.degree(51.397809576171085), + Angle.degree(-1.3230646597735394), + ), vehicleType: VehicleType.rrv, ), Unit( callsign: 'NR154', - location: LatLng(51.66706110914126, -1.3082872829130447), + location: LatLng( + Angle.degree(51.66706110914126), + Angle.degree(-1.3082872829130447), + ), vehicleType: VehicleType.criticalCareCar, ), Unit( callsign: 'NH58', - location: LatLng(51.61832936052779, -1.0854888181805424), + location: LatLng( + Angle.degree(51.61832936052779), + Angle.degree(-1.0854888181805424), + ), vehicleType: VehicleType.helicopter, ), ]; diff --git a/app/pubspec.yaml b/app/pubspec.yaml index d061a47..72893f6 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -40,6 +40,7 @@ dependencies: provider: ^6.1.5 go_router: ^15.1.1 gap: ^3.0.1 + latlng: ^2.0.7 dev_dependencies: flutter_test: diff --git a/server/pubspec.yaml b/server/pubspec.yaml index a6e63bd..1256e6e 100644 --- a/server/pubspec.yaml +++ b/server/pubspec.yaml @@ -11,6 +11,7 @@ environment: dependencies: dispatch: ^0.1.0+1 google_maps_flutter: ^2.12.2 + latlng: ^2.0.7 shelf: ^1.4.2 shelf_web_socket: ^3.0.0 # path: ^1.8.0 From 19de01dfcc4f724dce2138bed75c7120f6c6a663 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Sun, 25 May 2025 23:29:47 +0100 Subject: [PATCH 18/42] feat: add Event/Unit.toString() overrides --- app/lib/domain/models/event/event.dart | 3 +++ app/lib/domain/models/unit/unit.dart | 3 +++ 2 files changed, 6 insertions(+) diff --git a/app/lib/domain/models/event/event.dart b/app/lib/domain/models/event/event.dart index be95cd6..cfa0d47 100644 --- a/app/lib/domain/models/event/event.dart +++ b/app/lib/domain/models/event/event.dart @@ -209,4 +209,7 @@ class Event { NOC? get noc => _noc; Status status; + + @override + String toString() => 'Event $id'; } diff --git a/app/lib/domain/models/unit/unit.dart b/app/lib/domain/models/unit/unit.dart index bf11fd4..4adf8df 100644 --- a/app/lib/domain/models/unit/unit.dart +++ b/app/lib/domain/models/unit/unit.dart @@ -37,6 +37,9 @@ class Unit { // ), // ); + @override + String toString() => callsign; + /// The type of vehicle that this is. final VehicleType vehicleType; } From bfa728f2621cde4dddd6c78dd7484b0441c37d9c Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Sun, 25 May 2025 23:32:10 +0100 Subject: [PATCH 19/42] fix: fix callsign for HeliMed 24 --- app/lib/data/services/local_data_service.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/data/services/local_data_service.dart b/app/lib/data/services/local_data_service.dart index 89f6051..a7d59bc 100644 --- a/app/lib/data/services/local_data_service.dart +++ b/app/lib/data/services/local_data_service.dart @@ -64,7 +64,7 @@ final List _defaultUnits = [ vehicleType: VehicleType.criticalCareCar, ), Unit( - callsign: 'NH58', + callsign: '0024', location: LatLng( Angle.degree(51.61832936052779), Angle.degree(-1.0854888181805424), From f3803313d916c98edb76022a506b8d9d51e3cab6 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Sun, 25 May 2025 23:35:59 +0100 Subject: [PATCH 20/42] feat: add private LocalDataService._events, _units attributes --- app/lib/data/services/local_data_service.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/lib/data/services/local_data_service.dart b/app/lib/data/services/local_data_service.dart index a7d59bc..a99aeec 100644 --- a/app/lib/data/services/local_data_service.dart +++ b/app/lib/data/services/local_data_service.dart @@ -10,9 +10,15 @@ import '../../domain/models/unit/unit.dart'; import '../../domain/models/user/user.dart'; class LocalDataService { - List get events => _defaultEvents; + LocalDataService() : _events = _defaultEvents, _units = _defaultUnits; - List get units => _defaultUnits; + final List _events; + + List get events => _events; + + final List _units; + + List get units => _units; User get user { return const User( From 99139fb15ca05f3a35fce56418293068f6efe6fc Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Sun, 25 May 2025 23:39:46 +0100 Subject: [PATCH 21/42] refactor: move Unit._iconAsset, mapMarker getters to new unit_map_marker.dart * Avoids dependency on flutter/material.dart via package google_maps_flutter --- app/lib/domain/models/unit/unit.dart | 23 ----------------- .../domain/models/unit/unit_map_marker.dart | 25 +++++++++++++++++++ app/lib/map.dart | 9 +------ 3 files changed, 26 insertions(+), 31 deletions(-) create mode 100644 app/lib/domain/models/unit/unit_map_marker.dart diff --git a/app/lib/domain/models/unit/unit.dart b/app/lib/domain/models/unit/unit.dart index 4adf8df..ffe1c5f 100644 --- a/app/lib/domain/models/unit/unit.dart +++ b/app/lib/domain/models/unit/unit.dart @@ -1,4 +1,3 @@ -// import 'package:google_maps_flutter/google_maps_flutter.dart' as maps; import 'package:latlng/latlng.dart'; /// An ambulance vehicle, air ambulance or other resource. @@ -12,31 +11,9 @@ class Unit { /// A unique identifier for this resource. final String callsign; - // /// Path to the image used as this [Event]'s icon. - // String get _iconAsset => switch (vehicleType) { - // VehicleType.dca => 'assets/images/dca.png', - // VehicleType.rrv => 'assets/images/rrv.png', - // VehicleType.helicopter => 'assets/images/tvaa.jpg', - // VehicleType.criticalCareCar => 'assets/images/hems-car.png', - // }; - /// The current latitude and longitude of this unit. LatLng location; - // /// Gets a [Marker] for showing this [Unit] on a map. - // maps.Marker get mapMarker => maps.Marker( - // markerId: maps.MarkerId(callsign), - // position: maps.LatLng( - // location.latitude.degrees, - // location.longitude.degrees, - // ), - // icon: markerIcon(_iconAsset), - // infoWindow: maps.InfoWindow( - // title: '$callsign (${vehicleType.name})', - // snippet: location.toString(), - // ), - // ); - @override String toString() => callsign; diff --git a/app/lib/domain/models/unit/unit_map_marker.dart b/app/lib/domain/models/unit/unit_map_marker.dart new file mode 100644 index 0000000..82b07c5 --- /dev/null +++ b/app/lib/domain/models/unit/unit_map_marker.dart @@ -0,0 +1,25 @@ +import 'package:dispatch/domain/models/unit/unit.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; + +import '../../../map.dart'; + +extension UnitMapMarker on Unit { + /// Path to the image used as this [Event]'s icon. + String get _iconAsset => switch (vehicleType) { + VehicleType.dca => 'assets/images/dca.png', + VehicleType.rrv => 'assets/images/rrv.png', + VehicleType.helicopter => 'assets/images/tvaa.jpg', + VehicleType.criticalCareCar => 'assets/images/hems-car.png', + }; + + /// Gets a [Marker] for showing this [Unit] on a map. + Marker get mapMarker => Marker( + markerId: MarkerId(callsign), + position: LatLng(location.latitude.degrees, location.longitude.degrees), + icon: markerIcon(_iconAsset), + infoWindow: InfoWindow( + title: '$callsign (${vehicleType.name})', + snippet: location.toString(), + ), + ); +} diff --git a/app/lib/map.dart b/app/lib/map.dart index 0e39100..6a5d88a 100644 --- a/app/lib/map.dart +++ b/app/lib/map.dart @@ -41,14 +41,7 @@ class _MapPageState extends State { Set get _markers => { // FIXME fix event markers // ...(showEvents) ? widget.events.map((Event event) => event.mapMarker) : {}, - ...(showUnits) - ? widget.units.map( - (Unit unit) => - // FIXME fix Marker - Marker(markerId: MarkerId('PLACEHOLDER ID')), - // unit.mapMarker - ) - : {}, + ...(showUnits) ? widget.units.map((Unit unit) => unit.mapMarker) : {}, }; Future _onMapCreated(GoogleMapController controller) async { From b8451e7e384f94fb806e41c0125eaf5828548b78 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Sun, 25 May 2025 23:45:44 +0100 Subject: [PATCH 22/42] refactor: move Event._iconAsset, mapMarker getters to new event_map_marker.dart * Avoids dependency on flutter/material.dart via package google_maps_flutter --- app/lib/domain/models/event/event.dart | 33 +++--------------- .../domain/models/event/event_map_marker.dart | 34 +++++++++++++++++++ app/lib/map.dart | 4 ++- 3 files changed, 41 insertions(+), 30 deletions(-) create mode 100644 app/lib/domain/models/event/event_map_marker.dart diff --git a/app/lib/domain/models/event/event.dart b/app/lib/domain/models/event/event.dart index cfa0d47..ad665a8 100644 --- a/app/lib/domain/models/event/event.dart +++ b/app/lib/domain/models/event/event.dart @@ -6,6 +6,8 @@ // import '../../../api/maps/geocoding.dart'; // import '../../map.dart'; // import 'package:flutter/foundation.dart'; +import 'package:latlng/latlng.dart'; + import '../status.dart'; import '../unit/unit.dart'; import 'category.dart'; @@ -160,21 +162,11 @@ class Event { Category category; - // // TODO vary the icon based on the category of event. - // /// Path to the image used as this [Event]'s icon. - // String? get _iconAsset => null; - /// A unique numerical identifier. final int id; - // /// Latitude. - // double get lat => location.lat; - // - // /// Longitude. - // double get lng => location.lng; - // - // /// The latitude and longitude of the emergency. - // late Location location; + /// The latitude and longitude of the emergency. + late LatLng location; // /// Returns the latitude and longitude of a given street [address]. // Future _locationFromAddress() async { @@ -185,23 +177,6 @@ class Event { // return location; // } - // /// Gets a [Marker] for showing this [Event] on a map. - // Marker get mapMarker { - // final String id = this.id.toString(); - // - // return Marker( - // markerId: MarkerId(id), - // position: LatLng(lat, lng), - // icon: (_iconAsset != null) - // ? markerIcon(_iconAsset!) - // : BitmapDescriptor.defaultMarker, - // infoWindow: InfoWindow( - // title: 'Event $id (cat ${category.number})', - // snippet: address, - // ), - // ); - // } - /// Nature of Call. NOC? _noc; diff --git a/app/lib/domain/models/event/event_map_marker.dart b/app/lib/domain/models/event/event_map_marker.dart new file mode 100644 index 0000000..6654f97 --- /dev/null +++ b/app/lib/domain/models/event/event_map_marker.dart @@ -0,0 +1,34 @@ +import 'package:google_maps_flutter/google_maps_flutter.dart'; + +import '../../../map.dart'; +import 'event.dart'; + +extension EventMapMarker on Event { + // TODO vary the icon based on the category of event. + /// Path to the image used as this [Event]'s icon. + String? get _iconAsset => + throw UnimplementedError('Event._iconAsset is not yet implemented.'); + + /// Latitude. + double get lat => location.latitude.degrees; + + /// Longitude. + double get lng => location.longitude.degrees; + + /// Gets a [Marker] for showing this [Event] on a map. + Marker get mapMarker { + final String id = this.id.toString(); + + return Marker( + markerId: MarkerId(id), + position: LatLng(lat, lng), + icon: (_iconAsset != null) + ? markerIcon(_iconAsset!) + : BitmapDescriptor.defaultMarker, + infoWindow: InfoWindow( + title: 'Event $id (cat ${category.number})', + snippet: address, + ), + ); + } +} diff --git a/app/lib/map.dart b/app/lib/map.dart index 6a5d88a..145dec4 100644 --- a/app/lib/map.dart +++ b/app/lib/map.dart @@ -2,7 +2,9 @@ import 'package:flutter/material.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'domain/models/event/event.dart'; +// import 'domain/models/event/event_map_marker.dart'; import 'domain/models/unit/unit.dart'; +import 'domain/models/unit/unit_map_marker.dart'; /// A page that displays a Google Maps map. class MapPage extends StatefulWidget { @@ -39,7 +41,7 @@ class _MapPageState extends State { bool showUnits = true; Set get _markers => { - // FIXME fix event markers + // // FIXME fix _iconAsset for event markers // ...(showEvents) ? widget.events.map((Event event) => event.mapMarker) : {}, ...(showUnits) ? widget.units.map((Unit unit) => unit.mapMarker) : {}, }; From 174b2f62d219819ceb68b8cb19acffd7ba5772c8 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Sun, 25 May 2025 23:47:45 +0100 Subject: [PATCH 23/42] docs: remove redundant TODO --- server/lib/server.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/server/lib/server.dart b/server/lib/server.dart index 25dd4fe..fe7236c 100644 --- a/server/lib/server.dart +++ b/server/lib/server.dart @@ -4,5 +4,3 @@ library; export 'src/web_socket_server.dart'; - -// TODO: Export any libraries intended for clients of this package. From f9102cb0df48bd07b65fb83d9f4d2bc68f5d0a8e Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Mon, 26 May 2025 00:47:56 +0100 Subject: [PATCH 24/42] feat: add Category.toJson() --- app/lib/domain/models/event/category.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/lib/domain/models/event/category.dart b/app/lib/domain/models/event/category.dart index 4c551e3..189ea08 100644 --- a/app/lib/domain/models/event/category.dart +++ b/app/lib/domain/models/event/category.dart @@ -20,6 +20,8 @@ enum Category { final String number; + String toJson() => name; + @override String toString() => switch (this) { Category.none => '', From 144b9214ae9c110a0f3b62217f16b01fd863ec3b Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Mon, 26 May 2025 00:54:21 +0100 Subject: [PATCH 25/42] feat: add Event.toJson() --- app/lib/domain/models/event/event.dart | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/lib/domain/models/event/event.dart b/app/lib/domain/models/event/event.dart index ad665a8..57969d7 100644 --- a/app/lib/domain/models/event/event.dart +++ b/app/lib/domain/models/event/event.dart @@ -185,6 +185,15 @@ class Event { Status status; + Map toJson() => { + 'id': id, + 'category': category.toJson(), + 'address': address, + 'assignedUnits': List.from( + assignedUnits.map((Unit assignedUnit) => assignedUnit.callsign), + ), + }; + @override String toString() => 'Event $id'; } From 35075e720e588b45b7c80be761b52fc4f5f897b7 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Mon, 26 May 2025 00:54:52 +0100 Subject: [PATCH 26/42] feat: add Unit.toJson() --- app/lib/domain/models/unit/unit.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/lib/domain/models/unit/unit.dart b/app/lib/domain/models/unit/unit.dart index ffe1c5f..3d4a60b 100644 --- a/app/lib/domain/models/unit/unit.dart +++ b/app/lib/domain/models/unit/unit.dart @@ -14,6 +14,12 @@ class Unit { /// The current latitude and longitude of this unit. LatLng location; + Map toJson() => { + 'callsign': callsign, + 'vehicleType': vehicleType.toString(), + 'location': location.toString(), + }; + @override String toString() => callsign; From c06b5613975848a0c1b8dfc0cb2d6b7a12a889f1 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Mon, 26 May 2025 01:01:47 +0100 Subject: [PATCH 27/42] feat: add CFR option in VehicleType enum --- app/lib/domain/models/unit/unit.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/lib/domain/models/unit/unit.dart b/app/lib/domain/models/unit/unit.dart index 3d4a60b..83d17c6 100644 --- a/app/lib/domain/models/unit/unit.dart +++ b/app/lib/domain/models/unit/unit.dart @@ -31,7 +31,8 @@ enum VehicleType { dca('Double-Crewed Ambulance'), rrv('Rapid Response Vehicle'), helicopter('Air Ambulance Helicopter'), - criticalCareCar('Critical Care Car'); + criticalCareCar('Critical Care Car'), + communityFirstResponder('Community First Responder'); const VehicleType(this.name); From e887f2e8fffb0fcc4d3388b8d97fa2e780a17703 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Mon, 26 May 2025 01:08:45 +0100 Subject: [PATCH 28/42] feat: add to _defaultUnits, assign units to some _defaultEvents --- app/lib/data/services/local_data_service.dart | 42 +++++++++++++------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/app/lib/data/services/local_data_service.dart b/app/lib/data/services/local_data_service.dart index a99aeec..942725c 100644 --- a/app/lib/data/services/local_data_service.dart +++ b/app/lib/data/services/local_data_service.dart @@ -39,6 +39,10 @@ final List _defaultUnits = [ Angle.degree(-1.237806756282358), ), ), + Unit( + callsign: 'NA402', + location: LatLng(Angle.degree(51.605), Angle.degree(-1.238)), + ), Unit( callsign: 'NA283', location: LatLng( @@ -54,12 +58,12 @@ final List _defaultUnits = [ ), ), Unit( - callsign: 'NT431', + callsign: 'NF159', location: LatLng( - Angle.degree(51.397809576171085), - Angle.degree(-1.3230646597735394), + Angle.degree(51.62832936052779), + Angle.degree(-1.1854888181805424), ), - vehicleType: VehicleType.rrv, + vehicleType: VehicleType.communityFirstResponder, ), Unit( callsign: 'NR154', @@ -69,6 +73,14 @@ final List _defaultUnits = [ ), vehicleType: VehicleType.criticalCareCar, ), + Unit( + callsign: 'NT431', + location: LatLng( + Angle.degree(51.397809576171085), + Angle.degree(-1.3230646597735394), + ), + vehicleType: VehicleType.rrv, + ), Unit( callsign: '0024', location: LatLng( @@ -87,25 +99,31 @@ final List _defaultEvents = [ id: 423129, address: 'Carfax Tower, Oxford', noc: Cat2NOC.c2Stabbing(), - ), + )..assignedUnits = [_defaultUnits[2]], Event.withNOC( id: 423126, address: '25 Old Union Way, Thame', noc: Cat4NOC.medicalMinor(), - ), + )..assignedUnits = [_defaultUnits[1]], Event.withNOC( - id: 423127, - address: '6 The Greenway, Oxfordshire', - noc: Cat1NOC.c1ArrestPeriArrest(), - ), + id: 423127, + address: '6 The Greenway, Oxfordshire', + noc: Cat1NOC.c1ArrestPeriArrest(), + ) + ..assignedUnits = [ + _defaultUnits[0], + _defaultUnits[4], + _defaultUnits[6], + _defaultUnits[7], + ], Event.withNOC( id: 423128, address: 'Thatcham Station', noc: Cat4NOC.mentalHealth(), - ), + )..assignedUnits = [_defaultUnits[5]], Event.withNOC( id: 423130, address: 'Next, Westgate Shopping Centre, Oxford', noc: Cat3NOC.fallInjuriesUnknown(), - ), + )..assignedUnits = [_defaultUnits[3]], ]; From 8003ad019a263a484fde9ba8a8514e77f95d5581 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Mon, 26 May 2025 01:15:04 +0100 Subject: [PATCH 29/42] fix: fix Unit location encoding --- app/lib/domain/models/unit/unit.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/domain/models/unit/unit.dart b/app/lib/domain/models/unit/unit.dart index 83d17c6..de5cbb2 100644 --- a/app/lib/domain/models/unit/unit.dart +++ b/app/lib/domain/models/unit/unit.dart @@ -17,7 +17,7 @@ class Unit { Map toJson() => { 'callsign': callsign, 'vehicleType': vehicleType.toString(), - 'location': location.toString(), + 'location': [location.latitude.degrees, location.longitude.degrees], }; @override From 5766c12eeb7f7356cfe94358d2b2a651584d600d Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Mon, 26 May 2025 01:16:10 +0100 Subject: [PATCH 30/42] feat: add api_client.dart with ApiClient --- app/lib/data/services/api/api_client.dart | 26 +++++++++++++++++++++++ app/pubspec.yaml | 1 + 2 files changed, 27 insertions(+) create mode 100644 app/lib/data/services/api/api_client.dart diff --git a/app/lib/data/services/api/api_client.dart b/app/lib/data/services/api/api_client.dart new file mode 100644 index 0000000..babdf31 --- /dev/null +++ b/app/lib/data/services/api/api_client.dart @@ -0,0 +1,26 @@ +import 'package:web_socket_channel/web_socket_channel.dart'; + +class ApiClient { + ApiClient({required this.host, required this.port}); + + WebSocketChannel? _channel; + + WebSocketChannel? get channel => _channel; + + Uri get _channelUri => Uri(scheme: 'ws', host: host, port: port); + + WebSocketChannel connect() { + _channel = WebSocketChannel.connect(_channelUri); + return channel!; + } + + final String host; + + final int port; + + Stream get stream => channel!.stream; + + void get requestEvents => channel!.sink.add('events'); + + void get requestUnits => channel!.sink.add('units'); +} diff --git a/app/pubspec.yaml b/app/pubspec.yaml index 72893f6..93749ed 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -41,6 +41,7 @@ dependencies: go_router: ^15.1.1 gap: ^3.0.1 latlng: ^2.0.7 + web_socket_channel: ^3.0.3 dev_dependencies: flutter_test: From c86fcd6850d2cdc4955f0ee2976a57b5e28da937 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Mon, 26 May 2025 01:17:00 +0100 Subject: [PATCH 31/42] fix: fix WebSocketServer message handling --- server/lib/src/web_socket_server.dart | 35 ++++++++++++++++++--------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/server/lib/src/web_socket_server.dart b/server/lib/src/web_socket_server.dart index 1ccc3c7..f2bd155 100644 --- a/server/lib/src/web_socket_server.dart +++ b/server/lib/src/web_socket_server.dart @@ -34,18 +34,29 @@ class WebSocketServer { _ => throw TypeError(), }; - static final Handler coreHandler = webSocketHandler((webSocket, _) { + Handler get coreHandler => webSocketHandler((webSocket, _) { webSocket.stream.listen((message) async { print('Received message: $message'); - Map messageJSON = messageFromJSON(message); - print('Message JSON: $messageJSON'); - - // TODO implement response. - final String response = 'A placeholder response'; + final String key; + final List response; + + switch (message) { + case 'units': + response = _units; + key = message; + case 'events': + response = _events; + key = message; + case _: + response = message; + key = 'error'; + } // Send the response back to the sender. - webSocket.sink.add(json.encode({'response': response})); + Map messageToReply = {key: response}; + webSocket.sink.add(json.encode(messageToReply)); + print('Replied with: $messageToReply'); }); }); @@ -73,14 +84,16 @@ class WebSocketServer { // FIXME refactor so server is higher-level than dart:io's HttpServer. Currently crashes when run on web because HttpServer isn't supported on web. Future _serve() async => shelf_io.serve(coreHandler, host, _port).then((HttpServer server) { - print('Serving at ws://${server.address.host}:${server.port}'); - print('\t- Current units: $_units'); - print('\t- Current events: $_events'); + print( + 'Serving at ws://${server.address.host}:${server.port}\n' + '\t- Current units: $_units\n' + '\t- Current events: $_events\n', + ); return server; }); List _units = []; /// Gets all the [Unit]s currently connected to (but not necessarily logged in to) this server. - Future>> get units async => Future(() => Result.ok(_units)); + Result> get units => Result.ok(_units); } From 3261f9bec665b2c99234d7699da08bfa3be2a8d3 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Mon, 26 May 2025 01:17:17 +0100 Subject: [PATCH 32/42] fix: add placeholder map marker image for CFR --- app/lib/domain/models/unit/unit_map_marker.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/lib/domain/models/unit/unit_map_marker.dart b/app/lib/domain/models/unit/unit_map_marker.dart index 82b07c5..8c66e18 100644 --- a/app/lib/domain/models/unit/unit_map_marker.dart +++ b/app/lib/domain/models/unit/unit_map_marker.dart @@ -10,6 +10,8 @@ extension UnitMapMarker on Unit { VehicleType.rrv => 'assets/images/rrv.png', VehicleType.helicopter => 'assets/images/tvaa.jpg', VehicleType.criticalCareCar => 'assets/images/hems-car.png', + // FIXME: give the CFR a unique image. + VehicleType.communityFirstResponder => 'assets/images/rrv.png', }; /// Gets a [Marker] for showing this [Unit] on a map. From 86baac2023fa195816851e8f05474d5f1e2fbfc7 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Mon, 26 May 2025 01:24:07 +0100 Subject: [PATCH 33/42] feat: add NOC to Event.toJson() --- app/lib/domain/models/event/event.dart | 1 + app/lib/domain/models/status.dart | 2 ++ 2 files changed, 3 insertions(+) diff --git a/app/lib/domain/models/event/event.dart b/app/lib/domain/models/event/event.dart index 57969d7..ec50517 100644 --- a/app/lib/domain/models/event/event.dart +++ b/app/lib/domain/models/event/event.dart @@ -188,6 +188,7 @@ class Event { Map toJson() => { 'id': id, 'category': category.toJson(), + 'noc': noc, 'address': address, 'assignedUnits': List.from( assignedUnits.map((Unit assignedUnit) => assignedUnit.callsign), diff --git a/app/lib/domain/models/status.dart b/app/lib/domain/models/status.dart index 16c8bbe..af91368 100644 --- a/app/lib/domain/models/status.dart +++ b/app/lib/domain/models/status.dart @@ -57,6 +57,8 @@ abstract class NOC extends Status { static List get cat4 => catFourNOCs; + String toJson() => toString(); + @override String toString() { final String catNumber = category.number; From 52f3ed3bd873af682dab3d685bbe4243b26670ef Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Mon, 26 May 2025 01:24:55 +0100 Subject: [PATCH 34/42] fix: print correct reply message --- server/lib/src/web_socket_server.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/lib/src/web_socket_server.dart b/server/lib/src/web_socket_server.dart index f2bd155..c5a760d 100644 --- a/server/lib/src/web_socket_server.dart +++ b/server/lib/src/web_socket_server.dart @@ -55,8 +55,9 @@ class WebSocketServer { // Send the response back to the sender. Map messageToReply = {key: response}; - webSocket.sink.add(json.encode(messageToReply)); - print('Replied with: $messageToReply'); + String messageJSON = json.encode(messageToReply); + webSocket.sink.add(messageJSON); + print('Replied with: $messageJSON'); }); }); From 0c9707c815ce9820f931418619255308c6adb557 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Mon, 26 May 2025 01:25:20 +0100 Subject: [PATCH 35/42] feat: add example of data retrieval from WebSocketServer --- app/lib/routing/router.dart | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/app/lib/routing/router.dart b/app/lib/routing/router.dart index 3f07f8e..ee064f1 100644 --- a/app/lib/routing/router.dart +++ b/app/lib/routing/router.dart @@ -2,13 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'package:provider/provider.dart'; +import 'package:web_socket_channel/web_socket_channel.dart'; import '../data/repositories/auth/auth_repository.dart'; -import '../ui/home/view_models/home_viewmodel.dart'; -import '../ui/home/widgets/home_screen.dart'; +import '../data/services/api/api_client.dart'; +// import '../ui/home/view_models/home_viewmodel.dart'; +// import '../ui/home/widgets/home_screen.dart'; import 'routes.dart'; /// Top go_router entry point. @@ -34,8 +36,33 @@ GoRouter router(AuthRepository authRepository) => GoRouter( GoRoute( path: Routes.home, builder: (context, state) { - final viewModel = HomeViewModel(eventRepository: context.read()); - return HomeScreen(viewModel: viewModel); + ApiClient client = ApiClient(host: 'localhost', port: 8080); + WebSocketChannel channel = client.connect(); + // client.requestUnits; + client.requestEvents; + + return Scaffold( + appBar: AppBar(title: Text('StreamBuilder test')), + body: Center( + child: StreamBuilder( + stream: channel.stream, + builder: (context, snapshot) => + switch (snapshot.connectionState) { + ConnectionState.none => Text('None'), + ConnectionState.waiting => CircularProgressIndicator(), + ConnectionState.active => Text( + 'Active\n\n' + '${snapshot.data}', + textAlign: TextAlign.center, + ), + ConnectionState.done => Text('Done'), + }, + ), + ), + ); + + // final viewModel = HomeViewModel(eventRepository: context.read()); + // return HomeScreen(viewModel: viewModel); }, routes: [ GoRoute( From 3fdfe1ce1ced03e9bf82d329c01d000d88c56f45 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Mon, 26 May 2025 01:30:39 +0100 Subject: [PATCH 36/42] docs: add TODO to revert to Home --- app/lib/routing/router.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/app/lib/routing/router.dart b/app/lib/routing/router.dart index ee064f1..80a830d 100644 --- a/app/lib/routing/router.dart +++ b/app/lib/routing/router.dart @@ -36,6 +36,7 @@ GoRouter router(AuthRepository authRepository) => GoRouter( GoRoute( path: Routes.home, builder: (context, state) { + // TODO move this StreamBuilder test to a new Widget and revert to the Home widget. ApiClient client = ApiClient(host: 'localhost', port: 8080); WebSocketChannel channel = client.connect(); // client.requestUnits; From f89b7761568ea1b533500e40fce45a0a6bded712 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Mon, 26 May 2025 10:11:13 +0100 Subject: [PATCH 37/42] refactor: make Status.category non-nullable --- app/lib/domain/models/status.dart | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/lib/domain/models/status.dart b/app/lib/domain/models/status.dart index af91368..8ef2e4a 100644 --- a/app/lib/domain/models/status.dart +++ b/app/lib/domain/models/status.dart @@ -6,7 +6,7 @@ interface class Status { /// Creates an emergency ambulance [Status]. const factory Status.nhs999(Category category) = PathwaysDisposition._nhs999; - const Status.preAlert() : category = null, description = _preAlert; + const Status.preAlert() : category = Category.none, description = _preAlert; @override bool operator ==(Object other) => @@ -14,7 +14,7 @@ interface class Status { (other.category == category) && (other.description == description); - final Category? category; + final Category category; final String description; @@ -44,9 +44,6 @@ abstract class NOC extends Status { // /// The extra details provided in response to a "Specify..." prompt. // final String detail; - @override - Category get category => super.category!; - final bool specify; static List get cat1 => catOneNOCs; From 02bb8a20dcc04b46ccd8a0e8ceeace6b21c19747 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Mon, 26 May 2025 10:11:47 +0100 Subject: [PATCH 38/42] refactor: get Event category from status --- app/lib/domain/models/event/event.dart | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/lib/domain/models/event/event.dart b/app/lib/domain/models/event/event.dart index ec50517..bda7f2c 100644 --- a/app/lib/domain/models/event/event.dart +++ b/app/lib/domain/models/event/event.dart @@ -14,12 +14,8 @@ import 'category.dart'; /// An emergency event that the ambulance service has become aware of. class Event { - Event._({ - required this.id, - required this.address, - required this.status, - required this.category, - }) { + Event._({required this.id, required this.address, required this.status}) + : category = status.category { if (status == Status.preAlert()) { assert(category == Category.none); } From 72fb673122a52c0bde559450d8d0f8cfbe732ca3 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Mon, 26 May 2025 10:13:09 +0100 Subject: [PATCH 39/42] refactor: rename Status to EventStatus --- app/lib/domain/models/event/event.dart | 13 ++++--------- app/lib/domain/models/status.dart | 19 +++++++++++-------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/app/lib/domain/models/event/event.dart b/app/lib/domain/models/event/event.dart index bda7f2c..451c290 100644 --- a/app/lib/domain/models/event/event.dart +++ b/app/lib/domain/models/event/event.dart @@ -16,7 +16,7 @@ import 'category.dart'; class Event { Event._({required this.id, required this.address, required this.status}) : category = status.category { - if (status == Status.preAlert()) { + if (status == EventStatus.preAlert()) { assert(category == Category.none); } @@ -26,12 +26,7 @@ class Event { } Event.preAlert({required int id, required String address}) - : this._( - id: id, - address: address, - status: Status.preAlert(), - category: Category.none, - ); + : this._(id: id, address: address, status: EventStatus.preAlert()); factory Event.withNOC({ required int id, @@ -128,7 +123,7 @@ class Event { void addNOC(NOC noc) { if (_noc == null) { _noc = noc; - status = Status.nhs999(noc.category); + status = EventStatus.nhs999(noc.category); category = noc.category; } else { throw Exception( @@ -179,7 +174,7 @@ class Event { /// Nature of Call. NOC? get noc => _noc; - Status status; + EventStatus status; Map toJson() => { 'id': id, diff --git a/app/lib/domain/models/status.dart b/app/lib/domain/models/status.dart index 8ef2e4a..ebb92a9 100644 --- a/app/lib/domain/models/status.dart +++ b/app/lib/domain/models/status.dart @@ -1,16 +1,19 @@ import 'event/category.dart'; -interface class Status { - const Status(this.category, this.description); +interface class EventStatus { + const EventStatus(this.category, this.description); - /// Creates an emergency ambulance [Status]. - const factory Status.nhs999(Category category) = PathwaysDisposition._nhs999; + /// Creates an emergency ambulance [EventStatus]. + const factory EventStatus.nhs999(Category category) = + PathwaysDisposition._nhs999; - const Status.preAlert() : category = Category.none, description = _preAlert; + const EventStatus.preAlert() + : category = Category.none, + description = _preAlert; @override bool operator ==(Object other) => - other is Status && + other is EventStatus && (other.category == category) && (other.description == description); @@ -27,7 +30,7 @@ interface class Status { String toString() => description; } -base class PathwaysDisposition extends Status { +base class PathwaysDisposition extends EventStatus { const PathwaysDisposition._(super.category, super.description); const PathwaysDisposition._nhs999(Category category) @@ -35,7 +38,7 @@ base class PathwaysDisposition extends Status { } /// Nature of Call. -abstract class NOC extends Status { +abstract class NOC extends EventStatus { const NOC(super.category, super.description) : specify = false; const NOC.withSpecify(super.category, super.description) : specify = true; From efd473ee6f11dd789f88bd790f8cafc7126232c3 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Mon, 26 May 2025 10:13:21 +0100 Subject: [PATCH 40/42] feat: add Event.fromJson() factory --- app/lib/domain/models/event/event.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/lib/domain/models/event/event.dart b/app/lib/domain/models/event/event.dart index 451c290..e1575e3 100644 --- a/app/lib/domain/models/event/event.dart +++ b/app/lib/domain/models/event/event.dart @@ -28,6 +28,14 @@ class Event { Event.preAlert({required int id, required String address}) : this._(id: id, address: address, status: EventStatus.preAlert()); + factory Event.fromJson(Map json) { + return switch (json) { + {'id': int id, 'address': String address, 'status': EventStatus status} => + Event._(id: id, address: address, status: status), + _ => throw const FormatException('Failed to load album.'), + }; + } + factory Event.withNOC({ required int id, required String address, From 7e5bb74cb1e1f0d022b552616931ddc637395026 Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Mon, 26 May 2025 10:13:41 +0100 Subject: [PATCH 41/42] chore: update IDE files --- .idea/libraries/Dart_SDK.xml | 34 +++++++++++++++++++++++----------- .idea/vcs.xml | 2 +- dispatch.iml | 1 + 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml index 3447a85..ede6037 100644 --- a/.idea/libraries/Dart_SDK.xml +++ b/.idea/libraries/Dart_SDK.xml @@ -1,17 +1,29 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 4c6280e..7ddfc9e 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -7,6 +7,6 @@ - + \ No newline at end of file diff --git a/dispatch.iml b/dispatch.iml index 3bdd1ca..05abede 100644 --- a/dispatch.iml +++ b/dispatch.iml @@ -21,6 +21,7 @@ + From b400c1b22eb0198a540f6c5c5763cae46081247c Mon Sep 17 00:00:00 2001 From: weasdown <34220924+weasdown@users.noreply.github.com> Date: Mon, 26 May 2025 10:13:54 +0100 Subject: [PATCH 42/42] feat: add server main.dart run configuration --- .idea/runConfigurations/server_main_dart.xml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .idea/runConfigurations/server_main_dart.xml diff --git a/.idea/runConfigurations/server_main_dart.xml b/.idea/runConfigurations/server_main_dart.xml new file mode 100644 index 0000000..d51a979 --- /dev/null +++ b/.idea/runConfigurations/server_main_dart.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file