From 60a49060a118041b4ac2a7aad8be354fc0e33f54 Mon Sep 17 00:00:00 2001 From: aitorarana Date: Fri, 23 Jan 2026 14:52:08 +0100 Subject: [PATCH] added hub module --- .dart_tool/package_config.json | 122 +- .idea/modules.xml | 2 + .../melos_flutter_run_sf_app_platform.xml | 2 +- .../melos_flutter_test_design_system.xml | 2 +- .../melos_flutter_test_home.xml | 2 +- apps/mobile_app/assets/images/ui/iso_sf.png | Bin 0 -> 2250 bytes apps/mobile_app/assets/images/ui/location.svg | 19 + .../mobile_app/lib/navigation/app_router.dart | 6 + apps/mobile_app/pubspec.lock | 1058 ----------------- apps/mobile_app/pubspec.yaml | 2 + apps/mobile_app/pubspec_overrides.yaml | 26 - melos_sf-app-platform.iml | 11 +- .../presentation/onboarding_screen.dart | 4 +- .../presentation/welcome_screen.dart | 0 modules/auth/pubspec.yaml | 6 +- modules/auth/pubspec_overrides.yaml | 6 +- .../dashboard_shell/pubspec_overrides.yaml | 24 - .../datasource/hub_remote_datasource.dart | 10 + .../hub_remote_datasource_impl.dart | 120 ++ .../models/get_devices_response_model.dart | 38 + .../get_devices_response_model.freezed.dart | 552 +++++++++ .../models/get_devices_response_model.g.dart | 37 + .../latest_positions_response_model.dart | 44 + ...test_positions_response_model.freezed.dart | 561 +++++++++ .../latest_positions_response_model.g.dart | 45 + .../repositories/hub_repository_impl.dart | 21 + .../domain/repositories/hub_repository.dart | 10 + .../hub_remote_datasource_provier.dart | 9 + .../providers/hub_repository_provider.dart | 9 + .../hub/domain/entities/device_entity.dart | 11 + .../entities/get_devices_request_entity.dart | 10 + .../get_devices_request_entity.freezed.dart | 271 +++++ .../hub/domain/entities/position_entity.dart | 17 + .../hub/domain/get_devices_use_case.dart | 5 + .../hub/domain/get_devices_use_case_impl.dart | 14 + .../domain/get_latest_positions_use_case.dart | 5 + .../get_latest_positions_use_case_impl.dart | 14 + .../hub/lib/src/features/hub/hub_builder.dart | 18 + .../features/hub/presentation/hub_screen.dart | 184 +++ .../get_devices_use_case_provider.dart | 10 + ...et_latest_positions_use_case_provider.dart | 10 + .../presentation/state/hub_view_model.dart | 87 ++ .../presentation/state/hub_view_state.dart | 14 + .../state/hub_view_state.freezed.dart | 286 +++++ packages/fonts/.dart_tool/package_config.json | 20 +- packages/fonts/.dart_tool/version | 2 +- packages/navigation/lib/app_routes.dart | 1 + packages/sf_localizations/assets/l10n/en.json | 8 +- packages/sf_localizations/assets/l10n/es.json | 8 +- .../lib/src/generated/i18n.dart | 6 + 50 files changed, 2558 insertions(+), 1191 deletions(-) create mode 100644 apps/mobile_app/assets/images/ui/iso_sf.png create mode 100644 apps/mobile_app/assets/images/ui/location.svg delete mode 100644 apps/mobile_app/pubspec.lock delete mode 100644 apps/mobile_app/pubspec_overrides.yaml delete mode 100644 modules/auth/lib/src/features/onboarding/presentation/welcome_screen.dart delete mode 100644 modules/dashboard_shell/pubspec_overrides.yaml create mode 100644 modules/hub/lib/src/core/data/datasource/hub_remote_datasource.dart create mode 100644 modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart create mode 100644 modules/hub/lib/src/core/data/models/get_devices_response_model.dart create mode 100644 modules/hub/lib/src/core/data/models/get_devices_response_model.freezed.dart create mode 100644 modules/hub/lib/src/core/data/models/get_devices_response_model.g.dart create mode 100644 modules/hub/lib/src/core/data/models/latest_positions_response_model.dart create mode 100644 modules/hub/lib/src/core/data/models/latest_positions_response_model.freezed.dart create mode 100644 modules/hub/lib/src/core/data/models/latest_positions_response_model.g.dart create mode 100644 modules/hub/lib/src/core/data/repositories/hub_repository_impl.dart create mode 100644 modules/hub/lib/src/core/domain/repositories/hub_repository.dart create mode 100644 modules/hub/lib/src/core/providers/hub_remote_datasource_provier.dart create mode 100644 modules/hub/lib/src/core/providers/hub_repository_provider.dart create mode 100644 modules/hub/lib/src/features/hub/domain/entities/device_entity.dart create mode 100644 modules/hub/lib/src/features/hub/domain/entities/get_devices_request_entity.dart create mode 100644 modules/hub/lib/src/features/hub/domain/entities/get_devices_request_entity.freezed.dart create mode 100644 modules/hub/lib/src/features/hub/domain/entities/position_entity.dart create mode 100644 modules/hub/lib/src/features/hub/domain/get_devices_use_case.dart create mode 100644 modules/hub/lib/src/features/hub/domain/get_devices_use_case_impl.dart create mode 100644 modules/hub/lib/src/features/hub/domain/get_latest_positions_use_case.dart create mode 100644 modules/hub/lib/src/features/hub/domain/get_latest_positions_use_case_impl.dart create mode 100644 modules/hub/lib/src/features/hub/hub_builder.dart create mode 100644 modules/hub/lib/src/features/hub/presentation/hub_screen.dart create mode 100644 modules/hub/lib/src/features/hub/presentation/providers/get_devices_use_case_provider.dart create mode 100644 modules/hub/lib/src/features/hub/presentation/providers/get_latest_positions_use_case_provider.dart create mode 100644 modules/hub/lib/src/features/hub/presentation/state/hub_view_model.dart create mode 100644 modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart create mode 100644 modules/hub/lib/src/features/hub/presentation/state/hub_view_state.freezed.dart diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json index 3b00a9d9..e15b8038 100644 --- a/.dart_tool/package_config.json +++ b/.dart_tool/package_config.json @@ -3,349 +3,349 @@ "packages": [ { "name": "ansi_styles", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/ansi_styles-0.3.2+1", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/ansi_styles-0.3.2+1", "packageUri": "lib/", "languageVersion": "2.12" }, { "name": "args", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/args-2.7.0", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/args-2.7.0", "packageUri": "lib/", "languageVersion": "3.3" }, { "name": "async", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/async-2.13.0", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/async-2.13.0", "packageUri": "lib/", "languageVersion": "3.4" }, { "name": "characters", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/characters-1.4.0", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/characters-1.4.0", "packageUri": "lib/", "languageVersion": "3.4" }, { "name": "charcode", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/charcode-1.4.0", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/charcode-1.4.0", "packageUri": "lib/", "languageVersion": "3.0" }, { "name": "checked_yaml", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/checked_yaml-2.0.4", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/checked_yaml-2.0.4", "packageUri": "lib/", "languageVersion": "3.8" }, { "name": "cli_launcher", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/cli_launcher-0.3.2+1", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/cli_launcher-0.3.2+1", "packageUri": "lib/", "languageVersion": "3.8" }, { "name": "cli_util", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/cli_util-0.4.2", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/cli_util-0.4.2", "packageUri": "lib/", "languageVersion": "3.4" }, { "name": "collection", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/collection-1.19.1", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/collection-1.19.1", "packageUri": "lib/", "languageVersion": "3.4" }, { "name": "conventional_commit", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/conventional_commit-0.6.1+1", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/conventional_commit-0.6.1+1", "packageUri": "lib/", "languageVersion": "3.8" }, { "name": "ffi", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/ffi-2.1.4", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/ffi-2.1.4", "packageUri": "lib/", "languageVersion": "3.7" }, { "name": "file", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/file-7.0.1", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/file-7.0.1", "packageUri": "lib/", "languageVersion": "3.0" }, { "name": "flutter", - "rootUri": "file:///Users/juliandalcalaf/Development/flutter/packages/flutter", + "rootUri": "file:///C:/Program%20Files/Flutter/packages/flutter", "packageUri": "lib/", "languageVersion": "3.8" }, { "name": "flutter_secure_storage", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_secure_storage-9.2.4", "packageUri": "lib/", "languageVersion": "2.12" }, { "name": "flutter_secure_storage_linux", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_linux-1.2.3", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_secure_storage_linux-1.2.3", "packageUri": "lib/", "languageVersion": "2.12" }, { "name": "flutter_secure_storage_macos", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_macos-3.1.3", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_secure_storage_macos-3.1.3", "packageUri": "lib/", "languageVersion": "2.12" }, { "name": "flutter_secure_storage_platform_interface", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_platform_interface-1.1.2", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_secure_storage_platform_interface-1.1.2", "packageUri": "lib/", "languageVersion": "2.12" }, { "name": "flutter_secure_storage_web", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_web-1.2.1", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_secure_storage_web-1.2.1", "packageUri": "lib/", "languageVersion": "2.12" }, { "name": "flutter_secure_storage_windows", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_windows-3.1.2", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_secure_storage_windows-3.1.2", "packageUri": "lib/", "languageVersion": "2.12" }, { "name": "flutter_web_plugins", - "rootUri": "file:///Users/juliandalcalaf/Development/flutter/packages/flutter_web_plugins", + "rootUri": "file:///C:/Program%20Files/Flutter/packages/flutter_web_plugins", "packageUri": "lib/", "languageVersion": "3.8" }, { "name": "glob", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/glob-2.1.3", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/glob-2.1.3", "packageUri": "lib/", "languageVersion": "3.3" }, { "name": "graphs", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/graphs-2.3.2", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/graphs-2.3.2", "packageUri": "lib/", "languageVersion": "3.4" }, { "name": "http", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/http-1.5.0", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/http-1.5.0", "packageUri": "lib/", "languageVersion": "3.4" }, { "name": "http_parser", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/http_parser-4.1.2", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/http_parser-4.1.2", "packageUri": "lib/", "languageVersion": "3.4" }, { "name": "io", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/io-1.0.5", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/io-1.0.5", "packageUri": "lib/", "languageVersion": "3.4" }, { "name": "js", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/js-0.6.7", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/js-0.6.7", "packageUri": "lib/", "languageVersion": "2.19" }, { "name": "json_annotation", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/json_annotation-4.9.0", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/json_annotation-4.9.0", "packageUri": "lib/", "languageVersion": "3.0" }, { "name": "material_color_utilities", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/material_color_utilities-0.11.1", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/material_color_utilities-0.11.1", "packageUri": "lib/", "languageVersion": "2.17" }, { "name": "melos", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/melos-6.3.3", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/melos-6.3.3", "packageUri": "lib/", "languageVersion": "3.8" }, { "name": "meta", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/meta-1.16.0", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/meta-1.16.0", "packageUri": "lib/", "languageVersion": "2.12" }, { "name": "mustache_template", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/mustache_template-2.0.2", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/mustache_template-2.0.2", "packageUri": "lib/", "languageVersion": "3.7" }, { "name": "path", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path-1.9.1", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/path-1.9.1", "packageUri": "lib/", "languageVersion": "3.4" }, { "name": "path_provider", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider-2.1.5", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider-2.1.5", "packageUri": "lib/", "languageVersion": "3.4" }, { "name": "path_provider_android", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_android-2.2.20", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_android-2.2.20", "packageUri": "lib/", "languageVersion": "3.9" }, { "name": "path_provider_foundation", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.3", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_foundation-2.4.3", "packageUri": "lib/", "languageVersion": "3.9" }, { "name": "path_provider_linux", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_linux-2.2.1", "packageUri": "lib/", "languageVersion": "2.19" }, { "name": "path_provider_platform_interface", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_platform_interface-2.1.2", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_platform_interface-2.1.2", "packageUri": "lib/", "languageVersion": "3.0" }, { "name": "path_provider_windows", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_windows-2.3.0", "packageUri": "lib/", "languageVersion": "3.2" }, { "name": "platform", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/platform-3.1.6", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/platform-3.1.6", "packageUri": "lib/", "languageVersion": "3.2" }, { "name": "plugin_platform_interface", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/plugin_platform_interface-2.1.8", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/plugin_platform_interface-2.1.8", "packageUri": "lib/", "languageVersion": "3.0" }, { "name": "pool", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/pool-1.5.2", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/pool-1.5.2", "packageUri": "lib/", "languageVersion": "3.4" }, { "name": "process", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/process-5.0.5", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/process-5.0.5", "packageUri": "lib/", "languageVersion": "3.5" }, { "name": "prompts", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/prompts-2.0.0", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/prompts-2.0.0", "packageUri": "lib/", "languageVersion": "2.12" }, { "name": "pub_semver", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/pub_semver-2.2.0", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/pub_semver-2.2.0", "packageUri": "lib/", "languageVersion": "3.4" }, { "name": "pub_updater", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/pub_updater-0.5.0", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/pub_updater-0.5.0", "packageUri": "lib/", "languageVersion": "3.5" }, { "name": "pubspec_parse", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/pubspec_parse-1.5.0", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/pubspec_parse-1.5.0", "packageUri": "lib/", "languageVersion": "3.6" }, { "name": "sky_engine", - "rootUri": "file:///Users/juliandalcalaf/Development/flutter/bin/cache/pkg/sky_engine", + "rootUri": "file:///C:/Program%20Files/Flutter/bin/cache/pkg/sky_engine", "packageUri": "lib/", "languageVersion": "3.8" }, { "name": "source_span", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/source_span-1.10.1", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/source_span-1.10.1", "packageUri": "lib/", "languageVersion": "3.1" }, { "name": "stack_trace", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/stack_trace-1.12.1", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/stack_trace-1.12.1", "packageUri": "lib/", "languageVersion": "3.4" }, { "name": "string_scanner", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/string_scanner-1.4.1", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/string_scanner-1.4.1", "packageUri": "lib/", "languageVersion": "3.1" }, { "name": "term_glyph", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/term_glyph-1.2.2", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/term_glyph-1.2.2", "packageUri": "lib/", "languageVersion": "3.1" }, { "name": "typed_data", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/typed_data-1.4.0", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/typed_data-1.4.0", "packageUri": "lib/", "languageVersion": "3.5" }, { "name": "vector_math", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/vector_math-2.2.0", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/vector_math-2.2.0", "packageUri": "lib/", "languageVersion": "3.1" }, { "name": "web", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/web-1.1.1", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/web-1.1.1", "packageUri": "lib/", "languageVersion": "3.4" }, { "name": "win32", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/win32-5.15.0", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/win32-5.15.0", "packageUri": "lib/", "languageVersion": "3.8" }, { "name": "xdg_directories", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/xdg_directories-1.1.0", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/xdg_directories-1.1.0", "packageUri": "lib/", "languageVersion": "3.3" }, { "name": "yaml", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/yaml-3.1.3", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/yaml-3.1.3", "packageUri": "lib/", "languageVersion": "3.4" }, { "name": "yaml_edit", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/yaml_edit-2.2.2", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/yaml_edit-2.2.2", "packageUri": "lib/", "languageVersion": "3.1" }, @@ -358,7 +358,7 @@ ], "generator": "pub", "generatorVersion": "3.9.2", - "flutterRoot": "file:///Users/juliandalcalaf/Development/flutter", - "flutterVersion": "3.35.7", - "pubCache": "file:///Users/juliandalcalaf/.pub-cache" + "flutterRoot": "file:///C:/Program%20Files/Flutter", + "flutterVersion": "3.35.6", + "pubCache": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache" } diff --git a/.idea/modules.xml b/.idea/modules.xml index 2c5bd550..97af5312 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -7,6 +7,7 @@ + @@ -14,6 +15,7 @@ + diff --git a/.idea/runConfigurations/melos_flutter_run_sf_app_platform.xml b/.idea/runConfigurations/melos_flutter_run_sf_app_platform.xml index e2a9ffba..c7845145 100644 --- a/.idea/runConfigurations/melos_flutter_run_sf_app_platform.xml +++ b/.idea/runConfigurations/melos_flutter_run_sf_app_platform.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/.idea/runConfigurations/melos_flutter_test_design_system.xml b/.idea/runConfigurations/melos_flutter_test_design_system.xml index 5f9f3264..42cc1035 100644 --- a/.idea/runConfigurations/melos_flutter_test_design_system.xml +++ b/.idea/runConfigurations/melos_flutter_test_design_system.xml @@ -1,7 +1,7 @@ - \ No newline at end of file diff --git a/.idea/runConfigurations/melos_flutter_test_home.xml b/.idea/runConfigurations/melos_flutter_test_home.xml index 745b2563..d444d048 100644 --- a/.idea/runConfigurations/melos_flutter_test_home.xml +++ b/.idea/runConfigurations/melos_flutter_test_home.xml @@ -1,7 +1,7 @@ - \ No newline at end of file diff --git a/apps/mobile_app/assets/images/ui/iso_sf.png b/apps/mobile_app/assets/images/ui/iso_sf.png new file mode 100644 index 0000000000000000000000000000000000000000..d6673496588f8b5a1374b18bdfba2657dd66b8bd GIT binary patch literal 2250 zcmV;*2sQVKP)C8CJoUwCe>2$E#ajc^)RgqPuBTAJBwQd<(B0@qIvNIlcT;ftUL;`MA zP!#LZKv2X5A>;ztASAXHwIeP>L54-kBH->j-*=N6E*Gt6i`D0x@1NxT-kaZf?tSj} zrdO{Xl!Q3jH`ZX6%8RW93ZuPIVJ>Tz8La0e`VwtyzGV!v{-w}Dn{9~PY%7%;%YeRQ z#a58$Eg;D=-V+`(e6C6(e#zYX!fLj)+(TisUFia4CDTs9@h&f>Z(Gda!hls<> z{V${d;AcuxStb(-FR9Bd@kt|yjunCMupXi_@__ecu7KI+g_FW$Uq^u`OxEVvMq7~5 zXe*InFyxj*XNH(usHW>OTEVf96sjQst5V{@f zRRqynX|Qd<&z2Osm4|M_Y z^VTEb%=SvD!Fo$tgxo4HgBZJYv=BX81rV)4ZtXh;k-Lw;%(UzfX73k5a;yC#xyf3` z1jCCA4Wh*5Rxxsm0KPUKcn5PKD*Y%#>^uy!c4UPyd-kY6Gwijd1pm~V@d4#cs{=B= zTQOR8eeSqLSHyw+n6(%VIrM-DCM`mtQDA`>92%5c8Q87k5SgBHIwCb|BPT`sS7yH+ zS5v}hQS&-~Xj<(LjjBLsm=^@KvJWp;i9c8y0}G#29Ee*GUBmY(VE;E z6daT1q@VmXy~lG^Q@p>u3z#Gru0^t{8YWHp4ZT)jEVXoUt4qWeV6bz-z1lbE`<}a6 zlD!4Z8+?Hdc70xutxht2Syg06v*X{P8|n23M%&dbXT%GUTf#&6&9idMZ_@V=Dx&x0 zsT|arP6z0;MZZOI% z6dKqq0eT^e4&^VVU!zWt6i~xc8>%DLKd79s8ZJy*b+;mPX-8Qdd4WQ%CImcwNGxc z@1Wf367gBO6siu;i@QO*761zwwaHgpM`8IQr{!KuL6P!^y(Rqng!Pt@LL((S#Y-f7$6ZNIqcv`Sap`pQ4KQtldxFi0AGvfJL9X=OcreF8EBzdPBEGoeTwhAgR*u*7Jj=;WV zfLVr1nk-(zk@P-~6#{Fyl{p;R4~~Fm0lPAN;(d_Ie?j$=6_sQ=Bi{K!#u1NaF7E#0 z-_WmHEmCVqFkv!WLts}h*mN4$hZt-w31)SHnctUy`CZ95+h2rz=)E4P_9O4j{~=&k z*{p1OKe67j?~yat7df54sstOeNHBp5EW88k90fK8fsICBz6i`qMuHjNjRE6O(QScSkA zLwWGy!HS27ZWBXd#?bpcQuqYly5CFvv|!hG6X!B}p(G5YN4#_9LZ|q&oZA5K3RQPq zymcW4s}&?6unlnKQv^261;%oMef2L4_8&Kx34;y8U_vMwB&;9?@w+z>+)npa+}h*a z{v@y)3&u9rD?=2_{aE#isgGEEZKz?b_-y|ON>wm9cyH}q!b%1w!a=`S)q`)by2|n*byl1zLHrO>m zRzVgyAtSeD?aBtub}h`@lF?}r_)fYxxt6ac!5kQDDgygx8JtC6-!Q-|E--@|jPC?{ zi-(sZe-M8Ry?2jEq9OY751w2Qwfo3}h}1*C*_Hv}Ne3FFd$N8{)ig(^zFsR(*O6eK ztU(807g$If0wd3fBv|Paz;yk&c-_}~@OBYza=Q22{ZR4tobczQ9L^2js(Bc$-VdCF zeVggu*Ud_r@>F0$onS;)Fme@maI5qBM@P`F(W8pkrWqTaxG(?H!~?fE>Vw|&?`oqG zc#iP3jpWEefjLk12rL##y%E?5sS8X5MT1>n0}|XR3ZlQcQe8A zJ-8*rAJ~1FwJ(*9_7Cr;8_2s#hDQIWhbTxg2$iZgv+ku-(LlabKY;tKZa|b0RD>Jq Y|H`mk?~QgOy#N3J07*qoM6N<$f+TT6d;kCd literal 0 HcmV?d00001 diff --git a/apps/mobile_app/assets/images/ui/location.svg b/apps/mobile_app/assets/images/ui/location.svg new file mode 100644 index 00000000..471dee7b --- /dev/null +++ b/apps/mobile_app/assets/images/ui/location.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/apps/mobile_app/lib/navigation/app_router.dart b/apps/mobile_app/lib/navigation/app_router.dart index 406722d7..65b5aed0 100644 --- a/apps/mobile_app/lib/navigation/app_router.dart +++ b/apps/mobile_app/lib/navigation/app_router.dart @@ -3,6 +3,7 @@ import 'package:dashboard_shell/dashboard_builder.dart'; import 'package:flutter/material.dart'; import 'package:get_it/get_it.dart'; import 'package:go_router/go_router.dart'; +import 'package:hub/hub.dart'; import 'package:home/home.dart'; import 'package:navigation/navigation.dart'; import 'package:notifications/notifications.dart'; @@ -24,6 +25,11 @@ void configureAppRouter() { name: 'splash', pageBuilder: SplashBuilder().buildPage, ), + GoRoute( + path: AppRoutes.hub, + name: 'hub', + pageBuilder: HubBuilder().buildPage, + ), GoRoute( path: AppRoutes.login, name: 'login', diff --git a/apps/mobile_app/pubspec.lock b/apps/mobile_app/pubspec.lock deleted file mode 100644 index 53b85bf0..00000000 --- a/apps/mobile_app/pubspec.lock +++ /dev/null @@ -1,1058 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - _fe_analyzer_shared: - dependency: transitive - description: - name: _fe_analyzer_shared - sha256: da0d9209ca76bde579f2da330aeb9df62b6319c834fa7baae052021b0462401f - url: "https://pub.dev" - source: hosted - version: "85.0.0" - analyzer: - dependency: transitive - description: - name: analyzer - sha256: "974859dc0ff5f37bc4313244b3218c791810d03ab3470a579580279ba971a48d" - url: "https://pub.dev" - source: hosted - version: "7.7.1" - animated_splash_screen: - dependency: transitive - description: - name: animated_splash_screen - sha256: f45634db6ec4e8cf034c53e03f3bd83898a16fe3c9286bf5510b6831dfcf2124 - url: "https://pub.dev" - source: hosted - version: "1.3.0" - ansicolor: - dependency: transitive - description: - name: ansicolor - sha256: "50e982d500bc863e1d703448afdbf9e5a72eb48840a4f766fa361ffd6877055f" - url: "https://pub.dev" - source: hosted - version: "2.0.3" - archive: - dependency: transitive - description: - name: archive - sha256: "2fde1607386ab523f7a36bb3e7edb43bd58e6edaf2ffb29d8a6d578b297fdbbd" - url: "https://pub.dev" - source: hosted - version: "4.0.7" - args: - dependency: transitive - description: - name: args - sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 - url: "https://pub.dev" - source: hosted - version: "2.7.0" - async: - dependency: transitive - description: - name: async - sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" - url: "https://pub.dev" - source: hosted - version: "2.13.0" - auth: - dependency: "direct main" - description: - path: "../../modules/auth" - relative: true - source: path - version: "0.0.1" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" - url: "https://pub.dev" - source: hosted - version: "2.1.2" - build: - dependency: transitive - description: - name: build - sha256: ce76b1d48875e3233fde17717c23d1f60a91cc631597e49a400c89b475395b1d - url: "https://pub.dev" - source: hosted - version: "3.1.0" - build_config: - dependency: transitive - description: - name: build_config - sha256: "4f64382b97504dc2fcdf487d5aae33418e08b4703fc21249e4db6d804a4d0187" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - build_daemon: - dependency: transitive - description: - name: build_daemon - sha256: bf05f6e12cfea92d3c09308d7bcdab1906cd8a179b023269eed00c071004b957 - url: "https://pub.dev" - source: hosted - version: "4.1.1" - build_resolvers: - dependency: transitive - description: - name: build_resolvers - sha256: d1d57f7807debd7349b4726a19fd32ec8bc177c71ad0febf91a20f84cd2d4b46 - url: "https://pub.dev" - source: hosted - version: "3.0.3" - build_runner: - dependency: "direct main" - description: - name: build_runner - sha256: b24597fceb695969d47025c958f3837f9f0122e237c6a22cb082a5ac66c3ca30 - url: "https://pub.dev" - source: hosted - version: "2.7.1" - build_runner_core: - dependency: transitive - description: - name: build_runner_core - sha256: "066dda7f73d8eb48ba630a55acb50c4a84a2e6b453b1cb4567f581729e794f7b" - url: "https://pub.dev" - source: hosted - version: "9.3.1" - built_collection: - dependency: transitive - description: - name: built_collection - sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" - url: "https://pub.dev" - source: hosted - version: "5.1.1" - built_value: - dependency: transitive - description: - name: built_value - sha256: a30f0a0e38671e89a492c44d005b5545b830a961575bbd8336d42869ff71066d - url: "https://pub.dev" - source: hosted - version: "8.12.0" - characters: - dependency: transitive - description: - name: characters - sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 - url: "https://pub.dev" - source: hosted - version: "1.4.0" - checked_yaml: - dependency: transitive - description: - name: checked_yaml - sha256: "959525d3162f249993882720d52b7e0c833978df229be20702b33d48d91de70f" - url: "https://pub.dev" - source: hosted - version: "2.0.4" - cli_config: - dependency: transitive - description: - name: cli_config - sha256: ac20a183a07002b700f0c25e61b7ee46b23c309d76ab7b7640a028f18e4d99ec - url: "https://pub.dev" - source: hosted - version: "0.2.0" - cli_util: - dependency: transitive - description: - name: cli_util - sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c - url: "https://pub.dev" - source: hosted - version: "0.4.2" - clock: - dependency: transitive - description: - name: clock - sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b - url: "https://pub.dev" - source: hosted - version: "1.1.2" - code_builder: - dependency: transitive - description: - name: code_builder - sha256: "11654819532ba94c34de52ff5feb52bd81cba1de00ef2ed622fd50295f9d4243" - url: "https://pub.dev" - source: hosted - version: "4.11.0" - collection: - dependency: transitive - description: - name: collection - sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" - url: "https://pub.dev" - source: hosted - version: "1.19.1" - convert: - dependency: transitive - description: - name: convert - sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 - url: "https://pub.dev" - source: hosted - version: "3.1.2" - country_code_picker: - dependency: "direct main" - description: - name: country_code_picker - sha256: f0411f4833b6f98e8b7215f4fa3813bcc88e50f13925f70a170dbd36e3e447f5 - url: "https://pub.dev" - source: hosted - version: "3.4.1" - coverage: - dependency: transitive - description: - name: coverage - sha256: "5da775aa218eaf2151c721b16c01c7676fbfdd99cebba2bf64e8b807a28ff94d" - url: "https://pub.dev" - source: hosted - version: "1.15.0" - crypto: - dependency: transitive - description: - name: crypto - sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf - url: "https://pub.dev" - source: hosted - version: "3.0.7" - csslib: - dependency: transitive - description: - name: csslib - sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" - url: "https://pub.dev" - source: hosted - version: "1.0.2" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 - url: "https://pub.dev" - source: hosted - version: "1.0.8" - dart_style: - dependency: transitive - description: - name: dart_style - sha256: "8a0e5fba27e8ee025d2ffb4ee820b4e6e2cf5e4246a6b1a477eb66866947e0bb" - url: "https://pub.dev" - source: hosted - version: "3.1.1" - dashboard_shell: - dependency: "direct main" - description: - path: "../../modules/dashboard_shell" - relative: true - source: path - version: "0.0.1" - design_system: - dependency: "direct main" - description: - path: "../../packages/design_system" - relative: true - source: path - version: "0.0.1" - diacritic: - dependency: transitive - description: - name: diacritic - sha256: "12981945ec38931748836cd76f2b38773118d0baef3c68404bdfde9566147876" - url: "https://pub.dev" - source: hosted - version: "0.1.6" - dio: - dependency: transitive - description: - name: dio - sha256: d90ee57923d1828ac14e492ca49440f65477f4bb1263575900be731a3dac66a9 - url: "https://pub.dev" - source: hosted - version: "5.9.0" - dio_web_adapter: - dependency: transitive - description: - name: dio_web_adapter - sha256: "7586e476d70caecaf1686d21eee7247ea43ef5c345eab9e0cc3583ff13378d78" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - equatable: - dependency: transitive - description: - name: equatable - sha256: "567c64b3cb4cf82397aac55f4f0cbd3ca20d77c6c03bedbc4ceaddc08904aef7" - url: "https://pub.dev" - source: hosted - version: "2.0.7" - fake_async: - dependency: transitive - description: - name: fake_async - sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" - url: "https://pub.dev" - source: hosted - version: "1.3.3" - ffi: - dependency: transitive - description: - name: ffi - sha256: d07d37192dbf97461359c1518788f203b0c9102cfd2c35a716b823741219542c - url: "https://pub.dev" - source: hosted - version: "2.1.5" - file: - dependency: transitive - description: - name: file - sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 - url: "https://pub.dev" - source: hosted - version: "7.0.1" - fixnum: - dependency: transitive - description: - name: fixnum - sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be - url: "https://pub.dev" - source: hosted - version: "1.1.1" - fl_chart: - dependency: transitive - description: - name: fl_chart - sha256: "7ca9a40f4eb85949190e54087be8b4d6ac09dc4c54238d782a34cf1f7c011de9" - url: "https://pub.dev" - source: hosted - version: "1.1.1" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_dotenv: - dependency: "direct main" - description: - name: flutter_dotenv - sha256: d4130c4a43e0b13fefc593bc3961f2cb46e30cb79e253d4a526b1b5d24ae1ce4 - url: "https://pub.dev" - source: hosted - version: "6.0.0" - flutter_launcher_icons: - dependency: "direct dev" - description: - name: flutter_launcher_icons - sha256: "10f13781741a2e3972126fae08393d3c4e01fa4cd7473326b94b72cf594195e7" - url: "https://pub.dev" - source: hosted - version: "0.14.4" - flutter_lints: - dependency: "direct dev" - description: - name: flutter_lints - sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" - url: "https://pub.dev" - source: hosted - version: "5.0.0" - flutter_localizations: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_native_splash: - dependency: "direct main" - description: - name: flutter_native_splash - sha256: "4fb9f4113350d3a80841ce05ebf1976a36de622af7d19aca0ca9a9911c7ff002" - url: "https://pub.dev" - source: hosted - version: "2.4.7" - flutter_riverpod: - dependency: "direct main" - description: - name: flutter_riverpod - sha256: "9e2d6907f12cc7d23a846847615941bddee8709bf2bfd274acdf5e80bcf22fde" - url: "https://pub.dev" - source: hosted - version: "3.0.3" - flutter_svg: - dependency: "direct main" - description: - name: flutter_svg - sha256: "87fbd7c534435b6c5d9d98b01e1fd527812b82e68ddd8bd35fc45ed0fa8f0a95" - url: "https://pub.dev" - source: hosted - version: "2.2.3" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - flutter_web_plugins: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - fonts: - dependency: "direct main" - description: - path: "../../packages/fonts" - relative: true - source: path - version: "0.0.1" - freezed: - dependency: transitive - description: - name: freezed - sha256: "13065f10e135263a4f5a4391b79a8efc5fb8106f8dd555a9e49b750b45393d77" - url: "https://pub.dev" - source: hosted - version: "3.2.3" - freezed_annotation: - dependency: transitive - description: - name: freezed_annotation - sha256: "7294967ff0a6d98638e7acb774aac3af2550777accd8149c90af5b014e6d44d8" - url: "https://pub.dev" - source: hosted - version: "3.1.0" - frontend_server_client: - dependency: transitive - description: - name: frontend_server_client - sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 - url: "https://pub.dev" - source: hosted - version: "4.0.0" - get_it: - dependency: "direct main" - description: - name: get_it - sha256: "84792561b731b6463d053e9761a5236da967c369da10b134b8585a5e18429956" - url: "https://pub.dev" - source: hosted - version: "9.0.5" - glob: - dependency: transitive - description: - name: glob - sha256: c3f1ee72c96f8f78935e18aa8cecced9ab132419e8625dc187e1c2408efc20de - url: "https://pub.dev" - source: hosted - version: "2.1.3" - go_router: - dependency: "direct main" - description: - name: go_router - sha256: c92d18e1fe994cb06d48aa786c46b142a5633067e8297cff6b5a3ac742620104 - url: "https://pub.dev" - source: hosted - version: "17.0.0" - go_router_builder: - dependency: "direct main" - description: - name: go_router_builder - sha256: e0646fb5586e04e1df92678f539059f38e4314848f06dd4f3cd87fed434e16b5 - url: "https://pub.dev" - source: hosted - version: "4.1.1" - graphs: - dependency: transitive - description: - name: graphs - sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" - url: "https://pub.dev" - source: hosted - version: "2.3.2" - home: - dependency: "direct main" - description: - path: "../../modules/home" - relative: true - source: path - version: "0.0.1" - html: - dependency: transitive - description: - name: html - sha256: "6d1264f2dffa1b1101c25a91dff0dc2daee4c18e87cd8538729773c073dbf602" - url: "https://pub.dev" - source: hosted - version: "0.15.6" - http: - dependency: transitive - description: - name: http - sha256: bb2ce4590bc2667c96f318d68cac1b5a7987ec819351d32b1c987239a815e007 - url: "https://pub.dev" - source: hosted - version: "1.5.0" - http_multi_server: - dependency: transitive - description: - name: http_multi_server - sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8 - url: "https://pub.dev" - source: hosted - version: "3.2.2" - http_parser: - dependency: transitive - description: - name: http_parser - sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" - url: "https://pub.dev" - source: hosted - version: "4.1.2" - image: - dependency: transitive - description: - name: image - sha256: "492bd52f6c4fbb6ee41f781ff27765ce5f627910e1e0cbecfa3d9add5562604c" - url: "https://pub.dev" - source: hosted - version: "4.7.2" - intl: - dependency: transitive - description: - name: intl - sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5" - url: "https://pub.dev" - source: hosted - version: "0.20.2" - io: - dependency: transitive - description: - name: io - sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b - url: "https://pub.dev" - source: hosted - version: "1.0.5" - js: - dependency: transitive - description: - name: js - sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc" - url: "https://pub.dev" - source: hosted - version: "0.7.2" - json_annotation: - dependency: transitive - description: - name: json_annotation - sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" - url: "https://pub.dev" - source: hosted - version: "4.9.0" - json_serializable: - dependency: transitive - description: - name: json_serializable - sha256: c5b2ee75210a0f263c6c7b9eeea80553dbae96ea1bf57f02484e806a3ffdffa3 - url: "https://pub.dev" - source: hosted - version: "6.11.2" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" - url: "https://pub.dev" - source: hosted - version: "11.0.2" - leak_tracker_flutter_testing: - dependency: transitive - description: - name: leak_tracker_flutter_testing - sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" - url: "https://pub.dev" - source: hosted - version: "3.0.10" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" - url: "https://pub.dev" - source: hosted - version: "3.0.2" - lints: - dependency: transitive - description: - name: lints - sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 - url: "https://pub.dev" - source: hosted - version: "5.1.1" - logging: - dependency: transitive - description: - name: logging - sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 - url: "https://pub.dev" - source: hosted - version: "1.3.0" - matcher: - dependency: transitive - description: - name: matcher - sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 - url: "https://pub.dev" - source: hosted - version: "0.12.17" - material_color_utilities: - dependency: transitive - description: - name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec - url: "https://pub.dev" - source: hosted - version: "0.11.1" - meta: - dependency: transitive - description: - name: meta - sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c - url: "https://pub.dev" - source: hosted - version: "1.16.0" - mime: - dependency: transitive - description: - name: mime - sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" - url: "https://pub.dev" - source: hosted - version: "2.0.0" - navigation: - dependency: "direct main" - description: - path: "../../packages/navigation" - relative: true - source: path - version: "0.0.1" - node_preamble: - dependency: transitive - description: - name: node_preamble - sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" - url: "https://pub.dev" - source: hosted - version: "2.0.2" - notifications: - dependency: "direct main" - description: - path: "../../modules/notifications" - relative: true - source: path - version: "0.0.1" - package_config: - dependency: transitive - description: - name: package_config - sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc - url: "https://pub.dev" - source: hosted - version: "2.2.0" - page_transition: - dependency: transitive - description: - name: page_transition - sha256: "9d2a780d7d68b53ae82fbcc43e06a16195e6775e9aae40e55dc0cbb593460f9d" - url: "https://pub.dev" - source: hosted - version: "2.2.1" - path: - dependency: transitive - description: - name: path - sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" - url: "https://pub.dev" - source: hosted - version: "1.9.1" - path_parsing: - dependency: transitive - description: - name: path_parsing - sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca" - url: "https://pub.dev" - source: hosted - version: "1.1.0" - petitparser: - dependency: transitive - description: - name: petitparser - sha256: "1a97266a94f7350d30ae522c0af07890c70b8e62c71e8e3920d1db4d23c057d1" - url: "https://pub.dev" - source: hosted - version: "7.0.1" - pool: - dependency: transitive - description: - name: pool - sha256: "978783255c543aa3586a1b3c21f6e9d720eb315376a915872c61ef8b5c20177d" - url: "https://pub.dev" - source: hosted - version: "1.5.2" - posix: - dependency: transitive - description: - name: posix - sha256: "6323a5b0fa688b6a010df4905a56b00181479e6d10534cecfecede2aa55add61" - url: "https://pub.dev" - source: hosted - version: "6.0.3" - profile: - dependency: "direct main" - description: - path: "../../modules/profile" - relative: true - source: path - version: "0.0.1" - pub_semver: - dependency: transitive - description: - name: pub_semver - sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585" - url: "https://pub.dev" - source: hosted - version: "2.2.0" - pubspec_parse: - dependency: transitive - description: - name: pubspec_parse - sha256: "0560ba233314abbed0a48a2956f7f022cce7c3e1e73df540277da7544cad4082" - url: "https://pub.dev" - source: hosted - version: "1.5.0" - riverpod: - dependency: transitive - description: - name: riverpod - sha256: c406de02bff19d920b832bddfb8283548bfa05ce41c59afba57ce643e116aa59 - url: "https://pub.dev" - source: hosted - version: "3.0.3" - sf_infrastructure: - dependency: "direct main" - description: - path: "../../packages/sf_infrastructure" - relative: true - source: path - version: "0.0.1" - sf_localizations: - dependency: "direct main" - description: - path: "../../packages/sf_localizations" - relative: true - source: path - version: "0.0.1" - sf_shared: - dependency: "direct overridden" - description: - path: "../../packages/sf_shared" - relative: true - source: path - version: "0.0.1" - shelf: - dependency: transitive - description: - name: shelf - sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12 - url: "https://pub.dev" - source: hosted - version: "1.4.2" - shelf_packages_handler: - dependency: transitive - description: - name: shelf_packages_handler - sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" - url: "https://pub.dev" - source: hosted - version: "3.0.2" - shelf_static: - dependency: transitive - description: - name: shelf_static - sha256: c87c3875f91262785dade62d135760c2c69cb217ac759485334c5857ad89f6e3 - url: "https://pub.dev" - source: hosted - version: "1.1.3" - shelf_web_socket: - dependency: transitive - description: - name: shelf_web_socket - sha256: "3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925" - url: "https://pub.dev" - source: hosted - version: "3.0.0" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - source_gen: - dependency: transitive - description: - name: source_gen - sha256: "800f12fb87434defa13432ab37e33051b43b290a174e15259563b043cda40c46" - url: "https://pub.dev" - source: hosted - version: "4.0.0" - source_helper: - dependency: transitive - description: - name: source_helper - sha256: "6a3c6cc82073a8797f8c4dc4572146114a39652851c157db37e964d9c7038723" - url: "https://pub.dev" - source: hosted - version: "1.3.8" - source_map_stack_trace: - dependency: transitive - description: - name: source_map_stack_trace - sha256: c0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b - url: "https://pub.dev" - source: hosted - version: "2.1.2" - source_maps: - dependency: transitive - description: - name: source_maps - sha256: "190222579a448b03896e0ca6eca5998fa810fda630c1d65e2f78b3f638f54812" - url: "https://pub.dev" - source: hosted - version: "0.10.13" - source_span: - dependency: transitive - description: - name: source_span - sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" - url: "https://pub.dev" - source: hosted - version: "1.10.1" - splash: - dependency: "direct main" - description: - path: "../../modules/splash" - relative: true - source: path - version: "0.0.1" - stack_trace: - dependency: transitive - description: - name: stack_trace - sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" - url: "https://pub.dev" - source: hosted - version: "1.12.1" - state_notifier: - dependency: transitive - description: - name: state_notifier - sha256: b8677376aa54f2d7c58280d5a007f9e8774f1968d1fb1c096adcb4792fba29bb - url: "https://pub.dev" - source: hosted - version: "1.0.0" - stream_channel: - dependency: transitive - description: - name: stream_channel - sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - stream_transform: - dependency: transitive - description: - name: stream_transform - sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 - url: "https://pub.dev" - source: hosted - version: "2.1.1" - string_scanner: - dependency: transitive - description: - name: string_scanner - sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" - url: "https://pub.dev" - source: hosted - version: "1.4.1" - term_glyph: - dependency: transitive - description: - name: term_glyph - sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" - url: "https://pub.dev" - source: hosted - version: "1.2.2" - test: - dependency: transitive - description: - name: test - sha256: "65e29d831719be0591f7b3b1a32a3cda258ec98c58c7b25f7b84241bc31215bb" - url: "https://pub.dev" - source: hosted - version: "1.26.2" - test_api: - dependency: transitive - description: - name: test_api - sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00" - url: "https://pub.dev" - source: hosted - version: "0.7.6" - test_core: - dependency: transitive - description: - name: test_core - sha256: "80bf5a02b60af04b09e14f6fe68b921aad119493e26e490deaca5993fef1b05a" - url: "https://pub.dev" - source: hosted - version: "0.6.11" - timing: - dependency: transitive - description: - name: timing - sha256: "62ee18aca144e4a9f29d212f5a4c6a053be252b895ab14b5821996cff4ed90fe" - url: "https://pub.dev" - source: hosted - version: "1.0.2" - typed_data: - dependency: transitive - description: - name: typed_data - sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 - url: "https://pub.dev" - source: hosted - version: "1.4.0" - universal_io: - dependency: transitive - description: - name: universal_io - sha256: f63cbc48103236abf48e345e07a03ce5757ea86285ed313a6a032596ed9301e2 - url: "https://pub.dev" - source: hosted - version: "2.3.1" - utils: - dependency: "direct main" - description: - path: "../../packages/utils" - relative: true - source: path - version: "0.0.1" - uuid: - dependency: transitive - description: - name: uuid - sha256: a11b666489b1954e01d992f3d601b1804a33937b5a8fe677bd26b8a9f96f96e8 - url: "https://pub.dev" - source: hosted - version: "4.5.2" - vector_graphics: - dependency: transitive - description: - name: vector_graphics - sha256: a4f059dc26fc8295b5921376600a194c4ec7d55e72f2fe4c7d2831e103d461e6 - url: "https://pub.dev" - source: hosted - version: "1.1.19" - vector_graphics_codec: - dependency: transitive - description: - name: vector_graphics_codec - sha256: "99fd9fbd34d9f9a32efd7b6a6aae14125d8237b10403b422a6a6dfeac2806146" - url: "https://pub.dev" - source: hosted - version: "1.1.13" - vector_graphics_compiler: - dependency: transitive - description: - name: vector_graphics_compiler - sha256: d354a7ec6931e6047785f4db12a1f61ec3d43b207fc0790f863818543f8ff0dc - url: "https://pub.dev" - source: hosted - version: "1.1.19" - vector_math: - dependency: transitive - description: - name: vector_math - sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b - url: "https://pub.dev" - source: hosted - version: "2.2.0" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60" - url: "https://pub.dev" - source: hosted - version: "15.0.2" - watcher: - dependency: transitive - description: - name: watcher - sha256: "592ab6e2892f67760543fb712ff0177f4ec76c031f02f5b4ff8d3fc5eb9fb61a" - url: "https://pub.dev" - source: hosted - version: "1.1.4" - web: - dependency: transitive - description: - name: web - sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" - url: "https://pub.dev" - source: hosted - version: "1.1.1" - web_socket: - dependency: transitive - description: - name: web_socket - sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c" - url: "https://pub.dev" - source: hosted - version: "1.0.1" - web_socket_channel: - dependency: transitive - description: - name: web_socket_channel - sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8 - url: "https://pub.dev" - source: hosted - version: "3.0.3" - webkit_inspection_protocol: - dependency: transitive - description: - name: webkit_inspection_protocol - sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" - url: "https://pub.dev" - source: hosted - version: "1.2.1" - xml: - dependency: transitive - description: - name: xml - sha256: "971043b3a0d3da28727e40ed3e0b5d18b742fa5a68665cca88e74b7876d5e025" - url: "https://pub.dev" - source: hosted - version: "6.6.1" - yaml: - dependency: transitive - description: - name: yaml - sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce - url: "https://pub.dev" - source: hosted - version: "3.1.3" -sdks: - dart: ">=3.9.2 <4.0.0" - flutter: ">=3.32.0" diff --git a/apps/mobile_app/pubspec.yaml b/apps/mobile_app/pubspec.yaml index bab26b88..356c20c0 100644 --- a/apps/mobile_app/pubspec.yaml +++ b/apps/mobile_app/pubspec.yaml @@ -41,6 +41,8 @@ dependencies: path: ../../modules/auth home: path: ../../modules/home + hub: + path: ../../modules/hub profile: path: ../../modules/profile notifications: diff --git a/apps/mobile_app/pubspec_overrides.yaml b/apps/mobile_app/pubspec_overrides.yaml deleted file mode 100644 index 41f777ad..00000000 --- a/apps/mobile_app/pubspec_overrides.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# melos_managed_dependency_overrides: auth,dashboard_shell,design_system,home,navigation,notifications,profile,sf_shared,utils,sf_localizations,fonts,sf_infrastructure -dependency_overrides: - auth: - path: ../../modules/auth - dashboard_shell: - path: ../../modules/dashboard_shell - design_system: - path: ../../packages/design_system - fonts: - path: ../../packages/fonts - home: - path: ../../modules/home - navigation: - path: ../../packages/navigation - notifications: - path: ../../modules/notifications - profile: - path: ../../modules/profile - sf_infrastructure: - path: ../../packages/sf_infrastructure - sf_localizations: - path: ../../packages/sf_localizations - sf_shared: - path: ../../packages/sf_shared - utils: - path: ../../packages/utils diff --git a/melos_sf-app-platform.iml b/melos_sf-app-platform.iml index 96815595..1ff30704 100644 --- a/melos_sf-app-platform.iml +++ b/melos_sf-app-platform.iml @@ -4,9 +4,18 @@ + + + + + + + + + - + \ No newline at end of file diff --git a/modules/auth/lib/src/features/onboarding/presentation/onboarding_screen.dart b/modules/auth/lib/src/features/onboarding/presentation/onboarding_screen.dart index 1ad3fdc1..e50606b3 100644 --- a/modules/auth/lib/src/features/onboarding/presentation/onboarding_screen.dart +++ b/modules/auth/lib/src/features/onboarding/presentation/onboarding_screen.dart @@ -32,7 +32,7 @@ class OnboardingScreen extends ConsumerWidget { void goToNext() { if (isLast) { - navigationContract.goTo(AppRoutes.linkPhone); + navigationContract.goTo(AppRoutes.hub); } else { pageController.nextPage( duration: const Duration(milliseconds: 400), @@ -111,7 +111,7 @@ class OnboardingScreen extends ConsumerWidget { ? const SizedBox.shrink() : TextButton( onPressed: () => - navigationContract.goTo(AppRoutes.linkPhone), + navigationContract.goTo(AppRoutes.hub), child: Text( context.translate(I18n.skip), style: AppFonts.stolzlStyle( diff --git a/modules/auth/lib/src/features/onboarding/presentation/welcome_screen.dart b/modules/auth/lib/src/features/onboarding/presentation/welcome_screen.dart deleted file mode 100644 index e69de29b..00000000 diff --git a/modules/auth/pubspec.yaml b/modules/auth/pubspec.yaml index 953889a6..faf9f3a8 100644 --- a/modules/auth/pubspec.yaml +++ b/modules/auth/pubspec.yaml @@ -13,8 +13,8 @@ dependencies: flutter: sdk: flutter #modules dependencies go here - dashboard_shell: - path: ../../modules/dashboard_shell + home: + path: ../../modules/home #packages dependencies go here design_system: path: ../../packages/design_system @@ -40,6 +40,8 @@ dependencies: json_annotation: ^4.9.0 json_serializable: ^6.11.2 uuid: ^4.5.2 + flutter_map: ^8.2.2 + latlong2: ^0.9.1 dev_dependencies: flutter_test: diff --git a/modules/auth/pubspec_overrides.yaml b/modules/auth/pubspec_overrides.yaml index 9d5c49cf..c26aef41 100644 --- a/modules/auth/pubspec_overrides.yaml +++ b/modules/auth/pubspec_overrides.yaml @@ -1,3 +1,5 @@ +# melos_managed_dependency_overrides: home +# melos_managed_dependency_overrides: home # melos_managed_dependency_overrides: dashboard_shell,design_system,home,notifications,profile,sf_shared,navigation,utils,sf_localizations,fonts,sf_infrastructure dependency_overrides: dashboard_shell: @@ -7,7 +9,9 @@ dependency_overrides: fonts: path: ../../packages/fonts home: - path: ../home + path: ..\\home + hub: + path: ../hub navigation: path: ../../packages/navigation notifications: diff --git a/modules/dashboard_shell/pubspec_overrides.yaml b/modules/dashboard_shell/pubspec_overrides.yaml deleted file mode 100644 index e06af733..00000000 --- a/modules/dashboard_shell/pubspec_overrides.yaml +++ /dev/null @@ -1,24 +0,0 @@ -# melos_managed_dependency_overrides: auth,design_system,home,notifications,profile,sf_shared,navigation,utils,sf_localizations,fonts,sf_infrastructure -dependency_overrides: - auth: - path: ../auth - design_system: - path: ../../packages/design_system - fonts: - path: ../../packages/fonts - home: - path: ../home - navigation: - path: ../../packages/navigation - notifications: - path: ../notifications - profile: - path: ../profile - sf_infrastructure: - path: ../../packages/sf_infrastructure - sf_localizations: - path: ../../packages/sf_localizations - sf_shared: - path: ../../packages/sf_shared - utils: - path: ../../packages/utils diff --git a/modules/hub/lib/src/core/data/datasource/hub_remote_datasource.dart b/modules/hub/lib/src/core/data/datasource/hub_remote_datasource.dart new file mode 100644 index 00000000..54336801 --- /dev/null +++ b/modules/hub/lib/src/core/data/datasource/hub_remote_datasource.dart @@ -0,0 +1,10 @@ + +import 'package:hub/src/features/hub/domain/entities/device_entity.dart'; +import 'package:hub/src/features/hub/domain/entities/get_devices_request_entity.dart'; +import 'package:hub/src/features/hub/domain/entities/position_entity.dart'; + +abstract class HomeRemoteDatasource { + Future> getDevices({required String userId}); + + Future> getLatestPositions({required String deviceId}); +} diff --git a/modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart b/modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart new file mode 100644 index 00000000..78fb2279 --- /dev/null +++ b/modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart @@ -0,0 +1,120 @@ +import 'dart:convert'; + +import 'package:dio/dio.dart'; +import 'package:flutter/material.dart'; +import 'package:hub/src/core/data/datasource/hub_remote_datasource.dart'; +import 'package:hub/src/core/data/models/get_devices_response_model.dart'; +import 'package:hub/src/core/data/models/latest_positions_response_model.dart'; +import 'package:hub/src/features/hub/domain/entities/device_entity.dart'; +import 'package:hub/src/features/hub/domain/entities/position_entity.dart'; +import 'package:hub/src/features/hub/domain/get_latest_positions_use_case.dart'; +import 'package:sf_infrastructure/sf_infrastructure.dart'; + +class HomeRemoteDatasourceImpl implements HomeRemoteDatasource { + HomeRemoteDatasourceImpl(this._repository); + + final QuestiaRepository _repository; + + @override + Future> getDevices({required String userId}) async { + try { + final response = await _repository.get>( + '/$userId/devices', + ); + final data = response.data!['items']; + if (data == null || data.isEmpty) { + throw Exception('Empty response from /:userId/devices'); + } + + final model = GetDevicesResponseModel.fromJson(data); + /*final model = GetDevicesResponseModel(items: [ + GetDevicesItemResponseModel( + id: '1', + identificator: '1111', + carrierName: 'Carlos'), + GetDevicesItemResponseModel( + id: '2', + identificator: '1112', + carrierName: 'Ana'), + ]);*/ + return model.toEntity(); + } on DioException catch (error) { + throw _mapDioError( + error, + defaultMessage: error.message ?? 'Error getting devices', + ); + } + } + + @override + Future> getLatestPositions({required String deviceId}) async { + try { + final response = await _repository.get>( + '/positions/api/identificator/$deviceId/positions', + ); + final data = response.data?['items'] ?? []; + if (data == null || data.isEmpty) { + throw Exception('Empty response from /identificator/:deviceId/positions'); + } + + final model = LatestPositionsResponseModel.fromJson(data); + /*final model = LatestPositionsResponseModel(items: [ + LatestPositionsItemResponseModel( + latitude: 43.327116830678186, + longitude: -3.083269100434551, + address: 'Aparcamiento', + positionDate: DateTime.now(), + frequentPlace: false, + frequentPlaceName: ''), + LatestPositionsItemResponseModel( + latitude: 43.32729043118528, + longitude: -3.08320596406992, + address: 'Izekoren etxea', + positionDate: DateTime.now(), + frequentPlace: true, + frequentPlaceName: 'La cafetería'), + ]);*/ + return model.toEntity(); + } on DioException catch (error) { + throw _mapDioError( + error, + defaultMessage: error.message ?? 'Error getting latest position', + ); + } + } +} + +Exception _mapDioError(DioException error, {required String defaultMessage}) { + final apiMsg = _extractApiMessage(error.response?.data); + final msg = apiMsg ?? error.message ?? defaultMessage; + return Exception(msg); +} + +String? _extractApiMessage(Object? data) { + if (data == null) return null; + + if (data is Map) { + final errorObj = data['error']; + if (errorObj is Map && errorObj['message'] is String) { + return (errorObj['message'] as String).trim(); + } + if (data['message'] is String) { + return (data['message'] as String).trim(); + } + return null; + } + + if (data is String) { + final raw = data.trim(); + if (raw.isEmpty) return null; + + try { + final decoded = jsonDecode(raw); + return _extractApiMessage(decoded); + } catch (_) { + return raw; + } + } + + return null; +} diff --git a/modules/hub/lib/src/core/data/models/get_devices_response_model.dart b/modules/hub/lib/src/core/data/models/get_devices_response_model.dart new file mode 100644 index 00000000..e64f3bf5 --- /dev/null +++ b/modules/hub/lib/src/core/data/models/get_devices_response_model.dart @@ -0,0 +1,38 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:hub/src/features/hub/domain/entities/device_entity.dart'; + +part 'get_devices_response_model.freezed.dart'; +part 'get_devices_response_model.g.dart'; + +@freezed +abstract class GetDevicesResponseModel with _$GetDevicesResponseModel { + const factory GetDevicesResponseModel({ + required List items, + }) = _GetDevicesResponseModel; + + factory GetDevicesResponseModel.fromJson(Map json) => + _$GetDevicesResponseModelFromJson(json); +} + +@freezed +abstract class GetDevicesItemResponseModel + with _$GetDevicesItemResponseModel { + const factory GetDevicesItemResponseModel({ + required String id, + required String identificator, + required String carrierName, + }) = _GetDevicesItemResponseModel; + + factory GetDevicesItemResponseModel.fromJson(Map json) => + _$GetDevicesItemResponseModelFromJson(json); +} + +extension GetDevicesResponseModelMapper on GetDevicesResponseModel { + List toEntity() { + return items.map((GetDevicesItemResponseModel item) => DeviceEntity( + id: item.id, + identificator: item.identificator, + carrierName: item.carrierName, + )).toList(); + } +} diff --git a/modules/hub/lib/src/core/data/models/get_devices_response_model.freezed.dart b/modules/hub/lib/src/core/data/models/get_devices_response_model.freezed.dart new file mode 100644 index 00000000..1ad17056 --- /dev/null +++ b/modules/hub/lib/src/core/data/models/get_devices_response_model.freezed.dart @@ -0,0 +1,552 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'get_devices_response_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$GetDevicesResponseModel { + + List get items; +/// Create a copy of GetDevicesResponseModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$GetDevicesResponseModelCopyWith get copyWith => _$GetDevicesResponseModelCopyWithImpl(this as GetDevicesResponseModel, _$identity); + + /// Serializes this GetDevicesResponseModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is GetDevicesResponseModel&&const DeepCollectionEquality().equals(other.items, items)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(items)); + +@override +String toString() { + return 'GetDevicesResponseModel(items: $items)'; +} + + +} + +/// @nodoc +abstract mixin class $GetDevicesResponseModelCopyWith<$Res> { + factory $GetDevicesResponseModelCopyWith(GetDevicesResponseModel value, $Res Function(GetDevicesResponseModel) _then) = _$GetDevicesResponseModelCopyWithImpl; +@useResult +$Res call({ + List items +}); + + + + +} +/// @nodoc +class _$GetDevicesResponseModelCopyWithImpl<$Res> + implements $GetDevicesResponseModelCopyWith<$Res> { + _$GetDevicesResponseModelCopyWithImpl(this._self, this._then); + + final GetDevicesResponseModel _self; + final $Res Function(GetDevicesResponseModel) _then; + +/// Create a copy of GetDevicesResponseModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? items = null,}) { + return _then(_self.copyWith( +items: null == items ? _self.items : items // ignore: cast_nullable_to_non_nullable +as List, + )); +} + +} + + +/// Adds pattern-matching-related methods to [GetDevicesResponseModel]. +extension GetDevicesResponseModelPatterns on GetDevicesResponseModel { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _GetDevicesResponseModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _GetDevicesResponseModel() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _GetDevicesResponseModel value) $default,){ +final _that = this; +switch (_that) { +case _GetDevicesResponseModel(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _GetDevicesResponseModel value)? $default,){ +final _that = this; +switch (_that) { +case _GetDevicesResponseModel() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( List items)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _GetDevicesResponseModel() when $default != null: +return $default(_that.items);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( List items) $default,) {final _that = this; +switch (_that) { +case _GetDevicesResponseModel(): +return $default(_that.items);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( List items)? $default,) {final _that = this; +switch (_that) { +case _GetDevicesResponseModel() when $default != null: +return $default(_that.items);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _GetDevicesResponseModel implements GetDevicesResponseModel { + const _GetDevicesResponseModel({required final List items}): _items = items; + factory _GetDevicesResponseModel.fromJson(Map json) => _$GetDevicesResponseModelFromJson(json); + + final List _items; +@override List get items { + if (_items is EqualUnmodifiableListView) return _items; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_items); +} + + +/// Create a copy of GetDevicesResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$GetDevicesResponseModelCopyWith<_GetDevicesResponseModel> get copyWith => __$GetDevicesResponseModelCopyWithImpl<_GetDevicesResponseModel>(this, _$identity); + +@override +Map toJson() { + return _$GetDevicesResponseModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetDevicesResponseModel&&const DeepCollectionEquality().equals(other._items, _items)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_items)); + +@override +String toString() { + return 'GetDevicesResponseModel(items: $items)'; +} + + +} + +/// @nodoc +abstract mixin class _$GetDevicesResponseModelCopyWith<$Res> implements $GetDevicesResponseModelCopyWith<$Res> { + factory _$GetDevicesResponseModelCopyWith(_GetDevicesResponseModel value, $Res Function(_GetDevicesResponseModel) _then) = __$GetDevicesResponseModelCopyWithImpl; +@override @useResult +$Res call({ + List items +}); + + + + +} +/// @nodoc +class __$GetDevicesResponseModelCopyWithImpl<$Res> + implements _$GetDevicesResponseModelCopyWith<$Res> { + __$GetDevicesResponseModelCopyWithImpl(this._self, this._then); + + final _GetDevicesResponseModel _self; + final $Res Function(_GetDevicesResponseModel) _then; + +/// Create a copy of GetDevicesResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? items = null,}) { + return _then(_GetDevicesResponseModel( +items: null == items ? _self._items : items // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + + +/// @nodoc +mixin _$GetDevicesItemResponseModel { + + String get id; String get identificator; String get carrierName; +/// Create a copy of GetDevicesItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$GetDevicesItemResponseModelCopyWith get copyWith => _$GetDevicesItemResponseModelCopyWithImpl(this as GetDevicesItemResponseModel, _$identity); + + /// Serializes this GetDevicesItemResponseModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is GetDevicesItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,identificator,carrierName); + +@override +String toString() { + return 'GetDevicesItemResponseModel(id: $id, identificator: $identificator, carrierName: $carrierName)'; +} + + +} + +/// @nodoc +abstract mixin class $GetDevicesItemResponseModelCopyWith<$Res> { + factory $GetDevicesItemResponseModelCopyWith(GetDevicesItemResponseModel value, $Res Function(GetDevicesItemResponseModel) _then) = _$GetDevicesItemResponseModelCopyWithImpl; +@useResult +$Res call({ + String id, String identificator, String carrierName +}); + + + + +} +/// @nodoc +class _$GetDevicesItemResponseModelCopyWithImpl<$Res> + implements $GetDevicesItemResponseModelCopyWith<$Res> { + _$GetDevicesItemResponseModelCopyWithImpl(this._self, this._then); + + final GetDevicesItemResponseModel _self; + final $Res Function(GetDevicesItemResponseModel) _then; + +/// Create a copy of GetDevicesItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? identificator = null,Object? carrierName = null,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable +as String,carrierName: null == carrierName ? _self.carrierName : carrierName // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [GetDevicesItemResponseModel]. +extension GetDevicesItemResponseModelPatterns on GetDevicesItemResponseModel { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _GetDevicesItemResponseModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _GetDevicesItemResponseModel() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _GetDevicesItemResponseModel value) $default,){ +final _that = this; +switch (_that) { +case _GetDevicesItemResponseModel(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _GetDevicesItemResponseModel value)? $default,){ +final _that = this; +switch (_that) { +case _GetDevicesItemResponseModel() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String identificator, String carrierName)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _GetDevicesItemResponseModel() when $default != null: +return $default(_that.id,_that.identificator,_that.carrierName);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String id, String identificator, String carrierName) $default,) {final _that = this; +switch (_that) { +case _GetDevicesItemResponseModel(): +return $default(_that.id,_that.identificator,_that.carrierName);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String identificator, String carrierName)? $default,) {final _that = this; +switch (_that) { +case _GetDevicesItemResponseModel() when $default != null: +return $default(_that.id,_that.identificator,_that.carrierName);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _GetDevicesItemResponseModel implements GetDevicesItemResponseModel { + const _GetDevicesItemResponseModel({required this.id, required this.identificator, required this.carrierName}); + factory _GetDevicesItemResponseModel.fromJson(Map json) => _$GetDevicesItemResponseModelFromJson(json); + +@override final String id; +@override final String identificator; +@override final String carrierName; + +/// Create a copy of GetDevicesItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$GetDevicesItemResponseModelCopyWith<_GetDevicesItemResponseModel> get copyWith => __$GetDevicesItemResponseModelCopyWithImpl<_GetDevicesItemResponseModel>(this, _$identity); + +@override +Map toJson() { + return _$GetDevicesItemResponseModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetDevicesItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,identificator,carrierName); + +@override +String toString() { + return 'GetDevicesItemResponseModel(id: $id, identificator: $identificator, carrierName: $carrierName)'; +} + + +} + +/// @nodoc +abstract mixin class _$GetDevicesItemResponseModelCopyWith<$Res> implements $GetDevicesItemResponseModelCopyWith<$Res> { + factory _$GetDevicesItemResponseModelCopyWith(_GetDevicesItemResponseModel value, $Res Function(_GetDevicesItemResponseModel) _then) = __$GetDevicesItemResponseModelCopyWithImpl; +@override @useResult +$Res call({ + String id, String identificator, String carrierName +}); + + + + +} +/// @nodoc +class __$GetDevicesItemResponseModelCopyWithImpl<$Res> + implements _$GetDevicesItemResponseModelCopyWith<$Res> { + __$GetDevicesItemResponseModelCopyWithImpl(this._self, this._then); + + final _GetDevicesItemResponseModel _self; + final $Res Function(_GetDevicesItemResponseModel) _then; + +/// Create a copy of GetDevicesItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? identificator = null,Object? carrierName = null,}) { + return _then(_GetDevicesItemResponseModel( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable +as String,carrierName: null == carrierName ? _self.carrierName : carrierName // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/modules/hub/lib/src/core/data/models/get_devices_response_model.g.dart b/modules/hub/lib/src/core/data/models/get_devices_response_model.g.dart new file mode 100644 index 00000000..e6927c90 --- /dev/null +++ b/modules/hub/lib/src/core/data/models/get_devices_response_model.g.dart @@ -0,0 +1,37 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'get_devices_response_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_GetDevicesResponseModel _$GetDevicesResponseModelFromJson( + Map json, +) => _GetDevicesResponseModel( + items: (json['items'] as List) + .map( + (e) => GetDevicesItemResponseModel.fromJson(e as Map), + ) + .toList(), +); + +Map _$GetDevicesResponseModelToJson( + _GetDevicesResponseModel instance, +) => {'items': instance.items}; + +_GetDevicesItemResponseModel _$GetDevicesItemResponseModelFromJson( + Map json, +) => _GetDevicesItemResponseModel( + id: json['id'] as String, + identificator: json['identificator'] as String, + carrierName: json['carrierName'] as String, +); + +Map _$GetDevicesItemResponseModelToJson( + _GetDevicesItemResponseModel instance, +) => { + 'id': instance.id, + 'identificator': instance.identificator, + 'carrierName': instance.carrierName, +}; diff --git a/modules/hub/lib/src/core/data/models/latest_positions_response_model.dart b/modules/hub/lib/src/core/data/models/latest_positions_response_model.dart new file mode 100644 index 00000000..e9aeaf19 --- /dev/null +++ b/modules/hub/lib/src/core/data/models/latest_positions_response_model.dart @@ -0,0 +1,44 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:hub/src/features/hub/domain/entities/position_entity.dart'; + +part 'latest_positions_response_model.freezed.dart'; +part 'latest_positions_response_model.g.dart'; + +@freezed +abstract class LatestPositionsResponseModel with _$LatestPositionsResponseModel { + const factory LatestPositionsResponseModel({ + required List items, + }) = _LatestPositionsResponseModel; + + factory LatestPositionsResponseModel.fromJson(Map json) => + _$LatestPositionsResponseModelFromJson(json); +} + +@freezed +abstract class LatestPositionsItemResponseModel + with _$LatestPositionsItemResponseModel { + const factory LatestPositionsItemResponseModel({ + required double latitude, + required double longitude, + required String? address, + required DateTime positionDate, + required bool frequentPlace, + required String frequentPlaceName, + }) = _LatestPositionsItemResponseModel; + + factory LatestPositionsItemResponseModel.fromJson(Map json) => + _$LatestPositionsItemResponseModelFromJson(json); +} + +extension LatestPositionsResponseModelMapper on LatestPositionsResponseModel { + List toEntity() { + return items.map((LatestPositionsItemResponseModel item) => PositionEntity( + latitude: item.latitude, + longitude: item.longitude, + address: item.address, + positionDate: item.positionDate, + frequentPlace: item.frequentPlace, + frequentPlaceName: item.frequentPlaceName, + )).toList(); + } +} diff --git a/modules/hub/lib/src/core/data/models/latest_positions_response_model.freezed.dart b/modules/hub/lib/src/core/data/models/latest_positions_response_model.freezed.dart new file mode 100644 index 00000000..1f149eaa --- /dev/null +++ b/modules/hub/lib/src/core/data/models/latest_positions_response_model.freezed.dart @@ -0,0 +1,561 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'latest_positions_response_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$LatestPositionsResponseModel { + + List get items; +/// Create a copy of LatestPositionsResponseModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$LatestPositionsResponseModelCopyWith get copyWith => _$LatestPositionsResponseModelCopyWithImpl(this as LatestPositionsResponseModel, _$identity); + + /// Serializes this LatestPositionsResponseModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is LatestPositionsResponseModel&&const DeepCollectionEquality().equals(other.items, items)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(items)); + +@override +String toString() { + return 'LatestPositionsResponseModel(items: $items)'; +} + + +} + +/// @nodoc +abstract mixin class $LatestPositionsResponseModelCopyWith<$Res> { + factory $LatestPositionsResponseModelCopyWith(LatestPositionsResponseModel value, $Res Function(LatestPositionsResponseModel) _then) = _$LatestPositionsResponseModelCopyWithImpl; +@useResult +$Res call({ + List items +}); + + + + +} +/// @nodoc +class _$LatestPositionsResponseModelCopyWithImpl<$Res> + implements $LatestPositionsResponseModelCopyWith<$Res> { + _$LatestPositionsResponseModelCopyWithImpl(this._self, this._then); + + final LatestPositionsResponseModel _self; + final $Res Function(LatestPositionsResponseModel) _then; + +/// Create a copy of LatestPositionsResponseModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? items = null,}) { + return _then(_self.copyWith( +items: null == items ? _self.items : items // ignore: cast_nullable_to_non_nullable +as List, + )); +} + +} + + +/// Adds pattern-matching-related methods to [LatestPositionsResponseModel]. +extension LatestPositionsResponseModelPatterns on LatestPositionsResponseModel { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _LatestPositionsResponseModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _LatestPositionsResponseModel() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _LatestPositionsResponseModel value) $default,){ +final _that = this; +switch (_that) { +case _LatestPositionsResponseModel(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _LatestPositionsResponseModel value)? $default,){ +final _that = this; +switch (_that) { +case _LatestPositionsResponseModel() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( List items)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _LatestPositionsResponseModel() when $default != null: +return $default(_that.items);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( List items) $default,) {final _that = this; +switch (_that) { +case _LatestPositionsResponseModel(): +return $default(_that.items);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( List items)? $default,) {final _that = this; +switch (_that) { +case _LatestPositionsResponseModel() when $default != null: +return $default(_that.items);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _LatestPositionsResponseModel implements LatestPositionsResponseModel { + const _LatestPositionsResponseModel({required final List items}): _items = items; + factory _LatestPositionsResponseModel.fromJson(Map json) => _$LatestPositionsResponseModelFromJson(json); + + final List _items; +@override List get items { + if (_items is EqualUnmodifiableListView) return _items; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_items); +} + + +/// Create a copy of LatestPositionsResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$LatestPositionsResponseModelCopyWith<_LatestPositionsResponseModel> get copyWith => __$LatestPositionsResponseModelCopyWithImpl<_LatestPositionsResponseModel>(this, _$identity); + +@override +Map toJson() { + return _$LatestPositionsResponseModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _LatestPositionsResponseModel&&const DeepCollectionEquality().equals(other._items, _items)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_items)); + +@override +String toString() { + return 'LatestPositionsResponseModel(items: $items)'; +} + + +} + +/// @nodoc +abstract mixin class _$LatestPositionsResponseModelCopyWith<$Res> implements $LatestPositionsResponseModelCopyWith<$Res> { + factory _$LatestPositionsResponseModelCopyWith(_LatestPositionsResponseModel value, $Res Function(_LatestPositionsResponseModel) _then) = __$LatestPositionsResponseModelCopyWithImpl; +@override @useResult +$Res call({ + List items +}); + + + + +} +/// @nodoc +class __$LatestPositionsResponseModelCopyWithImpl<$Res> + implements _$LatestPositionsResponseModelCopyWith<$Res> { + __$LatestPositionsResponseModelCopyWithImpl(this._self, this._then); + + final _LatestPositionsResponseModel _self; + final $Res Function(_LatestPositionsResponseModel) _then; + +/// Create a copy of LatestPositionsResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? items = null,}) { + return _then(_LatestPositionsResponseModel( +items: null == items ? _self._items : items // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + + +/// @nodoc +mixin _$LatestPositionsItemResponseModel { + + double get latitude; double get longitude; String? get address; DateTime get positionDate; bool get frequentPlace; String get frequentPlaceName; +/// Create a copy of LatestPositionsItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$LatestPositionsItemResponseModelCopyWith get copyWith => _$LatestPositionsItemResponseModelCopyWithImpl(this as LatestPositionsItemResponseModel, _$identity); + + /// Serializes this LatestPositionsItemResponseModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is LatestPositionsItemResponseModel&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.address, address) || other.address == address)&&(identical(other.positionDate, positionDate) || other.positionDate == positionDate)&&(identical(other.frequentPlace, frequentPlace) || other.frequentPlace == frequentPlace)&&(identical(other.frequentPlaceName, frequentPlaceName) || other.frequentPlaceName == frequentPlaceName)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,latitude,longitude,address,positionDate,frequentPlace,frequentPlaceName); + +@override +String toString() { + return 'LatestPositionsItemResponseModel(latitude: $latitude, longitude: $longitude, address: $address, positionDate: $positionDate, frequentPlace: $frequentPlace, frequentPlaceName: $frequentPlaceName)'; +} + + +} + +/// @nodoc +abstract mixin class $LatestPositionsItemResponseModelCopyWith<$Res> { + factory $LatestPositionsItemResponseModelCopyWith(LatestPositionsItemResponseModel value, $Res Function(LatestPositionsItemResponseModel) _then) = _$LatestPositionsItemResponseModelCopyWithImpl; +@useResult +$Res call({ + double latitude, double longitude, String? address, DateTime positionDate, bool frequentPlace, String frequentPlaceName +}); + + + + +} +/// @nodoc +class _$LatestPositionsItemResponseModelCopyWithImpl<$Res> + implements $LatestPositionsItemResponseModelCopyWith<$Res> { + _$LatestPositionsItemResponseModelCopyWithImpl(this._self, this._then); + + final LatestPositionsItemResponseModel _self; + final $Res Function(LatestPositionsItemResponseModel) _then; + +/// Create a copy of LatestPositionsItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? latitude = null,Object? longitude = null,Object? address = freezed,Object? positionDate = null,Object? frequentPlace = null,Object? frequentPlaceName = null,}) { + return _then(_self.copyWith( +latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable +as double,longitude: null == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable +as double,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable +as String?,positionDate: null == positionDate ? _self.positionDate : positionDate // ignore: cast_nullable_to_non_nullable +as DateTime,frequentPlace: null == frequentPlace ? _self.frequentPlace : frequentPlace // ignore: cast_nullable_to_non_nullable +as bool,frequentPlaceName: null == frequentPlaceName ? _self.frequentPlaceName : frequentPlaceName // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [LatestPositionsItemResponseModel]. +extension LatestPositionsItemResponseModelPatterns on LatestPositionsItemResponseModel { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _LatestPositionsItemResponseModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _LatestPositionsItemResponseModel() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _LatestPositionsItemResponseModel value) $default,){ +final _that = this; +switch (_that) { +case _LatestPositionsItemResponseModel(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _LatestPositionsItemResponseModel value)? $default,){ +final _that = this; +switch (_that) { +case _LatestPositionsItemResponseModel() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( double latitude, double longitude, String? address, DateTime positionDate, bool frequentPlace, String frequentPlaceName)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _LatestPositionsItemResponseModel() when $default != null: +return $default(_that.latitude,_that.longitude,_that.address,_that.positionDate,_that.frequentPlace,_that.frequentPlaceName);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( double latitude, double longitude, String? address, DateTime positionDate, bool frequentPlace, String frequentPlaceName) $default,) {final _that = this; +switch (_that) { +case _LatestPositionsItemResponseModel(): +return $default(_that.latitude,_that.longitude,_that.address,_that.positionDate,_that.frequentPlace,_that.frequentPlaceName);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( double latitude, double longitude, String? address, DateTime positionDate, bool frequentPlace, String frequentPlaceName)? $default,) {final _that = this; +switch (_that) { +case _LatestPositionsItemResponseModel() when $default != null: +return $default(_that.latitude,_that.longitude,_that.address,_that.positionDate,_that.frequentPlace,_that.frequentPlaceName);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _LatestPositionsItemResponseModel implements LatestPositionsItemResponseModel { + const _LatestPositionsItemResponseModel({required this.latitude, required this.longitude, required this.address, required this.positionDate, required this.frequentPlace, required this.frequentPlaceName}); + factory _LatestPositionsItemResponseModel.fromJson(Map json) => _$LatestPositionsItemResponseModelFromJson(json); + +@override final double latitude; +@override final double longitude; +@override final String? address; +@override final DateTime positionDate; +@override final bool frequentPlace; +@override final String frequentPlaceName; + +/// Create a copy of LatestPositionsItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$LatestPositionsItemResponseModelCopyWith<_LatestPositionsItemResponseModel> get copyWith => __$LatestPositionsItemResponseModelCopyWithImpl<_LatestPositionsItemResponseModel>(this, _$identity); + +@override +Map toJson() { + return _$LatestPositionsItemResponseModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _LatestPositionsItemResponseModel&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.address, address) || other.address == address)&&(identical(other.positionDate, positionDate) || other.positionDate == positionDate)&&(identical(other.frequentPlace, frequentPlace) || other.frequentPlace == frequentPlace)&&(identical(other.frequentPlaceName, frequentPlaceName) || other.frequentPlaceName == frequentPlaceName)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,latitude,longitude,address,positionDate,frequentPlace,frequentPlaceName); + +@override +String toString() { + return 'LatestPositionsItemResponseModel(latitude: $latitude, longitude: $longitude, address: $address, positionDate: $positionDate, frequentPlace: $frequentPlace, frequentPlaceName: $frequentPlaceName)'; +} + + +} + +/// @nodoc +abstract mixin class _$LatestPositionsItemResponseModelCopyWith<$Res> implements $LatestPositionsItemResponseModelCopyWith<$Res> { + factory _$LatestPositionsItemResponseModelCopyWith(_LatestPositionsItemResponseModel value, $Res Function(_LatestPositionsItemResponseModel) _then) = __$LatestPositionsItemResponseModelCopyWithImpl; +@override @useResult +$Res call({ + double latitude, double longitude, String? address, DateTime positionDate, bool frequentPlace, String frequentPlaceName +}); + + + + +} +/// @nodoc +class __$LatestPositionsItemResponseModelCopyWithImpl<$Res> + implements _$LatestPositionsItemResponseModelCopyWith<$Res> { + __$LatestPositionsItemResponseModelCopyWithImpl(this._self, this._then); + + final _LatestPositionsItemResponseModel _self; + final $Res Function(_LatestPositionsItemResponseModel) _then; + +/// Create a copy of LatestPositionsItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? latitude = null,Object? longitude = null,Object? address = freezed,Object? positionDate = null,Object? frequentPlace = null,Object? frequentPlaceName = null,}) { + return _then(_LatestPositionsItemResponseModel( +latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable +as double,longitude: null == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable +as double,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable +as String?,positionDate: null == positionDate ? _self.positionDate : positionDate // ignore: cast_nullable_to_non_nullable +as DateTime,frequentPlace: null == frequentPlace ? _self.frequentPlace : frequentPlace // ignore: cast_nullable_to_non_nullable +as bool,frequentPlaceName: null == frequentPlaceName ? _self.frequentPlaceName : frequentPlaceName // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/modules/hub/lib/src/core/data/models/latest_positions_response_model.g.dart b/modules/hub/lib/src/core/data/models/latest_positions_response_model.g.dart new file mode 100644 index 00000000..6ac15cc9 --- /dev/null +++ b/modules/hub/lib/src/core/data/models/latest_positions_response_model.g.dart @@ -0,0 +1,45 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'latest_positions_response_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_LatestPositionsResponseModel _$LatestPositionsResponseModelFromJson( + Map json, +) => _LatestPositionsResponseModel( + items: (json['items'] as List) + .map( + (e) => LatestPositionsItemResponseModel.fromJson( + e as Map, + ), + ) + .toList(), +); + +Map _$LatestPositionsResponseModelToJson( + _LatestPositionsResponseModel instance, +) => {'items': instance.items}; + +_LatestPositionsItemResponseModel _$LatestPositionsItemResponseModelFromJson( + Map json, +) => _LatestPositionsItemResponseModel( + latitude: (json['latitude'] as num).toDouble(), + longitude: (json['longitude'] as num).toDouble(), + address: json['address'] as String?, + positionDate: DateTime.parse(json['positionDate'] as String), + frequentPlace: json['frequentPlace'] as bool, + frequentPlaceName: json['frequentPlaceName'] as String, +); + +Map _$LatestPositionsItemResponseModelToJson( + _LatestPositionsItemResponseModel instance, +) => { + 'latitude': instance.latitude, + 'longitude': instance.longitude, + 'address': instance.address, + 'positionDate': instance.positionDate.toIso8601String(), + 'frequentPlace': instance.frequentPlace, + 'frequentPlaceName': instance.frequentPlaceName, +}; diff --git a/modules/hub/lib/src/core/data/repositories/hub_repository_impl.dart b/modules/hub/lib/src/core/data/repositories/hub_repository_impl.dart new file mode 100644 index 00000000..90e10058 --- /dev/null +++ b/modules/hub/lib/src/core/data/repositories/hub_repository_impl.dart @@ -0,0 +1,21 @@ +import 'package:hub/src/core/data/datasource/hub_remote_datasource.dart'; +import 'package:hub/src/core/domain/repositories/hub_repository.dart'; +import 'package:hub/src/features/hub/domain/entities/device_entity.dart'; +import 'package:hub/src/features/hub/domain/entities/get_devices_request_entity.dart'; +import 'package:hub/src/features/hub/domain/entities/position_entity.dart'; + +class HomeRepositoryImpl implements HomeRepository { + const HomeRepositoryImpl(this._remote); + + final HomeRemoteDatasource _remote; + + @override + Future> getDevices({required String userId}) async { + return _remote.getDevices(userId: userId); + } + + @override + Future> getLatestPositions({required String deviceId}) async { + return _remote.getLatestPositions(deviceId: deviceId); + } +} diff --git a/modules/hub/lib/src/core/domain/repositories/hub_repository.dart b/modules/hub/lib/src/core/domain/repositories/hub_repository.dart new file mode 100644 index 00000000..ad163bef --- /dev/null +++ b/modules/hub/lib/src/core/domain/repositories/hub_repository.dart @@ -0,0 +1,10 @@ +import 'package:hub/src/features/hub/domain/entities/device_entity.dart'; +import 'package:hub/src/features/hub/domain/entities/get_devices_request_entity.dart'; +import 'package:hub/src/features/hub/domain/entities/position_entity.dart'; + +abstract class HomeRepository { + Future> getDevices({required String userId}); + + Future> getLatestPositions({required String deviceId}); + +} diff --git a/modules/hub/lib/src/core/providers/hub_remote_datasource_provier.dart b/modules/hub/lib/src/core/providers/hub_remote_datasource_provier.dart new file mode 100644 index 00000000..f390c698 --- /dev/null +++ b/modules/hub/lib/src/core/providers/hub_remote_datasource_provier.dart @@ -0,0 +1,9 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:hub/src/core/data/datasource/hub_remote_datasource.dart'; +import 'package:hub/src/core/data/datasource/hub_remote_datasource_impl.dart'; +import 'package:sf_infrastructure/sf_infrastructure.dart'; + +final homeRemoteDatasourceProvider = Provider((ref) { + final questiaRepository = getIt(); + return HomeRemoteDatasourceImpl(questiaRepository); +}); diff --git a/modules/hub/lib/src/core/providers/hub_repository_provider.dart b/modules/hub/lib/src/core/providers/hub_repository_provider.dart new file mode 100644 index 00000000..b27525fb --- /dev/null +++ b/modules/hub/lib/src/core/providers/hub_repository_provider.dart @@ -0,0 +1,9 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:hub/src/core/data/repositories/hub_repository_impl.dart'; +import 'package:hub/src/core/domain/repositories/hub_repository.dart'; +import 'package:hub/src/core/providers/hub_remote_datasource_provier.dart'; + +final homeRepositoryProvider = Provider((ref) { + final remote = ref.read(homeRemoteDatasourceProvider); + return HomeRepositoryImpl(remote); +}); diff --git a/modules/hub/lib/src/features/hub/domain/entities/device_entity.dart b/modules/hub/lib/src/features/hub/domain/entities/device_entity.dart new file mode 100644 index 00000000..23334861 --- /dev/null +++ b/modules/hub/lib/src/features/hub/domain/entities/device_entity.dart @@ -0,0 +1,11 @@ +class DeviceEntity { + final String id; + final String identificator; + final String carrierName; + + const DeviceEntity({ + required this.id, + required this.identificator, + required this.carrierName, + }); +} \ No newline at end of file diff --git a/modules/hub/lib/src/features/hub/domain/entities/get_devices_request_entity.dart b/modules/hub/lib/src/features/hub/domain/entities/get_devices_request_entity.dart new file mode 100644 index 00000000..b0adfb6a --- /dev/null +++ b/modules/hub/lib/src/features/hub/domain/entities/get_devices_request_entity.dart @@ -0,0 +1,10 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'get_devices_request_entity.freezed.dart'; + +@freezed +abstract class GetDevicesRequestEntity with _$GetDevicesRequestEntity { + const factory GetDevicesRequestEntity({ + required String userId, + }) = _GetDevicesRequestEntity; +} diff --git a/modules/hub/lib/src/features/hub/domain/entities/get_devices_request_entity.freezed.dart b/modules/hub/lib/src/features/hub/domain/entities/get_devices_request_entity.freezed.dart new file mode 100644 index 00000000..5319aa3e --- /dev/null +++ b/modules/hub/lib/src/features/hub/domain/entities/get_devices_request_entity.freezed.dart @@ -0,0 +1,271 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'get_devices_request_entity.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$GetDevicesRequestEntity { + + String get userId; +/// Create a copy of GetDevicesRequestEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$GetDevicesRequestEntityCopyWith get copyWith => _$GetDevicesRequestEntityCopyWithImpl(this as GetDevicesRequestEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is GetDevicesRequestEntity&&(identical(other.userId, userId) || other.userId == userId)); +} + + +@override +int get hashCode => Object.hash(runtimeType,userId); + +@override +String toString() { + return 'GetDevicesRequestEntity(userId: $userId)'; +} + + +} + +/// @nodoc +abstract mixin class $GetDevicesRequestEntityCopyWith<$Res> { + factory $GetDevicesRequestEntityCopyWith(GetDevicesRequestEntity value, $Res Function(GetDevicesRequestEntity) _then) = _$GetDevicesRequestEntityCopyWithImpl; +@useResult +$Res call({ + String userId +}); + + + + +} +/// @nodoc +class _$GetDevicesRequestEntityCopyWithImpl<$Res> + implements $GetDevicesRequestEntityCopyWith<$Res> { + _$GetDevicesRequestEntityCopyWithImpl(this._self, this._then); + + final GetDevicesRequestEntity _self; + final $Res Function(GetDevicesRequestEntity) _then; + +/// Create a copy of GetDevicesRequestEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? userId = null,}) { + return _then(_self.copyWith( +userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [GetDevicesRequestEntity]. +extension GetDevicesRequestEntityPatterns on GetDevicesRequestEntity { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _GetDevicesRequestEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _GetDevicesRequestEntity() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _GetDevicesRequestEntity value) $default,){ +final _that = this; +switch (_that) { +case _GetDevicesRequestEntity(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _GetDevicesRequestEntity value)? $default,){ +final _that = this; +switch (_that) { +case _GetDevicesRequestEntity() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String userId)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _GetDevicesRequestEntity() when $default != null: +return $default(_that.userId);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String userId) $default,) {final _that = this; +switch (_that) { +case _GetDevicesRequestEntity(): +return $default(_that.userId);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String userId)? $default,) {final _that = this; +switch (_that) { +case _GetDevicesRequestEntity() when $default != null: +return $default(_that.userId);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _GetDevicesRequestEntity implements GetDevicesRequestEntity { + const _GetDevicesRequestEntity({required this.userId}); + + +@override final String userId; + +/// Create a copy of GetDevicesRequestEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$GetDevicesRequestEntityCopyWith<_GetDevicesRequestEntity> get copyWith => __$GetDevicesRequestEntityCopyWithImpl<_GetDevicesRequestEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetDevicesRequestEntity&&(identical(other.userId, userId) || other.userId == userId)); +} + + +@override +int get hashCode => Object.hash(runtimeType,userId); + +@override +String toString() { + return 'GetDevicesRequestEntity(userId: $userId)'; +} + + +} + +/// @nodoc +abstract mixin class _$GetDevicesRequestEntityCopyWith<$Res> implements $GetDevicesRequestEntityCopyWith<$Res> { + factory _$GetDevicesRequestEntityCopyWith(_GetDevicesRequestEntity value, $Res Function(_GetDevicesRequestEntity) _then) = __$GetDevicesRequestEntityCopyWithImpl; +@override @useResult +$Res call({ + String userId +}); + + + + +} +/// @nodoc +class __$GetDevicesRequestEntityCopyWithImpl<$Res> + implements _$GetDevicesRequestEntityCopyWith<$Res> { + __$GetDevicesRequestEntityCopyWithImpl(this._self, this._then); + + final _GetDevicesRequestEntity _self; + final $Res Function(_GetDevicesRequestEntity) _then; + +/// Create a copy of GetDevicesRequestEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? userId = null,}) { + return _then(_GetDevicesRequestEntity( +userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/modules/hub/lib/src/features/hub/domain/entities/position_entity.dart b/modules/hub/lib/src/features/hub/domain/entities/position_entity.dart new file mode 100644 index 00000000..00750377 --- /dev/null +++ b/modules/hub/lib/src/features/hub/domain/entities/position_entity.dart @@ -0,0 +1,17 @@ +class PositionEntity { + final double latitude; + final double longitude; + final String? address; + final bool frequentPlace; + final String frequentPlaceName; + final DateTime positionDate; + + const PositionEntity({ + required this.latitude, + required this.longitude, + required this.address, + required this.positionDate, + required this.frequentPlace, + required this.frequentPlaceName, + }); +} \ No newline at end of file diff --git a/modules/hub/lib/src/features/hub/domain/get_devices_use_case.dart b/modules/hub/lib/src/features/hub/domain/get_devices_use_case.dart new file mode 100644 index 00000000..2647cb60 --- /dev/null +++ b/modules/hub/lib/src/features/hub/domain/get_devices_use_case.dart @@ -0,0 +1,5 @@ +import 'package:hub/src/features/hub/domain/entities/device_entity.dart'; + +abstract class GetDevicesUseCase { + Future> getDevices({required String userId}); +} diff --git a/modules/hub/lib/src/features/hub/domain/get_devices_use_case_impl.dart b/modules/hub/lib/src/features/hub/domain/get_devices_use_case_impl.dart new file mode 100644 index 00000000..a5e8c62c --- /dev/null +++ b/modules/hub/lib/src/features/hub/domain/get_devices_use_case_impl.dart @@ -0,0 +1,14 @@ +import 'package:hub/src/core/domain/repositories/hub_repository.dart'; +import 'package:hub/src/features/hub/domain/entities/device_entity.dart'; +import 'package:hub/src/features/hub/domain/entities/get_devices_request_entity.dart'; +import 'package:hub/src/features/hub/domain/get_devices_use_case.dart'; + +class GetDevicesUseCaseImpl implements GetDevicesUseCase { + GetDevicesUseCaseImpl(this._repository); + + final HomeRepository _repository; + @override + Future> getDevices({required String userId}) async { + return _repository.getDevices(userId: userId); + } +} \ No newline at end of file diff --git a/modules/hub/lib/src/features/hub/domain/get_latest_positions_use_case.dart b/modules/hub/lib/src/features/hub/domain/get_latest_positions_use_case.dart new file mode 100644 index 00000000..cabea1e3 --- /dev/null +++ b/modules/hub/lib/src/features/hub/domain/get_latest_positions_use_case.dart @@ -0,0 +1,5 @@ +import 'package:hub/src/features/hub/domain/entities/position_entity.dart'; + +abstract class GetLatestPositionsUseCase { + Future> getLatestPositions({required String deviceId}); +} diff --git a/modules/hub/lib/src/features/hub/domain/get_latest_positions_use_case_impl.dart b/modules/hub/lib/src/features/hub/domain/get_latest_positions_use_case_impl.dart new file mode 100644 index 00000000..5fc5ea3a --- /dev/null +++ b/modules/hub/lib/src/features/hub/domain/get_latest_positions_use_case_impl.dart @@ -0,0 +1,14 @@ +import 'package:hub/src/core/domain/repositories/hub_repository.dart'; +import 'package:hub/src/features/hub/domain/entities/position_entity.dart'; +import 'package:hub/src/features/hub/domain/get_latest_positions_use_case.dart'; + +class GetLatestPositionsUseCaseImpl implements GetLatestPositionsUseCase { + GetLatestPositionsUseCaseImpl(this._repository); + + final HomeRepository _repository; + @override + Future> getLatestPositions({required String deviceId}) async { + await Future.delayed(const Duration(milliseconds: 2000)); + return _repository.getLatestPositions(deviceId: deviceId); + } +} diff --git a/modules/hub/lib/src/features/hub/hub_builder.dart b/modules/hub/lib/src/features/hub/hub_builder.dart new file mode 100644 index 00000000..51504488 --- /dev/null +++ b/modules/hub/lib/src/features/hub/hub_builder.dart @@ -0,0 +1,18 @@ +import 'package:hub/src/features/hub/presentation/hub_screen.dart'; +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import 'package:get_it/get_it.dart'; +import 'package:navigation/navigation.dart'; + +class HubBuilder { + const HubBuilder(); + + Page buildPage(BuildContext context, GoRouterState state) { + final NavigationContract navigationContract = GetIt.I(); + + return MaterialPage( + key: state.pageKey, + child: HubScreen(navigationContract: navigationContract), + ); + } +} diff --git a/modules/hub/lib/src/features/hub/presentation/hub_screen.dart b/modules/hub/lib/src/features/hub/presentation/hub_screen.dart new file mode 100644 index 00000000..1da55137 --- /dev/null +++ b/modules/hub/lib/src/features/hub/presentation/hub_screen.dart @@ -0,0 +1,184 @@ +import 'package:flutter_svg/svg.dart'; +import 'package:hub/src/features/hub/presentation/state/hub_view_model.dart'; +import 'package:design_system/design_system.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_map/flutter_map.dart'; +import 'package:latlong2/latlong.dart'; +import 'package:navigation/navigation.dart'; +import 'package:sf_localizations/sf_localizations.dart'; +import 'package:utils/utils.dart'; + +class HubScreen extends ConsumerWidget { + final NavigationContract navigationContract; + + const HubScreen({super.key, required this.navigationContract}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.watch(themePortProvider); + + final viewState = ref.watch(hubViewModelProvider); + final viewModel = ref.read(hubViewModelProvider.notifier); + + return Scaffold( + backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + body: SafeArea( + child: Container( + padding: EdgeInsets.symmetric(horizontal: 14), + child: Column( + children: [ + SizedBox(height: SizeUtils.getByScreen(small: 8, big: 4)), + Stack( + children: [ + SizedBox( + height: SizeUtils.getByScreen(small: 36, big: 36), + child: Align( + alignment: Alignment.centerLeft, + child: Image.asset('assets/images/ui/iso_sf.png', + height: SizeUtils.getByScreen(small: 18, big: 18)), + ) + ), + Center( + child: SvgPicture.asset('assets/images/ui/logo_sf.svg', + height: SizeUtils.getByScreen(small: 36, big: 36)) + ), + ], + ), + SizedBox(height: SizeUtils.getByScreen(small: 12, big: 14)), + Expanded(child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppSectionButton( + onPressed: (){}, + icon: Icons.support_agent_outlined, + text: I18n.customerService), + SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), + AppSectionButton( + onPressed: (){navigationContract.pushTo(AppRoutes.dashboardHome);}, + icon: Icons.payments_outlined, + text: I18n.sfPay), + SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), + AppSectionButton( + onPressed: (){}, + icon: Icons.menu_open_outlined, + text: I18n.functions), + SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), + AppSectionButton( + onPressed: (){}, + icon: Icons.manage_accounts_outlined, + text: I18n.accountSettings), + SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), + AppSectionButton( + onPressed: (){}, + icon: Icons.settings_outlined, + text: I18n.deviceSettings), + + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 22)), + Text(context.translate(I18n.watchesOnMap), + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 20, big: 19), + fontWeight: FontWeight.bold, + color: Color(0xFF588EA5), + ), + ), + SizedBox(height: SizeUtils.getByScreen(small: 4, big: 8)), + SizedBox( + height: SizeUtils.getByScreen(small: 200, big: 300), + child: FlutterMap( + mapController: viewModel.mapController, + options: MapOptions( + initialCenter: LatLng(45.32833189648895, -3.0830872665435085), // Center the map over London, UK + initialZoom: 15, + keepAlive: true, + ), + children: [ + TileLayer( + urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', + userAgentPackageName: 'com.savefamily.sf_platform', + ), + MarkerLayer(markers: viewState.positions.map((position)=> + Marker( + point: LatLng(position.latitude, position.longitude), + width: 200, + height: 145, + child: Align( + alignment: Alignment.topCenter, + child: SvgPicture.asset('assets/images/ui/location.svg', + height: 80)), + rotate: true, + ) + ).toList()) + ], + ) + ), + SizedBox(height: SizeUtils.getByScreen(small: 14, big: 13)), + ], + ), + )) + ], + ), + ), + ), + ); + } +} + +class AppSectionButton extends ConsumerWidget { + + final GestureTapCallback onPressed; + final IconData icon; + final String text; + + const AppSectionButton({ + required this.onPressed, + required this.icon, + required this.text, + }); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.read(themePortProvider); + + return GestureDetector( + onTap: onPressed, + child: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(SizeUtils.getByScreen(small: 12, big: 18))), + color: theme.getColorFor(ThemeCode.backgroundSecondary), + ), + child: Row( + children: [ + Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: theme.getColorFor(ThemeCode.backgroundPrimary), + ), + padding: EdgeInsets.all(SizeUtils.getByScreen(small: 4, big: 12)), + child: Icon(icon, + size: SizeUtils.getByScreen(small: 40, big: 44), + color: Color(0xFF588EA5), + weight: 30, + ), + ), + SizedBox(width: SizeUtils.getByScreen(small: 16, big: 15)), + Expanded( + child: Text(context.translate(text), + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 18, big: 19), + fontWeight: FontWeight.w500 + ) + ) + ) + ], + ), + ) + ); + } + +} \ No newline at end of file diff --git a/modules/hub/lib/src/features/hub/presentation/providers/get_devices_use_case_provider.dart b/modules/hub/lib/src/features/hub/presentation/providers/get_devices_use_case_provider.dart new file mode 100644 index 00000000..1779071f --- /dev/null +++ b/modules/hub/lib/src/features/hub/presentation/providers/get_devices_use_case_provider.dart @@ -0,0 +1,10 @@ +import 'package:hub/src/core/providers/hub_repository_provider.dart'; +import 'package:hub/src/features/hub/domain/get_devices_use_case.dart'; +import 'package:hub/src/features/hub/domain/get_devices_use_case_impl.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +final getDevicesUseCaseProvider = +Provider.autoDispose((ref) { + final authRepository = ref.read(homeRepositoryProvider); + return GetDevicesUseCaseImpl(authRepository); +}); diff --git a/modules/hub/lib/src/features/hub/presentation/providers/get_latest_positions_use_case_provider.dart b/modules/hub/lib/src/features/hub/presentation/providers/get_latest_positions_use_case_provider.dart new file mode 100644 index 00000000..fa7ca0e4 --- /dev/null +++ b/modules/hub/lib/src/features/hub/presentation/providers/get_latest_positions_use_case_provider.dart @@ -0,0 +1,10 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:hub/src/core/providers/hub_repository_provider.dart'; +import 'package:hub/src/features/hub/domain/get_latest_positions_use_case.dart'; +import 'package:hub/src/features/hub/domain/get_latest_positions_use_case_impl.dart'; + +final getLatestPositionsUseCaseProvider = +Provider.autoDispose((ref) { + final authRepository = ref.read(homeRepositoryProvider); + return GetLatestPositionsUseCaseImpl(authRepository); +}); diff --git a/modules/hub/lib/src/features/hub/presentation/state/hub_view_model.dart b/modules/hub/lib/src/features/hub/presentation/state/hub_view_model.dart new file mode 100644 index 00000000..c87c507a --- /dev/null +++ b/modules/hub/lib/src/features/hub/presentation/state/hub_view_model.dart @@ -0,0 +1,87 @@ +import 'dart:async'; + +import 'package:flutter_map/flutter_map.dart'; +import 'package:hub/src/features/hub/domain/entities/device_entity.dart'; +import 'package:hub/src/features/hub/domain/entities/get_devices_request_entity.dart'; +import 'package:hub/src/features/hub/domain/entities/position_entity.dart'; +import 'package:hub/src/features/hub/domain/get_devices_use_case.dart'; +import 'package:hub/src/features/hub/domain/get_latest_positions_use_case.dart'; +import 'package:hub/src/features/hub/presentation/providers/get_devices_use_case_provider.dart'; +import 'package:hub/src/features/hub/presentation/providers/get_latest_positions_use_case_provider.dart'; +import 'package:hub/src/features/hub/presentation/state/hub_view_state.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:latlong2/latlong.dart'; +import 'package:sf_localizations/sf_localizations.dart'; +import 'package:uuid/uuid.dart'; + +final hubViewModelProvider = +NotifierProvider.autoDispose( + HubViewModel.new, +); + +class HubViewModel extends Notifier { + late final GetDevicesUseCase _getDevicesUseCase; + late final GetLatestPositionsUseCase _getLatestPositionsUseCase; + + late final MapController mapController; + + @override + HubViewState build() { + _getDevicesUseCase = ref.read(getDevicesUseCaseProvider); + _getLatestPositionsUseCase = ref.read(getLatestPositionsUseCaseProvider); + + mapController = MapControllerImpl(); + + _getDevicesUseCase.getDevices( + userId: '' + ).then((List res){ + state = state.copyWith(devices: res); + return Future.wait(res.map((device) => + _getLatestPositionsUseCase.getLatestPositions( + deviceId: device.identificator + ) + )); + }).then( + (List> res) { + setPositions(res); + } + ); + + ref.onDispose(disposeControllers); + + return HubViewState(); + } + + void setPositions(List> positions) { + final devicePositions = positions.map((List devicePositions)=>devicePositions[0]).toList(); + state = state.copyWith( + positions: devicePositions, + ); + mapController.move(LatLng( + devicePositions.fold(0.0, (double x, PositionEntity position)=>x+position.latitude)/positions.length, + devicePositions.fold(0.0, (double x, PositionEntity position)=>x+position.longitude)/positions.length, + ), 15); + } + + GetDevicesRequestEntity _toDevicesRequest() { + final userId = ''; + if (userId == null) throw Exception('userId is required'); + + return GetDevicesRequestEntity(userId: userId); + } + + /*void _startLoadingForSignUp() { + state = state.copyWith( + isLoading: true, + errorMessage: '', + twoFASecret: null, + showSecretCode: false, + showAccountCreated: false, + ); + }*/ + + void disposeControllers(){ + mapController.dispose(); + } +} diff --git a/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart b/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart new file mode 100644 index 00000000..f7968fa4 --- /dev/null +++ b/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart @@ -0,0 +1,14 @@ +import 'package:hub/src/features/hub/domain/entities/device_entity.dart'; +import 'package:hub/src/features/hub/domain/entities/position_entity.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:latlong2/latlong.dart'; + +part 'hub_view_state.freezed.dart'; + +@freezed +abstract class HubViewState with _$HubViewState { + const factory HubViewState({ + @Default([]) List devices, + @Default([]) List positions + }) = _HubViewState; +} diff --git a/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.freezed.dart b/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.freezed.dart new file mode 100644 index 00000000..0388aa6b --- /dev/null +++ b/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.freezed.dart @@ -0,0 +1,286 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'hub_view_state.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$HubViewState { + + List get devices; List get positions; +/// Create a copy of HubViewState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$HubViewStateCopyWith get copyWith => _$HubViewStateCopyWithImpl(this as HubViewState, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is HubViewState&&const DeepCollectionEquality().equals(other.devices, devices)&&const DeepCollectionEquality().equals(other.positions, positions)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(devices),const DeepCollectionEquality().hash(positions)); + +@override +String toString() { + return 'HubViewState(devices: $devices, positions: $positions)'; +} + + +} + +/// @nodoc +abstract mixin class $HubViewStateCopyWith<$Res> { + factory $HubViewStateCopyWith(HubViewState value, $Res Function(HubViewState) _then) = _$HubViewStateCopyWithImpl; +@useResult +$Res call({ + List devices, List positions +}); + + + + +} +/// @nodoc +class _$HubViewStateCopyWithImpl<$Res> + implements $HubViewStateCopyWith<$Res> { + _$HubViewStateCopyWithImpl(this._self, this._then); + + final HubViewState _self; + final $Res Function(HubViewState) _then; + +/// Create a copy of HubViewState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? devices = null,Object? positions = null,}) { + return _then(_self.copyWith( +devices: null == devices ? _self.devices : devices // ignore: cast_nullable_to_non_nullable +as List,positions: null == positions ? _self.positions : positions // ignore: cast_nullable_to_non_nullable +as List, + )); +} + +} + + +/// Adds pattern-matching-related methods to [HubViewState]. +extension HubViewStatePatterns on HubViewState { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _HubViewState value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _HubViewState() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _HubViewState value) $default,){ +final _that = this; +switch (_that) { +case _HubViewState(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _HubViewState value)? $default,){ +final _that = this; +switch (_that) { +case _HubViewState() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( List devices, List positions)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _HubViewState() when $default != null: +return $default(_that.devices,_that.positions);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( List devices, List positions) $default,) {final _that = this; +switch (_that) { +case _HubViewState(): +return $default(_that.devices,_that.positions);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( List devices, List positions)? $default,) {final _that = this; +switch (_that) { +case _HubViewState() when $default != null: +return $default(_that.devices,_that.positions);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _HubViewState implements HubViewState { + const _HubViewState({final List devices = const [], final List positions = const []}): _devices = devices,_positions = positions; + + + final List _devices; +@override@JsonKey() List get devices { + if (_devices is EqualUnmodifiableListView) return _devices; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_devices); +} + + final List _positions; +@override@JsonKey() List get positions { + if (_positions is EqualUnmodifiableListView) return _positions; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_positions); +} + + +/// Create a copy of HubViewState +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$HubViewStateCopyWith<_HubViewState> get copyWith => __$HubViewStateCopyWithImpl<_HubViewState>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _HubViewState&&const DeepCollectionEquality().equals(other._devices, _devices)&&const DeepCollectionEquality().equals(other._positions, _positions)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_devices),const DeepCollectionEquality().hash(_positions)); + +@override +String toString() { + return 'HubViewState(devices: $devices, positions: $positions)'; +} + + +} + +/// @nodoc +abstract mixin class _$HubViewStateCopyWith<$Res> implements $HubViewStateCopyWith<$Res> { + factory _$HubViewStateCopyWith(_HubViewState value, $Res Function(_HubViewState) _then) = __$HubViewStateCopyWithImpl; +@override @useResult +$Res call({ + List devices, List positions +}); + + + + +} +/// @nodoc +class __$HubViewStateCopyWithImpl<$Res> + implements _$HubViewStateCopyWith<$Res> { + __$HubViewStateCopyWithImpl(this._self, this._then); + + final _HubViewState _self; + final $Res Function(_HubViewState) _then; + +/// Create a copy of HubViewState +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? devices = null,Object? positions = null,}) { + return _then(_HubViewState( +devices: null == devices ? _self._devices : devices // ignore: cast_nullable_to_non_nullable +as List,positions: null == positions ? _self._positions : positions // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + +// dart format on diff --git a/packages/fonts/.dart_tool/package_config.json b/packages/fonts/.dart_tool/package_config.json index a9903353..8f2356e6 100644 --- a/packages/fonts/.dart_tool/package_config.json +++ b/packages/fonts/.dart_tool/package_config.json @@ -3,43 +3,43 @@ "packages": [ { "name": "characters", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/characters-1.4.0", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/characters-1.4.0", "packageUri": "lib/", "languageVersion": "3.4" }, { "name": "collection", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/collection-1.19.1", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/collection-1.19.1", "packageUri": "lib/", "languageVersion": "3.4" }, { "name": "flutter", - "rootUri": "file:///Users/juliandalcalaf/Development/flutter/packages/flutter", + "rootUri": "file:///C:/Program%20Files/Flutter/packages/flutter", "packageUri": "lib/", "languageVersion": "3.8" }, { "name": "material_color_utilities", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/material_color_utilities-0.11.1", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/material_color_utilities-0.11.1", "packageUri": "lib/", "languageVersion": "2.17" }, { "name": "meta", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/meta-1.16.0", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/meta-1.16.0", "packageUri": "lib/", "languageVersion": "2.12" }, { "name": "sky_engine", - "rootUri": "file:///Users/juliandalcalaf/Development/flutter/bin/cache/pkg/sky_engine", + "rootUri": "file:///C:/Program%20Files/Flutter/bin/cache/pkg/sky_engine", "packageUri": "lib/", "languageVersion": "3.8" }, { "name": "vector_math", - "rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/vector_math-2.2.0", + "rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/vector_math-2.2.0", "packageUri": "lib/", "languageVersion": "3.1" }, @@ -52,7 +52,7 @@ ], "generator": "pub", "generatorVersion": "3.9.2", - "flutterRoot": "file:///Users/juliandalcalaf/Development/flutter", - "flutterVersion": "3.35.7", - "pubCache": "file:///Users/juliandalcalaf/.pub-cache" + "flutterRoot": "file:///C:/Program%20Files/Flutter", + "flutterVersion": "3.35.6", + "pubCache": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache" } diff --git a/packages/fonts/.dart_tool/version b/packages/fonts/.dart_tool/version index e119acda..eb4861ac 100644 --- a/packages/fonts/.dart_tool/version +++ b/packages/fonts/.dart_tool/version @@ -1 +1 @@ -3.35.7 \ No newline at end of file +3.35.6 \ No newline at end of file diff --git a/packages/navigation/lib/app_routes.dart b/packages/navigation/lib/app_routes.dart index 9d368821..736fc2d3 100644 --- a/packages/navigation/lib/app_routes.dart +++ b/packages/navigation/lib/app_routes.dart @@ -1,5 +1,6 @@ class AppRoutes { static const splash = '/splash'; + static const hub = '/hub'; static const login = '/login'; static const signup = '/signup'; static const onboarding = '/onboarding'; diff --git a/packages/sf_localizations/assets/l10n/en.json b/packages/sf_localizations/assets/l10n/en.json index 8789000e..741e7aac 100755 --- a/packages/sf_localizations/assets/l10n/en.json +++ b/packages/sf_localizations/assets/l10n/en.json @@ -130,5 +130,11 @@ "secretCodeKeyCopied": "Key copied", "secretCodeStep3Title": "Copy the generated code", "secretCodeStep3Body": "After scanning the QR code or entering the key in the authenticator app, copy the generated 6-digit code and enter it on the next screen.", - "secretCodeConfigure": "Set up" + "secretCodeConfigure": "Set up", + "customerService": "Customer service / Support", + "sfPay": "SaveFamily Pay", + "functions": "Functions", + "accountSettings": "Account Settings", + "deviceSettings": "Device Settings", + "watchesOnMap": "Smartwatch on the map" } \ No newline at end of file diff --git a/packages/sf_localizations/assets/l10n/es.json b/packages/sf_localizations/assets/l10n/es.json index 4b020053..b35774fd 100644 --- a/packages/sf_localizations/assets/l10n/es.json +++ b/packages/sf_localizations/assets/l10n/es.json @@ -130,5 +130,11 @@ "secretCodeKeyCopied": "Llave copiada", "secretCodeStep3Title": "Copia el código generado", "secretCodeStep3Body": "Después de escanear el código QR o introducir la llave en la aplicación de autenticación, copia el código generado de 6 dígitos e introdúcelo en la siguiente pantalla.", - "secretCodeConfigure": "Configurar" + "secretCodeConfigure": "Configurar", + "customerService": "Servicio de Atención al Cliente", + "sfPay": "SaveFamily Pay", + "functions": "Funciones", + "accountSettings": "Ajustes de la cuenta", + "deviceSettings": "Ajustes del dispositivo", + "watchesOnMap": "Relojes en el mapa" } \ No newline at end of file diff --git a/packages/sf_localizations/lib/src/generated/i18n.dart b/packages/sf_localizations/lib/src/generated/i18n.dart index 74e9e434..b0a55947 100755 --- a/packages/sf_localizations/lib/src/generated/i18n.dart +++ b/packages/sf_localizations/lib/src/generated/i18n.dart @@ -161,4 +161,10 @@ class I18n { static const String secretCodeStep3Title = 'secretCodeStep3Title'; static const String secretCodeStep3Body = 'secretCodeStep3Body'; static const String secretCodeConfigure = 'secretCodeConfigure'; + static const String customerService = 'customerService'; + static const String sfPay = 'sfPay'; + static const String functions = 'functions'; + static const String accountSettings = 'accountSettings'; + static const String deviceSettings = 'deviceSettings'; + static const String watchesOnMap = 'watchesOnMap'; }