From 59d566e9a627d736c5a2e2195d52790fae3b4310 Mon Sep 17 00:00:00 2001 From: JulianAlcala Date: Sat, 17 Jan 2026 22:20:34 +0100 Subject: [PATCH 01/25] onboarding copy --- .../onboarding/domain/onboarding_page.dart | 6 ++-- .../presentation/onboarding_screen.dart | 31 ++++++++++++------- .../widgets/onboarding_content.dart | 24 +++++++++----- .../screens/account_created_screen.dart | 2 +- .../screens/secret_code_screen.dart | 2 +- .../src/widgets/layouts/sign_up_layout.dart | 2 +- modules/auth/pubspec.yaml | 2 ++ .../lib/src/buttons/secondary_button.dart | 9 +++--- .../lib/src/theme/theme_sf_adapter.dart | 4 ++- packages/sf_localizations/assets/l10n/de.json | 12 +++---- packages/sf_localizations/assets/l10n/en.json | 12 +++---- packages/sf_localizations/assets/l10n/es.json | 12 +++---- packages/sf_localizations/assets/l10n/fr.json | 12 +++---- packages/sf_localizations/assets/l10n/it.json | 12 +++---- packages/sf_localizations/assets/l10n/pt.json | 12 +++---- 15 files changed, 87 insertions(+), 67 deletions(-) diff --git a/modules/auth/lib/src/features/onboarding/domain/onboarding_page.dart b/modules/auth/lib/src/features/onboarding/domain/onboarding_page.dart index 6af9886d..65857026 100644 --- a/modules/auth/lib/src/features/onboarding/domain/onboarding_page.dart +++ b/modules/auth/lib/src/features/onboarding/domain/onboarding_page.dart @@ -14,17 +14,17 @@ class OnboardingPage { const List onboardingPages = [ OnboardingPage( - image: 'assets/images/ui/bienvenida_paso1.svg', + image: 'assets/images/ui/real_time_device_location.svg', title: I18n.onboardingTitle1, subtitle: I18n.onboardingSubtitle1, ), OnboardingPage( - image: 'assets/images/ui/bienvenida_paso2.svg', + image: 'assets/images/ui/safety_zone.svg', title: I18n.onboardingTitle2, subtitle: I18n.onboardingSubtitle2, ), OnboardingPage( - image: 'assets/images/ui/bienvenida_paso3.svg', + image: 'assets/images/ui/chat.svg', title: I18n.onboardingTitle3, subtitle: I18n.onboardingSubtitle3, ), 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 a263d04c..1ad3fdc1 100644 --- a/modules/auth/lib/src/features/onboarding/presentation/onboarding_screen.dart +++ b/modules/auth/lib/src/features/onboarding/presentation/onboarding_screen.dart @@ -5,6 +5,7 @@ import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:fonts/fonts.dart'; import 'package:navigation/navigation.dart'; import 'package:sf_localizations/sf_localizations.dart'; @@ -41,7 +42,7 @@ class OnboardingScreen extends ConsumerWidget { } return Scaffold( - backgroundColor: Colors.white, + backgroundColor: Color.fromRGBO(247, 247, 247, 1), body: Padding( padding: const EdgeInsets.symmetric(horizontal: 24), child: Column( @@ -64,7 +65,7 @@ class OnboardingScreen extends ConsumerWidget { StepIndicator( current: state.cardIndex + 1, total: onboardingPages.length, - color: const Color(0xFF4A4A4A), + color: Color.fromRGBO(88, 142, 165, 1), ), const SizedBox(height: 38), Container( @@ -74,24 +75,30 @@ class OnboardingScreen extends ConsumerWidget { onPressed: goToNext, style: TextButton.styleFrom( backgroundColor: isLast - ? const Color(0xFF329E95) - : const Color(0xFF333333), - foregroundColor: Colors.white, + ? const Color.fromRGBO(88, 142, 165, 1) + : const Color.fromRGBO(255, 255, 255, 1), + foregroundColor: isLast + ? const Color.fromRGBO(255, 255, 255, 1) + : const Color.fromRGBO(88, 142, 165, 1), padding: const EdgeInsets.symmetric( vertical: 16, horizontal: 24, ), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(18), + side: const BorderSide( + color: Color.fromRGBO(88, 142, 165, 1), + width: 3, + ), ), ), child: Text( isLast ? context.translate(I18n.start) : context.translate(I18n.next), - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.w600, + style: AppFonts.stolzlStyle( + size: 18, + weight: FontWeight.w600, ), ), ), @@ -107,11 +114,11 @@ class OnboardingScreen extends ConsumerWidget { navigationContract.goTo(AppRoutes.linkPhone), child: Text( context.translate(I18n.skip), - style: TextStyle( - color: Color(0xFF333333), + style: AppFonts.stolzlStyle( + color: Color.fromRGBO(88, 142, 165, 1), decoration: TextDecoration.underline, - fontWeight: FontWeight.w500, - fontSize: 18, + weight: FontWeight.w600, + size: 18, ), ), ), diff --git a/modules/auth/lib/src/features/onboarding/presentation/widgets/onboarding_content.dart b/modules/auth/lib/src/features/onboarding/presentation/widgets/onboarding_content.dart index 5e2c434a..2188365d 100644 --- a/modules/auth/lib/src/features/onboarding/presentation/widgets/onboarding_content.dart +++ b/modules/auth/lib/src/features/onboarding/presentation/widgets/onboarding_content.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:fonts/fonts.dart'; import 'package:sf_localizations/sf_localizations.dart'; class OnboardingContent extends StatelessWidget { @@ -21,28 +22,35 @@ class OnboardingContent extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Flexible(flex: 3, child: SvgPicture.asset(image)), + SvgPicture.asset(image, height: 250), const SizedBox(height: 48), Text( context.translate(title), textAlign: TextAlign.center, - style: const TextStyle( - fontWeight: FontWeight.w700, - fontSize: 28, + style: AppFonts.stolzlStyle( + size: 28, + weight: FontWeight.w700, + color: const Color(0xFF4A4A4A), height: 1.4, letterSpacing: 0.3, - color: Color(0xFF4A4A4A), ), + // style: const TextStyle( + // fontWeight: FontWeight.w700, + // fontSize: 28, + // height: 1.4, + // letterSpacing: 0.3, + // color: Color(0xFF4A4A4A), + // ), ), const SizedBox(height: 16), Text( context.translate(subtitle), textAlign: TextAlign.center, - style: const TextStyle( - fontSize: 18, + style: AppFonts.stolzlStyle( + size: 18, height: 1.4, letterSpacing: 0.3, - color: Color(0xFF9B9B9B), + color: const Color(0xFF333333), ), ), ], diff --git a/modules/auth/lib/src/features/sign_up/presentation/screens/account_created_screen.dart b/modules/auth/lib/src/features/sign_up/presentation/screens/account_created_screen.dart index 041546ab..e90283e4 100644 --- a/modules/auth/lib/src/features/sign_up/presentation/screens/account_created_screen.dart +++ b/modules/auth/lib/src/features/sign_up/presentation/screens/account_created_screen.dart @@ -80,7 +80,7 @@ class AccountCreatedScreen extends ConsumerWidget { PrimaryButton( onPressed: () => navigationContract.goTo(AppRoutes.login), text: context.translate(I18n.accountCreatedContinue), - color: theme.getColorFor(ThemeCode.buttonPrimary), + color: Color.fromRGBO(88, 142, 165, 1), ), const Spacer(flex: 8), ], diff --git a/modules/auth/lib/src/features/sign_up/presentation/screens/secret_code_screen.dart b/modules/auth/lib/src/features/sign_up/presentation/screens/secret_code_screen.dart index bef23b5d..7512ff73 100644 --- a/modules/auth/lib/src/features/sign_up/presentation/screens/secret_code_screen.dart +++ b/modules/auth/lib/src/features/sign_up/presentation/screens/secret_code_screen.dart @@ -226,7 +226,7 @@ class SecretCodeScreen extends ConsumerWidget { } }, text: context.translate(I18n.secretCodeConfigure), - color: theme.getColorFor(ThemeCode.buttonPrimary), + color: Color.fromRGBO(88, 142, 165, 1), ), ], ), diff --git a/modules/auth/lib/src/widgets/layouts/sign_up_layout.dart b/modules/auth/lib/src/widgets/layouts/sign_up_layout.dart index 5fe55a2b..5db05c0d 100644 --- a/modules/auth/lib/src/widgets/layouts/sign_up_layout.dart +++ b/modules/auth/lib/src/widgets/layouts/sign_up_layout.dart @@ -99,7 +99,7 @@ class SignUpLayout extends StatelessWidget { onPressed: onNextPressed, text: "Siguiente", size: 16, - color: theme.getColorFor(ThemeCode.buttonSecondary), + color: Color.fromRGBO(88, 142, 165, 1), ), ), ], diff --git a/modules/auth/pubspec.yaml b/modules/auth/pubspec.yaml index 02c81046..953889a6 100644 --- a/modules/auth/pubspec.yaml +++ b/modules/auth/pubspec.yaml @@ -26,6 +26,8 @@ dependencies: path: ../../packages/sf_infrastructure utils: path: ../../packages/utils + fonts: + path: ../../packages/fonts #dependencies go here flutter_svg: ^2.2.1 get_it: ^9.0.5 diff --git a/packages/design_system/lib/src/buttons/secondary_button.dart b/packages/design_system/lib/src/buttons/secondary_button.dart index 8bb07c8b..fc6ff8b3 100644 --- a/packages/design_system/lib/src/buttons/secondary_button.dart +++ b/packages/design_system/lib/src/buttons/secondary_button.dart @@ -33,10 +33,12 @@ class SecondaryButton extends StatelessWidget { padding: WidgetStatePropertyAll( EdgeInsets.symmetric(horizontal: padding), ), + side: const WidgetStatePropertyAll( + BorderSide(color: Color.fromRGBO(88, 142, 165, 1), width: 1), + ), shape: WidgetStatePropertyAll( RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(radius)), - side: BorderSide(color: Color(0xFF4B4B4B)), ), ), ), @@ -53,15 +55,14 @@ class SecondaryButton extends StatelessWidget { style: TextStyle( fontSize: size ?? 18, fontWeight: FontWeight.w500, - letterSpacing: 0, - color: Color(0xFF4B4B4B), + color: const Color.fromRGBO(88, 142, 165, 1), ), ) : Icon( icon, semanticLabel: label, size: size ?? 24, - color: color ?? Color(0xFF4B4B4B), + color: color ?? const Color.fromRGBO(88, 142, 165, 1), ), ), ), diff --git a/packages/design_system/lib/src/theme/theme_sf_adapter.dart b/packages/design_system/lib/src/theme/theme_sf_adapter.dart index c4a68ed4..942139ae 100644 --- a/packages/design_system/lib/src/theme/theme_sf_adapter.dart +++ b/packages/design_system/lib/src/theme/theme_sf_adapter.dart @@ -27,7 +27,9 @@ class ThemeSfAdapter extends ThemePort { List> get cardColors => _cardColors; final List _disabledCardColors = [ - Color(0xFF989797), Color(0xFF797676), Color(0xFF5F5A5A) + Color(0xFF989797), + Color(0xFF797676), + Color(0xFF5F5A5A), ]; @override diff --git a/packages/sf_localizations/assets/l10n/de.json b/packages/sf_localizations/assets/l10n/de.json index 1fca4204..dfd73023 100644 --- a/packages/sf_localizations/assets/l10n/de.json +++ b/packages/sf_localizations/assets/l10n/de.json @@ -3,12 +3,12 @@ "start": "Starten", "next": "Weiter", "skip": "Überspringen", - "onboardingTitle1": "Lerne, ihr Geld zu verwalten", - "onboardingSubtitle1": "Dein Kind entwickelt Gewohnheiten und hat Spaß dabei", - "onboardingTitle2": "Gelassenheit bei jeder Zahlung", - "onboardingSubtitle2": "Überwache ihre Ausgaben, setze Limits und begleite sie bei jedem Schritt", - "onboardingTitle3": "Einfache und sichere Zahlungen in ihren Händen", - "onboardingSubtitle3": "Sie können mit ihrer Uhr bezahlen.\nGanz ohne Handy und Bargeld", + "onboardingTitle1": "Echtzeit-Standort des Geräts", + "onboardingSubtitle1": "Verpassen Sie nichts.\nGreifen Sie überall und jederzeit in Echtzeit auf den Standort Ihres Geräts zu.", + "onboardingTitle2": "Sicherheitszone", + "onboardingSubtitle2": "Kontrolle in Ihrer Hand.\nLegen Sie einen Bereich fest, und wir benachrichtigen Sie, sobald das Gerät Ihre Sicherheitszone verlässt.", + "onboardingTitle3": "Chat", + "onboardingSubtitle3": "Immer verbunden.\nÜber den Chat können Sie jederzeit mit dem Besitzer des Geräts kommunizieren.", "linkPhoneTitle": "Wir freuen uns sehr, dass du hier bist!", "linkPhoneSubtitle": "Um dich sicher anzumelden, senden wir dir einen Code an deine Telefonnummer", "mobilePhone": "Mobiltelefon", diff --git a/packages/sf_localizations/assets/l10n/en.json b/packages/sf_localizations/assets/l10n/en.json index 9e4de259..8789000e 100755 --- a/packages/sf_localizations/assets/l10n/en.json +++ b/packages/sf_localizations/assets/l10n/en.json @@ -1,11 +1,11 @@ { "example": "example", - "onboardingTitle1": "Learn to manage their money", - "onboardingSubtitle1": "Your kid builds habits and has fun while doing it", - "onboardingTitle2": "Peace of mind in every payment", - "onboardingSubtitle2": "Monitor their spending, set limits and guide them step by step", - "onboardingTitle3": "Easy and secure payments in their hands", - "onboardingSubtitle3": "They can pay from their watch.\nNo phone or cash needed", + "onboardingTitle1": "Real-time device location", + "onboardingSubtitle1": "Don't miss a thing.\nAccess your device's location in real time wherever you are.", + "onboardingTitle2": "Safety Zone", + "onboardingSubtitle2": "Control in your hands.\nChoose a perimeter and we'll alert you when the device leaves your secure zone.", + "onboardingTitle3": "Chat", + "onboardingSubtitle3": "Always connected.\nThrough the chat you can communicate with the owner of the device whenever you want.", "start": "Start", "next": "Next", "skip": "Skip", diff --git a/packages/sf_localizations/assets/l10n/es.json b/packages/sf_localizations/assets/l10n/es.json index 8beabf1a..4b020053 100644 --- a/packages/sf_localizations/assets/l10n/es.json +++ b/packages/sf_localizations/assets/l10n/es.json @@ -1,11 +1,11 @@ { "example": "ejemplo", - "onboardingTitle1": "Aprende a gestionar su dinero", - "onboardingSubtitle1": "Tu peque crea hábitos y se divierte mientras lo hace", - "onboardingTitle2": "Tranquilidad en cada pago que hacen", - "onboardingSubtitle2": "Supervisa sus gastos, fija límites y acompáñalos en cada paso", - "onboardingTitle3": "Pagos fáciles y seguros en sus manos", - "onboardingSubtitle3": "Podrá pagar desde su reloj.\nSin móvil ni efectivo", + "onboardingTitle1": "Ubicación del dispositivo en tiempo real", + "onboardingSubtitle1": "No te pierdas nada.\nAccede a la ubicación de tu dispositivo en tiempo real estés donde estés.", + "onboardingTitle2": "Zona segura", + "onboardingSubtitle2": "El control en tus manos.\nElige un perímetro y te avisaremos cuando el dispositivo salga de tu zona segura.", + "onboardingTitle3": "Chat", + "onboardingSubtitle3": "Siempre conectados.\nA través del chat puedes comunicarte con el propietario del dispositivo cuando quieras.", "start": "Comenzar", "next": "Siguiente", "skip": "Omitir", diff --git a/packages/sf_localizations/assets/l10n/fr.json b/packages/sf_localizations/assets/l10n/fr.json index ae8be5a0..6c85b109 100644 --- a/packages/sf_localizations/assets/l10n/fr.json +++ b/packages/sf_localizations/assets/l10n/fr.json @@ -3,12 +3,12 @@ "start": "Commencer", "next": "Suivant", "skip": "Passer", - "onboardingTitle1": "Apprenez à gérer leur argent", - "onboardingSubtitle1": "Votre enfant développe de bonnes habitudes et s'amuse en le faisant", - "onboardingTitle2": "La tranquillité à chaque paiement", - "onboardingSubtitle2": "Surveillez leurs dépenses, fixez des limites et accompagnez-les à chaque étape", - "onboardingTitle3": "Des paiements faciles et sécurisés entre leurs mains", - "onboardingSubtitle3": "Ils peuvent payer avec leur montre.\nSans téléphone ni espèces", + "onboardingTitle1": "Localisation de l'appareil en temps réel", + "onboardingSubtitle1": "Ne manquez rien.\nAccédez à la localisation de votre appareil en temps réel, où que vous soyez.", + "onboardingTitle2": "Zone de sécurité", + "onboardingSubtitle2": "Le contrôle entre vos mains.\nDéfinissez un périmètre et nous vous avertirons lorsque l'appareil quitte votre zone de sécurité.", + "onboardingTitle3": "Chat", + "onboardingSubtitle3": "Toujours connectés.\nVia le chat, vous pouvez communiquer avec le propriétaire de l'appareil quand vous le souhaitez.", "linkPhoneTitle": "Nous sommes ravis de te compter parmi nous !", "linkPhoneSubtitle": "Pour te connecter en toute sécurité, nous allons envoyer un code sur ton téléphone", "mobilePhone": "Téléphone portable", diff --git a/packages/sf_localizations/assets/l10n/it.json b/packages/sf_localizations/assets/l10n/it.json index d1c54076..df7c099e 100644 --- a/packages/sf_localizations/assets/l10n/it.json +++ b/packages/sf_localizations/assets/l10n/it.json @@ -3,12 +3,12 @@ "start": "Inizia", "next": "Avanti", "skip": "Salta", - "onboardingTitle1": "Impara a gestire il loro denaro", - "onboardingSubtitle1": "Tuo figlio crea abitudini e si diverte mentre lo fa", - "onboardingTitle2": "Tranquillità in ogni pagamento", - "onboardingSubtitle2": "Monitora le sue spese, imposta limiti e accompagnalo in ogni passo", - "onboardingTitle3": "Pagamenti facili e sicuri nelle sue mani", - "onboardingSubtitle3": "Potrà pagare dal suo orologio.\nSenza telefono né contanti", + "onboardingTitle1": "Posizione del dispositivo in tempo reale", + "onboardingSubtitle1": "Non perderti nulla.\nAccedi alla posizione del tuo dispositivo in tempo reale, ovunque tu sia.", + "onboardingTitle2": "Zona di sicurezza", + "onboardingSubtitle2": "Il controllo nelle tue mani.\nScegli un perimetro e ti avviseremo quando il dispositivo esce dalla tua zona sicura.", + "onboardingTitle3": "Chat", + "onboardingSubtitle3": "Sempre connessi.\nTramite la chat puoi comunicare con il proprietario del dispositivo quando vuoi.", "linkPhoneTitle": "Siamo molto felici di averti qui!", "linkPhoneSubtitle": "Per accedere in modo sicuro, ti invieremo un codice al tuo telefono", "mobilePhone": "Telefono cellulare", diff --git a/packages/sf_localizations/assets/l10n/pt.json b/packages/sf_localizations/assets/l10n/pt.json index 4fb3a0a0..8b695fd6 100644 --- a/packages/sf_localizations/assets/l10n/pt.json +++ b/packages/sf_localizations/assets/l10n/pt.json @@ -3,12 +3,12 @@ "start": "Começar", "next": "Próximo", "skip": "Pular", - "onboardingTitle1": "Aprenda a gerenciar o dinheiro deles", - "onboardingSubtitle1": "Seu filho cria hábitos e se diverte enquanto faz isso", - "onboardingTitle2": "Tranquilidade em cada pagamento", - "onboardingSubtitle2": "Monitore os gastos deles, defina limites e acompanhe cada passo", - "onboardingTitle3": "Pagamentos fáceis e seguros nas mãos deles", - "onboardingSubtitle3": "Eles poderão pagar pelo relógio.\nSem celular nem dinheiro em espécie", + "onboardingTitle1": "Localização do dispositivo em tempo real", + "onboardingSubtitle1": "Não perca nada.\nAcesse a localização do seu dispositivo em tempo real, onde quer que você esteja.", + "onboardingTitle2": "Zona segura", + "onboardingSubtitle2": "O controlo nas suas mãos.\nEscolha um perímetro e avisaremos quando o dispositivo sair da sua zona segura.", + "onboardingTitle3": "Chat", + "onboardingSubtitle3": "Sempre conectados.\nPelo chat, você pode se comunicar com o proprietário do dispositivo quando quiser.", "linkPhoneTitle": "Ficamos muito felizes em ter você aqui!", "linkPhoneSubtitle": "Para entrar com segurança, vamos enviar um código para o seu telefone", "mobilePhone": "Telefone celular", From 60a49060a118041b4ac2a7aad8be354fc0e33f54 Mon Sep 17 00:00:00 2001 From: aitorarana Date: Fri, 23 Jan 2026 14:52:08 +0100 Subject: [PATCH 02/25] 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'; } From 12edcd094095dbc43ef0e575fa64205349e99269 Mon Sep 17 00:00:00 2001 From: aitorarana Date: Tue, 27 Jan 2026 12:45:25 +0100 Subject: [PATCH 03/25] added legacy and legacy_dashboard_shell modules --- .idea/modules.xml | 5 +- .../mobile_app/lib/navigation/app_router.dart | 23 +- apps/mobile_app/pubspec.yaml | 4 +- melos_sf-app-platform.iml | 9 + .../presentation/onboarding_screen.dart | 4 +- modules/auth/pubspec_overrides.yaml | 28 - modules/legacy/.gitignore | 48 + modules/legacy/.metadata | 10 + modules/legacy/README.md | 11 + modules/legacy/analysis_options.yaml | 4 + modules/legacy/legacy.iml | 14 + modules/legacy/melos_legacy.iml | 26 + .../lib/legacy_dashboard_builder.dart | 1 + modules/legacy/modules/hub/.gitignore | 45 + modules/legacy/modules/hub/.metadata | 45 + modules/legacy/modules/hub/README.md | 16 + .../legacy/modules/hub/analysis_options.yaml | 28 + modules/legacy/modules/hub/lib/hub.dart | 1 + .../datasource/hub_remote_datasource.dart | 0 .../hub_remote_datasource_impl.dart | 0 .../models/get_devices_response_model.dart | 0 .../get_devices_response_model.freezed.dart | 0 .../models/get_devices_response_model.g.dart | 0 .../latest_positions_response_model.dart | 0 ...test_positions_response_model.freezed.dart | 0 .../latest_positions_response_model.g.dart | 0 .../repositories/hub_repository_impl.dart | 0 .../domain/repositories/hub_repository.dart | 0 .../hub_remote_datasource_provier.dart | 0 .../providers/hub_repository_provider.dart | 0 .../hub/domain/entities/device_entity.dart | 0 .../entities/get_devices_request_entity.dart | 0 .../get_devices_request_entity.freezed.dart | 0 .../hub/domain/entities/position_entity.dart | 0 .../hub/domain/get_devices_use_case.dart | 0 .../hub/domain/get_devices_use_case_impl.dart | 0 .../domain/get_latest_positions_use_case.dart | 0 .../get_latest_positions_use_case_impl.dart | 0 .../hub/lib/src/features/hub/hub_builder.dart | 0 .../features/hub/presentation/hub_screen.dart | 6 +- .../get_devices_use_case_provider.dart | 0 ...et_latest_positions_use_case_provider.dart | 0 .../presentation/state/hub_view_model.dart | 0 .../presentation/state/hub_view_state.dart | 0 .../state/hub_view_state.freezed.dart | 0 modules/legacy/modules/hub/pubspec.lock | 1206 +++++++++++++++++ modules/legacy/modules/hub/pubspec.yaml | 114 ++ .../legacy/modules/hub/pubspec_overrides.yaml | 26 + .../modules/legacy_dashboard_shell/.gitignore | 31 + .../modules/legacy_dashboard_shell/.metadata | 10 + .../legacy_dashboard_shell/CHANGELOG.md | 3 + .../modules/legacy_dashboard_shell/LICENSE | 1 + .../modules/legacy_dashboard_shell}/README.md | 0 .../analysis_options.yaml | 4 + .../lib/legacy_dashboard_builder.dart | 18 + .../lib/legacy_dashboard_shell.dart | 2 + .../legacy_main_shell_screen.dart | 61 + .../legacy_main_shell_view_model.dart | 13 + .../legacy_main_shell_view_state.dart | 14 + .../legacy_main_shell_view_state.freezed.dart | 280 ++++ .../legacy_dashboard_shell/pubspec.yaml | 77 ++ .../pubspec_overrides.yaml | 28 + modules/legacy/pubspec.lock | 213 +++ modules/legacy/pubspec.yaml | 87 ++ packages/navigation/lib/app_routes.dart | 7 +- packages/sf_localizations/assets/l10n/en.json | 5 +- packages/sf_localizations/assets/l10n/es.json | 11 +- .../lib/src/generated/i18n.dart | 3 + 68 files changed, 2496 insertions(+), 46 deletions(-) delete mode 100644 modules/auth/pubspec_overrides.yaml create mode 100644 modules/legacy/.gitignore create mode 100644 modules/legacy/.metadata create mode 100644 modules/legacy/README.md create mode 100644 modules/legacy/analysis_options.yaml create mode 100644 modules/legacy/legacy.iml create mode 100644 modules/legacy/melos_legacy.iml create mode 100644 modules/legacy/modules/dashboard_shell/lib/legacy_dashboard_builder.dart create mode 100644 modules/legacy/modules/hub/.gitignore create mode 100644 modules/legacy/modules/hub/.metadata create mode 100644 modules/legacy/modules/hub/README.md create mode 100644 modules/legacy/modules/hub/analysis_options.yaml create mode 100644 modules/legacy/modules/hub/lib/hub.dart rename modules/{ => legacy/modules}/hub/lib/src/core/data/datasource/hub_remote_datasource.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/core/data/models/get_devices_response_model.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/core/data/models/get_devices_response_model.freezed.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/core/data/models/get_devices_response_model.g.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/core/data/models/latest_positions_response_model.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/core/data/models/latest_positions_response_model.freezed.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/core/data/models/latest_positions_response_model.g.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/core/data/repositories/hub_repository_impl.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/core/domain/repositories/hub_repository.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/core/providers/hub_remote_datasource_provier.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/core/providers/hub_repository_provider.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/features/hub/domain/entities/device_entity.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/features/hub/domain/entities/get_devices_request_entity.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/features/hub/domain/entities/get_devices_request_entity.freezed.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/features/hub/domain/entities/position_entity.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/features/hub/domain/get_devices_use_case.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/features/hub/domain/get_devices_use_case_impl.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/features/hub/domain/get_latest_positions_use_case.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/features/hub/domain/get_latest_positions_use_case_impl.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/features/hub/hub_builder.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/features/hub/presentation/hub_screen.dart (97%) rename modules/{ => legacy/modules}/hub/lib/src/features/hub/presentation/providers/get_devices_use_case_provider.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/features/hub/presentation/providers/get_latest_positions_use_case_provider.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/features/hub/presentation/state/hub_view_model.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/features/hub/presentation/state/hub_view_state.dart (100%) rename modules/{ => legacy/modules}/hub/lib/src/features/hub/presentation/state/hub_view_state.freezed.dart (100%) create mode 100644 modules/legacy/modules/hub/pubspec.lock create mode 100644 modules/legacy/modules/hub/pubspec.yaml create mode 100644 modules/legacy/modules/hub/pubspec_overrides.yaml create mode 100644 modules/legacy/modules/legacy_dashboard_shell/.gitignore create mode 100644 modules/legacy/modules/legacy_dashboard_shell/.metadata create mode 100644 modules/legacy/modules/legacy_dashboard_shell/CHANGELOG.md create mode 100644 modules/legacy/modules/legacy_dashboard_shell/LICENSE rename modules/{dashboard_shell => legacy/modules/legacy_dashboard_shell}/README.md (100%) create mode 100644 modules/legacy/modules/legacy_dashboard_shell/analysis_options.yaml create mode 100644 modules/legacy/modules/legacy_dashboard_shell/lib/legacy_dashboard_builder.dart create mode 100644 modules/legacy/modules/legacy_dashboard_shell/lib/legacy_dashboard_shell.dart create mode 100644 modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_screen.dart create mode 100644 modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_view_model.dart create mode 100644 modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_view_state.dart create mode 100644 modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_view_state.freezed.dart create mode 100644 modules/legacy/modules/legacy_dashboard_shell/pubspec.yaml create mode 100644 modules/legacy/modules/legacy_dashboard_shell/pubspec_overrides.yaml create mode 100644 modules/legacy/pubspec.lock create mode 100644 modules/legacy/pubspec.yaml diff --git a/.idea/modules.xml b/.idea/modules.xml index 97af5312..cfa0d987 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -7,9 +7,12 @@ - + + + + diff --git a/apps/mobile_app/lib/navigation/app_router.dart b/apps/mobile_app/lib/navigation/app_router.dart index 65b5aed0..485f4469 100644 --- a/apps/mobile_app/lib/navigation/app_router.dart +++ b/apps/mobile_app/lib/navigation/app_router.dart @@ -1,4 +1,5 @@ import 'package:auth/auth.dart'; +import 'package:legacy_dashboard_shell/legacy_dashboard_builder.dart'; import 'package:dashboard_shell/dashboard_builder.dart'; import 'package:flutter/material.dart'; import 'package:get_it/get_it.dart'; @@ -17,7 +18,7 @@ late final GoRouter appRouter; void configureAppRouter() { appRouter = GoRouter( navigatorKey: rootNavigatorKey, - initialLocation: AppRoutes.splash, + initialLocation: AppRoutes.dashboardHub, debugLogDiagnostics: true, routes: [ GoRoute( @@ -25,11 +26,23 @@ void configureAppRouter() { name: 'splash', pageBuilder: SplashBuilder().buildPage, ), - GoRoute( - path: AppRoutes.hub, - name: 'hub', - pageBuilder: HubBuilder().buildPage, + StatefulShellRoute.indexedStack( + builder: (context, state, navShell) { + return LegacyDashboardBuilder().build(context, navShell); + }, + branches: [ + StatefulShellBranch( + routes: [ + GoRoute( + path: AppRoutes.dashboardHub, + name: 'hub', + pageBuilder: const HubBuilder().buildPage, + ), + ], + ), + ], ), + GoRoute( path: AppRoutes.login, name: 'login', diff --git a/apps/mobile_app/pubspec.yaml b/apps/mobile_app/pubspec.yaml index 356c20c0..9fdc39d3 100644 --- a/apps/mobile_app/pubspec.yaml +++ b/apps/mobile_app/pubspec.yaml @@ -42,13 +42,15 @@ dependencies: home: path: ../../modules/home hub: - path: ../../modules/hub + path: ../../modules/legacy/modules/hub profile: path: ../../modules/profile notifications: path: ../../modules/notifications dashboard_shell: path: ../../modules/dashboard_shell + legacy_dashboard_shell: + path: ../../modules/legacy/modules/legacy_dashboard_shell splash: path: ../../modules/splash #packages dependencies go here diff --git a/melos_sf-app-platform.iml b/melos_sf-app-platform.iml index 1ff30704..531e8329 100644 --- a/melos_sf-app-platform.iml +++ b/melos_sf-app-platform.iml @@ -13,6 +13,15 @@ + + + + + + + + + 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 e50606b3..1ad3fdc1 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.hub); + navigationContract.goTo(AppRoutes.linkPhone); } else { pageController.nextPage( duration: const Duration(milliseconds: 400), @@ -111,7 +111,7 @@ class OnboardingScreen extends ConsumerWidget { ? const SizedBox.shrink() : TextButton( onPressed: () => - navigationContract.goTo(AppRoutes.hub), + navigationContract.goTo(AppRoutes.linkPhone), child: Text( context.translate(I18n.skip), style: AppFonts.stolzlStyle( diff --git a/modules/auth/pubspec_overrides.yaml b/modules/auth/pubspec_overrides.yaml deleted file mode 100644 index c26aef41..00000000 --- a/modules/auth/pubspec_overrides.yaml +++ /dev/null @@ -1,28 +0,0 @@ -# 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: - path: ../dashboard_shell - design_system: - path: ../../packages/design_system - fonts: - path: ../../packages/fonts - home: - path: ..\\home - hub: - path: ../hub - 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/legacy/.gitignore b/modules/legacy/.gitignore new file mode 100644 index 00000000..5d88593f --- /dev/null +++ b/modules/legacy/.gitignore @@ -0,0 +1,48 @@ +.DS_Store +.dart_tool/ + +.pub/ + +.idea/ +.vagrant/ +.sconsign.dblite +.svn/ + +migrate_working_dir/ + +*.swp +profile + +DerivedData/ + +.generated/ + +*.pbxuser +*.mode1v3 +*.mode2v3 +*.perspectivev3 + +!default.pbxuser +!default.mode1v3 +!default.mode2v3 +!default.perspectivev3 + +xcuserdata + +*.moved-aside + +*.pyc +*sync/ +Icon? +.tags* + +build/ +.android/ +.ios/ +.flutter-plugins-dependencies + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json diff --git a/modules/legacy/.metadata b/modules/legacy/.metadata new file mode 100644 index 00000000..0556c982 --- /dev/null +++ b/modules/legacy/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "9f455d2486bcb28cad87b062475f42edc959f636" + channel: "stable" + +project_type: module diff --git a/modules/legacy/README.md b/modules/legacy/README.md new file mode 100644 index 00000000..d2b4e288 --- /dev/null +++ b/modules/legacy/README.md @@ -0,0 +1,11 @@ +# legacy + +A new Flutter project. + +## Getting Started + +For help getting started with Flutter development, view the online +[documentation](https://flutter.dev/). + +For instructions integrating Flutter modules to your existing applications, +see the [add-to-app documentation](https://flutter.dev/to/add-to-app). diff --git a/modules/legacy/analysis_options.yaml b/modules/legacy/analysis_options.yaml new file mode 100644 index 00000000..a5744c1c --- /dev/null +++ b/modules/legacy/analysis_options.yaml @@ -0,0 +1,4 @@ +include: package:flutter_lints/flutter.yaml + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/modules/legacy/legacy.iml b/modules/legacy/legacy.iml new file mode 100644 index 00000000..a461e815 --- /dev/null +++ b/modules/legacy/legacy.iml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/legacy/melos_legacy.iml b/modules/legacy/melos_legacy.iml new file mode 100644 index 00000000..26a45e79 --- /dev/null +++ b/modules/legacy/melos_legacy.iml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/legacy/modules/dashboard_shell/lib/legacy_dashboard_builder.dart b/modules/legacy/modules/dashboard_shell/lib/legacy_dashboard_builder.dart new file mode 100644 index 00000000..b9f78bb0 --- /dev/null +++ b/modules/legacy/modules/dashboard_shell/lib/legacy_dashboard_builder.dart @@ -0,0 +1 @@ +// TODO Implement this library. \ No newline at end of file diff --git a/modules/legacy/modules/hub/.gitignore b/modules/legacy/modules/hub/.gitignore new file mode 100644 index 00000000..3820a95c --- /dev/null +++ b/modules/legacy/modules/hub/.gitignore @@ -0,0 +1,45 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.build/ +.buildlog/ +.history +.svn/ +.swiftpm/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ +/coverage/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/modules/legacy/modules/hub/.metadata b/modules/legacy/modules/hub/.metadata new file mode 100644 index 00000000..70a7d44a --- /dev/null +++ b/modules/legacy/modules/hub/.metadata @@ -0,0 +1,45 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "9f455d2486bcb28cad87b062475f42edc959f636" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 9f455d2486bcb28cad87b062475f42edc959f636 + base_revision: 9f455d2486bcb28cad87b062475f42edc959f636 + - platform: android + create_revision: 9f455d2486bcb28cad87b062475f42edc959f636 + base_revision: 9f455d2486bcb28cad87b062475f42edc959f636 + - platform: ios + create_revision: 9f455d2486bcb28cad87b062475f42edc959f636 + base_revision: 9f455d2486bcb28cad87b062475f42edc959f636 + - platform: linux + create_revision: 9f455d2486bcb28cad87b062475f42edc959f636 + base_revision: 9f455d2486bcb28cad87b062475f42edc959f636 + - platform: macos + create_revision: 9f455d2486bcb28cad87b062475f42edc959f636 + base_revision: 9f455d2486bcb28cad87b062475f42edc959f636 + - platform: web + create_revision: 9f455d2486bcb28cad87b062475f42edc959f636 + base_revision: 9f455d2486bcb28cad87b062475f42edc959f636 + - platform: windows + create_revision: 9f455d2486bcb28cad87b062475f42edc959f636 + base_revision: 9f455d2486bcb28cad87b062475f42edc959f636 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/modules/legacy/modules/hub/README.md b/modules/legacy/modules/hub/README.md new file mode 100644 index 00000000..989a876e --- /dev/null +++ b/modules/legacy/modules/hub/README.md @@ -0,0 +1,16 @@ +# home + +A new Flutter project. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/modules/legacy/modules/hub/analysis_options.yaml b/modules/legacy/modules/hub/analysis_options.yaml new file mode 100644 index 00000000..0d290213 --- /dev/null +++ b/modules/legacy/modules/hub/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/modules/legacy/modules/hub/lib/hub.dart b/modules/legacy/modules/hub/lib/hub.dart new file mode 100644 index 00000000..aecabee0 --- /dev/null +++ b/modules/legacy/modules/hub/lib/hub.dart @@ -0,0 +1 @@ +export 'src/features/hub/hub_builder.dart'; \ No newline at end of file diff --git a/modules/hub/lib/src/core/data/datasource/hub_remote_datasource.dart b/modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource.dart similarity index 100% rename from modules/hub/lib/src/core/data/datasource/hub_remote_datasource.dart rename to modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource.dart diff --git a/modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart b/modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart similarity index 100% rename from modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart rename to modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart diff --git a/modules/hub/lib/src/core/data/models/get_devices_response_model.dart b/modules/legacy/modules/hub/lib/src/core/data/models/get_devices_response_model.dart similarity index 100% rename from modules/hub/lib/src/core/data/models/get_devices_response_model.dart rename to modules/legacy/modules/hub/lib/src/core/data/models/get_devices_response_model.dart diff --git a/modules/hub/lib/src/core/data/models/get_devices_response_model.freezed.dart b/modules/legacy/modules/hub/lib/src/core/data/models/get_devices_response_model.freezed.dart similarity index 100% rename from modules/hub/lib/src/core/data/models/get_devices_response_model.freezed.dart rename to modules/legacy/modules/hub/lib/src/core/data/models/get_devices_response_model.freezed.dart diff --git a/modules/hub/lib/src/core/data/models/get_devices_response_model.g.dart b/modules/legacy/modules/hub/lib/src/core/data/models/get_devices_response_model.g.dart similarity index 100% rename from modules/hub/lib/src/core/data/models/get_devices_response_model.g.dart rename to modules/legacy/modules/hub/lib/src/core/data/models/get_devices_response_model.g.dart diff --git a/modules/hub/lib/src/core/data/models/latest_positions_response_model.dart b/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.dart similarity index 100% rename from modules/hub/lib/src/core/data/models/latest_positions_response_model.dart rename to modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.dart diff --git a/modules/hub/lib/src/core/data/models/latest_positions_response_model.freezed.dart b/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.freezed.dart similarity index 100% rename from modules/hub/lib/src/core/data/models/latest_positions_response_model.freezed.dart rename to modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.freezed.dart diff --git a/modules/hub/lib/src/core/data/models/latest_positions_response_model.g.dart b/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.g.dart similarity index 100% rename from modules/hub/lib/src/core/data/models/latest_positions_response_model.g.dart rename to modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.g.dart diff --git a/modules/hub/lib/src/core/data/repositories/hub_repository_impl.dart b/modules/legacy/modules/hub/lib/src/core/data/repositories/hub_repository_impl.dart similarity index 100% rename from modules/hub/lib/src/core/data/repositories/hub_repository_impl.dart rename to modules/legacy/modules/hub/lib/src/core/data/repositories/hub_repository_impl.dart diff --git a/modules/hub/lib/src/core/domain/repositories/hub_repository.dart b/modules/legacy/modules/hub/lib/src/core/domain/repositories/hub_repository.dart similarity index 100% rename from modules/hub/lib/src/core/domain/repositories/hub_repository.dart rename to modules/legacy/modules/hub/lib/src/core/domain/repositories/hub_repository.dart diff --git a/modules/hub/lib/src/core/providers/hub_remote_datasource_provier.dart b/modules/legacy/modules/hub/lib/src/core/providers/hub_remote_datasource_provier.dart similarity index 100% rename from modules/hub/lib/src/core/providers/hub_remote_datasource_provier.dart rename to modules/legacy/modules/hub/lib/src/core/providers/hub_remote_datasource_provier.dart diff --git a/modules/hub/lib/src/core/providers/hub_repository_provider.dart b/modules/legacy/modules/hub/lib/src/core/providers/hub_repository_provider.dart similarity index 100% rename from modules/hub/lib/src/core/providers/hub_repository_provider.dart rename to modules/legacy/modules/hub/lib/src/core/providers/hub_repository_provider.dart diff --git a/modules/hub/lib/src/features/hub/domain/entities/device_entity.dart b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/device_entity.dart similarity index 100% rename from modules/hub/lib/src/features/hub/domain/entities/device_entity.dart rename to modules/legacy/modules/hub/lib/src/features/hub/domain/entities/device_entity.dart diff --git a/modules/hub/lib/src/features/hub/domain/entities/get_devices_request_entity.dart b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/get_devices_request_entity.dart similarity index 100% rename from modules/hub/lib/src/features/hub/domain/entities/get_devices_request_entity.dart rename to modules/legacy/modules/hub/lib/src/features/hub/domain/entities/get_devices_request_entity.dart diff --git a/modules/hub/lib/src/features/hub/domain/entities/get_devices_request_entity.freezed.dart b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/get_devices_request_entity.freezed.dart similarity index 100% rename from modules/hub/lib/src/features/hub/domain/entities/get_devices_request_entity.freezed.dart rename to modules/legacy/modules/hub/lib/src/features/hub/domain/entities/get_devices_request_entity.freezed.dart diff --git a/modules/hub/lib/src/features/hub/domain/entities/position_entity.dart b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/position_entity.dart similarity index 100% rename from modules/hub/lib/src/features/hub/domain/entities/position_entity.dart rename to modules/legacy/modules/hub/lib/src/features/hub/domain/entities/position_entity.dart diff --git a/modules/hub/lib/src/features/hub/domain/get_devices_use_case.dart b/modules/legacy/modules/hub/lib/src/features/hub/domain/get_devices_use_case.dart similarity index 100% rename from modules/hub/lib/src/features/hub/domain/get_devices_use_case.dart rename to modules/legacy/modules/hub/lib/src/features/hub/domain/get_devices_use_case.dart diff --git a/modules/hub/lib/src/features/hub/domain/get_devices_use_case_impl.dart b/modules/legacy/modules/hub/lib/src/features/hub/domain/get_devices_use_case_impl.dart similarity index 100% rename from modules/hub/lib/src/features/hub/domain/get_devices_use_case_impl.dart rename to modules/legacy/modules/hub/lib/src/features/hub/domain/get_devices_use_case_impl.dart diff --git a/modules/hub/lib/src/features/hub/domain/get_latest_positions_use_case.dart b/modules/legacy/modules/hub/lib/src/features/hub/domain/get_latest_positions_use_case.dart similarity index 100% rename from modules/hub/lib/src/features/hub/domain/get_latest_positions_use_case.dart rename to modules/legacy/modules/hub/lib/src/features/hub/domain/get_latest_positions_use_case.dart diff --git a/modules/hub/lib/src/features/hub/domain/get_latest_positions_use_case_impl.dart b/modules/legacy/modules/hub/lib/src/features/hub/domain/get_latest_positions_use_case_impl.dart similarity index 100% rename from modules/hub/lib/src/features/hub/domain/get_latest_positions_use_case_impl.dart rename to modules/legacy/modules/hub/lib/src/features/hub/domain/get_latest_positions_use_case_impl.dart diff --git a/modules/hub/lib/src/features/hub/hub_builder.dart b/modules/legacy/modules/hub/lib/src/features/hub/hub_builder.dart similarity index 100% rename from modules/hub/lib/src/features/hub/hub_builder.dart rename to modules/legacy/modules/hub/lib/src/features/hub/hub_builder.dart diff --git a/modules/hub/lib/src/features/hub/presentation/hub_screen.dart b/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart similarity index 97% rename from modules/hub/lib/src/features/hub/presentation/hub_screen.dart rename to modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart index 1da55137..47eb7af8 100644 --- a/modules/hub/lib/src/features/hub/presentation/hub_screen.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart @@ -52,17 +52,17 @@ class HubScreen extends ConsumerWidget { children: [ AppSectionButton( onPressed: (){}, - icon: Icons.support_agent_outlined, + icon: SFIcons.customerService, text: I18n.customerService), SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), AppSectionButton( onPressed: (){navigationContract.pushTo(AppRoutes.dashboardHome);}, - icon: Icons.payments_outlined, + icon: SFIcons.payments, text: I18n.sfPay), SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), AppSectionButton( onPressed: (){}, - icon: Icons.menu_open_outlined, + icon: SFIcons.functions, text: I18n.functions), SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), AppSectionButton( diff --git a/modules/hub/lib/src/features/hub/presentation/providers/get_devices_use_case_provider.dart b/modules/legacy/modules/hub/lib/src/features/hub/presentation/providers/get_devices_use_case_provider.dart similarity index 100% rename from modules/hub/lib/src/features/hub/presentation/providers/get_devices_use_case_provider.dart rename to modules/legacy/modules/hub/lib/src/features/hub/presentation/providers/get_devices_use_case_provider.dart diff --git a/modules/hub/lib/src/features/hub/presentation/providers/get_latest_positions_use_case_provider.dart b/modules/legacy/modules/hub/lib/src/features/hub/presentation/providers/get_latest_positions_use_case_provider.dart similarity index 100% rename from modules/hub/lib/src/features/hub/presentation/providers/get_latest_positions_use_case_provider.dart rename to modules/legacy/modules/hub/lib/src/features/hub/presentation/providers/get_latest_positions_use_case_provider.dart diff --git a/modules/hub/lib/src/features/hub/presentation/state/hub_view_model.dart b/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_model.dart similarity index 100% rename from modules/hub/lib/src/features/hub/presentation/state/hub_view_model.dart rename to modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_model.dart diff --git a/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart b/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart similarity index 100% rename from modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart rename to modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart diff --git a/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.freezed.dart b/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.freezed.dart similarity index 100% rename from modules/hub/lib/src/features/hub/presentation/state/hub_view_state.freezed.dart rename to modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.freezed.dart diff --git a/modules/legacy/modules/hub/pubspec.lock b/modules/legacy/modules/hub/pubspec.lock new file mode 100644 index 00000000..636f3de1 --- /dev/null +++ b/modules/legacy/modules/hub/pubspec.lock @@ -0,0 +1,1206 @@ +# 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: f4ad0fea5f102201015c9aae9d93bc02f75dd9491529a8c21f88d17a8523d44c + url: "https://pub.dev" + source: hosted + version: "7.6.0" + analyzer_buffer: + dependency: transitive + description: + name: analyzer_buffer + sha256: f7833bee67c03c37241c67f8741b17cc501b69d9758df7a5a4a13ed6c947be43 + url: "https://pub.dev" + source: hosted + version: "0.1.10" + analyzer_plugin: + dependency: transitive + description: + name: analyzer_plugin + sha256: a5ab7590c27b779f3d4de67f31c4109dbe13dd7339f86461a6f2a8ab2594d8ce + url: "https://pub.dev" + source: hosted + version: "0.13.4" + 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 overridden" + description: + path: "../../../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 dev" + 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: "7931c90b84bc573fef103548e354258ae4c9d28d140e41961df6843c5d60d4d8" + url: "https://pub.dev" + source: hosted + version: "8.12.3" + 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" + ci: + dependency: transitive + description: + name: ci + sha256: "145d095ce05cddac4d797a158bc4cf3b6016d1fe63d8c3d2fbd7212590adca13" + url: "https://pub.dev" + source: hosted + version: "0.1.0" + 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: "6a6cab2ba4680d6423f34a9b972a4c9a94ebe1b62ecec4e1a1f2cba91fd1319d" + url: "https://pub.dev" + source: hosted + version: "4.11.1" + 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: transitive + 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" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" + custom_lint: + dependency: transitive + description: + name: custom_lint + sha256: "78085fbe842de7c5bef92de811ca81536968dbcbbcdac5c316711add2d15e796" + url: "https://pub.dev" + source: hosted + version: "0.8.0" + custom_lint_builder: + dependency: transitive + description: + name: custom_lint_builder + sha256: cc5532d5733d4eccfccaaec6070a1926e9f21e613d93ad0927fad020b95c9e52 + url: "https://pub.dev" + source: hosted + version: "0.8.0" + custom_lint_core: + dependency: transitive + description: + name: custom_lint_core + sha256: cc4684d22ca05bf0a4a51127e19a8aea576b42079ed2bc9e956f11aaebe35dd1 + url: "https://pub.dev" + source: hosted + version: "0.8.0" + custom_lint_visitor: + dependency: transitive + description: + name: custom_lint_visitor + sha256: "4a86a0d8415a91fbb8298d6ef03e9034dc8e323a599ddc4120a0e36c433983a2" + url: "https://pub.dev" + source: hosted + version: "1.0.0+7.7.0" + dart_earcut: + dependency: transitive + description: + name: dart_earcut + sha256: e485001bfc05dcbc437d7bfb666316182e3522d4c3f9668048e004d0eb2ce43b + url: "https://pub.dev" + source: hosted + version: "1.2.0" + dart_polylabel2: + dependency: transitive + description: + name: dart_polylabel2 + sha256: "7eeab15ce72894e4bdba6a8765712231fc81be0bd95247de4ad9966abc57adc6" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + 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: "../../../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: "direct main" + 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: "3e0141505477fd8ad55d6eb4e7776d3fe8430be8e497ccb1521370c3f21a3e2b" + url: "https://pub.dev" + source: hosted + version: "2.0.8" + 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_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" + url: "https://pub.dev" + source: hosted + version: "5.0.0" + flutter_map: + dependency: "direct main" + description: + name: flutter_map + sha256: "391e7dc95cc3f5190748210a69d4cfeb5d8f84dcdfa9c3235d0a9d7742ccb3f8" + url: "https://pub.dev" + source: hosted + version: "8.2.2" + 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: "direct main" + description: + name: freezed + sha256: "13065f10e135263a4f5a4391b79a8efc5fb8106f8dd555a9e49b750b45393d77" + url: "https://pub.dev" + source: hosted + version: "3.2.3" + freezed_annotation: + dependency: "direct main" + 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: "1d648d2dd2047d7f7450d5727ca24ee435f240385753d90b49650e3cdff32e56" + url: "https://pub.dev" + source: hosted + version: "9.2.0" + 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: eff94d2a6fc79fa8b811dde79c7549808c2346037ee107a1121b4a644c745f2a + url: "https://pub.dev" + source: hosted + version: "17.0.1" + graphs: + dependency: transitive + description: + name: graphs + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + home: + dependency: "direct overridden" + description: + path: "../../../home" + relative: true + source: path + version: "0.0.1" + hotreloader: + dependency: transitive + description: + name: hotreloader + sha256: bc167a1163807b03bada490bfe2df25b0d744df359227880220a5cbd04e5734b + url: "https://pub.dev" + source: hosted + version: "4.3.0" + http: + dependency: transitive + description: + name: http + sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" + url: "https://pub.dev" + source: hosted + version: "1.6.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" + 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: "direct main" + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" + json_serializable: + dependency: "direct main" + description: + name: json_serializable + sha256: c5b2ee75210a0f263c6c7b9eeea80553dbae96ea1bf57f02484e806a3ffdffa3 + url: "https://pub.dev" + source: hosted + version: "6.11.2" + latlong2: + dependency: "direct main" + description: + name: latlong2 + sha256: "98227922caf49e6056f91b6c56945ea1c7b166f28ffcd5fb8e72fc0b453cc8fe" + url: "https://pub.dev" + source: hosted + version: "0.9.1" + 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" + lists: + dependency: transitive + description: + name: lists + sha256: "4ca5c19ae4350de036a7e996cdd1ee39c93ac0a2b840f4915459b7d0a7d4ab27" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + logger: + dependency: transitive + description: + name: logger + sha256: a7967e31b703831a893bbc3c3dd11db08126fe5f369b5c648a36f821979f5be3 + url: "https://pub.dev" + source: hosted + version: "2.6.2" + 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" + mgrs_dart: + dependency: transitive + description: + name: mgrs_dart + sha256: fb89ae62f05fa0bb90f70c31fc870bcbcfd516c843fb554452ab3396f78586f7 + url: "https://pub.dev" + source: hosted + version: "2.0.0" + mime: + dependency: transitive + description: + name: mime + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + mockito: + dependency: transitive + description: + name: mockito + sha256: "2314cbe9165bcd16106513df9cf3c3224713087f09723b128928dc11a4379f99" + url: "https://pub.dev" + source: hosted + version: "5.5.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 overridden" + description: + path: "../../../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" + 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" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" + url: "https://pub.dev" + source: hosted + version: "2.1.5" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: f2c65e21139ce2c3dad46922be8272bb5963516045659e71bb16e151c93b580e + url: "https://pub.dev" + source: hosted + version: "2.2.22" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "6d13aece7b3f5c5a9731eaf553ff9dcbc2eff41087fd2df587fd0fed9a3eb0c4" + url: "https://pub.dev" + source: hosted + version: "2.5.1" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: "1a97266a94f7350d30ae522c0af07890c70b8e62c71e8e3920d1db4d23c057d1" + url: "https://pub.dev" + source: hosted + version: "7.0.1" + platform: + dependency: transitive + description: + name: platform + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + url: "https://pub.dev" + source: hosted + version: "3.1.6" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + pool: + dependency: transitive + description: + name: pool + sha256: "978783255c543aa3586a1b3c21f6e9d720eb315376a915872c61ef8b5c20177d" + url: "https://pub.dev" + source: hosted + version: "1.5.2" + profile: + dependency: "direct overridden" + description: + path: "../../../profile" + relative: true + source: path + version: "0.0.1" + proj4dart: + dependency: transitive + description: + name: proj4dart + sha256: c8a659ac9b6864aa47c171e78d41bbe6f5e1d7bd790a5814249e6b68bc44324e + url: "https://pub.dev" + source: hosted + version: "2.1.0" + 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" + riverpod_analyzer_utils: + dependency: transitive + description: + name: riverpod_analyzer_utils + sha256: a0f68adb078b790faa3c655110a017f9a7b7b079a57bbd40f540e80dce5fcd29 + url: "https://pub.dev" + source: hosted + version: "1.0.0-dev.7" + riverpod_annotation: + dependency: transitive + description: + name: riverpod_annotation + sha256: "7230014155777fc31ba3351bc2cb5a3b5717b11bfafe52b1553cb47d385f8897" + url: "https://pub.dev" + source: hosted + version: "3.0.3" + riverpod_generator: + dependency: "direct dev" + description: + name: riverpod_generator + sha256: "49894543a42cf7a9954fc4e7366b6d3cb2e6ec0fa07775f660afcdd92d097702" + url: "https://pub.dev" + source: hosted + version: "3.0.3" + riverpod_lint: + dependency: "direct dev" + description: + name: riverpod_lint + sha256: "7ef9c43469e9b5ac4e4c3b24d7c30642e47ce1b12cd7dcdd643534db0a72ed13" + url: "https://pub.dev" + source: hosted + version: "3.0.3" + rxdart: + dependency: transitive + description: + name: rxdart + sha256: "5c3004a4a8dbb94bd4bf5412a4def4acdaa12e12f269737a5751369e12d1a962" + url: "https://pub.dev" + source: hosted + version: "0.28.0" + 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: "7b19d6ba131c6eb98bfcbf8d56c1a7002eba438af2e7ae6f8398b2b0f4f381e3" + url: "https://pub.dev" + source: hosted + version: "3.1.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" + 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" + unicode: + dependency: transitive + description: + name: unicode + sha256: "0f69e46593d65245774d4f17125c6084d2c20b4e473a983f6e21b7d7762218f1" + url: "https://pub.dev" + source: hosted + version: "0.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: "1398c9f081a753f9226febe8900fce8f7d0a67163334e1c94a2438339d79d635" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + 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" + wkt_parser: + dependency: transitive + description: + name: wkt_parser + sha256: "8a555fc60de3116c00aad67891bcab20f81a958e4219cc106e3c037aa3937f13" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + 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.35.0" diff --git a/modules/legacy/modules/hub/pubspec.yaml b/modules/legacy/modules/hub/pubspec.yaml new file mode 100644 index 00000000..44a59922 --- /dev/null +++ b/modules/legacy/modules/hub/pubspec.yaml @@ -0,0 +1,114 @@ +name: hub +description: "A new Flutter project." +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 + +environment: + sdk: ^3.9.2 + flutter: ">=1.17.0" + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + #modules dependencies go here + dashboard_shell: + path: ../../modules/dashboard_shell + #packages dependencies go here + design_system: + path: ../../../../packages/design_system + navigation: + path: ../../../../packages/navigation + sf_localizations: + path: ../../../../packages/sf_localizations + sf_infrastructure: + path: ../../../../packages/sf_infrastructure + utils: + path: ../../../../packages/utils + fonts: + path: ../../../../packages/fonts + #dependencies go here + flutter_svg: ^2.2.1 + get_it: ^9.0.5 + go_router: ^17.0.0 + flutter_riverpod: ^3.0.3 + freezed_annotation: ^3.1.0 + freezed: ^3.2.3 + dio: ^5.9.0 + json_annotation: ^4.9.0 + json_serializable: ^6.11.2 + flutter_map: ^8.2.2 + latlong2: ^0.9.1 + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.8 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^5.0.0 + riverpod_generator: ^3.0.3 + build_runner: ^2.7.1 + riverpod_lint: ^3.0.3 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/to/resolution-aware-images + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/to/asset-from-package + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/to/font-from-package diff --git a/modules/legacy/modules/hub/pubspec_overrides.yaml b/modules/legacy/modules/hub/pubspec_overrides.yaml new file mode 100644 index 00000000..cf91bc8a --- /dev/null +++ b/modules/legacy/modules/hub/pubspec_overrides.yaml @@ -0,0 +1,26 @@ +# melos_managed_dependency_overrides: design_system,fonts,navigation,sf_infrastructure,sf_localizations,utils,auth,dashboard_shell,home,notifications,sf_shared,profile +dependency_overrides: + auth: + path: ..\\..\\..\\auth + dashboard_shell: + path: ..\\..\\..\\dashboard_shell + 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/legacy/modules/legacy_dashboard_shell/.gitignore b/modules/legacy/modules/legacy_dashboard_shell/.gitignore new file mode 100644 index 00000000..dd5eb989 --- /dev/null +++ b/modules/legacy/modules/legacy_dashboard_shell/.gitignore @@ -0,0 +1,31 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. +/pubspec.lock +**/doc/api/ +.dart_tool/ +.flutter-plugins-dependencies +/build/ +/coverage/ diff --git a/modules/legacy/modules/legacy_dashboard_shell/.metadata b/modules/legacy/modules/legacy_dashboard_shell/.metadata new file mode 100644 index 00000000..d7469f07 --- /dev/null +++ b/modules/legacy/modules/legacy_dashboard_shell/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "adc901062556672b4138e18a4dc62a4be8f4b3c2" + channel: "stable" + +project_type: package diff --git a/modules/legacy/modules/legacy_dashboard_shell/CHANGELOG.md b/modules/legacy/modules/legacy_dashboard_shell/CHANGELOG.md new file mode 100644 index 00000000..41cc7d81 --- /dev/null +++ b/modules/legacy/modules/legacy_dashboard_shell/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.0.1 + +* TODO: Describe initial release. diff --git a/modules/legacy/modules/legacy_dashboard_shell/LICENSE b/modules/legacy/modules/legacy_dashboard_shell/LICENSE new file mode 100644 index 00000000..ba75c69f --- /dev/null +++ b/modules/legacy/modules/legacy_dashboard_shell/LICENSE @@ -0,0 +1 @@ +TODO: Add your license here. diff --git a/modules/dashboard_shell/README.md b/modules/legacy/modules/legacy_dashboard_shell/README.md similarity index 100% rename from modules/dashboard_shell/README.md rename to modules/legacy/modules/legacy_dashboard_shell/README.md diff --git a/modules/legacy/modules/legacy_dashboard_shell/analysis_options.yaml b/modules/legacy/modules/legacy_dashboard_shell/analysis_options.yaml new file mode 100644 index 00000000..a5744c1c --- /dev/null +++ b/modules/legacy/modules/legacy_dashboard_shell/analysis_options.yaml @@ -0,0 +1,4 @@ +include: package:flutter_lints/flutter.yaml + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/modules/legacy/modules/legacy_dashboard_shell/lib/legacy_dashboard_builder.dart b/modules/legacy/modules/legacy_dashboard_shell/lib/legacy_dashboard_builder.dart new file mode 100644 index 00000000..1f889ef7 --- /dev/null +++ b/modules/legacy/modules/legacy_dashboard_shell/lib/legacy_dashboard_builder.dart @@ -0,0 +1,18 @@ +import 'package:legacy_dashboard_shell/legacy_dashboard_shell.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 LegacyDashboardBuilder { + const LegacyDashboardBuilder(); + + Widget build(BuildContext context, StatefulNavigationShell navShell) { + final NavigationContract navigationContract = GetIt.I(); + + return LegacyDashboardScreen( + navigationShell: navShell, + navigationContract: navigationContract, + ); + } +} diff --git a/modules/legacy/modules/legacy_dashboard_shell/lib/legacy_dashboard_shell.dart b/modules/legacy/modules/legacy_dashboard_shell/lib/legacy_dashboard_shell.dart new file mode 100644 index 00000000..5731b0ee --- /dev/null +++ b/modules/legacy/modules/legacy_dashboard_shell/lib/legacy_dashboard_shell.dart @@ -0,0 +1,2 @@ +export 'src/presentation/legacy_main_shell_screen.dart'; +export 'legacy_dashboard_builder.dart'; diff --git a/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_screen.dart b/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_screen.dart new file mode 100644 index 00000000..b86d9016 --- /dev/null +++ b/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_screen.dart @@ -0,0 +1,61 @@ +import 'package:legacy_dashboard_shell/src/presentation/legacy_main_shell_view_model.dart'; +import 'package:design_system/design_system.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; +import 'package:legacy_dashboard_shell/src/presentation/legacy_main_shell_view_state.dart'; +import 'package:navigation/navigation.dart'; +import 'package:sf_localizations/sf_localizations.dart'; + +final mainShellViewModelProvider = + NotifierProvider.autoDispose( + () => LegacyMainShellViewModel(), + ); + +class LegacyDashboardScreen extends ConsumerWidget { + final NavigationContract navigationContract; + final StatefulNavigationShell navigationShell; + + const LegacyDashboardScreen({ + super.key, + required this.navigationContract, + required this.navigationShell, + }); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.watch(themePortProvider); + final viewState = ref.watch(mainShellViewModelProvider); + final viewModel = ref.read(mainShellViewModelProvider.notifier); + + return Scaffold( + body: navigationShell, + bottomNavigationBar: NavigationBar( + backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + selectedIndex: viewState.selectedIndex, + onDestinationSelected: (index) { + viewModel.onTabChanged(index); + navigationShell.goBranch(index); + }, + destinations: [ + NavigationDestination( + icon: Icon(Icons.home_outlined), + label: context.translate(I18n.home), + ), + NavigationDestination( + icon: Icon(SFIcons.functions), + label: context.translate(I18n.functions), + ), + NavigationDestination( + icon: Icon(Icons.location_on_outlined), + label: context.translate(I18n.location), + ), + NavigationDestination( + icon: Icon(Icons.chat_outlined), + label: context.translate(I18n.chat), + ), + ], + ), + ); + } +} diff --git a/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_view_model.dart b/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_view_model.dart new file mode 100644 index 00000000..4a92901a --- /dev/null +++ b/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_view_model.dart @@ -0,0 +1,13 @@ +import 'package:legacy_dashboard_shell/src/presentation/legacy_main_shell_view_state.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +class LegacyMainShellViewModel extends Notifier { + @override + LegacyMainShellViewState build() { + return LegacyMainShellViewState(); + } + + void onTabChanged(int index) { + state = state.copyWith(selectedIndex: index); + } +} diff --git a/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_view_state.dart b/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_view_state.dart new file mode 100644 index 00000000..c258052d --- /dev/null +++ b/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_view_state.dart @@ -0,0 +1,14 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +part 'legacy_main_shell_view_state.freezed.dart'; + +@freezed +abstract class LegacyMainShellViewState with _$LegacyMainShellViewState { + const factory LegacyMainShellViewState({ + @Default(0) int selectedIndex, + @Default(false) bool isLoading, + @Default(false) bool isComplete, + String? error, + }) = _LegacyMainShellViewState; + + +} diff --git a/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_view_state.freezed.dart b/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_view_state.freezed.dart new file mode 100644 index 00000000..62c23135 --- /dev/null +++ b/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_view_state.freezed.dart @@ -0,0 +1,280 @@ +// 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 'legacy_main_shell_view_state.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$LegacyMainShellViewState { + + int get selectedIndex; bool get isLoading; bool get isComplete; String? get error; +/// Create a copy of LegacyMainShellViewState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$LegacyMainShellViewStateCopyWith get copyWith => _$LegacyMainShellViewStateCopyWithImpl(this as LegacyMainShellViewState, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is LegacyMainShellViewState&&(identical(other.selectedIndex, selectedIndex) || other.selectedIndex == selectedIndex)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isComplete, isComplete) || other.isComplete == isComplete)&&(identical(other.error, error) || other.error == error)); +} + + +@override +int get hashCode => Object.hash(runtimeType,selectedIndex,isLoading,isComplete,error); + +@override +String toString() { + return 'LegacyMainShellViewState(selectedIndex: $selectedIndex, isLoading: $isLoading, isComplete: $isComplete, error: $error)'; +} + + +} + +/// @nodoc +abstract mixin class $LegacyMainShellViewStateCopyWith<$Res> { + factory $LegacyMainShellViewStateCopyWith(LegacyMainShellViewState value, $Res Function(LegacyMainShellViewState) _then) = _$LegacyMainShellViewStateCopyWithImpl; +@useResult +$Res call({ + int selectedIndex, bool isLoading, bool isComplete, String? error +}); + + + + +} +/// @nodoc +class _$LegacyMainShellViewStateCopyWithImpl<$Res> + implements $LegacyMainShellViewStateCopyWith<$Res> { + _$LegacyMainShellViewStateCopyWithImpl(this._self, this._then); + + final LegacyMainShellViewState _self; + final $Res Function(LegacyMainShellViewState) _then; + +/// Create a copy of LegacyMainShellViewState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? selectedIndex = null,Object? isLoading = null,Object? isComplete = null,Object? error = freezed,}) { + return _then(_self.copyWith( +selectedIndex: null == selectedIndex ? _self.selectedIndex : selectedIndex // ignore: cast_nullable_to_non_nullable +as int,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable +as bool,isComplete: null == isComplete ? _self.isComplete : isComplete // ignore: cast_nullable_to_non_nullable +as bool,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + +} + + +/// Adds pattern-matching-related methods to [LegacyMainShellViewState]. +extension LegacyMainShellViewStatePatterns on LegacyMainShellViewState { +/// 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( _LegacyMainShellViewState value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _LegacyMainShellViewState() 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( _LegacyMainShellViewState value) $default,){ +final _that = this; +switch (_that) { +case _LegacyMainShellViewState(): +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( _LegacyMainShellViewState value)? $default,){ +final _that = this; +switch (_that) { +case _LegacyMainShellViewState() 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( int selectedIndex, bool isLoading, bool isComplete, String? error)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _LegacyMainShellViewState() when $default != null: +return $default(_that.selectedIndex,_that.isLoading,_that.isComplete,_that.error);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( int selectedIndex, bool isLoading, bool isComplete, String? error) $default,) {final _that = this; +switch (_that) { +case _LegacyMainShellViewState(): +return $default(_that.selectedIndex,_that.isLoading,_that.isComplete,_that.error);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( int selectedIndex, bool isLoading, bool isComplete, String? error)? $default,) {final _that = this; +switch (_that) { +case _LegacyMainShellViewState() when $default != null: +return $default(_that.selectedIndex,_that.isLoading,_that.isComplete,_that.error);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _LegacyMainShellViewState implements LegacyMainShellViewState { + const _LegacyMainShellViewState({this.selectedIndex = 0, this.isLoading = false, this.isComplete = false, this.error}); + + +@override@JsonKey() final int selectedIndex; +@override@JsonKey() final bool isLoading; +@override@JsonKey() final bool isComplete; +@override final String? error; + +/// Create a copy of LegacyMainShellViewState +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$LegacyMainShellViewStateCopyWith<_LegacyMainShellViewState> get copyWith => __$LegacyMainShellViewStateCopyWithImpl<_LegacyMainShellViewState>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _LegacyMainShellViewState&&(identical(other.selectedIndex, selectedIndex) || other.selectedIndex == selectedIndex)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isComplete, isComplete) || other.isComplete == isComplete)&&(identical(other.error, error) || other.error == error)); +} + + +@override +int get hashCode => Object.hash(runtimeType,selectedIndex,isLoading,isComplete,error); + +@override +String toString() { + return 'LegacyMainShellViewState(selectedIndex: $selectedIndex, isLoading: $isLoading, isComplete: $isComplete, error: $error)'; +} + + +} + +/// @nodoc +abstract mixin class _$LegacyMainShellViewStateCopyWith<$Res> implements $LegacyMainShellViewStateCopyWith<$Res> { + factory _$LegacyMainShellViewStateCopyWith(_LegacyMainShellViewState value, $Res Function(_LegacyMainShellViewState) _then) = __$LegacyMainShellViewStateCopyWithImpl; +@override @useResult +$Res call({ + int selectedIndex, bool isLoading, bool isComplete, String? error +}); + + + + +} +/// @nodoc +class __$LegacyMainShellViewStateCopyWithImpl<$Res> + implements _$LegacyMainShellViewStateCopyWith<$Res> { + __$LegacyMainShellViewStateCopyWithImpl(this._self, this._then); + + final _LegacyMainShellViewState _self; + final $Res Function(_LegacyMainShellViewState) _then; + +/// Create a copy of LegacyMainShellViewState +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? selectedIndex = null,Object? isLoading = null,Object? isComplete = null,Object? error = freezed,}) { + return _then(_LegacyMainShellViewState( +selectedIndex: null == selectedIndex ? _self.selectedIndex : selectedIndex // ignore: cast_nullable_to_non_nullable +as int,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable +as bool,isComplete: null == isComplete ? _self.isComplete : isComplete // ignore: cast_nullable_to_non_nullable +as bool,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/legacy_dashboard_shell/pubspec.yaml b/modules/legacy/modules/legacy_dashboard_shell/pubspec.yaml new file mode 100644 index 00000000..f62a16a0 --- /dev/null +++ b/modules/legacy/modules/legacy_dashboard_shell/pubspec.yaml @@ -0,0 +1,77 @@ +name: legacy_dashboard_shell +resoluction: workspace +description: "A new Flutter package project." +publish_to: 'none' # Remove this line if you wish to publish to pub.dev +version: 0.0.1 +homepage: + +environment: + sdk: ^3.9.2 + flutter: ">=1.17.0" + +dependencies: + flutter: + sdk: flutter + + #modules dependencies go here + hub: + path: ../../modules/hub + #packages dependencies go here + design_system: + path: ../../../../packages/design_system + sf_localizations: + path: ../../../../packages/sf_localizations + + #dependencies go here + navigation: ^0.0.1 + get_it: ^9.0.5 + go_router: ^17.0.0 + flutter_riverpod: ^3.0.3 + freezed_annotation: ^3.1.0 + freezed: ^3.2.3 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^5.0.0 + riverpod_generator: ^3.0.3 + build_runner: ^2.7.1 + riverpod_lint: ^3.0.3 + + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # To add assets to your package, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + # + # For details regarding assets in packages, see + # https://flutter.dev/to/asset-from-package + # + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/to/resolution-aware-images + + # To add custom fonts to your package, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts in packages, see + # https://flutter.dev/to/font-from-package diff --git a/modules/legacy/modules/legacy_dashboard_shell/pubspec_overrides.yaml b/modules/legacy/modules/legacy_dashboard_shell/pubspec_overrides.yaml new file mode 100644 index 00000000..fef6dac5 --- /dev/null +++ b/modules/legacy/modules/legacy_dashboard_shell/pubspec_overrides.yaml @@ -0,0 +1,28 @@ +# melos_managed_dependency_overrides: auth,design_system,fonts,home,navigation,notifications,sf_infrastructure,sf_localizations,sf_shared,utils,dashboard_shell,hub,profile +dependency_overrides: + auth: + path: ..\\..\\..\\auth + dashboard_shell: + path: ..\\..\\..\\dashboard_shell + design_system: + path: ..\\..\\..\\..\\packages\\design_system + fonts: + path: ..\\..\\..\\..\\packages\\fonts + home: + path: ..\\..\\..\\home + hub: + path: ..\\hub + 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/legacy/pubspec.lock b/modules/legacy/pubspec.lock new file mode 100644 index 00000000..c1b51d33 --- /dev/null +++ b/modules/legacy/pubspec.lock @@ -0,0 +1,213 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" + url: "https://pub.dev" + source: hosted + version: "2.13.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + characters: + dependency: transitive + description: + name: characters + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + clock: + dependency: transitive + description: + name: clock + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + url: "https://pub.dev" + source: hosted + version: "1.1.2" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" + url: "https://pub.dev" + source: hosted + version: "5.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + 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" + 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" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" + url: "https://pub.dev" + source: hosted + version: "1.10.1" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" + source: hosted + version: "1.12.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + 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_api: + dependency: transitive + description: + name: test_api + sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00" + url: "https://pub.dev" + source: hosted + version: "0.7.6" + 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" +sdks: + dart: ">=3.9.2 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/modules/legacy/pubspec.yaml b/modules/legacy/pubspec.yaml new file mode 100644 index 00000000..a65876b9 --- /dev/null +++ b/modules/legacy/pubspec.yaml @@ -0,0 +1,87 @@ +name: legacy +description: "A new Flutter project." + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# +# This version is used _only_ for the Runner app, which is used if you just do +# a `flutter run`. It has no impact on any other native host app that you embed +# your Flutter project into. +version: 1.0.0+1 + +environment: + sdk: ^3.9.2 + +dependencies: + flutter: + sdk: flutter + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.8 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^5.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +flutter: + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add Flutter specific assets to your application, add an assets section, + # like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/to/resolution-aware-images + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/to/asset-from-package + + # To add Flutter specific custom fonts to your application, add a fonts + # section here, in this "flutter" section. Each entry in this list should + # have a "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/to/font-from-package + + + # This section identifies your Flutter project as a module meant for + # embedding in a native host app. These identifiers should _not_ ordinarily + # be changed after generation - they are used to ensure that the tooling can + # maintain consistency when adding or modifying assets and plugins. + # They also do not have any bearing on your native host application's + # identifiers, which may be completely independent or the same as these. + module: + androidX: true + androidPackage: com.example.legacy + iosBundleIdentifier: com.example.legacy diff --git a/packages/navigation/lib/app_routes.dart b/packages/navigation/lib/app_routes.dart index 736fc2d3..45ba35c8 100644 --- a/packages/navigation/lib/app_routes.dart +++ b/packages/navigation/lib/app_routes.dart @@ -1,6 +1,5 @@ class AppRoutes { static const splash = '/splash'; - static const hub = '/hub'; static const login = '/login'; static const signup = '/signup'; static const onboarding = '/onboarding'; @@ -15,4 +14,10 @@ class AppRoutes { static const dashboardActivity = '$dashboard/activity'; static const dashboardNotifications = '$dashboard/notifications'; static const dashboardProfile = '$dashboard/profile'; + + static const legacy = '/legacy'; + + static const legacyDashboard = '$legacy/dashboard'; + + static const dashboardHub = '$legacyDashboard/hub'; } diff --git a/packages/sf_localizations/assets/l10n/en.json b/packages/sf_localizations/assets/l10n/en.json index 741e7aac..b58dd5dc 100755 --- a/packages/sf_localizations/assets/l10n/en.json +++ b/packages/sf_localizations/assets/l10n/en.json @@ -136,5 +136,8 @@ "functions": "Functions", "accountSettings": "Account Settings", "deviceSettings": "Device Settings", - "watchesOnMap": "Smartwatch on the map" + "watchesOnMap": "Smartwatch on the map", + "home": "Home", + "location": "Location", + "chat": "Chat" } \ 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 b35774fd..c2e75c56 100644 --- a/packages/sf_localizations/assets/l10n/es.json +++ b/packages/sf_localizations/assets/l10n/es.json @@ -131,10 +131,13 @@ "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", - "customerService": "Servicio de Atención al Cliente", + "customerService": "Soporte", "sfPay": "SaveFamily Pay", "functions": "Funciones", - "accountSettings": "Ajustes de la cuenta", - "deviceSettings": "Ajustes del dispositivo", - "watchesOnMap": "Relojes en el mapa" + "accountSettings": "Perfil de cuenta", + "deviceSettings": "Ajustes", + "watchesOnMap": "Reloj inteligente en el mapa", + "home": "Inicio", + "location": "Mapa", + "chat": "Chat" } \ 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 b0a55947..bd01ab75 100755 --- a/packages/sf_localizations/lib/src/generated/i18n.dart +++ b/packages/sf_localizations/lib/src/generated/i18n.dart @@ -167,4 +167,7 @@ class I18n { static const String accountSettings = 'accountSettings'; static const String deviceSettings = 'deviceSettings'; static const String watchesOnMap = 'watchesOnMap'; + static const String home = 'home'; + static const String location = 'location'; + static const String chat = 'chat'; } From cd578352f9beb181c62d6540225b0bb5940c2292 Mon Sep 17 00:00:00 2001 From: aitorarana Date: Wed, 28 Jan 2026 17:36:01 +0100 Subject: [PATCH 04/25] Added customer service and contact screens and state --- .idea/modules.xml | 2 +- .../mobile_app/lib/navigation/app_router.dart | 6 + .../flutter/generated_plugin_registrant.cc | 4 + .../linux/flutter/generated_plugins.cmake | 1 + apps/mobile_app/pubspec.yaml | 6 +- modules/legacy/melos_legacy.iml | 5 +- .../lib/src/customer_service_builder.dart | 18 ++ .../entities/send_email_request_entity.dart | 15 + .../send_email_request_entity.freezed.dart | 286 +++++++++++++++++ .../customer_service_repository.dart | 0 .../lib/src/domain/send_email_use_case.dart | 5 + .../src/domain/send_email_use_case_impl.dart | 13 + .../lib/src/presentation/contact_screen.dart | 122 ++++++++ .../presentation/customer_service_screen.dart | 139 +++++++++ .../send_email_use_case_provider.dart | 9 + .../state/contact_view_model.dart | 129 ++++++++ .../state/contact_view_state.dart | 17 + .../state/contact_view_state.freezed.dart | 292 ++++++++++++++++++ .../customer_service_repository_provider.dart | 8 + .../lib/legacy_dashboard_builder.dart | 1 - .../features/hub/presentation/hub_screen.dart | 2 +- .../presentation/state/hub_view_state.dart | 1 - modules/legacy/modules/hub/pubspec.yaml | 2 +- packages/navigation/lib/app_routes.dart | 2 + packages/sf_localizations/assets/l10n/en.json | 14 +- packages/sf_localizations/assets/l10n/es.json | 14 +- .../lib/src/generated/i18n.dart | 12 + 27 files changed, 1115 insertions(+), 10 deletions(-) create mode 100644 modules/legacy/modules/customer_service/lib/src/customer_service_builder.dart create mode 100644 modules/legacy/modules/customer_service/lib/src/domain/entities/send_email_request_entity.dart create mode 100644 modules/legacy/modules/customer_service/lib/src/domain/entities/send_email_request_entity.freezed.dart create mode 100644 modules/legacy/modules/customer_service/lib/src/domain/repositories/customer_service_repository.dart create mode 100644 modules/legacy/modules/customer_service/lib/src/domain/send_email_use_case.dart create mode 100644 modules/legacy/modules/customer_service/lib/src/domain/send_email_use_case_impl.dart create mode 100644 modules/legacy/modules/customer_service/lib/src/presentation/contact_screen.dart create mode 100644 modules/legacy/modules/customer_service/lib/src/presentation/customer_service_screen.dart create mode 100644 modules/legacy/modules/customer_service/lib/src/presentation/providers/send_email_use_case_provider.dart create mode 100644 modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_model.dart create mode 100644 modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_state.dart create mode 100644 modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_state.freezed.dart create mode 100644 modules/legacy/modules/customer_service/lib/src/providers/customer_service_repository_provider.dart delete mode 100644 modules/legacy/modules/dashboard_shell/lib/legacy_dashboard_builder.dart diff --git a/.idea/modules.xml b/.idea/modules.xml index cfa0d987..de9529fa 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -3,6 +3,7 @@ + @@ -12,7 +13,6 @@ - diff --git a/apps/mobile_app/lib/navigation/app_router.dart b/apps/mobile_app/lib/navigation/app_router.dart index 485f4469..d6a540a0 100644 --- a/apps/mobile_app/lib/navigation/app_router.dart +++ b/apps/mobile_app/lib/navigation/app_router.dart @@ -1,4 +1,5 @@ import 'package:auth/auth.dart'; +import 'package:customer_service/customer_service.dart'; import 'package:legacy_dashboard_shell/legacy_dashboard_builder.dart'; import 'package:dashboard_shell/dashboard_builder.dart'; import 'package:flutter/material.dart'; @@ -43,6 +44,11 @@ void configureAppRouter() { ], ), + GoRoute( + path: AppRoutes.customerService, + name: 'customer_service', + pageBuilder: CustomerServiceBuilder().buildPage, + ), GoRoute( path: AppRoutes.login, name: 'login', diff --git a/apps/mobile_app/linux/flutter/generated_plugin_registrant.cc b/apps/mobile_app/linux/flutter/generated_plugin_registrant.cc index e71a16d2..f6f23bfe 100644 --- a/apps/mobile_app/linux/flutter/generated_plugin_registrant.cc +++ b/apps/mobile_app/linux/flutter/generated_plugin_registrant.cc @@ -6,6 +6,10 @@ #include "generated_plugin_registrant.h" +#include void fl_register_plugins(FlPluginRegistry* registry) { + g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); + url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); } diff --git a/apps/mobile_app/linux/flutter/generated_plugins.cmake b/apps/mobile_app/linux/flutter/generated_plugins.cmake index 2e1de87a..f16b4c34 100644 --- a/apps/mobile_app/linux/flutter/generated_plugins.cmake +++ b/apps/mobile_app/linux/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + url_launcher_linux ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/apps/mobile_app/pubspec.yaml b/apps/mobile_app/pubspec.yaml index 9fdc39d3..71f59dc4 100644 --- a/apps/mobile_app/pubspec.yaml +++ b/apps/mobile_app/pubspec.yaml @@ -41,8 +41,6 @@ dependencies: path: ../../modules/auth home: path: ../../modules/home - hub: - path: ../../modules/legacy/modules/hub profile: path: ../../modules/profile notifications: @@ -51,6 +49,10 @@ dependencies: path: ../../modules/dashboard_shell legacy_dashboard_shell: path: ../../modules/legacy/modules/legacy_dashboard_shell + hub: + path: ../../modules/legacy/modules/hub + customer_service: + path: ../../modules/legacy/modules/customer_service splash: path: ../../modules/splash #packages dependencies go here diff --git a/modules/legacy/melos_legacy.iml b/modules/legacy/melos_legacy.iml index 26a45e79..bb9b68c7 100644 --- a/modules/legacy/melos_legacy.iml +++ b/modules/legacy/melos_legacy.iml @@ -17,10 +17,13 @@ + + + - + \ No newline at end of file diff --git a/modules/legacy/modules/customer_service/lib/src/customer_service_builder.dart b/modules/legacy/modules/customer_service/lib/src/customer_service_builder.dart new file mode 100644 index 00000000..a5d4d885 --- /dev/null +++ b/modules/legacy/modules/customer_service/lib/src/customer_service_builder.dart @@ -0,0 +1,18 @@ +import 'package:customer_service/src/presentation/customer_service_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 CustomerServiceBuilder { + const CustomerServiceBuilder(); + + Page buildPage(BuildContext context, GoRouterState state) { + final NavigationContract navigationContract = GetIt.I(); + + return MaterialPage( + key: state.pageKey, + child: CustomerServiceScreen(navigationContract: navigationContract), + ); + } +} diff --git a/modules/legacy/modules/customer_service/lib/src/domain/entities/send_email_request_entity.dart b/modules/legacy/modules/customer_service/lib/src/domain/entities/send_email_request_entity.dart new file mode 100644 index 00000000..55204429 --- /dev/null +++ b/modules/legacy/modules/customer_service/lib/src/domain/entities/send_email_request_entity.dart @@ -0,0 +1,15 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'send_email_request_entity.freezed.dart'; + +@freezed +abstract class SendEmailRequestEntity with _$SendEmailRequestEntity{ + const factory SendEmailRequestEntity({ + required String country, + required String channel, + required String name, + required String email, + required String subject, + required String body, + }) = _SendEmailRequestEntity; +} \ No newline at end of file diff --git a/modules/legacy/modules/customer_service/lib/src/domain/entities/send_email_request_entity.freezed.dart b/modules/legacy/modules/customer_service/lib/src/domain/entities/send_email_request_entity.freezed.dart new file mode 100644 index 00000000..a92da8c7 --- /dev/null +++ b/modules/legacy/modules/customer_service/lib/src/domain/entities/send_email_request_entity.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 'send_email_request_entity.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$SendEmailRequestEntity { + + String get country; String get channel; String get name; String get email; String get subject; String get body; +/// Create a copy of SendEmailRequestEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$SendEmailRequestEntityCopyWith get copyWith => _$SendEmailRequestEntityCopyWithImpl(this as SendEmailRequestEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is SendEmailRequestEntity&&(identical(other.country, country) || other.country == country)&&(identical(other.channel, channel) || other.channel == channel)&&(identical(other.name, name) || other.name == name)&&(identical(other.email, email) || other.email == email)&&(identical(other.subject, subject) || other.subject == subject)&&(identical(other.body, body) || other.body == body)); +} + + +@override +int get hashCode => Object.hash(runtimeType,country,channel,name,email,subject,body); + +@override +String toString() { + return 'SendEmailRequestEntity(country: $country, channel: $channel, name: $name, email: $email, subject: $subject, body: $body)'; +} + + +} + +/// @nodoc +abstract mixin class $SendEmailRequestEntityCopyWith<$Res> { + factory $SendEmailRequestEntityCopyWith(SendEmailRequestEntity value, $Res Function(SendEmailRequestEntity) _then) = _$SendEmailRequestEntityCopyWithImpl; +@useResult +$Res call({ + String country, String channel, String name, String email, String subject, String body +}); + + + + +} +/// @nodoc +class _$SendEmailRequestEntityCopyWithImpl<$Res> + implements $SendEmailRequestEntityCopyWith<$Res> { + _$SendEmailRequestEntityCopyWithImpl(this._self, this._then); + + final SendEmailRequestEntity _self; + final $Res Function(SendEmailRequestEntity) _then; + +/// Create a copy of SendEmailRequestEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? country = null,Object? channel = null,Object? name = null,Object? email = null,Object? subject = null,Object? body = null,}) { + return _then(_self.copyWith( +country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable +as String,channel: null == channel ? _self.channel : channel // ignore: cast_nullable_to_non_nullable +as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable +as String,subject: null == subject ? _self.subject : subject // ignore: cast_nullable_to_non_nullable +as String,body: null == body ? _self.body : body // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [SendEmailRequestEntity]. +extension SendEmailRequestEntityPatterns on SendEmailRequestEntity { +/// 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( _SendEmailRequestEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _SendEmailRequestEntity() 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( _SendEmailRequestEntity value) $default,){ +final _that = this; +switch (_that) { +case _SendEmailRequestEntity(): +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( _SendEmailRequestEntity value)? $default,){ +final _that = this; +switch (_that) { +case _SendEmailRequestEntity() 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 country, String channel, String name, String email, String subject, String body)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _SendEmailRequestEntity() when $default != null: +return $default(_that.country,_that.channel,_that.name,_that.email,_that.subject,_that.body);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 country, String channel, String name, String email, String subject, String body) $default,) {final _that = this; +switch (_that) { +case _SendEmailRequestEntity(): +return $default(_that.country,_that.channel,_that.name,_that.email,_that.subject,_that.body);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 country, String channel, String name, String email, String subject, String body)? $default,) {final _that = this; +switch (_that) { +case _SendEmailRequestEntity() when $default != null: +return $default(_that.country,_that.channel,_that.name,_that.email,_that.subject,_that.body);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _SendEmailRequestEntity implements SendEmailRequestEntity { + const _SendEmailRequestEntity({required this.country, required this.channel, required this.name, required this.email, required this.subject, required this.body}); + + +@override final String country; +@override final String channel; +@override final String name; +@override final String email; +@override final String subject; +@override final String body; + +/// Create a copy of SendEmailRequestEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$SendEmailRequestEntityCopyWith<_SendEmailRequestEntity> get copyWith => __$SendEmailRequestEntityCopyWithImpl<_SendEmailRequestEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _SendEmailRequestEntity&&(identical(other.country, country) || other.country == country)&&(identical(other.channel, channel) || other.channel == channel)&&(identical(other.name, name) || other.name == name)&&(identical(other.email, email) || other.email == email)&&(identical(other.subject, subject) || other.subject == subject)&&(identical(other.body, body) || other.body == body)); +} + + +@override +int get hashCode => Object.hash(runtimeType,country,channel,name,email,subject,body); + +@override +String toString() { + return 'SendEmailRequestEntity(country: $country, channel: $channel, name: $name, email: $email, subject: $subject, body: $body)'; +} + + +} + +/// @nodoc +abstract mixin class _$SendEmailRequestEntityCopyWith<$Res> implements $SendEmailRequestEntityCopyWith<$Res> { + factory _$SendEmailRequestEntityCopyWith(_SendEmailRequestEntity value, $Res Function(_SendEmailRequestEntity) _then) = __$SendEmailRequestEntityCopyWithImpl; +@override @useResult +$Res call({ + String country, String channel, String name, String email, String subject, String body +}); + + + + +} +/// @nodoc +class __$SendEmailRequestEntityCopyWithImpl<$Res> + implements _$SendEmailRequestEntityCopyWith<$Res> { + __$SendEmailRequestEntityCopyWithImpl(this._self, this._then); + + final _SendEmailRequestEntity _self; + final $Res Function(_SendEmailRequestEntity) _then; + +/// Create a copy of SendEmailRequestEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? country = null,Object? channel = null,Object? name = null,Object? email = null,Object? subject = null,Object? body = null,}) { + return _then(_SendEmailRequestEntity( +country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable +as String,channel: null == channel ? _self.channel : channel // ignore: cast_nullable_to_non_nullable +as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable +as String,subject: null == subject ? _self.subject : subject // ignore: cast_nullable_to_non_nullable +as String,body: null == body ? _self.body : body // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/customer_service/lib/src/domain/repositories/customer_service_repository.dart b/modules/legacy/modules/customer_service/lib/src/domain/repositories/customer_service_repository.dart new file mode 100644 index 00000000..e69de29b diff --git a/modules/legacy/modules/customer_service/lib/src/domain/send_email_use_case.dart b/modules/legacy/modules/customer_service/lib/src/domain/send_email_use_case.dart new file mode 100644 index 00000000..e07870df --- /dev/null +++ b/modules/legacy/modules/customer_service/lib/src/domain/send_email_use_case.dart @@ -0,0 +1,5 @@ +import 'package:customer_service/src/domain/entities/send_email_request_entity.dart'; + +abstract class SendEmailUseCase { + Future sendEmail({required SendEmailRequestEntity request}); +} diff --git a/modules/legacy/modules/customer_service/lib/src/domain/send_email_use_case_impl.dart b/modules/legacy/modules/customer_service/lib/src/domain/send_email_use_case_impl.dart new file mode 100644 index 00000000..86002122 --- /dev/null +++ b/modules/legacy/modules/customer_service/lib/src/domain/send_email_use_case_impl.dart @@ -0,0 +1,13 @@ +import 'package:customer_service/src/domain/entities/send_email_request_entity.dart'; +import 'package:customer_service/src/domain/send_email_use_case.dart'; + +class SendEmailUseCaseImpl implements SendEmailUseCase { + //SignUpUseCaseImpl(this._repository); + + //final AuthRepository _repository; + + @override + Future sendEmail({required SendEmailRequestEntity request}) async { + //return _repository.signUp(request: request); + } +} diff --git a/modules/legacy/modules/customer_service/lib/src/presentation/contact_screen.dart b/modules/legacy/modules/customer_service/lib/src/presentation/contact_screen.dart new file mode 100644 index 00000000..d5507856 --- /dev/null +++ b/modules/legacy/modules/customer_service/lib/src/presentation/contact_screen.dart @@ -0,0 +1,122 @@ +import 'package:customer_service/src/presentation/state/contact_view_model.dart'; +import 'package:design_system/design_system.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:navigation/navigation.dart'; +import 'package:sf_localizations/sf_localizations.dart'; +import 'package:utils/utils.dart'; + +const Map country = { + 'SPAIN': 'España', + 'PORTUGAL': 'Portugal', + 'FRANCE': 'France', + 'ITALIA': 'Italia', + 'GERMANY': 'Deutschland', + 'OTHER': I18n.other, +}; + +const Map channel = { + 'ONLINE_SHOP': I18n.channelOnline, + 'AMAZON': I18n.channelAmazon, + 'STORE': I18n.channelStore, + 'OTHER': I18n.other, +}; + +class ContactScreen extends ConsumerWidget { + final NavigationContract navigationContract; + + const ContactScreen({super.key, required this.navigationContract}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.watch(themePortProvider); + + final vm = ref.read(contactViewModelProvider.notifier); + final viewState = ref.watch(contactViewModelProvider); + + return Scaffold( + backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + body: SafeArea( + child: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 38, vertical: 14), + big: EdgeInsets.symmetric(horizontal: 36, vertical: 12) + ), + child: SingleChildScrollView( + child: Column( + children: [ + Stack( + children: [ + SizedBox( + height: SizeUtils.getByScreen(small: 36, big: 36), + child: Align( + alignment: Alignment.centerLeft, + child: Icon(Icons.arrow_back, size: SizeUtils.getByScreen(small: 36, big: 34)) + ) + ), + Center(child: Text(context.translate(I18n.contactTitle), + style: TextStyle(fontSize: SizeUtils.getByScreen(small: 28, big: 27)))) + ], + ), + SizedBox(height: SizeUtils.getByScreen(small: 40, big: 38)), + CustomDropdown( + items: country.values.map(Text.new).toList(growable: false), + values: country.keys.toList(), + onChanged: (x){vm.setCountry(x);}, + hint: 'Choose your country' + ), + SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), + CustomDropdown( + items: channel.values.map(Text.new).toList(growable: false), + values: channel.keys.toList(), + onChanged: (x){vm.setChannel(x);}, + hint: 'Purchase channel' + ), + SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), + CustomTextField( + controller: vm.nameController, + hint: 'Enter your name', + ), + SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), + CustomTextField( + controller: vm.emailController, + keyboardType: TextInputType.emailAddress, + hint: 'Enter your email', + ), + SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), + CustomTextField( + controller: vm.subjectController, + hint: 'Your message subject', + ), + SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), + CustomTextField( + controller: vm.bodyController, + keyboardType: TextInputType.multiline, + hint: 'Your message', + lines: 8, + ), + if (viewState.errorMessage.isNotEmpty) ...[ + const SizedBox(height: 4), + Text( + viewState.errorMessage, + textAlign: TextAlign.center, + style: const TextStyle( + color: Color.fromRGBO(239, 17, 17, 1), + fontSize: 12, + ), + ), + ], + SizedBox(height: SizeUtils.getByScreen(small: 28, big: 27)), + PrimaryButton( + onPressed: vm.sendEmail, + text: 'Send!', + color: theme.getColorFor(ThemeCode.buttonPrimary) + ) + ], + ) + ) + ) + ), + ); + } +} \ No newline at end of file diff --git a/modules/legacy/modules/customer_service/lib/src/presentation/customer_service_screen.dart b/modules/legacy/modules/customer_service/lib/src/presentation/customer_service_screen.dart new file mode 100644 index 00000000..28f839ff --- /dev/null +++ b/modules/legacy/modules/customer_service/lib/src/presentation/customer_service_screen.dart @@ -0,0 +1,139 @@ +import 'package:customer_service/src/presentation/contact_screen.dart'; +import 'package:design_system/design_system.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:navigation/navigation.dart'; +import 'package:sf_localizations/sf_localizations.dart'; +import 'package:utils/utils.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class CustomerServiceScreen extends ConsumerWidget { + final NavigationContract navigationContract; + + const CustomerServiceScreen({super.key, required this.navigationContract}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.watch(themePortProvider); + + return Scaffold( + backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + body: SafeArea( + child: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 18, vertical: 14), + big: EdgeInsets.symmetric(horizontal: 16, vertical: 12) + ), + child: Column( + children: [ + Stack( + children: [ + SizedBox( + height: SizeUtils.getByScreen(small: 36, big: 36), + child: Align( + alignment: Alignment.centerLeft, + child: Icon(Icons.arrow_back, size: SizeUtils.getByScreen(small: 36, big: 34)) + ) + ), + Center(child: Text(context.translate(I18n.customerService), + style: TextStyle(fontSize: SizeUtils.getByScreen(small: 28, big: 27)))) + ], + ), + SizedBox(height: SizeUtils.getByScreen(small: 40, big: 38)), + AppSectionButton( + onPressed: () async { + final Uri url = Uri.parse('https://www.savefamilygps.com/'); + if (!await launchUrl(url)) { + throw Exception('Could not launch $url'); + } + }, + icon: Icons.sunny, + text: "Visit our Website" + ), + SizedBox(height: SizeUtils.getByScreen(small: 10, big: 9)), + AppSectionButton( + onPressed: () async { + final Uri url = Uri.parse('https://savefamilygpshelp.zendesk.com/hc/es'); + if (!await launchUrl(url)) { + throw Exception('Could not launch $url'); + } + }, + icon: Icons.handshake_outlined, + text: "Can we help you?" + ), + SizedBox(height: SizeUtils.getByScreen(small: 10, big: 9)), + AppSectionButton( + onPressed: (){Navigator.push(context, + MaterialPageRoute( + builder: (_) => ContactScreen(navigationContract: navigationContract), + ));}, + icon: Icons.email_outlined, + text: context.translate(I18n.contactTitle) + ), + ], + ) + ) + ), + ); + } +} + + +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/legacy/modules/customer_service/lib/src/presentation/providers/send_email_use_case_provider.dart b/modules/legacy/modules/customer_service/lib/src/presentation/providers/send_email_use_case_provider.dart new file mode 100644 index 00000000..b4fe853a --- /dev/null +++ b/modules/legacy/modules/customer_service/lib/src/presentation/providers/send_email_use_case_provider.dart @@ -0,0 +1,9 @@ +import 'package:customer_service/src/domain/send_email_use_case.dart'; +import 'package:customer_service/src/domain/send_email_use_case_impl.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +final sendEmailUseCaseProvider = +Provider.autoDispose((ref) { + //final authRepository = ref.read(customerServiceRepositoryProvider); + return SendEmailUseCaseImpl(); +}); diff --git a/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_model.dart b/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_model.dart new file mode 100644 index 00000000..6f804672 --- /dev/null +++ b/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_model.dart @@ -0,0 +1,129 @@ +// import 'package:customer_service/src/domain/send_email_use_case.dart'; +// import 'package:customer_service/src/presentation/providers/send_email_use_case_provider.dart'; +import 'package:customer_service/src/presentation/state/contact_view_state.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:sf_localizations/sf_localizations.dart'; +import 'package:url_launcher/url_launcher.dart'; + +final contactViewModelProvider = +NotifierProvider.autoDispose( + ContactViewModel.new, +); + +class ContactViewModel extends Notifier { + //late final SendEmailUseCase _sendEmailUseCase; + + late final TextEditingController nameController; + late final TextEditingController emailController; + late final TextEditingController subjectController; + late final TextEditingController bodyController; + + static final RegExp _emailRegex = RegExp( + r'^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$', + caseSensitive: false, + ); + + @override + ContactViewState build() { + //_sendEmailUseCase = ref.read(sendEmailUseCaseProvider); + + nameController = TextEditingController(); + emailController = TextEditingController(); + subjectController = TextEditingController(); + bodyController = TextEditingController(); + + nameController.addListener(_onNameChanged); + emailController.addListener(_onEmailChanged); + subjectController.addListener(_onSubjectChanged); + bodyController.addListener(_onBodyChanged); + + ref.onDispose(disposeControllers); + + return const ContactViewState(); + } + + void setCountry(String value) { + if (value == state.country) return; + + state = state.copyWith(country: value, errorMessage: ''); + } + + void setChannel(String value) { + if (value == state.channel) return; + + state = state.copyWith(channel: value, errorMessage: ''); + } + + void _onNameChanged() { + final text = nameController.text; + if (text == state.name) return; + + state = state.copyWith(name: text, errorMessage: ''); + } + + void _onEmailChanged() { + final text = emailController.text; + if (text == state.email) return; + + state = state.copyWith(email: text, errorMessage: ''); + state = state.copyWith(emailError: _emailErrorFor(text)); + } + + bool _isValidEmail(String email) => _emailRegex.hasMatch(email); + + String _emailErrorFor(String value) { + final email = value.trim(); + if (email.isEmpty) return I18n.errorEmailRequired; + if (!_isValidEmail(email)) return I18n.errorEmailInvalid; + return ''; + } + + void _onSubjectChanged() { + final text = subjectController.text; + if (text == state.subject) return; + + state = state.copyWith(subject: text, errorMessage: ''); + } + + void _onBodyChanged() { + final text = bodyController.text; + if (text == state.body) return; + + state = state.copyWith(body: text, errorMessage: ''); + } + + void sendEmail() async { + final receiver = 'aitorarana@savefamilygps.com'; + + //final name = state.name; + final sender = state.email; + final subject = state.subject; + final body = state.body; + + if (sender.isEmpty) { + state = state.copyWith(errorMessage: I18n.errorEmailRequired); + return; + } + if (_isValidEmail(sender)) { + state = state.copyWith(errorMessage: I18n.errorEmailInvalid); + } + + final Uri url = Uri.parse('mailto:$receiver?from=$sender&subject=$subject&body=$body'); + if (!await launchUrl(url)) { + throw Exception('Could not launch $url'); + } + } + + void disposeControllers() { + nameController.removeListener(_onNameChanged); + emailController.removeListener(_onEmailChanged); + subjectController.removeListener(_onSubjectChanged); + bodyController.removeListener(_onBodyChanged); + + nameController.dispose(); + emailController.dispose(); + subjectController.dispose(); + bodyController.dispose(); + } +} \ No newline at end of file diff --git a/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_state.dart b/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_state.dart new file mode 100644 index 00000000..08133560 --- /dev/null +++ b/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_state.dart @@ -0,0 +1,17 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'contact_view_state.freezed.dart'; + +@freezed +abstract class ContactViewState with _$ContactViewState{ + const factory ContactViewState({ + @Default('') String country, + @Default('') String channel, + @Default('') String name, + @Default('') String email, + @Default('') String subject, + @Default('') String body, + @Default('') String errorMessage, + @Default('') String emailError, + }) = _ContactViewState; +} \ No newline at end of file diff --git a/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_state.freezed.dart b/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_state.freezed.dart new file mode 100644 index 00000000..31f58ae1 --- /dev/null +++ b/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_state.freezed.dart @@ -0,0 +1,292 @@ +// 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 'contact_view_state.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$ContactViewState { + + String get country; String get channel; String get name; String get email; String get subject; String get body; String get errorMessage; String get emailError; +/// Create a copy of ContactViewState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ContactViewStateCopyWith get copyWith => _$ContactViewStateCopyWithImpl(this as ContactViewState, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ContactViewState&&(identical(other.country, country) || other.country == country)&&(identical(other.channel, channel) || other.channel == channel)&&(identical(other.name, name) || other.name == name)&&(identical(other.email, email) || other.email == email)&&(identical(other.subject, subject) || other.subject == subject)&&(identical(other.body, body) || other.body == body)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.emailError, emailError) || other.emailError == emailError)); +} + + +@override +int get hashCode => Object.hash(runtimeType,country,channel,name,email,subject,body,errorMessage,emailError); + +@override +String toString() { + return 'ContactViewState(country: $country, channel: $channel, name: $name, email: $email, subject: $subject, body: $body, errorMessage: $errorMessage, emailError: $emailError)'; +} + + +} + +/// @nodoc +abstract mixin class $ContactViewStateCopyWith<$Res> { + factory $ContactViewStateCopyWith(ContactViewState value, $Res Function(ContactViewState) _then) = _$ContactViewStateCopyWithImpl; +@useResult +$Res call({ + String country, String channel, String name, String email, String subject, String body, String errorMessage, String emailError +}); + + + + +} +/// @nodoc +class _$ContactViewStateCopyWithImpl<$Res> + implements $ContactViewStateCopyWith<$Res> { + _$ContactViewStateCopyWithImpl(this._self, this._then); + + final ContactViewState _self; + final $Res Function(ContactViewState) _then; + +/// Create a copy of ContactViewState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? country = null,Object? channel = null,Object? name = null,Object? email = null,Object? subject = null,Object? body = null,Object? errorMessage = null,Object? emailError = null,}) { + return _then(_self.copyWith( +country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable +as String,channel: null == channel ? _self.channel : channel // ignore: cast_nullable_to_non_nullable +as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable +as String,subject: null == subject ? _self.subject : subject // ignore: cast_nullable_to_non_nullable +as String,body: null == body ? _self.body : body // ignore: cast_nullable_to_non_nullable +as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable +as String,emailError: null == emailError ? _self.emailError : emailError // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [ContactViewState]. +extension ContactViewStatePatterns on ContactViewState { +/// 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( _ContactViewState value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _ContactViewState() 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( _ContactViewState value) $default,){ +final _that = this; +switch (_that) { +case _ContactViewState(): +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( _ContactViewState value)? $default,){ +final _that = this; +switch (_that) { +case _ContactViewState() 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 country, String channel, String name, String email, String subject, String body, String errorMessage, String emailError)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _ContactViewState() when $default != null: +return $default(_that.country,_that.channel,_that.name,_that.email,_that.subject,_that.body,_that.errorMessage,_that.emailError);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 country, String channel, String name, String email, String subject, String body, String errorMessage, String emailError) $default,) {final _that = this; +switch (_that) { +case _ContactViewState(): +return $default(_that.country,_that.channel,_that.name,_that.email,_that.subject,_that.body,_that.errorMessage,_that.emailError);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 country, String channel, String name, String email, String subject, String body, String errorMessage, String emailError)? $default,) {final _that = this; +switch (_that) { +case _ContactViewState() when $default != null: +return $default(_that.country,_that.channel,_that.name,_that.email,_that.subject,_that.body,_that.errorMessage,_that.emailError);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _ContactViewState implements ContactViewState { + const _ContactViewState({this.country = '', this.channel = '', this.name = '', this.email = '', this.subject = '', this.body = '', this.errorMessage = '', this.emailError = ''}); + + +@override@JsonKey() final String country; +@override@JsonKey() final String channel; +@override@JsonKey() final String name; +@override@JsonKey() final String email; +@override@JsonKey() final String subject; +@override@JsonKey() final String body; +@override@JsonKey() final String errorMessage; +@override@JsonKey() final String emailError; + +/// Create a copy of ContactViewState +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$ContactViewStateCopyWith<_ContactViewState> get copyWith => __$ContactViewStateCopyWithImpl<_ContactViewState>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _ContactViewState&&(identical(other.country, country) || other.country == country)&&(identical(other.channel, channel) || other.channel == channel)&&(identical(other.name, name) || other.name == name)&&(identical(other.email, email) || other.email == email)&&(identical(other.subject, subject) || other.subject == subject)&&(identical(other.body, body) || other.body == body)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.emailError, emailError) || other.emailError == emailError)); +} + + +@override +int get hashCode => Object.hash(runtimeType,country,channel,name,email,subject,body,errorMessage,emailError); + +@override +String toString() { + return 'ContactViewState(country: $country, channel: $channel, name: $name, email: $email, subject: $subject, body: $body, errorMessage: $errorMessage, emailError: $emailError)'; +} + + +} + +/// @nodoc +abstract mixin class _$ContactViewStateCopyWith<$Res> implements $ContactViewStateCopyWith<$Res> { + factory _$ContactViewStateCopyWith(_ContactViewState value, $Res Function(_ContactViewState) _then) = __$ContactViewStateCopyWithImpl; +@override @useResult +$Res call({ + String country, String channel, String name, String email, String subject, String body, String errorMessage, String emailError +}); + + + + +} +/// @nodoc +class __$ContactViewStateCopyWithImpl<$Res> + implements _$ContactViewStateCopyWith<$Res> { + __$ContactViewStateCopyWithImpl(this._self, this._then); + + final _ContactViewState _self; + final $Res Function(_ContactViewState) _then; + +/// Create a copy of ContactViewState +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? country = null,Object? channel = null,Object? name = null,Object? email = null,Object? subject = null,Object? body = null,Object? errorMessage = null,Object? emailError = null,}) { + return _then(_ContactViewState( +country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable +as String,channel: null == channel ? _self.channel : channel // ignore: cast_nullable_to_non_nullable +as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable +as String,subject: null == subject ? _self.subject : subject // ignore: cast_nullable_to_non_nullable +as String,body: null == body ? _self.body : body // ignore: cast_nullable_to_non_nullable +as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable +as String,emailError: null == emailError ? _self.emailError : emailError // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/customer_service/lib/src/providers/customer_service_repository_provider.dart b/modules/legacy/modules/customer_service/lib/src/providers/customer_service_repository_provider.dart new file mode 100644 index 00000000..a8d0bd56 --- /dev/null +++ b/modules/legacy/modules/customer_service/lib/src/providers/customer_service_repository_provider.dart @@ -0,0 +1,8 @@ +/* +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +final customerServiceRepositoryProvider = Provider((ref) { + final remote = ref.read(customerServiceRemoteDatasourceProvider); + return CustomerServiceRepositoryImpl(remote); +}); +*/ diff --git a/modules/legacy/modules/dashboard_shell/lib/legacy_dashboard_builder.dart b/modules/legacy/modules/dashboard_shell/lib/legacy_dashboard_builder.dart deleted file mode 100644 index b9f78bb0..00000000 --- a/modules/legacy/modules/dashboard_shell/lib/legacy_dashboard_builder.dart +++ /dev/null @@ -1 +0,0 @@ -// TODO Implement this library. \ No newline at end of file diff --git a/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart b/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart index 47eb7af8..408f99ab 100644 --- a/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart @@ -51,7 +51,7 @@ class HubScreen extends ConsumerWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppSectionButton( - onPressed: (){}, + onPressed: (){navigationContract.pushTo(AppRoutes.customerService);}, icon: SFIcons.customerService, text: I18n.customerService), SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), diff --git a/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart b/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart index f7968fa4..a1c6dbde 100644 --- a/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart @@ -1,7 +1,6 @@ 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'; diff --git a/modules/legacy/modules/hub/pubspec.yaml b/modules/legacy/modules/hub/pubspec.yaml index 44a59922..aa7ceb59 100644 --- a/modules/legacy/modules/hub/pubspec.yaml +++ b/modules/legacy/modules/hub/pubspec.yaml @@ -33,7 +33,7 @@ dependencies: sdk: flutter #modules dependencies go here dashboard_shell: - path: ../../modules/dashboard_shell + path: ../../../../modules/dashboard_shell #packages dependencies go here design_system: path: ../../../../packages/design_system diff --git a/packages/navigation/lib/app_routes.dart b/packages/navigation/lib/app_routes.dart index 45ba35c8..c4ddab10 100644 --- a/packages/navigation/lib/app_routes.dart +++ b/packages/navigation/lib/app_routes.dart @@ -17,6 +17,8 @@ class AppRoutes { static const legacy = '/legacy'; + static const customerService = '$legacy/customer_service'; + static const legacyDashboard = '$legacy/dashboard'; static const dashboardHub = '$legacyDashboard/hub'; diff --git a/packages/sf_localizations/assets/l10n/en.json b/packages/sf_localizations/assets/l10n/en.json index b58dd5dc..4ea242cc 100755 --- a/packages/sf_localizations/assets/l10n/en.json +++ b/packages/sf_localizations/assets/l10n/en.json @@ -139,5 +139,17 @@ "watchesOnMap": "Smartwatch on the map", "home": "Home", "location": "Location", - "chat": "Chat" + "chat": "Chat", + "channelOnline": "SF online shop", + "channelAmazon": "Amazon", + "channelStore": "Physical store", + "other": "Other", + "contactTitle": "Contact us", + "selectCountry": "Choose your country", + "selectChannel": "Purchase channel", + "enterName": "Enter your name", + "enterEmail": "Enter your email", + "enterSubject": "Your message subject", + "enterMessage": "Your message", + "sendEmail": "Send!" } \ 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 c2e75c56..48151842 100644 --- a/packages/sf_localizations/assets/l10n/es.json +++ b/packages/sf_localizations/assets/l10n/es.json @@ -139,5 +139,17 @@ "watchesOnMap": "Reloj inteligente en el mapa", "home": "Inicio", "location": "Mapa", - "chat": "Chat" + "chat": "Chat", + "channelOnline": "Tienda online SF", + "channelAmazon": "Amazon", + "channelStore": "Tienda física", + "other": "Otro", + "contactTitle": "Contacta con nosotros", + "selectCountry": "Selecciona tu país", + "selectChannel": "Caal de compra", + "enterName": "Introduce tu nombre", + "enterEmail": "Introduce tu correo electrónico", + "enterSubject": "Asunto del mensaje", + "enterMessage": "Tu mensaje", + "sendEmail": "!Enviar!" } \ 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 bd01ab75..764d1d8a 100755 --- a/packages/sf_localizations/lib/src/generated/i18n.dart +++ b/packages/sf_localizations/lib/src/generated/i18n.dart @@ -170,4 +170,16 @@ class I18n { static const String home = 'home'; static const String location = 'location'; static const String chat = 'chat'; + static const String channelOnline = 'channelOnline'; + static const String channelAmazon = 'channelAmazon'; + static const String channelStore = 'channelStore'; + static const String other = 'other'; + static const String contactTitle = 'contactTitle'; + static const String selectCountry = 'selectCountry'; + static const String selectChannel = 'selectChannel'; + static const String enterName = 'enterName'; + static const String enterEmail = 'enterEmail'; + static const String enterSubject = 'enterSubject'; + static const String enterMessage = 'enterMessage'; + static const String sendEmail = 'sendEmail'; } From 880dd85d2bf970947325c80d74524e026a6f9e1b Mon Sep 17 00:00:00 2001 From: aitorarana Date: Thu, 29 Jan 2026 17:45:14 +0100 Subject: [PATCH 05/25] added account_settings, linked_devices and edit_linked_device screens and state --- .idea/modules.xml | 3 +- apps/mobile_app/assets/images/ui/profile.svg | 12 + .../mobile_app/lib/navigation/app_router.dart | 6 + apps/mobile_app/pubspec.yaml | 2 + modules/legacy/melos_legacy.iml | 5 +- .../datasource/account_remote_datasource.dart | 5 + .../account_remote_datasource_impl.dart | 80 +++ .../get_linked_devices_response_model.dart | 38 ++ ...linked_devices_response_model.freezed.dart | 552 ++++++++++++++++++ .../get_linked_devices_response_model.g.dart | 39 ++ .../repositories/account_repository_impl.dart | 14 + .../repositories/account_repository.dart | 5 + .../account_remote_datasource_provider.dart | 9 + .../account_repository_provider.dart | 9 + .../account_settings_builder.dart | 18 + .../presentation/account_settings_screen.dart | 149 +++++ .../domain/entities/device_entity.dart | 12 + .../entities/device_entity.freezed.dart | 277 +++++++++ .../domain/get_linked_devices_use_case.dart | 5 + .../get_linked_devices_use_case_impl.dart | 14 + .../edit_linked_device_screen.dart | 100 ++++ .../presentation/linked_devices_screen.dart | 226 +++++++ .../get_linked_devices_use_case_provider.dart | 9 + .../state/linked_devices_view_model.dart | 56 ++ .../state/linked_devices_view_state.dart | 14 + .../linked_devices_view_state.freezed.dart | 286 +++++++++ .../lib/legacy_dashboard_builder.dart | 1 - .../features/hub/presentation/hub_screen.dart | 2 +- .../design_system/{lib => }/fonts/config.json | 140 +++++ packages/navigation/lib/app_routes.dart | 1 + 30 files changed, 2085 insertions(+), 4 deletions(-) create mode 100644 apps/mobile_app/assets/images/ui/profile.svg create mode 100644 modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart create mode 100644 modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart create mode 100644 modules/legacy/modules/account/lib/src/core/data/models/get_linked_devices_response_model.dart create mode 100644 modules/legacy/modules/account/lib/src/core/data/models/get_linked_devices_response_model.freezed.dart create mode 100644 modules/legacy/modules/account/lib/src/core/data/models/get_linked_devices_response_model.g.dart create mode 100644 modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart create mode 100644 modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart create mode 100644 modules/legacy/modules/account/lib/src/core/providers/account_remote_datasource_provider.dart create mode 100644 modules/legacy/modules/account/lib/src/core/providers/account_repository_provider.dart create mode 100644 modules/legacy/modules/account/lib/src/features/account_settings/account_settings_builder.dart create mode 100644 modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart create mode 100644 modules/legacy/modules/account/lib/src/features/linked_devices/domain/entities/device_entity.dart create mode 100644 modules/legacy/modules/account/lib/src/features/linked_devices/domain/entities/device_entity.freezed.dart create mode 100644 modules/legacy/modules/account/lib/src/features/linked_devices/domain/get_linked_devices_use_case.dart create mode 100644 modules/legacy/modules/account/lib/src/features/linked_devices/domain/get_linked_devices_use_case_impl.dart create mode 100644 modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart create mode 100644 modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart create mode 100644 modules/legacy/modules/account/lib/src/features/linked_devices/presentation/providers/get_linked_devices_use_case_provider.dart create mode 100644 modules/legacy/modules/account/lib/src/features/linked_devices/state/linked_devices_view_model.dart create mode 100644 modules/legacy/modules/account/lib/src/features/linked_devices/state/linked_devices_view_state.dart create mode 100644 modules/legacy/modules/account/lib/src/features/linked_devices/state/linked_devices_view_state.freezed.dart delete mode 100644 modules/legacy/modules/dashboard_shell/lib/legacy_dashboard_builder.dart rename packages/design_system/{lib => }/fonts/config.json (70%) mode change 100755 => 100644 diff --git a/.idea/modules.xml b/.idea/modules.xml index cfa0d987..7005aa74 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,7 +2,9 @@ + + @@ -12,7 +14,6 @@ - diff --git a/apps/mobile_app/assets/images/ui/profile.svg b/apps/mobile_app/assets/images/ui/profile.svg new file mode 100644 index 00000000..3e1a697c --- /dev/null +++ b/apps/mobile_app/assets/images/ui/profile.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/apps/mobile_app/lib/navigation/app_router.dart b/apps/mobile_app/lib/navigation/app_router.dart index 485f4469..68380200 100644 --- a/apps/mobile_app/lib/navigation/app_router.dart +++ b/apps/mobile_app/lib/navigation/app_router.dart @@ -1,3 +1,4 @@ +import 'package:account/account.dart'; import 'package:auth/auth.dart'; import 'package:legacy_dashboard_shell/legacy_dashboard_builder.dart'; import 'package:dashboard_shell/dashboard_builder.dart'; @@ -42,6 +43,11 @@ void configureAppRouter() { ), ], ), + GoRoute( + path: AppRoutes.accountSettings, + name: 'account_settings', + pageBuilder: AccountSettingsBuilder().buildPage, + ), GoRoute( path: AppRoutes.login, diff --git a/apps/mobile_app/pubspec.yaml b/apps/mobile_app/pubspec.yaml index 9fdc39d3..96b021f5 100644 --- a/apps/mobile_app/pubspec.yaml +++ b/apps/mobile_app/pubspec.yaml @@ -53,6 +53,8 @@ dependencies: path: ../../modules/legacy/modules/legacy_dashboard_shell splash: path: ../../modules/splash + account: + path: ../../modules/legacy/modules/account #packages dependencies go here navigation: path: ../../packages/navigation diff --git a/modules/legacy/melos_legacy.iml b/modules/legacy/melos_legacy.iml index 26a45e79..a7cf90de 100644 --- a/modules/legacy/melos_legacy.iml +++ b/modules/legacy/melos_legacy.iml @@ -17,10 +17,13 @@ + + + - + \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart new file mode 100644 index 00000000..844a5932 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart @@ -0,0 +1,5 @@ +import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; + +abstract class AccountRemoteDatasource { + Future> getLinkedDevices({required String userId}); +} diff --git a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart new file mode 100644 index 00000000..d33455cb --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart @@ -0,0 +1,80 @@ +import 'dart:convert'; + +import 'package:account/src/core/data/datasource/account_remote_datasource.dart'; +import 'package:account/src/core/data/models/get_linked_devices_response_model.dart'; +import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:dio/dio.dart'; +// import 'package:flutter/material.dart'; +// import 'package:sf_infrastructure/sf_infrastructure.dart'; + +class AccountRemoteDatasourceImpl implements AccountRemoteDatasource { + AccountRemoteDatasourceImpl(/*this._repository*/); + + // final QuestiaRepository _repository; + + @override + Future> getLinkedDevices({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 = GetLinkedDevicesResponseModel.fromJson(data);*/ + final model = GetLinkedDevicesResponseModel(items: [ + GetLinkedDevicesItemResponseModel( + identificator: '1111', + name: 'Carlos', + number: '111111111'), + GetLinkedDevicesItemResponseModel( + identificator: '1112', + name: 'Ana', + number: '222222222'), + ]); + return model.toEntity(); + } on DioException catch (error) { + throw _mapDioError( + error, + defaultMessage: error.message ?? 'Error getting devices', + ); + } + } +} + +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/legacy/modules/account/lib/src/core/data/models/get_linked_devices_response_model.dart b/modules/legacy/modules/account/lib/src/core/data/models/get_linked_devices_response_model.dart new file mode 100644 index 00000000..e844559d --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/data/models/get_linked_devices_response_model.dart @@ -0,0 +1,38 @@ +import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'get_linked_devices_response_model.freezed.dart'; +part 'get_linked_devices_response_model.g.dart'; + +@freezed +abstract class GetLinkedDevicesResponseModel with _$GetLinkedDevicesResponseModel { + const factory GetLinkedDevicesResponseModel({ + required List items, + }) = _GetLinkedDevicesResponseModel; + + factory GetLinkedDevicesResponseModel.fromJson(Map json) => + _$GetLinkedDevicesResponseModelFromJson(json); +} + +@freezed +abstract class GetLinkedDevicesItemResponseModel with _$GetLinkedDevicesItemResponseModel { + const factory GetLinkedDevicesItemResponseModel({ + required String identificator, + required String name, + required String number, + }) = + _GetLinkedDevicesItemResponseModel; + + factory GetLinkedDevicesItemResponseModel.fromJson(Map json) => + _$GetLinkedDevicesItemResponseModelFromJson(json); +} + +extension GetDevicesResponseModelMapper on GetLinkedDevicesResponseModel { + List toEntity() { + return items.map((GetLinkedDevicesItemResponseModel item) => DeviceEntity( + identificator: item.identificator, + name: item.name, + number: item.number + )).toList(); + } +} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/core/data/models/get_linked_devices_response_model.freezed.dart b/modules/legacy/modules/account/lib/src/core/data/models/get_linked_devices_response_model.freezed.dart new file mode 100644 index 00000000..ed127626 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/data/models/get_linked_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_linked_devices_response_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$GetLinkedDevicesResponseModel { + + List get items; +/// Create a copy of GetLinkedDevicesResponseModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$GetLinkedDevicesResponseModelCopyWith get copyWith => _$GetLinkedDevicesResponseModelCopyWithImpl(this as GetLinkedDevicesResponseModel, _$identity); + + /// Serializes this GetLinkedDevicesResponseModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is GetLinkedDevicesResponseModel&&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 'GetLinkedDevicesResponseModel(items: $items)'; +} + + +} + +/// @nodoc +abstract mixin class $GetLinkedDevicesResponseModelCopyWith<$Res> { + factory $GetLinkedDevicesResponseModelCopyWith(GetLinkedDevicesResponseModel value, $Res Function(GetLinkedDevicesResponseModel) _then) = _$GetLinkedDevicesResponseModelCopyWithImpl; +@useResult +$Res call({ + List items +}); + + + + +} +/// @nodoc +class _$GetLinkedDevicesResponseModelCopyWithImpl<$Res> + implements $GetLinkedDevicesResponseModelCopyWith<$Res> { + _$GetLinkedDevicesResponseModelCopyWithImpl(this._self, this._then); + + final GetLinkedDevicesResponseModel _self; + final $Res Function(GetLinkedDevicesResponseModel) _then; + +/// Create a copy of GetLinkedDevicesResponseModel +/// 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 [GetLinkedDevicesResponseModel]. +extension GetLinkedDevicesResponseModelPatterns on GetLinkedDevicesResponseModel { +/// 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( _GetLinkedDevicesResponseModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _GetLinkedDevicesResponseModel() 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( _GetLinkedDevicesResponseModel value) $default,){ +final _that = this; +switch (_that) { +case _GetLinkedDevicesResponseModel(): +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( _GetLinkedDevicesResponseModel value)? $default,){ +final _that = this; +switch (_that) { +case _GetLinkedDevicesResponseModel() 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 _GetLinkedDevicesResponseModel() 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 _GetLinkedDevicesResponseModel(): +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 _GetLinkedDevicesResponseModel() when $default != null: +return $default(_that.items);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _GetLinkedDevicesResponseModel implements GetLinkedDevicesResponseModel { + const _GetLinkedDevicesResponseModel({required final List items}): _items = items; + factory _GetLinkedDevicesResponseModel.fromJson(Map json) => _$GetLinkedDevicesResponseModelFromJson(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 GetLinkedDevicesResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$GetLinkedDevicesResponseModelCopyWith<_GetLinkedDevicesResponseModel> get copyWith => __$GetLinkedDevicesResponseModelCopyWithImpl<_GetLinkedDevicesResponseModel>(this, _$identity); + +@override +Map toJson() { + return _$GetLinkedDevicesResponseModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetLinkedDevicesResponseModel&&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 'GetLinkedDevicesResponseModel(items: $items)'; +} + + +} + +/// @nodoc +abstract mixin class _$GetLinkedDevicesResponseModelCopyWith<$Res> implements $GetLinkedDevicesResponseModelCopyWith<$Res> { + factory _$GetLinkedDevicesResponseModelCopyWith(_GetLinkedDevicesResponseModel value, $Res Function(_GetLinkedDevicesResponseModel) _then) = __$GetLinkedDevicesResponseModelCopyWithImpl; +@override @useResult +$Res call({ + List items +}); + + + + +} +/// @nodoc +class __$GetLinkedDevicesResponseModelCopyWithImpl<$Res> + implements _$GetLinkedDevicesResponseModelCopyWith<$Res> { + __$GetLinkedDevicesResponseModelCopyWithImpl(this._self, this._then); + + final _GetLinkedDevicesResponseModel _self; + final $Res Function(_GetLinkedDevicesResponseModel) _then; + +/// Create a copy of GetLinkedDevicesResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? items = null,}) { + return _then(_GetLinkedDevicesResponseModel( +items: null == items ? _self._items : items // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + + +/// @nodoc +mixin _$GetLinkedDevicesItemResponseModel { + + String get identificator; String get name; String get number; +/// Create a copy of GetLinkedDevicesItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$GetLinkedDevicesItemResponseModelCopyWith get copyWith => _$GetLinkedDevicesItemResponseModelCopyWithImpl(this as GetLinkedDevicesItemResponseModel, _$identity); + + /// Serializes this GetLinkedDevicesItemResponseModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is GetLinkedDevicesItemResponseModel&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.name, name) || other.name == name)&&(identical(other.number, number) || other.number == number)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,identificator,name,number); + +@override +String toString() { + return 'GetLinkedDevicesItemResponseModel(identificator: $identificator, name: $name, number: $number)'; +} + + +} + +/// @nodoc +abstract mixin class $GetLinkedDevicesItemResponseModelCopyWith<$Res> { + factory $GetLinkedDevicesItemResponseModelCopyWith(GetLinkedDevicesItemResponseModel value, $Res Function(GetLinkedDevicesItemResponseModel) _then) = _$GetLinkedDevicesItemResponseModelCopyWithImpl; +@useResult +$Res call({ + String identificator, String name, String number +}); + + + + +} +/// @nodoc +class _$GetLinkedDevicesItemResponseModelCopyWithImpl<$Res> + implements $GetLinkedDevicesItemResponseModelCopyWith<$Res> { + _$GetLinkedDevicesItemResponseModelCopyWithImpl(this._self, this._then); + + final GetLinkedDevicesItemResponseModel _self; + final $Res Function(GetLinkedDevicesItemResponseModel) _then; + +/// Create a copy of GetLinkedDevicesItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? identificator = null,Object? name = null,Object? number = null,}) { + return _then(_self.copyWith( +identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable +as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,number: null == number ? _self.number : number // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [GetLinkedDevicesItemResponseModel]. +extension GetLinkedDevicesItemResponseModelPatterns on GetLinkedDevicesItemResponseModel { +/// 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( _GetLinkedDevicesItemResponseModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _GetLinkedDevicesItemResponseModel() 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( _GetLinkedDevicesItemResponseModel value) $default,){ +final _that = this; +switch (_that) { +case _GetLinkedDevicesItemResponseModel(): +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( _GetLinkedDevicesItemResponseModel value)? $default,){ +final _that = this; +switch (_that) { +case _GetLinkedDevicesItemResponseModel() 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 identificator, String name, String number)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _GetLinkedDevicesItemResponseModel() when $default != null: +return $default(_that.identificator,_that.name,_that.number);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 identificator, String name, String number) $default,) {final _that = this; +switch (_that) { +case _GetLinkedDevicesItemResponseModel(): +return $default(_that.identificator,_that.name,_that.number);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 identificator, String name, String number)? $default,) {final _that = this; +switch (_that) { +case _GetLinkedDevicesItemResponseModel() when $default != null: +return $default(_that.identificator,_that.name,_that.number);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _GetLinkedDevicesItemResponseModel implements GetLinkedDevicesItemResponseModel { + const _GetLinkedDevicesItemResponseModel({required this.identificator, required this.name, required this.number}); + factory _GetLinkedDevicesItemResponseModel.fromJson(Map json) => _$GetLinkedDevicesItemResponseModelFromJson(json); + +@override final String identificator; +@override final String name; +@override final String number; + +/// Create a copy of GetLinkedDevicesItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$GetLinkedDevicesItemResponseModelCopyWith<_GetLinkedDevicesItemResponseModel> get copyWith => __$GetLinkedDevicesItemResponseModelCopyWithImpl<_GetLinkedDevicesItemResponseModel>(this, _$identity); + +@override +Map toJson() { + return _$GetLinkedDevicesItemResponseModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetLinkedDevicesItemResponseModel&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.name, name) || other.name == name)&&(identical(other.number, number) || other.number == number)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,identificator,name,number); + +@override +String toString() { + return 'GetLinkedDevicesItemResponseModel(identificator: $identificator, name: $name, number: $number)'; +} + + +} + +/// @nodoc +abstract mixin class _$GetLinkedDevicesItemResponseModelCopyWith<$Res> implements $GetLinkedDevicesItemResponseModelCopyWith<$Res> { + factory _$GetLinkedDevicesItemResponseModelCopyWith(_GetLinkedDevicesItemResponseModel value, $Res Function(_GetLinkedDevicesItemResponseModel) _then) = __$GetLinkedDevicesItemResponseModelCopyWithImpl; +@override @useResult +$Res call({ + String identificator, String name, String number +}); + + + + +} +/// @nodoc +class __$GetLinkedDevicesItemResponseModelCopyWithImpl<$Res> + implements _$GetLinkedDevicesItemResponseModelCopyWith<$Res> { + __$GetLinkedDevicesItemResponseModelCopyWithImpl(this._self, this._then); + + final _GetLinkedDevicesItemResponseModel _self; + final $Res Function(_GetLinkedDevicesItemResponseModel) _then; + +/// Create a copy of GetLinkedDevicesItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? identificator = null,Object? name = null,Object? number = null,}) { + return _then(_GetLinkedDevicesItemResponseModel( +identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable +as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,number: null == number ? _self.number : number // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/account/lib/src/core/data/models/get_linked_devices_response_model.g.dart b/modules/legacy/modules/account/lib/src/core/data/models/get_linked_devices_response_model.g.dart new file mode 100644 index 00000000..19d9d0bb --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/data/models/get_linked_devices_response_model.g.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'get_linked_devices_response_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_GetLinkedDevicesResponseModel _$GetLinkedDevicesResponseModelFromJson( + Map json, +) => _GetLinkedDevicesResponseModel( + items: (json['items'] as List) + .map( + (e) => GetLinkedDevicesItemResponseModel.fromJson( + e as Map, + ), + ) + .toList(), +); + +Map _$GetLinkedDevicesResponseModelToJson( + _GetLinkedDevicesResponseModel instance, +) => {'items': instance.items}; + +_GetLinkedDevicesItemResponseModel _$GetLinkedDevicesItemResponseModelFromJson( + Map json, +) => _GetLinkedDevicesItemResponseModel( + identificator: json['identificator'] as String, + name: json['name'] as String, + number: json['number'] as String, +); + +Map _$GetLinkedDevicesItemResponseModelToJson( + _GetLinkedDevicesItemResponseModel instance, +) => { + 'identificator': instance.identificator, + 'name': instance.name, + 'number': instance.number, +}; diff --git a/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart b/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart new file mode 100644 index 00000000..f34f0806 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart @@ -0,0 +1,14 @@ +import 'package:account/src/core/data/datasource/account_remote_datasource.dart'; +import 'package:account/src/core/domain/repositories/account_repository.dart'; +import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; + +class AccountRepositoryImpl implements AccountRepository { + const AccountRepositoryImpl(this._remote); + + final AccountRemoteDatasource _remote; + + @override + Future> getLinkedDevices({required String userId}) { + return _remote.getLinkedDevices(userId: userId); + } +} diff --git a/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart b/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart new file mode 100644 index 00000000..9dc33f59 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart @@ -0,0 +1,5 @@ +import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; + +abstract class AccountRepository { + Future> getLinkedDevices({required String userId}); +} diff --git a/modules/legacy/modules/account/lib/src/core/providers/account_remote_datasource_provider.dart b/modules/legacy/modules/account/lib/src/core/providers/account_remote_datasource_provider.dart new file mode 100644 index 00000000..89277b0f --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/providers/account_remote_datasource_provider.dart @@ -0,0 +1,9 @@ +import 'package:account/src/core/data/datasource/account_remote_datasource.dart'; +import 'package:account/src/core/data/datasource/account_remote_datasource_impl.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +// import 'package:sf_infrastructure/sf_infrastructure.dart'; + +final accountRemoteDatasourceProvider = Provider((ref) { + // final questiaRepository = getIt(); + return AccountRemoteDatasourceImpl(/*questiaRepository*/); +}); diff --git a/modules/legacy/modules/account/lib/src/core/providers/account_repository_provider.dart b/modules/legacy/modules/account/lib/src/core/providers/account_repository_provider.dart new file mode 100644 index 00000000..c0d92797 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/providers/account_repository_provider.dart @@ -0,0 +1,9 @@ +import 'package:account/src/core/data/repositories/account_repository_impl.dart'; +import 'package:account/src/core/domain/repositories/account_repository.dart'; +import 'package:account/src/core/providers/account_remote_datasource_provider.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +final accountRepositoryProvider = Provider((ref) { + final remote = ref.read(accountRemoteDatasourceProvider); + return AccountRepositoryImpl(remote); +}); diff --git a/modules/legacy/modules/account/lib/src/features/account_settings/account_settings_builder.dart b/modules/legacy/modules/account/lib/src/features/account_settings/account_settings_builder.dart new file mode 100644 index 00000000..a3b68a78 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/account_settings/account_settings_builder.dart @@ -0,0 +1,18 @@ +import 'package:account/src/features/account_settings/presentation/account_settings_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 AccountSettingsBuilder { + const AccountSettingsBuilder(); + + Page buildPage(BuildContext context, GoRouterState state) { + final NavigationContract navigationContract = GetIt.I(); + + return MaterialPage( + key: state.pageKey, + child: AccountSettingsScreen(navigationContract: navigationContract), + ); + } +} diff --git a/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart b/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart new file mode 100644 index 00000000..8ea067b9 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart @@ -0,0 +1,149 @@ +import 'package:account/src/features/linked_devices/presentation/linked_devices_screen.dart'; +import 'package:design_system/design_system.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:navigation/navigation.dart'; +import 'package:sf_localizations/sf_localizations.dart'; +import 'package:utils/utils.dart'; + +class AccountSettingsScreen extends ConsumerWidget { + final NavigationContract navigationContract; + + const AccountSettingsScreen({super.key, required this.navigationContract}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.watch(themePortProvider); + + return Scaffold( + backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + body: SafeArea( + child: Column( + children: [ + Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) + ), + child: Stack( + children: [ + IconButton(onPressed: () {Navigator.pop(context);}, + icon: Icon(Icons.arrow_back)), + Center( + child: Text(context.translate(I18n.accountSettings), + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 28, big: 27) + ), + ) + ) + ], + ), + ), + SizedBox(height: SizeUtils.getByScreen(small: 30, big: 28)), + SingleChildScrollView(child: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) + ), + child: Column( + children: [ + AppSectionButton( + onPressed: (){}, + icon: SFIcons.account, + text: 'Personal Data' + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){}, + icon: Icons.add_circle_outline, + text: 'Add a new SaveFamily' + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){Navigator.push( + context, + MaterialPageRoute(builder: (_) => LinkedDevicesScreen(navigationContract: navigationContract)), + );}, + icon: Icons.account_circle_outlined, + text: 'Linked Devices' + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){}, + icon: Icons.groups_outlined, + text: 'App Users' + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){}, + icon: SFIcons.privacy, + text: 'User privacy policy' + ), + SizedBox(height: SizeUtils.getByScreen(small: 48, big: 47)), + PrimaryButton(text: 'Log out', color: Color(0xFF588EA5)) + ], + ), + )), + ], + ) + ), + ); + } +} + +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: 20), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 18) + ), + 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/legacy/modules/account/lib/src/features/linked_devices/domain/entities/device_entity.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/entities/device_entity.dart new file mode 100644 index 00000000..c34bd875 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/entities/device_entity.dart @@ -0,0 +1,12 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'device_entity.freezed.dart'; + +@freezed +abstract class DeviceEntity with _$DeviceEntity { + const factory DeviceEntity({ + required String identificator, + required String name, + required String number, + }) = _DeviceEntity; +} diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/domain/entities/device_entity.freezed.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/entities/device_entity.freezed.dart new file mode 100644 index 00000000..eed00822 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/entities/device_entity.freezed.dart @@ -0,0 +1,277 @@ +// 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 'device_entity.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$DeviceEntity { + + String get identificator; String get name; String get number; +/// Create a copy of DeviceEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceEntityCopyWith get copyWith => _$DeviceEntityCopyWithImpl(this as DeviceEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceEntity&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.name, name) || other.name == name)&&(identical(other.number, number) || other.number == number)); +} + + +@override +int get hashCode => Object.hash(runtimeType,identificator,name,number); + +@override +String toString() { + return 'DeviceEntity(identificator: $identificator, name: $name, number: $number)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceEntityCopyWith<$Res> { + factory $DeviceEntityCopyWith(DeviceEntity value, $Res Function(DeviceEntity) _then) = _$DeviceEntityCopyWithImpl; +@useResult +$Res call({ + String identificator, String name, String number +}); + + + + +} +/// @nodoc +class _$DeviceEntityCopyWithImpl<$Res> + implements $DeviceEntityCopyWith<$Res> { + _$DeviceEntityCopyWithImpl(this._self, this._then); + + final DeviceEntity _self; + final $Res Function(DeviceEntity) _then; + +/// Create a copy of DeviceEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? identificator = null,Object? name = null,Object? number = null,}) { + return _then(_self.copyWith( +identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable +as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,number: null == number ? _self.number : number // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceEntity]. +extension DeviceEntityPatterns on DeviceEntity { +/// 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( _DeviceEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceEntity() 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( _DeviceEntity value) $default,){ +final _that = this; +switch (_that) { +case _DeviceEntity(): +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( _DeviceEntity value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceEntity() 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 identificator, String name, String number)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceEntity() when $default != null: +return $default(_that.identificator,_that.name,_that.number);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 identificator, String name, String number) $default,) {final _that = this; +switch (_that) { +case _DeviceEntity(): +return $default(_that.identificator,_that.name,_that.number);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 identificator, String name, String number)? $default,) {final _that = this; +switch (_that) { +case _DeviceEntity() when $default != null: +return $default(_that.identificator,_that.name,_that.number);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DeviceEntity implements DeviceEntity { + const _DeviceEntity({required this.identificator, required this.name, required this.number}); + + +@override final String identificator; +@override final String name; +@override final String number; + +/// Create a copy of DeviceEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceEntityCopyWith<_DeviceEntity> get copyWith => __$DeviceEntityCopyWithImpl<_DeviceEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceEntity&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.name, name) || other.name == name)&&(identical(other.number, number) || other.number == number)); +} + + +@override +int get hashCode => Object.hash(runtimeType,identificator,name,number); + +@override +String toString() { + return 'DeviceEntity(identificator: $identificator, name: $name, number: $number)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceEntityCopyWith<$Res> implements $DeviceEntityCopyWith<$Res> { + factory _$DeviceEntityCopyWith(_DeviceEntity value, $Res Function(_DeviceEntity) _then) = __$DeviceEntityCopyWithImpl; +@override @useResult +$Res call({ + String identificator, String name, String number +}); + + + + +} +/// @nodoc +class __$DeviceEntityCopyWithImpl<$Res> + implements _$DeviceEntityCopyWith<$Res> { + __$DeviceEntityCopyWithImpl(this._self, this._then); + + final _DeviceEntity _self; + final $Res Function(_DeviceEntity) _then; + +/// Create a copy of DeviceEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? identificator = null,Object? name = null,Object? number = null,}) { + return _then(_DeviceEntity( +identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable +as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,number: null == number ? _self.number : number // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/domain/get_linked_devices_use_case.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/get_linked_devices_use_case.dart new file mode 100644 index 00000000..67f1d8d5 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/get_linked_devices_use_case.dart @@ -0,0 +1,5 @@ +import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; + +abstract class GetLinkedDevicesUseCase { + Future> getLinkedDevices({required String userId}); +} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/domain/get_linked_devices_use_case_impl.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/get_linked_devices_use_case_impl.dart new file mode 100644 index 00000000..5cabc76e --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/get_linked_devices_use_case_impl.dart @@ -0,0 +1,14 @@ +import 'package:account/src/core/domain/repositories/account_repository.dart'; +import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:account/src/features/linked_devices/domain/get_linked_devices_use_case.dart'; + +class GetLinkedDevicesUseCaseImpl implements GetLinkedDevicesUseCase { + GetLinkedDevicesUseCaseImpl(this._repository); + + final AccountRepository _repository; + + @override + Future> getLinkedDevices({required String userId}) { + return _repository.getLinkedDevices(userId: userId); + } +} diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart new file mode 100644 index 00000000..1eeaea61 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart @@ -0,0 +1,100 @@ +import 'package:account/src/features/linked_devices/state/linked_devices_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_svg/flutter_svg.dart'; +// import 'package:navigation/navigation.dart'; +import 'package:sf_localizations/sf_localizations.dart'; +import 'package:utils/utils.dart'; + +class EditLinkedDeviceScreen extends ConsumerWidget { + //final NavigationContract navigationContract; + final String deviceName; + + const EditLinkedDeviceScreen({super.key, required this.deviceName /*required this.navigationContract*/}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final vm = ref.read(linkedDevicesViewModelProvider.notifier); + // final state = ref.watch(linkedDevicesViewModelProvider); + + final theme = ref.watch(themePortProvider); + + return Scaffold( + backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + body: SafeArea( + child: Column( + children: [ + Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) + ), + child: Stack( + children: [ + IconButton(onPressed: () {Navigator.pop(context);}, + icon: Icon(Icons.arrow_back)), + Center( + child: Text(context.translate('Edit device'), + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 28, big: 27) + ), + ) + ) + ], + ), + ), + SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)), + Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Stack( + children: [ + Center(child: SvgPicture.asset('assets/images/ui/profile.svg')), + Center(child: SizedBox( + width: 160, + height: 160, + child: Align(alignment: Alignment.bottomRight, + child: IconButton( + onPressed: (){}, + icon: Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Color(0xFFCAC9C9) + ), + padding: EdgeInsets.all(8), + child: Icon( + Icons.edit_outlined, + color: Colors.white, + size: SizeUtils.getByScreen(small: 32, big: 30), + ), + ), + ) + ) + )) + ], + ), + CustomTextField( + controller: vm.deviceNameController, + hint: deviceName, + ) + ], + ), + PrimaryButton(text: 'Save', color: Color(0xFF588EA5)) + ], + ) + ), + ], + ) + ), + ); + } +} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart new file mode 100644 index 00000000..f6e8e2e3 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart @@ -0,0 +1,226 @@ +import 'package:account/src/features/linked_devices/presentation/edit_linked_device_screen.dart'; +import 'package:account/src/features/linked_devices/state/linked_devices_view_model.dart'; +import 'package:design_system/design_system.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:navigation/navigation.dart'; +import 'package:sf_localizations/sf_localizations.dart'; +import 'package:utils/utils.dart'; + +class LinkedDevicesScreen extends ConsumerWidget { + final NavigationContract navigationContract; + + const LinkedDevicesScreen({super.key, required this.navigationContract}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final vm = ref.read(linkedDevicesViewModelProvider.notifier); + final state = ref.watch(linkedDevicesViewModelProvider); + + final theme = ref.watch(themePortProvider); + + return Scaffold( + backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + body: SafeArea( + child: Column( + children: [ + Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) + ), + child: Stack( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + IconButton(onPressed: () {Navigator.pop(context);}, + icon: Icon(Icons.arrow_back)), + DecoratedBox( + decoration: BoxDecoration( + color: Color(0xFF588EA5), + shape: BoxShape.circle + ), + child: IconButton(onPressed: vm.toggleIsEditing, + icon: Icon(Icons.edit_outlined, + color: Colors.white, + size: SizeUtils.getByScreen(small: 30, big: 28), + ) + ), + ) + ], + ), + Center( + child: Text(context.translate('Linked Devices'), + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 28, big: 27) + ), + ) + ) + ], + ), + ), + SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)), + Expanded( child: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) + ), + child: ListView.separated( + itemBuilder: (BuildContext context, int index)=>LinkedDeviceCard( + name: state.linkedDevices[index].name, + body: state.linkedDevices[index].number, + isEditing: state.isEditing, + ), + separatorBuilder: (BuildContext context, int index)=>SizedBox( + height: SizeUtils.getByScreen(small: 18, big: 17) + ), + itemCount: state.linkedDevices.length + ), + )), + ], + ) + ), + ); + } +} + +class LinkedDeviceCard extends ConsumerWidget { + + final String name; + final String body; + final bool isEditing; + + const LinkedDeviceCard({ + required this.name, + required this.body, + required this.isEditing, + }); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.read(themePortProvider); + + return 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(SFIcons.watch, + size: SizeUtils.getByScreen(small: 40, big: 44), + color: Color(0xFF588EA5), + weight: 30, + ), + ), + SizedBox(width: SizeUtils.getByScreen(small: 16, big: 15)), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(name, + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 18, big: 19), + fontWeight: FontWeight.w500 + ) + ), + Text(body, + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 14, big: 13), + ) + ) + ], + ) + ), + if (isEditing) ...[ + DecoratedBox( + decoration: BoxDecoration( + color: Color(0xFFFF5D52), + borderRadius: BorderRadius.all(Radius.circular(12)), + ), + child: IconButton( + onPressed: (){showDialog(context: context, builder: (context)=>Dialog( + child: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 32, vertical: 30), + big: EdgeInsets.symmetric(horizontal: 30, vertical: 28) + ), + width: SizeUtils.getByScreen(small: 360, big: 350), + height: SizeUtils.getByScreen(small: 195, big: 185), + child: Column( + children: [ + Text('Are you sure you want to delete this device from the list?', + textAlign: TextAlign.center, + style: TextStyle(fontSize: SizeUtils.getByScreen(small: 19, big: 18)), + ), + SizedBox(height: SizeUtils.getByScreen(small: 28, big: 27)), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded(child: PrimaryButton( + onPressed: (){Navigator.pop(context);}, + text: 'Cancel', + color: Color(0xFF588EA5), + height: SizeUtils.getByScreen(small: 38, big: 36), + radius: SizeUtils.getByScreen(small: 32, big: 34), + )), + SizedBox(width: SizeUtils.getByScreen(small: 4, big: 16)), + Expanded(child: PrimaryButton( + onPressed: (){ + Navigator.pop(context); + }, + text: 'Delete', + color: Color(0xFF588EA5), + height: SizeUtils.getByScreen(small: 38, big: 36), + radius: SizeUtils.getByScreen(small: 32, big: 34), + )) + ], + ) + ], + ), + ), + ));}, + icon: Icon( + Icons.close, + color: Colors.white, + ), + ), + ), + SizedBox(width: SizeUtils.getByScreen(small: 16, big: 14)), + DecoratedBox( + decoration: BoxDecoration( + color: Color(0xFF588EA5), + borderRadius: BorderRadius.all(Radius.circular(12)), + ), + child: + IconButton( + onPressed: (){Navigator.push( + context, + MaterialPageRoute(builder: (_) => EditLinkedDeviceScreen( + deviceName: name, + /*navigationContract: navigationContract*/ + )), + );}, + icon: Icon( + Icons.edit_outlined, + color: Colors.white, + ), + ), + ), + ] + ], + ), + ); + } +} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/providers/get_linked_devices_use_case_provider.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/providers/get_linked_devices_use_case_provider.dart new file mode 100644 index 00000000..4a6b96db --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/providers/get_linked_devices_use_case_provider.dart @@ -0,0 +1,9 @@ +import 'package:account/src/core/providers/account_repository_provider.dart'; +import 'package:account/src/features/linked_devices/domain/get_linked_devices_use_case.dart'; +import 'package:account/src/features/linked_devices/domain/get_linked_devices_use_case_impl.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +final getLinkedDevicesUseCaseProvider = Provider.autoDispose((ref) { + final authRepository = ref.read(accountRepositoryProvider); + return GetLinkedDevicesUseCaseImpl(authRepository); +}); diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/state/linked_devices_view_model.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/state/linked_devices_view_model.dart new file mode 100644 index 00000000..423d1c1d --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/state/linked_devices_view_model.dart @@ -0,0 +1,56 @@ +import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:account/src/features/linked_devices/domain/get_linked_devices_use_case.dart'; +import 'package:account/src/features/linked_devices/presentation/providers/get_linked_devices_use_case_provider.dart'; +import 'package:account/src/features/linked_devices/state/linked_devices_view_state.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +// import 'package:sf_localizations/sf_localizations.dart'; + +final linkedDevicesViewModelProvider = +NotifierProvider.autoDispose( + LinkedDevicesViewModel.new, +); + +class LinkedDevicesViewModel extends Notifier { + late final GetLinkedDevicesUseCase _getLinkedDevicesUseCase; + + late final TextEditingController deviceNameController; + + @override + LinkedDevicesViewState build() { + _getLinkedDevicesUseCase = ref.read(getLinkedDevicesUseCaseProvider); + + deviceNameController = TextEditingController(); + deviceNameController.addListener(_onDeviceNameChanged); + + _getLinkedDevicesUseCase.getLinkedDevices(userId: 'test') + .then(setLinkedDevices); + + ref.onDispose(disposeControllers); + + return const LinkedDevicesViewState(); + } + + void setLinkedDevices(List linkedDevices) { + state = state.copyWith(linkedDevices: linkedDevices); + } + + void toggleIsEditing() { + state = state.copyWith(isEditing: !state.isEditing); + } + + void _onDeviceNameChanged() { + final value = deviceNameController.text; + + if (value == state.deviceName) return; + + state = state.copyWith( + deviceName: value, + ); + } + + void disposeControllers() { + deviceNameController.removeListener(_onDeviceNameChanged); + deviceNameController.dispose(); + } +} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/state/linked_devices_view_state.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/state/linked_devices_view_state.dart new file mode 100644 index 00000000..d381c926 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/state/linked_devices_view_state.dart @@ -0,0 +1,14 @@ +import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'linked_devices_view_state.freezed.dart'; + +@freezed +abstract class LinkedDevicesViewState with _$LinkedDevicesViewState { + const factory LinkedDevicesViewState({ + @Default(false) bool isLoading, + @Default([]) List linkedDevices, + @Default(false) bool isEditing, + @Default('') String deviceName + }) = _LinkedDevicesViewState; +} diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/state/linked_devices_view_state.freezed.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/state/linked_devices_view_state.freezed.dart new file mode 100644 index 00000000..df1cedc8 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/state/linked_devices_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 'linked_devices_view_state.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$LinkedDevicesViewState { + + bool get isLoading; List get linkedDevices; bool get isEditing; String get deviceName; +/// Create a copy of LinkedDevicesViewState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$LinkedDevicesViewStateCopyWith get copyWith => _$LinkedDevicesViewStateCopyWithImpl(this as LinkedDevicesViewState, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is LinkedDevicesViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&const DeepCollectionEquality().equals(other.linkedDevices, linkedDevices)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)); +} + + +@override +int get hashCode => Object.hash(runtimeType,isLoading,const DeepCollectionEquality().hash(linkedDevices),isEditing,deviceName); + +@override +String toString() { + return 'LinkedDevicesViewState(isLoading: $isLoading, linkedDevices: $linkedDevices, isEditing: $isEditing, deviceName: $deviceName)'; +} + + +} + +/// @nodoc +abstract mixin class $LinkedDevicesViewStateCopyWith<$Res> { + factory $LinkedDevicesViewStateCopyWith(LinkedDevicesViewState value, $Res Function(LinkedDevicesViewState) _then) = _$LinkedDevicesViewStateCopyWithImpl; +@useResult +$Res call({ + bool isLoading, List linkedDevices, bool isEditing, String deviceName +}); + + + + +} +/// @nodoc +class _$LinkedDevicesViewStateCopyWithImpl<$Res> + implements $LinkedDevicesViewStateCopyWith<$Res> { + _$LinkedDevicesViewStateCopyWithImpl(this._self, this._then); + + final LinkedDevicesViewState _self; + final $Res Function(LinkedDevicesViewState) _then; + +/// Create a copy of LinkedDevicesViewState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? linkedDevices = null,Object? isEditing = null,Object? deviceName = null,}) { + return _then(_self.copyWith( +isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable +as bool,linkedDevices: null == linkedDevices ? _self.linkedDevices : linkedDevices // ignore: cast_nullable_to_non_nullable +as List,isEditing: null == isEditing ? _self.isEditing : isEditing // ignore: cast_nullable_to_non_nullable +as bool,deviceName: null == deviceName ? _self.deviceName : deviceName // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [LinkedDevicesViewState]. +extension LinkedDevicesViewStatePatterns on LinkedDevicesViewState { +/// 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( _LinkedDevicesViewState value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _LinkedDevicesViewState() 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( _LinkedDevicesViewState value) $default,){ +final _that = this; +switch (_that) { +case _LinkedDevicesViewState(): +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( _LinkedDevicesViewState value)? $default,){ +final _that = this; +switch (_that) { +case _LinkedDevicesViewState() 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( bool isLoading, List linkedDevices, bool isEditing, String deviceName)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _LinkedDevicesViewState() when $default != null: +return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.deviceName);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( bool isLoading, List linkedDevices, bool isEditing, String deviceName) $default,) {final _that = this; +switch (_that) { +case _LinkedDevicesViewState(): +return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.deviceName);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( bool isLoading, List linkedDevices, bool isEditing, String deviceName)? $default,) {final _that = this; +switch (_that) { +case _LinkedDevicesViewState() when $default != null: +return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.deviceName);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _LinkedDevicesViewState implements LinkedDevicesViewState { + const _LinkedDevicesViewState({this.isLoading = false, final List linkedDevices = const [], this.isEditing = false, this.deviceName = ''}): _linkedDevices = linkedDevices; + + +@override@JsonKey() final bool isLoading; + final List _linkedDevices; +@override@JsonKey() List get linkedDevices { + if (_linkedDevices is EqualUnmodifiableListView) return _linkedDevices; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_linkedDevices); +} + +@override@JsonKey() final bool isEditing; +@override@JsonKey() final String deviceName; + +/// Create a copy of LinkedDevicesViewState +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$LinkedDevicesViewStateCopyWith<_LinkedDevicesViewState> get copyWith => __$LinkedDevicesViewStateCopyWithImpl<_LinkedDevicesViewState>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _LinkedDevicesViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&const DeepCollectionEquality().equals(other._linkedDevices, _linkedDevices)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)); +} + + +@override +int get hashCode => Object.hash(runtimeType,isLoading,const DeepCollectionEquality().hash(_linkedDevices),isEditing,deviceName); + +@override +String toString() { + return 'LinkedDevicesViewState(isLoading: $isLoading, linkedDevices: $linkedDevices, isEditing: $isEditing, deviceName: $deviceName)'; +} + + +} + +/// @nodoc +abstract mixin class _$LinkedDevicesViewStateCopyWith<$Res> implements $LinkedDevicesViewStateCopyWith<$Res> { + factory _$LinkedDevicesViewStateCopyWith(_LinkedDevicesViewState value, $Res Function(_LinkedDevicesViewState) _then) = __$LinkedDevicesViewStateCopyWithImpl; +@override @useResult +$Res call({ + bool isLoading, List linkedDevices, bool isEditing, String deviceName +}); + + + + +} +/// @nodoc +class __$LinkedDevicesViewStateCopyWithImpl<$Res> + implements _$LinkedDevicesViewStateCopyWith<$Res> { + __$LinkedDevicesViewStateCopyWithImpl(this._self, this._then); + + final _LinkedDevicesViewState _self; + final $Res Function(_LinkedDevicesViewState) _then; + +/// Create a copy of LinkedDevicesViewState +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? linkedDevices = null,Object? isEditing = null,Object? deviceName = null,}) { + return _then(_LinkedDevicesViewState( +isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable +as bool,linkedDevices: null == linkedDevices ? _self._linkedDevices : linkedDevices // ignore: cast_nullable_to_non_nullable +as List,isEditing: null == isEditing ? _self.isEditing : isEditing // ignore: cast_nullable_to_non_nullable +as bool,deviceName: null == deviceName ? _self.deviceName : deviceName // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/dashboard_shell/lib/legacy_dashboard_builder.dart b/modules/legacy/modules/dashboard_shell/lib/legacy_dashboard_builder.dart deleted file mode 100644 index b9f78bb0..00000000 --- a/modules/legacy/modules/dashboard_shell/lib/legacy_dashboard_builder.dart +++ /dev/null @@ -1 +0,0 @@ -// TODO Implement this library. \ No newline at end of file diff --git a/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart b/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart index 47eb7af8..a5d7fd2d 100644 --- a/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart @@ -66,7 +66,7 @@ class HubScreen extends ConsumerWidget { text: I18n.functions), SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), AppSectionButton( - onPressed: (){}, + onPressed: (){navigationContract.pushTo(AppRoutes.accountSettings);}, icon: Icons.manage_accounts_outlined, text: I18n.accountSettings), SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), diff --git a/packages/design_system/lib/fonts/config.json b/packages/design_system/fonts/config.json old mode 100755 new mode 100644 similarity index 70% rename from packages/design_system/lib/fonts/config.json rename to packages/design_system/fonts/config.json index d22f8855..b2d52b8e --- a/packages/design_system/lib/fonts/config.json +++ b/packages/design_system/fonts/config.json @@ -823,6 +823,146 @@ "search": [ "lightbulb_outline" ] + }, + { + "uid": "0dcd448b171d3680fd792b4df0193724", + "css": "google", + "code": 59428, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M978.7 511.2C978.7 478.3 975.8 447.1 970.8 416.7H500V604.6H769.6C757.5 666.3 722.1 718.3 669.6 753.8V878.8H830.4C924.6 791.7 978.7 663.3 978.7 511.2ZM500 1000C635 1000 747.9 955 830.4 878.7L669.6 753.7C624.6 783.7 567.5 802 500 802 369.6 802 259.2 714.1 219.6 595.4H53.8V724.1C135.8 887.5 304.6 1000 500 1000ZM219.6 595.4C209.2 565.4 203.7 533.3 203.7 500 203.7 466.6 209.6 434.5 219.6 404.5V275.8H53.8C19.6 343.3 0 419.1 0 500 0 580.8 19.6 656.6 53.8 724.1L219.6 595.4ZM500 197.9C573.8 197.9 639.6 223.3 691.7 272.9L834.2 130.4C747.9 49.6 635 0 500 0 304.6 0 135.8 112.5 53.8 275.8L219.6 404.6C259.2 285.8 369.6 197.9 500 197.9Z", + "width": 1000 + }, + "search": [ + "google" + ] + }, + { + "uid": "6ac666884c15a883fc9c665312247abd", + "css": "premium", + "code": 59429, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M199.9 949.6H899.9M528 62.9C530.1 59 533.3 55.8 537.2 53.5 541 51.2 545.4 50 549.9 50 554.4 50 558.7 51.2 562.6 53.5 566.4 55.8 569.6 59 571.8 62.9L719.4 343.1C722.9 349.6 727.8 355.3 733.8 359.6 739.7 364 746.6 367 753.8 368.4 761 369.8 768.5 369.6 775.7 367.8 782.8 365.9 789.5 362.5 795.2 357.8L1009 174.6C1013.1 171.3 1018.2 169.4 1023.5 169.1 1028.8 168.8 1034 170.2 1038.4 173.1 1042.9 176 1046.3 180.2 1048.2 185.1 1050 190.1 1050.3 195.5 1048.9 200.6L907.2 712.9C904.3 723.4 898.1 732.6 889.5 739.3 880.9 745.9 870.3 749.5 859.4 749.6H240.4C229.5 749.5 218.9 745.9 210.3 739.3 201.7 732.6 195.4 723.4 192.5 712.9L50.9 200.6C49.5 195.5 49.8 190.1 51.6 185.2 53.5 180.2 56.9 176 61.4 173.1 65.8 170.2 71 168.8 76.3 169.1 81.6 169.4 86.7 171.4 90.8 174.7L304.6 357.9C310.3 362.6 316.9 366 324.1 367.8 331.2 369.6 338.7 369.8 345.9 368.4 353.2 367 360 364 366 359.7 371.9 355.3 376.9 349.7 380.4 343.2L528 62.9Z", + "width": 1100 + }, + "search": [ + "premium" + ] + }, + { + "uid": "317b5cb7bb65710ceda02e12965b8544", + "css": "savings", + "code": 59430, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M210.5 473.7C210.5 389.9 243.8 309.6 303 250.4 362.2 191.2 442.6 157.9 526.3 157.9H710.5L726.3 136.8C745.9 110.7 771.4 89.5 800.6 74.9 829.8 60.2 862.1 52.6 894.7 52.6V210.5C927.4 235 953.9 266.8 972.2 303.4 990.5 339.9 1000 380.2 1000 421.1H1052.6C1066.6 421.1 1080 426.6 1089.8 436.5 1099.7 446.3 1105.3 459.7 1105.3 473.7V578.9C1105.3 592.9 1099.7 606.3 1089.8 616.2 1080 626 1066.6 631.6 1052.6 631.6H1000C991.8 656.1 978.1 678.4 959.8 696.6 941.5 714.9 919.3 728.7 894.7 736.8V894.7C894.7 908.7 889.2 922.1 879.3 932 869.5 941.8 856.1 947.4 842.1 947.4H736.8C722.9 947.4 709.5 941.8 699.6 932 689.8 922.1 684.2 908.7 684.2 894.7V789.5H526.3V894.7C526.3 908.7 520.8 922.1 510.9 932 501 941.8 487.6 947.4 473.7 947.4H368.4C354.5 947.4 341.1 941.8 331.2 932 321.3 922.1 315.8 908.7 315.8 894.7V736.8C283.1 712.3 256.6 680.5 238.3 644 220 607.5 210.5 567.2 210.5 526.3V473.7ZM210.5 473.7H157.9C130 473.7 103.2 462.6 83.5 442.9 63.7 423.1 52.6 396.3 52.6 368.4V315.8M789.5 421.1H790", + "width": 1158 + }, + "search": [ + "savings" + ] + }, + { + "uid": "095ac9512167f24af81f73fc96862636", + "css": "functions", + "code": 59431, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M720.1 7.5C684.2 9.9 649.4 20.2 618 37.6V37.2H222C165.1 37.2 110.5 59.8 70.2 100.1 30 140.4 7.4 195.1 7.4 252 7.4 309 30 363.6 70.2 403.9 110.5 444.2 165.1 466.8 222 466.8H618V466.5C654.1 486.5 694.7 497.1 736 497.1 773.6 497.1 810.7 488.5 844.5 471.9 878.2 455.3 907.7 431.2 930.6 401.3 953.5 371.5 969.2 336.8 976.6 299.9 983.9 263 982.7 224.9 973 188.5 963.2 152.2 945.3 118.6 920.4 90.3 895.6 62 864.6 39.9 829.9 25.5 795.1 11.1 757.6 5 720.1 7.5ZM736 73.4C759.5 73.4 782.7 78 804.3 86.9 826 95.9 845.7 109.1 862.2 125.7 891.4 154.9 909.6 193.4 913.7 234.5 917.7 275.6 907.4 316.9 884.4 351.3 861.5 385.6 827.4 410.9 787.9 422.9 748.4 434.9 705.9 432.9 667.7 417.1 629.6 401.2 598.1 372.7 578.6 336.2 559.2 299.8 552.9 257.7 561 217.2 569 176.6 590.9 140.1 622.8 113.9 654.7 87.7 694.7 73.4 736 73.4ZM541.4 103.6C509 146.2 491.3 198.3 491.3 252 491.3 305.7 509 357.8 541.4 400.4H222C182.7 400.4 144.9 384.8 117.1 356.9 89.3 329.1 73.7 291.4 73.7 252 73.7 212.7 89.3 174.9 117.1 147.1 144.9 119.3 182.7 103.6 222 103.6H541.4ZM252.2 491.2C214.6 491.2 177.5 499.7 143.8 516.3 110 532.9 80.6 557.1 57.7 586.9 34.7 616.7 19 651.4 11.6 688.3 4.3 725.2 5.6 763.4 15.3 799.7 25 836 43 869.6 67.8 897.9 92.6 926.2 123.6 948.4 158.3 962.7 193.1 977.1 230.7 983.3 268.2 980.7 304 978.3 338.8 968 370.2 950.6V951H766.3C823.2 951 877.8 928.4 918 888.1 958.2 847.8 980.8 793.2 980.9 736.2 980.9 679.3 958.3 624.6 918 584.4 877.8 544.1 823.2 521.4 766.3 521.4H370.2V521.8C334.1 501.7 293.5 491.2 252.2 491.2H252.2ZM200.4 565.3C239.9 553.3 282.3 555.4 320.5 571.2 358.6 587 390.1 615.6 409.6 652 429.1 688.5 435.3 730.5 427.3 771.1 419.2 811.6 397.4 848.1 365.4 874.3 333.5 900.5 293.5 914.9 252.2 914.9 228.8 914.9 205.5 910.3 183.9 901.3 162.2 892.3 142.6 879.2 126 862.6 96.8 833.3 78.6 794.9 74.6 753.8 70.5 712.6 80.8 671.3 103.8 637 126.7 602.6 160.9 577.3 200.4 565.3ZM766.3 587.9C805.6 587.9 843.3 603.5 871.1 631.3 898.9 659.1 914.5 696.9 914.5 736.2 914.5 775.6 898.9 813.3 871.1 841.2 843.3 869 805.6 884.6 766.3 884.6H446.8C479.3 842 496.9 789.9 496.9 736.2 496.9 682.6 479.3 630.5 446.9 587.9H766.3Z", + "width": 1000 + }, + "search": [ + "functions" + ] + }, + { + "uid": "03dbb1571e217dd409e469aa106381ae", + "css": "payments", + "code": 59454, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M439.5 249.1C503.9 249.1 556.2 196.9 556.2 132.5 556.2 68 503.9 15.8 439.5 15.8 375 15.8 322.8 68 322.8 132.5 322.8 196.9 375 249.1 439.5 249.1ZM835.4 508.7C827.9 506.4 820.2 509.3 816.2 516 805.4 533.9 790.2 544.2 775.9 550.5 734.8 432.3 620.8 343.8 438.1 343.8 366.7 343.8 305.9 357.4 255.8 380.8 218.1 361.4 156.2 340.9 89.6 365.2 88.5 365.7 87.6 366.7 87.5 367.9 87.4 368.9 80.6 436.5 125.5 496.6 108 525.7 95.9 557.8 89.2 591.6L46.9 603.1C24.5 609.2 11.2 632.5 17.3 654.9L47.2 765.1C56.3 798.5 77.2 811.5 124.6 809.3H132.6C146.6 829.4 163.4 848 182.3 864.8L195.7 955.8C195.7 966.5 204.4 975.2 215.1 975.2H274.6C285.4 975.2 294.1 966.5 294.1 955.8L297.5 932.6C340.6 948.4 388.1 957.2 438.1 957.2 493.4 957.2 545.8 946.4 592.5 927.2L596.7 955.8C596.7 966.5 605.4 975.2 616.2 975.2H675.6C686.4 975.2 695.1 966.5 695.1 955.8L710.8 848.7C762.2 796.3 793.2 729 793.2 655.4 793.2 650.9 793.1 646.4 792.9 641.9 835.3 610.8 845.2 557.6 847.1 525.7 847.6 517.8 842.9 511 835.4 508.7ZM210.6 605.9C222.4 605.9 232 596.3 232 584.5 232 572.6 222.4 563.1 210.6 563.1 198.7 563.1 189.1 572.6 189.1 584.5 189.1 596.3 198.7 605.9 210.6 605.9ZM540.8 430C435.4 394.3 340.1 429.4 339.1 429.8L328.7 402.2C333 400.6 435 363.1 550.2 402L540.8 430V430Z", + "width": 867 + }, + "search": [ + "payments" + ] + }, + { + "uid": "0cd6b0a1d54c522228c928049c4c355b", + "css": "customer-service", + "code": 59455, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M600 19.5C852 19.5 1057.1 224.2 1057.1 475.8V684.9H1107.9C1112.6 684.9 1117.1 683.1 1120.4 679.8 1123.7 676.5 1125.5 672 1125.5 667.4V520.8C1125.5 516.1 1123.6 511.7 1120.4 508.4 1117.1 505.1 1112.6 503.2 1107.9 503.2H1095.2C1088 503.2 1081 500.4 1075.8 495.2 1070.6 490.1 1067.7 483.1 1067.7 475.8 1067.7 468.5 1070.6 461.5 1075.8 456.4 1081 451.2 1088 448.3 1095.2 448.3H1108L1115.1 448.7C1131.7 450.3 1147.4 457.7 1159.3 469.5 1172.9 483.1 1180.5 501.5 1180.6 520.8V667.4C1180.5 686.6 1172.9 705 1159.3 718.6 1145.7 732.2 1127.2 739.8 1108 739.8H1054.2C1040.8 829 964.4 897.9 871.3 897.9H771.1C766.1 914.9 755.9 930 741.8 940.8 728.9 950.7 713.5 956.7 697.4 958L690.5 958.3H545.2C522.8 958.3 501.4 949.4 485.5 933.6 469.7 917.8 460.8 896.3 460.7 874V866.8C460.8 844.4 469.7 823 485.5 807.2 501.4 791.3 522.8 782.5 545.2 782.4H690.5L697.4 782.7C713.5 784.1 728.9 790.1 741.8 799.9 755.9 810.8 766.1 825.9 771.1 842.9H871.3L877.8 842.7C910.1 841.1 940.7 827.6 963.7 804.6 988.2 780.2 1002 747 1002.1 712.4V475.8C1002.1 254.5 821.7 74.4 600 74.4 378.3 74.4 197.9 254.5 197.9 475.8V712.4C197.9 716 197.2 719.6 195.8 722.9 194.4 726.2 192.4 729.3 189.8 731.8 187.3 734.4 184.2 736.4 180.9 737.8 177.6 739.2 174 739.9 170.4 739.9H92C72.8 739.8 54.3 732.2 40.7 718.6 27.1 705 19.5 686.6 19.4 667.4V520.8C19.5 501.6 27.1 483.1 40.7 469.5 54.3 456 72.8 448.3 92 448.3H103.5C110.8 448.3 117.8 451.2 123 456.4 128.1 461.5 131 468.5 131 475.8 131 483.1 128.2 490.1 123 495.2 117.8 500.4 110.8 503.2 103.5 503.2H92C87.4 503.2 82.9 505.1 79.6 508.4 76.3 511.7 74.5 516.1 74.5 520.8V667.4C74.5 672 76.3 676.5 79.6 679.8 82.9 683.1 87.4 684.9 92 684.9H142.9V475.8C142.9 224.2 347.9 19.5 600 19.5ZM545.2 837.4C537.4 837.4 529.9 840.5 524.4 846 518.9 851.5 515.8 859 515.8 866.8V874C515.8 881.8 518.9 889.3 524.4 894.8 529.9 900.3 537.4 903.4 545.2 903.4H690.5C698.3 903.4 705.8 900.3 711.3 894.8 716.9 889.3 720 881.8 720 874V866.8C720 859 716.9 851.5 711.3 846 705.8 840.5 698.3 837.4 690.5 837.4H545.2ZM540.2 238.7C564.5 227.3 591.5 223.1 618.1 226.5 644.7 229.9 669.8 240.9 690.4 258.1 711 275.2 726.3 297.9 734.4 323.4 742.6 348.9 743.3 376.2 736.4 402.1 729.6 428 715.5 451.4 695.8 469.6 676.7 487.3 653 499.2 627.5 504.3V591.4C627.5 598.7 624.6 605.7 619.5 610.8 614.3 616 607.3 618.8 600 618.8 592.7 618.8 585.7 616 580.6 610.8 575.4 605.7 572.5 598.7 572.5 591.4V479.7C572.5 476.1 573.2 472.5 574.5 469.1 575.9 465.8 578 462.7 580.5 460.2 583.1 457.6 586.1 455.6 589.4 454.2 592.8 452.8 596.4 452.1 600 452.1 617 452.1 633.6 447.1 647.8 437.6 661.9 428.2 673 414.8 679.5 399.1 686 383.4 687.7 366.2 684.4 349.5 681.1 332.9 672.9 317.6 660.9 305.6 648.8 293.6 633.5 285.4 616.8 282.1 600.2 278.8 582.9 280.5 567.1 286.9 551.4 293.4 538 304.4 528.5 318.6 519.1 332.7 514 349.3 514 366.2L514.4 374.4V374.4C515.1 381.6 512.9 388.9 508.2 394.5 503.6 400.1 496.9 403.7 489.6 404.4H489.6C482.4 405 475.2 402.7 469.6 398.1 464 393.5 460.4 386.9 459.6 379.7L459.5 379.6C459.2 375.3 459 370.8 459 366.3 458.9 339.5 466.6 313.3 481 290.7 495.3 268.1 515.9 250 540.2 238.7ZM600 652.1C607.5 652.1 614.8 654.3 621 658.5 627.2 662.6 632 668.5 634.9 675.4 637.8 682.3 638.5 689.9 637.1 697.2 635.6 704.6 632 711.3 626.7 716.6 621.4 721.8 614.7 725.4 607.4 726.9 600 728.3 592.4 727.6 585.5 724.7 578.6 721.9 572.7 717.1 568.6 710.9 564.4 704.6 562.2 697.3 562.2 689.9 562.2 679.8 566.2 670.2 573.2 663.2 580.3 656.1 590 652.1 600 652.1Z", + "width": 1222 + }, + "search": [ + "customer-service" + ] + }, + { + "uid": "e026d4c23a49f4ee571d54a288da9671", + "css": "account", + "code": 59456, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M1001.2 782.8C978.1 723.1 944.7 669.4 900.8 621.7 888.6 608.4 875.4 596 861.7 584 859.8 581.7 857.5 579 855.1 576.7 819.7 546.8 781.1 522 738.7 502.8 731.1 499.5 724.1 496.3 716.5 493.1 715.6 492.7 715.1 492.7 714.2 492.2 702.4 487.1 690.6 482.6 678.3 477.5 742 427.5 779.7 363.6 785.3 283.7 791 203.9 764.1 134.5 706.6 78.1 653.8 26.6 586.4 0.9 519 0 517.1 0 515.7 0 513.8 0 511.9 0 510.5 0 508.6 0 441.2 0.9 373.8 26.6 321 78.1 263 134.5 236.6 203.4 242.3 283.7 248 363.6 285.7 427.5 349.3 477.5 337 482.6 325.3 487.1 313.5 492.2 312.5 492.7 312.1 492.7 311.1 493.1 303.6 496.3 296 499.1 289 502.8 246.5 522 207.9 546.8 172.5 576.7 169.7 579 167.8 581.3 165.9 584 152.3 596 139.5 608.4 126.8 621.7 83 669 49.5 722.7 26.4 782.8 13.7 815.4 4.2 848.5 0 883.4 0 883.8 0 884.3 0 884.8 1.9 893.9 2.8 903.6 5.7 912.3 20.7 965.6 66.9 1000 124.4 1000 201.3 1000 277.6 1000 354.5 1000 376.6 1000 394.6 982.6 394.6 961 394.6 939.4 376.6 921.9 354.5 921.9 278.6 921.9 202.7 921.9 126.8 921.9 94.3 921.9 75.4 897.2 84.4 866.9 93.3 837 102.3 806.7 115.5 778.7 154.6 696.1 216.4 632.7 297.4 587.7 331.4 568.9 366.3 555.1 402.1 545.9 402.6 545.9 403 545.5 403.5 545.5 408.7 544.1 413.9 542.7 419.1 541.8 424.3 540.9 429.4 539.5 435.1 538.6 437.5 538.1 439.3 538.1 441.7 537.6 446.4 536.7 451.1 536.3 455.8 535.8 457.2 535.8 458.7 535.4 460.1 535.4 467.1 534.4 473.7 534 480.8 533.5 491.7 532.6 502 532.6 512.9 532.1 513.3 532.1 513.8 532.1 514.3 532.1 514.8 532.1 515.2 532.1 515.7 532.1 526.1 532.1 536.9 532.6 547.8 533.5 554.8 534 561.4 534.9 568.5 535.4 569.9 535.4 571.3 535.8 572.7 535.8 577.5 536.3 582.2 537.2 586.9 537.6 589.2 538.1 591.1 538.1 593.5 538.6 598.7 539.5 604.3 540.4 609.5 541.8 614.7 542.7 619.9 544.1 625.1 545.5 625.5 545.5 626 545.9 626.5 545.9 662.3 555.1 697.2 569.3 731.1 587.7 812.2 632.7 874 696.1 913.1 778.7 926.3 806.7 935.2 837 944.2 866.9 953.1 897.2 934.3 921.9 901.8 921.9 825.9 921.9 278.6 921.9 202.7 921.9 180.5 921.9 162.6 939.4 162.6 961 162.6 982.6 180.5 1000 202.7 1000 279.5 1000 827.3 1000 904.1 1000 961.2 1000 1007.4 965.6 1022.9 912.3 1025.3 903.1 1026.7 893.9 1028.6 884.8 1028.6 884.3 1028.6 883.8 1028.6 883.4 1023.9 848.5 1014 815.4 1001.2 782.8ZM513.8 453.2C407.8 453.2 322 369.6 322 266.3 322 169.4 398.3 89.1 495 79.9 496.4 79.9 497.3 79.9 498.7 79.9 503.9 79.4 508.6 79 513.8 79 519 79 524.2 79.4 528.9 79.9 530.3 79.9 531.3 79.9 532.7 79.9 629.3 89.5 706.1 169.9 705.7 266.3 705.7 369.1 619.9 452.7 513.8 453.2Z", + "width": 1048 + }, + "search": [ + "icon" + ] + }, + { + "uid": "e2919df04c54615e3a7b3e87982ab49b", + "css": "privacy", + "code": 59457, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M862.1 232.5C861.8 216 849.7 202 833.4 199.4 752.9 186.2 688.8 117.4 690.6 34.3 690.7 15.6 675.1 0 656.4 0H205.9C187.2 0 171.7 15.6 171.8 34.3 173.6 117.5 109.4 186.2 28.8 199.4 12.6 202.1 0.6 215.9 0.3 232.3-6.6 529.2 107.7 860.5 398 989.3 419.6 998.9 445.2 997.8 466 986.5 488.6 974.1 530 949.1 577.6 908.8 620.8 964.3 688.3 1000 764.1 1000 894.2 1000 1000 894.6 1000 765 1000 655.1 923.9 562.5 821.4 537 850.4 443.1 864.1 340.9 862.1 232.5 864.1 340.9 861.8 216 862.1 232.5 864.1 340.9 861.8 216 862.1 232.5 864.1 340.9 861.8 216 862.1 232.5 864.1 340.9 861.8 216 862.1 232.5 864.1 340.9 861.8 216 862.1 232.5 864.1 340.9 861.8 216 862.1 232.5ZM433.2 926.4C430.9 927.7 428.2 927.9 425.7 926.8 169.9 813.3 67.9 521.8 68.3 260.5 156.5 235.2 225.7 160.2 238.1 68.4H624.2C636.7 160 705.8 235.1 793.9 260.5 793.2 356.8 779 447.3 751.7 530.2 719.2 531.9 688.4 540.2 660.6 553.7 646.7 489.3 607 433.5 551 399.3 574.3 371 588.4 334.8 588.4 295.4 588.4 205.3 514.9 131.9 424.7 131.9 334.5 131.9 261 205.3 261 295.4 261 334.8 275.1 371 298.4 399.3 227.8 442.4 183.2 519.5 183.2 605.2V671.5C183.2 690.4 198.6 705.7 217.4 705.7H535.7C523.5 752.4 526.2 802.9 543.4 848.1 496.2 889.5 455 914.6 433.2 926.4 455 914.6 430.9 927.7 433.2 926.4 455 914.6 430.9 927.7 433.2 926.4 455 914.6 430.9 927.7 433.2 926.4 455 914.6 430.9 927.7 433.2 926.4ZM566.1 637.3H251.6V605.2C251.6 534.3 294.3 471.5 359 445.1 400.5 463.4 448.9 463.4 490.4 445.1 553.1 470.7 595 530.4 597.6 598.5 585.8 610.3 575.2 623.3 566.1 637.3ZM424.7 390.5C372.2 390.5 329.4 347.9 329.4 295.4 329.4 243 372.2 200.3 424.7 200.3 477.2 200.3 520 243 520 295.4 520 347.9 477.2 390.5 424.7 390.5ZM764.1 931.6C671.7 931.6 596.5 856.9 596.5 765 596.5 673.1 671.7 598.3 764.1 598.3 856.4 598.3 931.6 673.1 931.6 765 931.6 856.9 856.5 931.6 764.1 931.6ZM841.2 665.7L729.8 778.6 690 732.6 638.3 777.3 702.3 851.3C721.1 869.6 746 859.5 752.5 853L889.8 713.7 841.2 665.7Z", + "width": 1000 + }, + "search": [ + "icon" + ] + }, + { + "uid": "5bf1ba3d4c9ac4d42afa0f14244ce7cb", + "css": "watch", + "code": 59459, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M561.4 314C559.5 281.9 546.9 251.5 525.5 227.5 504.2 203.6 475.5 187.5 444 182L424.1 55C418.1 18 398.2 0 368.3 0L195.1 0C165.2 0 144.3 20 138.4 55L118.5 182C51.8 194 0 252 0 323.1L0 677C0 748 50.8 806 118.5 818.1L138.4 945C145.3 981 165.2 1000 195.1 1000H368.3C398.2 1000 419.1 980 425.1 945L445 818C511.7 806 563.5 748 563.5 676.9L563.5 458 561.4 314ZM167.2 60C171.2 40 180.2 30 195.1 30L368.3 30C378.3 30 390.2 32 396.2 60L415.1 180 149.3 180 167.2 60ZM395.2 940C391.2 960 382.2 970 367.3 970H195.1C185.2 970 173.2 968 167.2 940L148.3 820H413.2L395.2 940ZM532.6 466L532.6 677C532.4 706.9 520.5 735.6 499.5 756.8 478.4 777.9 449.9 789.9 420.1 790H142.3C112.6 789.9 84 777.9 63 756.8 41.9 735.6 30 706.9 29.9 677L29.9 323C30 293.1 41.9 264.4 63 243.2 84 222.1 112.6 210.1 142.3 210L420.1 210C476.8 210 523.6 252 531.6 308L532.6 466ZM430 256L133.4 256C126.8 256 120.3 257.2 114.3 259.7 108.2 262.2 102.7 265.9 98.1 270.5 93.4 275.2 89.8 280.7 87.3 286.8 84.8 292.9 83.6 299.4 83.6 306L83.6 692C83.6 698.6 84.8 705.1 87.3 711.2 89.8 717.3 93.4 722.9 98.1 727.5 102.7 732.2 108.2 735.9 114.3 738.3 120.3 740.8 126.8 742.1 133.4 742H431C437.6 742.1 444.1 740.8 450.1 738.3 456.2 735.9 461.7 732.2 466.4 727.5 471 722.9 474.7 717.3 477.1 711.2 479.6 705.1 480.9 698.6 480.8 692L480.8 306C479.8 278 457.9 256 430 256ZM459.5 691C459.5 710 448.9 720.7 430 720.7H133.4C114.5 720.7 103.9 709.9 103.9 691L103.9 306C103.9 287 114.5 276.4 133.4 276.4L431 276.4C449.9 276.4 460.5 287.1 460.5 306L459.5 691Z", + "width": 563 + }, + "search": [ + "icon" + ] + }, + { + "uid": "1be2cce207fff03b21837256fabe7460", + "css": "handshake", + "code": 59460, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M972.4 732.3L837 626.1C841.3 618.5 844.1 610.1 844.9 601.2 846.5 584.1 840.8 567.5 828.9 554.5 820.2 544.9 808.9 538 796.3 534.5 815.1 511.1 814.9 477.9 793.8 454.7 784.6 444.6 772.6 437.5 759.1 434.2 774.2 411.3 772.6 381 753 359.3 742.1 347.4 727.1 339.7 710.5 337.4 718.1 316.7 714.3 293 698 275.1 686.2 262.1 669.5 254.1 651.1 252.7 632.6 251.1 614.8 256.5 600.7 267.5L598.2 269.5 520.6 235.8C479.9 216.3 444.4 231.7 427.2 255.5 421.5 263.5 418 272.1 416.1 280.7L399.2 267.4C370.1 244.6 326.5 248.1 301.9 275.1 285.7 292.9 281.9 316.7 289.5 337.4 272.9 339.7 257.9 347.3 247 359.3 235.2 372.4 229.5 389 231 406.1 232 416.2 235.3 425.8 240.9 434.2 227.8 437.4 215.6 444.3 206.2 454.6 185.1 477.9 184.9 511.1 203.7 534.5 191.4 537.9 180 544.6 171.1 554.4 152.3 575 150.1 603.5 163.1 626L27.7 732.3C20.6 737.8 19.7 747.5 25.7 754 28.9 757.7 33.6 759.5 38.4 759.5 42.2 759.5 46 758.4 49.1 755.9L185.1 649.3 239.6 692C252.1 701.8 267.7 707.1 283.9 707.1 285.9 707.1 287.9 707 289.9 706.9 308.3 705.4 324.9 697.4 336.7 684.4 348.6 671.4 354.3 654.8 352.8 637.7 351.9 628.6 349 620.1 344.5 612.4 358.3 609.3 371.2 602.5 380.9 591.7 394.4 576.8 399.1 558 395.9 540.1H396C415.4 540.1 434.5 532.7 447.6 518.3 459.8 506.9 466.1 491.4 465.3 474.6 465.3 474 465.1 473.5 465.1 473 467.8 473.3 470.5 473.7 473.3 473.7 475.2 473.7 477.3 473.6 479.3 473.4 497.7 472 514.3 464 525.2 451.9 537.4 440.6 543.8 425.1 543.1 408.3 542.4 393 535.7 378.7 524.9 367.4L622.2 291.1C629.4 285.4 638.6 282.6 648.3 283.5 657.8 284.2 666.4 288.4 672.6 295.1 685.3 309.1 683.3 330.1 668.3 341.9L655.7 351.8 655.7 351.8C648.7 357.3 647.8 367.1 653.7 373.6 659.7 380.1 670.1 380.9 677.2 375.4L677.2 375.3C684.5 369.7 693.7 367 703.1 367.7 712.7 368.5 721.4 372.6 727.5 379.3 740.2 393.3 738.3 414.3 723.2 426.1L696.5 447.1C696.5 447.1 696.5 447.1 696.5 447.1 689.5 452.6 688.6 462.4 694.5 468.9 700.5 475.4 711 476.2 718 470.7H718C725.3 465 734.7 462.3 744 463 753.6 463.8 762.2 467.9 768.3 474.6 781 488.6 779.1 509.6 764 521.4L731.7 546.8 731.6 546.8C724.6 552.3 723.7 562.1 729.6 568.6 735.6 575.1 746.1 576 753.1 570.4L753.1 570.4C760.4 564.7 769.5 562.1 779.1 562.8 788.7 563.5 797.3 567.7 803.4 574.4 809.6 581.2 812.5 589.8 811.7 598.6 810.9 607.5 806.4 615.5 799.2 621.2L648 739.8C586.4 788.1 535.5 783 459 768.9 454 767.9 448.9 769.2 445 772.3L217.4 950.7C210.4 956.2 209.5 965.9 215.5 972.5 218.8 976.1 223.4 978 228.2 978 232 978 235.8 976.8 238.9 974.3L460.4 800.6C492 806.2 520.9 810.2 548.8 809.2L761.2 974.4C764.4 976.8 768.1 978 771.9 978 776.7 978 781.4 976.1 784.7 972.4 790.6 965.9 789.7 956.1 782.6 950.7L592.7 803.1C617.9 796.4 643.1 784.1 669.5 763.4L815 649.3 950.9 755.9C954 758.3 957.8 759.5 961.6 759.5 966.4 759.5 971 757.7 974.4 754.1 980.3 747.5 979.4 737.8 972.4 732.3ZM456.6 312.4C444 302.6 446.3 284.6 454.9 272.7 459.1 266.8 475.3 248.8 505.9 263.5L570.2 291.4 500 346.5 456.8 312.6 456.7 312.5C456.6 312.5 456.7 312.4 456.6 312.4ZM311.3 664.4C305.2 671.2 296.6 675.3 287.1 676 277.5 676.8 268.3 674 261 668.4L200.8 621.2C185.7 609.3 183.8 588.3 196.5 574.4 209.2 560.5 231.5 558.6 246.6 570.2L307.2 617.6C314.4 623.3 318.8 631.3 319.6 640.2 320.4 649.1 317.5 657.7 311.3 664.4ZM355.5 571.7C342.8 585.7 320.2 587.5 305.2 575.7L268.4 546.9C268.4 546.9 268.3 546.8 268.3 546.8L268.3 546.8 235.9 521.4C220.9 509.6 219 488.6 231.6 474.6 237.8 467.9 246.4 463.7 256 463 265.5 462.3 274.8 465 282 470.7L282 470.7C282.1 470.7 282.1 470.7 282.2 470.8L351.2 524.9C366.3 536.7 368.2 557.7 355.5 571.7ZM423.1 497.4C410.4 511.3 387.8 513.1 372.7 501.3L303.3 446.9C303.3 446.8 303.3 446.8 303.2 446.8L276.7 426.1C269.5 420.4 265.1 412.4 264.2 403.5 263.4 394.6 266.4 386 272.5 379.3 278.6 372.5 287.2 368.4 296.8 367.7 306.2 366.9 315.5 369.6 322.7 375.2L322.9 375.3 418.8 450.5C426.8 456.8 431.7 466.2 432.2 475.8 432.5 483.9 429.7 491.2 423.1 497.4ZM500.8 431C494.7 437.7 486.1 441.8 476.5 442.6 466.9 443.4 457.7 440.6 450.5 435 449.7 434.3 449 434.3 448.3 434.7 445.8 432 443.3 429.3 440.3 426.9L344.3 351.7C344.3 351.6 344.2 351.6 344.1 351.6L331.7 341.8C316.6 330 314.7 309 327.4 295 340.1 281.1 362.7 279.3 377.8 291L400.5 308.9C400.5 308.9 400.5 308.9 400.5 308.9L436.7 337.3 447.8 346H447.9L496.6 384.2C504.5 390.4 509.4 399.9 509.9 409.5 510.3 417.5 507.4 424.8 500.8 431ZM972.4 732.3L837 626.1C841.3 618.5 844.1 610.1 844.9 601.2 846.5 584.1 840.8 567.5 828.9 554.5 820.2 544.9 808.9 538 796.3 534.5 815.1 511.1 814.9 477.9 793.8 454.7 784.6 444.6 772.6 437.5 759.1 434.2 774.2 411.3 772.6 381 753 359.3 742.1 347.4 727.1 339.7 710.5 337.4 718.1 316.7 714.3 293 698 275.1 686.2 262.1 669.5 254.1 651.1 252.7 632.6 251.1 614.8 256.5 600.7 267.5L598.2 269.5 520.6 235.8C479.9 216.3 444.4 231.7 427.2 255.5 421.5 263.5 418 272.1 416.1 280.7L399.2 267.4C370.1 244.6 326.5 248.1 301.9 275.1 285.7 292.9 281.9 316.7 289.5 337.4 272.9 339.7 257.9 347.3 247 359.3 235.2 372.4 229.5 389 231 406.1 232 416.2 235.3 425.8 240.9 434.2 227.8 437.4 215.6 444.3 206.2 454.6 185.1 477.9 184.9 511.1 203.7 534.5 191.4 537.9 180 544.6 171.1 554.4 152.3 575 150.1 603.5 163.1 626L27.7 732.3C20.6 737.8 19.7 747.5 25.7 754 28.9 757.7 33.6 759.5 38.4 759.5 42.2 759.5 46 758.4 49.1 755.9L185.1 649.3 239.6 692C252.1 701.8 267.7 707.1 283.9 707.1 285.9 707.1 287.9 707 289.9 706.9 308.3 705.4 324.9 697.4 336.7 684.4 348.6 671.4 354.3 654.8 352.8 637.7 351.9 628.6 349 620.1 344.5 612.4 358.3 609.3 371.2 602.5 380.9 591.7 394.4 576.8 399.1 558 395.9 540.1H396C415.4 540.1 434.5 532.7 447.6 518.3 459.8 506.9 466.1 491.4 465.3 474.6 465.3 474 465.1 473.5 465.1 473 467.8 473.3 470.5 473.7 473.3 473.7 475.2 473.7 477.3 473.6 479.3 473.4 497.7 472 514.3 464 525.2 451.9 537.4 440.6 543.8 425.1 543.1 408.3 542.4 393 535.7 378.7 524.9 367.4L622.2 291.1C629.4 285.4 638.6 282.6 648.3 283.5 657.8 284.2 666.4 288.4 672.6 295.1 685.3 309.1 683.3 330.1 668.3 341.9L655.7 351.8 655.7 351.8C648.7 357.3 647.8 367.1 653.7 373.6 659.7 380.1 670.1 380.9 677.2 375.4L677.2 375.3C684.5 369.7 693.7 367 703.1 367.7 712.7 368.5 721.4 372.6 727.5 379.3 740.2 393.3 738.3 414.3 723.2 426.1L696.5 447.1C696.5 447.1 696.5 447.1 696.5 447.1 689.5 452.6 688.6 462.4 694.5 468.9 700.5 475.4 711 476.2 718 470.7H718C725.3 465 734.7 462.3 744 463 753.6 463.8 762.2 467.9 768.3 474.6 781 488.6 779.1 509.6 764 521.4L731.7 546.8 731.6 546.8C724.6 552.3 723.7 562.1 729.6 568.6 735.6 575.1 746.1 576 753.1 570.4L753.1 570.4C760.4 564.7 769.5 562.1 779.1 562.8 788.7 563.5 797.3 567.7 803.4 574.4 809.6 581.2 812.5 589.8 811.7 598.6 810.9 607.5 806.4 615.5 799.2 621.2L648 739.8C586.4 788.1 535.5 783 459 768.9 454 767.9 448.9 769.2 445 772.3L217.4 950.7C210.4 956.2 209.5 965.9 215.5 972.5 218.8 976.1 223.4 978 228.2 978 232 978 235.8 976.8 238.9 974.3L460.4 800.6C492 806.2 520.9 810.2 548.8 809.2L761.2 974.4C764.4 976.8 768.1 978 771.9 978 776.7 978 781.4 976.1 784.7 972.4 790.6 965.9 789.7 956.1 782.6 950.7L592.7 803.1C617.9 796.4 643.1 784.1 669.5 763.4L815 649.3 950.9 755.9C954 758.3 957.8 759.5 961.6 759.5 966.4 759.5 971 757.7 974.4 754.1 980.3 747.5 979.4 737.8 972.4 732.3ZM456.6 312.4C444 302.6 446.3 284.6 454.9 272.7 459.1 266.8 475.3 248.8 505.9 263.5L570.2 291.4 500 346.5 456.8 312.6 456.7 312.5C456.6 312.5 456.7 312.4 456.6 312.4ZM311.3 664.4C305.2 671.2 296.6 675.3 287.1 676 277.5 676.8 268.3 674 261 668.4L200.8 621.2C185.7 609.3 183.8 588.3 196.5 574.4 209.2 560.5 231.5 558.6 246.6 570.2L307.2 617.6C314.4 623.3 318.8 631.3 319.6 640.2 320.4 649.1 317.5 657.7 311.3 664.4ZM355.5 571.7C342.8 585.7 320.2 587.5 305.2 575.7L268.4 546.9C268.4 546.9 268.3 546.8 268.3 546.8L268.3 546.8 235.9 521.4C220.9 509.6 219 488.6 231.6 474.6 237.8 467.9 246.4 463.7 256 463 265.5 462.3 274.8 465 282 470.7L282 470.7C282.1 470.7 282.1 470.7 282.2 470.8L351.2 524.9C366.3 536.7 368.2 557.7 355.5 571.7ZM423.1 497.4C410.4 511.3 387.8 513.1 372.7 501.3L303.3 446.9C303.3 446.8 303.3 446.8 303.2 446.8L276.7 426.1C269.5 420.4 265.1 412.4 264.2 403.5 263.4 394.6 266.4 386 272.5 379.3 278.6 372.5 287.2 368.4 296.8 367.7 306.2 366.9 315.5 369.6 322.7 375.2L322.9 375.3 418.8 450.5C426.8 456.8 431.7 466.2 432.2 475.8 432.5 483.9 429.7 491.2 423.1 497.4ZM500.8 431C494.7 437.7 486.1 441.8 476.5 442.6 466.9 443.4 457.7 440.6 450.5 435 449.7 434.3 449 434.3 448.3 434.7 445.8 432 443.3 429.3 440.3 426.9L344.3 351.7C344.3 351.6 344.2 351.6 344.1 351.6L331.7 341.8C316.6 330 314.7 309 327.4 295 340.1 281.1 362.7 279.3 377.8 291L400.5 308.9C400.5 308.9 400.5 308.9 400.5 308.9L436.7 337.3 447.8 346H447.9L496.6 384.2C504.5 390.4 509.4 399.9 509.9 409.5 510.3 417.5 507.4 424.8 500.8 431ZM566.6 14.3C578.6 14.3 589 23.4 589 35.4V116.7C589 128.8 578.6 137.9 566.6 137.9 554.7 137.8 544.3 128.8 544.3 116.7V35.4C544.3 23.4 554.7 14.3 566.6 14.3ZM820.9 83C827.8 74.3 840.3 72.1 849.9 77.3L851.8 78.5 853.6 79.9C862.1 87 863.7 99.3 856.7 108.3L856.6 108.3 804.9 173.8V173.8C800.5 179.4 793.7 182.3 787 182.3 782.5 182.3 777.9 181 774 178.3 764 171.5 761.6 158.1 769.2 148.5L820.9 83ZM281.4 78.5C291.2 71.9 305 73.7 312.3 83L364.1 148.5C371.7 158 369.3 171.4 359.3 178.3L359.3 178.3C355.3 181 350.7 182.3 346.3 182.3 339.6 182.3 332.8 179.4 328.4 173.8V173.8L276.6 108.3C269.1 98.7 271.4 85.3 281.4 78.5Z", + "width": 1000 + }, + "search": [ + "icon" + ] } ] } \ No newline at end of file diff --git a/packages/navigation/lib/app_routes.dart b/packages/navigation/lib/app_routes.dart index 45ba35c8..f95c5b2f 100644 --- a/packages/navigation/lib/app_routes.dart +++ b/packages/navigation/lib/app_routes.dart @@ -17,6 +17,7 @@ class AppRoutes { static const legacy = '/legacy'; + static const accountSettings = '$legacy/account_settings'; static const legacyDashboard = '$legacy/dashboard'; static const dashboardHub = '$legacyDashboard/hub'; From d515d0596fb78f2cc00cbbdb3ef3ab611d678433 Mon Sep 17 00:00:00 2001 From: aitorarana Date: Mon, 2 Feb 2026 15:14:44 +0100 Subject: [PATCH 06/25] added personal_data endpoints, providers and states --- .../mobile_app/lib/navigation/app_router.dart | 10 + .../datasource/account_remote_datasource.dart | 6 + .../account_remote_datasource_impl.dart | 51 +- .../get_logged_user_response_model.dart | 60 ++ ...et_logged_user_response_model.freezed.dart | 597 ++++++++++++++++++ .../get_logged_user_response_model.g.dart | 57 ++ .../models/update_device_request_model.dart | 50 ++ .../models/update_device_request_model.g.dart | 1 + .../models/update_user_request_model.dart | 47 ++ .../update_user_request_model.freezed.dart | 316 +++++++++ .../models/update_user_request_model.g.dart | 45 ++ .../repositories/account_repository_impl.dart | 12 + .../repositories/account_repository.dart | 6 + .../account_remote_datasource_provider.dart | 6 +- .../presentation/account_settings_screen.dart | 9 +- .../domain/update_device_use_case.dart | 4 + .../domain/update_device_use_case_impl.dart | 15 + .../linked_devices_builder.dart | 19 + .../edit_linked_device_screen.dart | 25 +- .../presentation/linked_devices_screen.dart | 18 +- .../update_device_use_case_provider.dart | 9 + .../state/linked_devices_view_model.dart | 19 +- .../state/linked_devices_view_state.dart | 3 +- .../linked_devices_view_state.freezed.dart | 39 +- .../entities/update_user_request_entity.dart | 23 + .../update_user_request_entity.freezed.dart | 310 +++++++++ .../domain/entities/user_entity.dart | 23 + .../domain/entities/user_entity.freezed.dart | 310 +++++++++ .../domain/get_logged_user_use_case.dart | 5 + .../domain/get_logged_user_use_case_impl.dart | 13 + .../domain/update_user_use_case.dart | 5 + .../domain/update_user_use_case_impl.dart | 13 + .../personal_data/personal_data_builder.dart | 19 + .../presentation/personal_data_screen.dart | 132 ++++ .../get_logged_user_use_case_provider.dart | 9 + .../update_user_use_case_provider.dart | 9 + .../state/personal_data_view_model.dart | 155 +++++ .../state/personal_data_view_state.dart | 18 + .../personal_data_view_state.freezed.dart | 316 +++++++++ packages/design_system/fonts/config.json | 2 +- packages/navigation/lib/app_routes.dart | 3 + 41 files changed, 2737 insertions(+), 52 deletions(-) create mode 100644 modules/legacy/modules/account/lib/src/core/data/models/get_logged_user_response_model.dart create mode 100644 modules/legacy/modules/account/lib/src/core/data/models/get_logged_user_response_model.freezed.dart create mode 100644 modules/legacy/modules/account/lib/src/core/data/models/get_logged_user_response_model.g.dart create mode 100644 modules/legacy/modules/account/lib/src/core/data/models/update_device_request_model.dart create mode 100644 modules/legacy/modules/account/lib/src/core/data/models/update_device_request_model.g.dart create mode 100644 modules/legacy/modules/account/lib/src/core/data/models/update_user_request_model.dart create mode 100644 modules/legacy/modules/account/lib/src/core/data/models/update_user_request_model.freezed.dart create mode 100644 modules/legacy/modules/account/lib/src/core/data/models/update_user_request_model.g.dart create mode 100644 modules/legacy/modules/account/lib/src/features/linked_devices/domain/update_device_use_case.dart create mode 100644 modules/legacy/modules/account/lib/src/features/linked_devices/domain/update_device_use_case_impl.dart create mode 100644 modules/legacy/modules/account/lib/src/features/linked_devices/linked_devices_builder.dart create mode 100644 modules/legacy/modules/account/lib/src/features/linked_devices/presentation/providers/update_device_use_case_provider.dart rename modules/legacy/modules/account/lib/src/features/linked_devices/{ => presentation}/state/linked_devices_view_model.dart (73%) rename modules/legacy/modules/account/lib/src/features/linked_devices/{ => presentation}/state/linked_devices_view_state.dart (86%) rename modules/legacy/modules/account/lib/src/features/linked_devices/{ => presentation}/state/linked_devices_view_state.freezed.dart (86%) create mode 100644 modules/legacy/modules/account/lib/src/features/personal_data/domain/entities/update_user_request_entity.dart create mode 100644 modules/legacy/modules/account/lib/src/features/personal_data/domain/entities/update_user_request_entity.freezed.dart create mode 100644 modules/legacy/modules/account/lib/src/features/personal_data/domain/entities/user_entity.dart create mode 100644 modules/legacy/modules/account/lib/src/features/personal_data/domain/entities/user_entity.freezed.dart create mode 100644 modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case.dart create mode 100644 modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case_impl.dart create mode 100644 modules/legacy/modules/account/lib/src/features/personal_data/domain/update_user_use_case.dart create mode 100644 modules/legacy/modules/account/lib/src/features/personal_data/domain/update_user_use_case_impl.dart create mode 100644 modules/legacy/modules/account/lib/src/features/personal_data/personal_data_builder.dart create mode 100644 modules/legacy/modules/account/lib/src/features/personal_data/presentation/personal_data_screen.dart create mode 100644 modules/legacy/modules/account/lib/src/features/personal_data/presentation/providers/get_logged_user_use_case_provider.dart create mode 100644 modules/legacy/modules/account/lib/src/features/personal_data/presentation/providers/update_user_use_case_provider.dart create mode 100644 modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_model.dart create mode 100644 modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_state.dart create mode 100644 modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_state.freezed.dart diff --git a/apps/mobile_app/lib/navigation/app_router.dart b/apps/mobile_app/lib/navigation/app_router.dart index 68380200..cb5a85bc 100644 --- a/apps/mobile_app/lib/navigation/app_router.dart +++ b/apps/mobile_app/lib/navigation/app_router.dart @@ -48,6 +48,16 @@ void configureAppRouter() { name: 'account_settings', pageBuilder: AccountSettingsBuilder().buildPage, ), + GoRoute( + path: AppRoutes.personalData, + name: 'personal_data', + pageBuilder: PersonalDataBuilder().buildPage, + ), + GoRoute( + path: AppRoutes.linkedDevices, + name: 'linked_devices', + pageBuilder: LinkedDevicesBuilder().buildPage, + ), GoRoute( path: AppRoutes.login, diff --git a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart index 844a5932..496c1b40 100644 --- a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart +++ b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart @@ -1,5 +1,11 @@ import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; +import 'package:account/src/features/personal_data/domain/entities/user_entity.dart'; abstract class AccountRemoteDatasource { Future> getLinkedDevices({required String userId}); + + Future getLoggedUser({required String token}); + + Future updateUser({required String userId, required UpdateUserRequestEntity request}); } diff --git a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart index d33455cb..1e5818f4 100644 --- a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart +++ b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart @@ -2,15 +2,19 @@ import 'dart:convert'; import 'package:account/src/core/data/datasource/account_remote_datasource.dart'; import 'package:account/src/core/data/models/get_linked_devices_response_model.dart'; +import 'package:account/src/core/data/models/get_logged_user_response_model.dart'; +import 'package:account/src/core/data/models/update_user_request_model.dart'; import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; +import 'package:account/src/features/personal_data/domain/entities/user_entity.dart'; import 'package:dio/dio.dart'; // import 'package:flutter/material.dart'; -// import 'package:sf_infrastructure/sf_infrastructure.dart'; +import 'package:sf_infrastructure/sf_infrastructure.dart'; class AccountRemoteDatasourceImpl implements AccountRemoteDatasource { - AccountRemoteDatasourceImpl(/*this._repository*/); + AccountRemoteDatasourceImpl(this._repository); - // final QuestiaRepository _repository; + final QuestiaRepository _repository; @override Future> getLinkedDevices({required String userId}) async { @@ -42,6 +46,47 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource { ); } } + + @override + Future getLoggedUser({required String token}) async { + try { + /*final response = await _repository.get>( + '/users/api/auth/me', + ); + final data = response.data!['item']; + if (data == null || data.isEmpty) { + throw Exception('Empty response from /auth/me'); + } + + final model = GetUserResponseModel.fromJson(data);*/ + final model = GetLoggedUserResponseModel(item: + GetLoggedUserItemResponseModel( + id: '1111', + firstName: 'Juan', + email: 'juan@test.com', + phone: '111111111')); + print(model.toEntity()); + return model.toEntity(); + } on DioException catch (error) { + throw _mapDioError( + error, + defaultMessage: error.message ?? 'Error getting devices', + ); + } + } + + @override + Future updateUser({required String userId, required UpdateUserRequestEntity request}) async { + try { + final body = request.toModel().toJson(); + await _repository.put( + '/users/$userId', + body: body, + ); + } on DioException catch (error) { + throw _mapDioError(error, defaultMessage: 'Error in verification code'); + } + } } Exception _mapDioError(DioException error, {required String defaultMessage}) { diff --git a/modules/legacy/modules/account/lib/src/core/data/models/get_logged_user_response_model.dart b/modules/legacy/modules/account/lib/src/core/data/models/get_logged_user_response_model.dart new file mode 100644 index 00000000..86d040cc --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/data/models/get_logged_user_response_model.dart @@ -0,0 +1,60 @@ +import 'package:account/src/features/personal_data/domain/entities/user_entity.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'get_logged_user_response_model.freezed.dart'; +part 'get_logged_user_response_model.g.dart'; + +@freezed +abstract class GetLoggedUserResponseModel with _$GetLoggedUserResponseModel { + const factory GetLoggedUserResponseModel({ + required GetLoggedUserItemResponseModel item, + }) = _GetLoggedUserResponseModel; + + factory GetLoggedUserResponseModel.fromJson(Map json) => + _$GetLoggedUserResponseModelFromJson(json); +} + +@freezed +abstract class GetLoggedUserItemResponseModel with _$GetLoggedUserItemResponseModel { + const factory GetLoggedUserItemResponseModel({ + required String id, + String? delegationId, + String? email, + String? createdAt, + String? updatedAt, + String? status, + String? role, + String? lastLogin, + String? currentLogin, + String? language, + String? firstName, + String? lastName, + String? hasApiKey, + String? phone, + }) = + _GetLoggedUserItemResponseModel; + + factory GetLoggedUserItemResponseModel.fromJson(Map json) => + _$GetLoggedUserItemResponseModelFromJson(json); +} + +extension GetLoggedUserResponseModelMapper on GetLoggedUserResponseModel { + UserEntity toEntity() { + return UserEntity( + id: item.id, + delegationId: item.delegationId ?? '', + email: item.email ?? '', + createdAt: item.createdAt ?? '', + updatedAt: item.updatedAt ?? '', + status: item.status ?? '', + role: item.role ?? '', + lastLogin: item.lastLogin ?? '', + currentLogin: item.currentLogin ?? '', + language: item.language ?? '', + firstName: item.firstName ?? '', + lastName: item.lastName ?? '', + hasApiKey: item.hasApiKey ?? '', + phone: item.phone ?? '' + ); + } +} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/core/data/models/get_logged_user_response_model.freezed.dart b/modules/legacy/modules/account/lib/src/core/data/models/get_logged_user_response_model.freezed.dart new file mode 100644 index 00000000..15722cae --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/data/models/get_logged_user_response_model.freezed.dart @@ -0,0 +1,597 @@ +// 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_logged_user_response_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$GetLoggedUserResponseModel { + + GetLoggedUserItemResponseModel get item; +/// Create a copy of GetLoggedUserResponseModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$GetLoggedUserResponseModelCopyWith get copyWith => _$GetLoggedUserResponseModelCopyWithImpl(this as GetLoggedUserResponseModel, _$identity); + + /// Serializes this GetLoggedUserResponseModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is GetLoggedUserResponseModel&&(identical(other.item, item) || other.item == item)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,item); + +@override +String toString() { + return 'GetLoggedUserResponseModel(item: $item)'; +} + + +} + +/// @nodoc +abstract mixin class $GetLoggedUserResponseModelCopyWith<$Res> { + factory $GetLoggedUserResponseModelCopyWith(GetLoggedUserResponseModel value, $Res Function(GetLoggedUserResponseModel) _then) = _$GetLoggedUserResponseModelCopyWithImpl; +@useResult +$Res call({ + GetLoggedUserItemResponseModel item +}); + + +$GetLoggedUserItemResponseModelCopyWith<$Res> get item; + +} +/// @nodoc +class _$GetLoggedUserResponseModelCopyWithImpl<$Res> + implements $GetLoggedUserResponseModelCopyWith<$Res> { + _$GetLoggedUserResponseModelCopyWithImpl(this._self, this._then); + + final GetLoggedUserResponseModel _self; + final $Res Function(GetLoggedUserResponseModel) _then; + +/// Create a copy of GetLoggedUserResponseModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? item = null,}) { + return _then(_self.copyWith( +item: null == item ? _self.item : item // ignore: cast_nullable_to_non_nullable +as GetLoggedUserItemResponseModel, + )); +} +/// Create a copy of GetLoggedUserResponseModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$GetLoggedUserItemResponseModelCopyWith<$Res> get item { + + return $GetLoggedUserItemResponseModelCopyWith<$Res>(_self.item, (value) { + return _then(_self.copyWith(item: value)); + }); +} +} + + +/// Adds pattern-matching-related methods to [GetLoggedUserResponseModel]. +extension GetLoggedUserResponseModelPatterns on GetLoggedUserResponseModel { +/// 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( _GetLoggedUserResponseModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _GetLoggedUserResponseModel() 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( _GetLoggedUserResponseModel value) $default,){ +final _that = this; +switch (_that) { +case _GetLoggedUserResponseModel(): +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( _GetLoggedUserResponseModel value)? $default,){ +final _that = this; +switch (_that) { +case _GetLoggedUserResponseModel() 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( GetLoggedUserItemResponseModel item)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _GetLoggedUserResponseModel() when $default != null: +return $default(_that.item);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( GetLoggedUserItemResponseModel item) $default,) {final _that = this; +switch (_that) { +case _GetLoggedUserResponseModel(): +return $default(_that.item);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( GetLoggedUserItemResponseModel item)? $default,) {final _that = this; +switch (_that) { +case _GetLoggedUserResponseModel() when $default != null: +return $default(_that.item);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _GetLoggedUserResponseModel implements GetLoggedUserResponseModel { + const _GetLoggedUserResponseModel({required this.item}); + factory _GetLoggedUserResponseModel.fromJson(Map json) => _$GetLoggedUserResponseModelFromJson(json); + +@override final GetLoggedUserItemResponseModel item; + +/// Create a copy of GetLoggedUserResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$GetLoggedUserResponseModelCopyWith<_GetLoggedUserResponseModel> get copyWith => __$GetLoggedUserResponseModelCopyWithImpl<_GetLoggedUserResponseModel>(this, _$identity); + +@override +Map toJson() { + return _$GetLoggedUserResponseModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetLoggedUserResponseModel&&(identical(other.item, item) || other.item == item)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,item); + +@override +String toString() { + return 'GetLoggedUserResponseModel(item: $item)'; +} + + +} + +/// @nodoc +abstract mixin class _$GetLoggedUserResponseModelCopyWith<$Res> implements $GetLoggedUserResponseModelCopyWith<$Res> { + factory _$GetLoggedUserResponseModelCopyWith(_GetLoggedUserResponseModel value, $Res Function(_GetLoggedUserResponseModel) _then) = __$GetLoggedUserResponseModelCopyWithImpl; +@override @useResult +$Res call({ + GetLoggedUserItemResponseModel item +}); + + +@override $GetLoggedUserItemResponseModelCopyWith<$Res> get item; + +} +/// @nodoc +class __$GetLoggedUserResponseModelCopyWithImpl<$Res> + implements _$GetLoggedUserResponseModelCopyWith<$Res> { + __$GetLoggedUserResponseModelCopyWithImpl(this._self, this._then); + + final _GetLoggedUserResponseModel _self; + final $Res Function(_GetLoggedUserResponseModel) _then; + +/// Create a copy of GetLoggedUserResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? item = null,}) { + return _then(_GetLoggedUserResponseModel( +item: null == item ? _self.item : item // ignore: cast_nullable_to_non_nullable +as GetLoggedUserItemResponseModel, + )); +} + +/// Create a copy of GetLoggedUserResponseModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$GetLoggedUserItemResponseModelCopyWith<$Res> get item { + + return $GetLoggedUserItemResponseModelCopyWith<$Res>(_self.item, (value) { + return _then(_self.copyWith(item: value)); + }); +} +} + + +/// @nodoc +mixin _$GetLoggedUserItemResponseModel { + + String get id; String? get delegationId; String? get email; String? get createdAt; String? get updatedAt; String? get status; String? get role; String? get lastLogin; String? get currentLogin; String? get language; String? get firstName; String? get lastName; String? get hasApiKey; String? get phone; +/// Create a copy of GetLoggedUserItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$GetLoggedUserItemResponseModelCopyWith get copyWith => _$GetLoggedUserItemResponseModelCopyWithImpl(this as GetLoggedUserItemResponseModel, _$identity); + + /// Serializes this GetLoggedUserItemResponseModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is GetLoggedUserItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone); + +@override +String toString() { + return 'GetLoggedUserItemResponseModel(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)'; +} + + +} + +/// @nodoc +abstract mixin class $GetLoggedUserItemResponseModelCopyWith<$Res> { + factory $GetLoggedUserItemResponseModelCopyWith(GetLoggedUserItemResponseModel value, $Res Function(GetLoggedUserItemResponseModel) _then) = _$GetLoggedUserItemResponseModelCopyWithImpl; +@useResult +$Res call({ + String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone +}); + + + + +} +/// @nodoc +class _$GetLoggedUserItemResponseModelCopyWithImpl<$Res> + implements $GetLoggedUserItemResponseModelCopyWith<$Res> { + _$GetLoggedUserItemResponseModelCopyWithImpl(this._self, this._then); + + final GetLoggedUserItemResponseModel _self; + final $Res Function(GetLoggedUserItemResponseModel) _then; + +/// Create a copy of GetLoggedUserItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? delegationId = freezed,Object? email = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? status = freezed,Object? role = freezed,Object? lastLogin = freezed,Object? currentLogin = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? hasApiKey = freezed,Object? phone = freezed,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable +as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable +as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable +as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable +as String?,lastLogin: freezed == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable +as String?,currentLogin: freezed == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable +as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable +as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable +as String?,hasApiKey: freezed == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable +as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + +} + + +/// Adds pattern-matching-related methods to [GetLoggedUserItemResponseModel]. +extension GetLoggedUserItemResponseModelPatterns on GetLoggedUserItemResponseModel { +/// 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( _GetLoggedUserItemResponseModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _GetLoggedUserItemResponseModel() 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( _GetLoggedUserItemResponseModel value) $default,){ +final _that = this; +switch (_that) { +case _GetLoggedUserItemResponseModel(): +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( _GetLoggedUserItemResponseModel value)? $default,){ +final _that = this; +switch (_that) { +case _GetLoggedUserItemResponseModel() 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? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _GetLoggedUserItemResponseModel() when $default != null: +return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);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? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone) $default,) {final _that = this; +switch (_that) { +case _GetLoggedUserItemResponseModel(): +return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);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? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone)? $default,) {final _that = this; +switch (_that) { +case _GetLoggedUserItemResponseModel() when $default != null: +return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _GetLoggedUserItemResponseModel implements GetLoggedUserItemResponseModel { + const _GetLoggedUserItemResponseModel({required this.id, this.delegationId, this.email, this.createdAt, this.updatedAt, this.status, this.role, this.lastLogin, this.currentLogin, this.language, this.firstName, this.lastName, this.hasApiKey, this.phone}); + factory _GetLoggedUserItemResponseModel.fromJson(Map json) => _$GetLoggedUserItemResponseModelFromJson(json); + +@override final String id; +@override final String? delegationId; +@override final String? email; +@override final String? createdAt; +@override final String? updatedAt; +@override final String? status; +@override final String? role; +@override final String? lastLogin; +@override final String? currentLogin; +@override final String? language; +@override final String? firstName; +@override final String? lastName; +@override final String? hasApiKey; +@override final String? phone; + +/// Create a copy of GetLoggedUserItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$GetLoggedUserItemResponseModelCopyWith<_GetLoggedUserItemResponseModel> get copyWith => __$GetLoggedUserItemResponseModelCopyWithImpl<_GetLoggedUserItemResponseModel>(this, _$identity); + +@override +Map toJson() { + return _$GetLoggedUserItemResponseModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetLoggedUserItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone); + +@override +String toString() { + return 'GetLoggedUserItemResponseModel(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)'; +} + + +} + +/// @nodoc +abstract mixin class _$GetLoggedUserItemResponseModelCopyWith<$Res> implements $GetLoggedUserItemResponseModelCopyWith<$Res> { + factory _$GetLoggedUserItemResponseModelCopyWith(_GetLoggedUserItemResponseModel value, $Res Function(_GetLoggedUserItemResponseModel) _then) = __$GetLoggedUserItemResponseModelCopyWithImpl; +@override @useResult +$Res call({ + String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone +}); + + + + +} +/// @nodoc +class __$GetLoggedUserItemResponseModelCopyWithImpl<$Res> + implements _$GetLoggedUserItemResponseModelCopyWith<$Res> { + __$GetLoggedUserItemResponseModelCopyWithImpl(this._self, this._then); + + final _GetLoggedUserItemResponseModel _self; + final $Res Function(_GetLoggedUserItemResponseModel) _then; + +/// Create a copy of GetLoggedUserItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? delegationId = freezed,Object? email = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? status = freezed,Object? role = freezed,Object? lastLogin = freezed,Object? currentLogin = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? hasApiKey = freezed,Object? phone = freezed,}) { + return _then(_GetLoggedUserItemResponseModel( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable +as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable +as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable +as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable +as String?,lastLogin: freezed == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable +as String?,currentLogin: freezed == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable +as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable +as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable +as String?,hasApiKey: freezed == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable +as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/account/lib/src/core/data/models/get_logged_user_response_model.g.dart b/modules/legacy/modules/account/lib/src/core/data/models/get_logged_user_response_model.g.dart new file mode 100644 index 00000000..7ad418b7 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/data/models/get_logged_user_response_model.g.dart @@ -0,0 +1,57 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'get_logged_user_response_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_GetLoggedUserResponseModel _$GetLoggedUserResponseModelFromJson( + Map json, +) => _GetLoggedUserResponseModel( + item: GetLoggedUserItemResponseModel.fromJson( + json['item'] as Map, + ), +); + +Map _$GetLoggedUserResponseModelToJson( + _GetLoggedUserResponseModel instance, +) => {'item': instance.item}; + +_GetLoggedUserItemResponseModel _$GetLoggedUserItemResponseModelFromJson( + Map json, +) => _GetLoggedUserItemResponseModel( + id: json['id'] as String, + delegationId: json['delegationId'] as String?, + email: json['email'] as String?, + createdAt: json['createdAt'] as String?, + updatedAt: json['updatedAt'] as String?, + status: json['status'] as String?, + role: json['role'] as String?, + lastLogin: json['lastLogin'] as String?, + currentLogin: json['currentLogin'] as String?, + language: json['language'] as String?, + firstName: json['firstName'] as String?, + lastName: json['lastName'] as String?, + hasApiKey: json['hasApiKey'] as String?, + phone: json['phone'] as String?, +); + +Map _$GetLoggedUserItemResponseModelToJson( + _GetLoggedUserItemResponseModel instance, +) => { + 'id': instance.id, + 'delegationId': instance.delegationId, + 'email': instance.email, + 'createdAt': instance.createdAt, + 'updatedAt': instance.updatedAt, + 'status': instance.status, + 'role': instance.role, + 'lastLogin': instance.lastLogin, + 'currentLogin': instance.currentLogin, + 'language': instance.language, + 'firstName': instance.firstName, + 'lastName': instance.lastName, + 'hasApiKey': instance.hasApiKey, + 'phone': instance.phone, +}; diff --git a/modules/legacy/modules/account/lib/src/core/data/models/update_device_request_model.dart b/modules/legacy/modules/account/lib/src/core/data/models/update_device_request_model.dart new file mode 100644 index 00000000..549b055c --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/data/models/update_device_request_model.dart @@ -0,0 +1,50 @@ +/* +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'update_device_request_model.freezed.dart'; +part 'update_device_request_model.g.dart'; + +@freezed +abstract class UpdateDeviceRequestModel with _$UpdateDeviceRequestModel { + const factory UpdateDeviceRequestModel({ + required String deviceIdentificator, + required String lastName, + required String email, + required String phone, + required String language, + required String password, + required List taxResidences, + required List addresses, + // ignore: invalid_annotation_target + @JsonKey(name: 'document') required String documentNumber, + required String documentType, + // ignore: invalid_annotation_target + @JsonKey(name: 'relationType') required String relationship, + }) = _UpdateDeviceRequestModel; + + factory UpdateDeviceRequestModel.fromCsv(Map json) => + _$UpdateDeviceRequestModelFromCsv(csv); + + @override + @JsonKey(name: 'document') + String get documentNumber; + @override + @JsonKey(name: 'relationType') + String get relationship; +} + +extension UpdateDeviceRequestModelMapper on UpdateDeviceRequestEntity { + UpdateDeviceRequestModel toModel() => UpdateDeviceRequestModel( + firstName: firstName, + lastName: lastName, + email: email, + phone: phone, + language: language, + password: password, + taxResidences: taxResidences + .map((e) => e.toModel()) + .toList(growable: false), + addresses: addresses.map((e) => e.toModel()).toList(growable: false), + ); +} +*/ diff --git a/modules/legacy/modules/account/lib/src/core/data/models/update_device_request_model.g.dart b/modules/legacy/modules/account/lib/src/core/data/models/update_device_request_model.g.dart new file mode 100644 index 00000000..7dee7b62 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/data/models/update_device_request_model.g.dart @@ -0,0 +1 @@ +part of 'update_device_request_model.dart'; \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/core/data/models/update_user_request_model.dart b/modules/legacy/modules/account/lib/src/core/data/models/update_user_request_model.dart new file mode 100644 index 00000000..0e5eb207 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/data/models/update_user_request_model.dart @@ -0,0 +1,47 @@ +import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'update_user_request_model.freezed.dart'; +part 'update_user_request_model.g.dart'; + +@freezed +abstract class UpdateUserRequestModel with _$UpdateUserRequestModel { + const factory UpdateUserRequestModel({ + required String id, + String? delegationId, + String? email, + String? createdAt, + String? updatedAt, + String? status, + String? role, + String? lastLogin, + String? currentLogin, + String? language, + String? firstName, + String? lastName, + String? hasApiKey, + String? phone, + }) = _UpdateUserRequestModel; + + factory UpdateUserRequestModel.fromJson(Map json) => + _$UpdateUserRequestModelFromJson(json); +} + +extension UpdateUserRequestModelMapper on UpdateUserRequestEntity { + UpdateUserRequestModel toModel() => UpdateUserRequestModel( + id: id, + delegationId: delegationId, + email: email, + createdAt: createdAt, + updatedAt: updatedAt, + status: status, + role: role, + lastLogin: lastLogin, + currentLogin: currentLogin, + language: language, + firstName: firstName, + lastName: lastName, + hasApiKey: hasApiKey, + phone: phone, + ); +} diff --git a/modules/legacy/modules/account/lib/src/core/data/models/update_user_request_model.freezed.dart b/modules/legacy/modules/account/lib/src/core/data/models/update_user_request_model.freezed.dart new file mode 100644 index 00000000..6ac6c523 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/data/models/update_user_request_model.freezed.dart @@ -0,0 +1,316 @@ +// 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 'update_user_request_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateUserRequestModel { + + String get id; String? get delegationId; String? get email; String? get createdAt; String? get updatedAt; String? get status; String? get role; String? get lastLogin; String? get currentLogin; String? get language; String? get firstName; String? get lastName; String? get hasApiKey; String? get phone; +/// Create a copy of UpdateUserRequestModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UpdateUserRequestModelCopyWith get copyWith => _$UpdateUserRequestModelCopyWithImpl(this as UpdateUserRequestModel, _$identity); + + /// Serializes this UpdateUserRequestModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UpdateUserRequestModel&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone); + +@override +String toString() { + return 'UpdateUserRequestModel(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)'; +} + + +} + +/// @nodoc +abstract mixin class $UpdateUserRequestModelCopyWith<$Res> { + factory $UpdateUserRequestModelCopyWith(UpdateUserRequestModel value, $Res Function(UpdateUserRequestModel) _then) = _$UpdateUserRequestModelCopyWithImpl; +@useResult +$Res call({ + String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone +}); + + + + +} +/// @nodoc +class _$UpdateUserRequestModelCopyWithImpl<$Res> + implements $UpdateUserRequestModelCopyWith<$Res> { + _$UpdateUserRequestModelCopyWithImpl(this._self, this._then); + + final UpdateUserRequestModel _self; + final $Res Function(UpdateUserRequestModel) _then; + +/// Create a copy of UpdateUserRequestModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? delegationId = freezed,Object? email = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? status = freezed,Object? role = freezed,Object? lastLogin = freezed,Object? currentLogin = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? hasApiKey = freezed,Object? phone = freezed,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable +as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable +as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable +as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable +as String?,lastLogin: freezed == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable +as String?,currentLogin: freezed == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable +as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable +as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable +as String?,hasApiKey: freezed == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable +as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + +} + + +/// Adds pattern-matching-related methods to [UpdateUserRequestModel]. +extension UpdateUserRequestModelPatterns on UpdateUserRequestModel { +/// 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( _UpdateUserRequestModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _UpdateUserRequestModel() 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( _UpdateUserRequestModel value) $default,){ +final _that = this; +switch (_that) { +case _UpdateUserRequestModel(): +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( _UpdateUserRequestModel value)? $default,){ +final _that = this; +switch (_that) { +case _UpdateUserRequestModel() 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? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _UpdateUserRequestModel() when $default != null: +return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);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? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone) $default,) {final _that = this; +switch (_that) { +case _UpdateUserRequestModel(): +return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);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? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone)? $default,) {final _that = this; +switch (_that) { +case _UpdateUserRequestModel() when $default != null: +return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _UpdateUserRequestModel implements UpdateUserRequestModel { + const _UpdateUserRequestModel({required this.id, this.delegationId, this.email, this.createdAt, this.updatedAt, this.status, this.role, this.lastLogin, this.currentLogin, this.language, this.firstName, this.lastName, this.hasApiKey, this.phone}); + factory _UpdateUserRequestModel.fromJson(Map json) => _$UpdateUserRequestModelFromJson(json); + +@override final String id; +@override final String? delegationId; +@override final String? email; +@override final String? createdAt; +@override final String? updatedAt; +@override final String? status; +@override final String? role; +@override final String? lastLogin; +@override final String? currentLogin; +@override final String? language; +@override final String? firstName; +@override final String? lastName; +@override final String? hasApiKey; +@override final String? phone; + +/// Create a copy of UpdateUserRequestModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$UpdateUserRequestModelCopyWith<_UpdateUserRequestModel> get copyWith => __$UpdateUserRequestModelCopyWithImpl<_UpdateUserRequestModel>(this, _$identity); + +@override +Map toJson() { + return _$UpdateUserRequestModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _UpdateUserRequestModel&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone); + +@override +String toString() { + return 'UpdateUserRequestModel(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)'; +} + + +} + +/// @nodoc +abstract mixin class _$UpdateUserRequestModelCopyWith<$Res> implements $UpdateUserRequestModelCopyWith<$Res> { + factory _$UpdateUserRequestModelCopyWith(_UpdateUserRequestModel value, $Res Function(_UpdateUserRequestModel) _then) = __$UpdateUserRequestModelCopyWithImpl; +@override @useResult +$Res call({ + String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone +}); + + + + +} +/// @nodoc +class __$UpdateUserRequestModelCopyWithImpl<$Res> + implements _$UpdateUserRequestModelCopyWith<$Res> { + __$UpdateUserRequestModelCopyWithImpl(this._self, this._then); + + final _UpdateUserRequestModel _self; + final $Res Function(_UpdateUserRequestModel) _then; + +/// Create a copy of UpdateUserRequestModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? delegationId = freezed,Object? email = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? status = freezed,Object? role = freezed,Object? lastLogin = freezed,Object? currentLogin = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? hasApiKey = freezed,Object? phone = freezed,}) { + return _then(_UpdateUserRequestModel( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable +as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable +as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable +as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable +as String?,lastLogin: freezed == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable +as String?,currentLogin: freezed == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable +as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable +as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable +as String?,hasApiKey: freezed == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable +as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/account/lib/src/core/data/models/update_user_request_model.g.dart b/modules/legacy/modules/account/lib/src/core/data/models/update_user_request_model.g.dart new file mode 100644 index 00000000..47c12852 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/data/models/update_user_request_model.g.dart @@ -0,0 +1,45 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_user_request_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_UpdateUserRequestModel _$UpdateUserRequestModelFromJson( + Map json, +) => _UpdateUserRequestModel( + id: json['id'] as String, + delegationId: json['delegationId'] as String?, + email: json['email'] as String?, + createdAt: json['createdAt'] as String?, + updatedAt: json['updatedAt'] as String?, + status: json['status'] as String?, + role: json['role'] as String?, + lastLogin: json['lastLogin'] as String?, + currentLogin: json['currentLogin'] as String?, + language: json['language'] as String?, + firstName: json['firstName'] as String?, + lastName: json['lastName'] as String?, + hasApiKey: json['hasApiKey'] as String?, + phone: json['phone'] as String?, +); + +Map _$UpdateUserRequestModelToJson( + _UpdateUserRequestModel instance, +) => { + 'id': instance.id, + 'delegationId': instance.delegationId, + 'email': instance.email, + 'createdAt': instance.createdAt, + 'updatedAt': instance.updatedAt, + 'status': instance.status, + 'role': instance.role, + 'lastLogin': instance.lastLogin, + 'currentLogin': instance.currentLogin, + 'language': instance.language, + 'firstName': instance.firstName, + 'lastName': instance.lastName, + 'hasApiKey': instance.hasApiKey, + 'phone': instance.phone, +}; diff --git a/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart b/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart index f34f0806..d22d920e 100644 --- a/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart +++ b/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart @@ -1,6 +1,8 @@ import 'package:account/src/core/data/datasource/account_remote_datasource.dart'; import 'package:account/src/core/domain/repositories/account_repository.dart'; import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; +import 'package:account/src/features/personal_data/domain/entities/user_entity.dart'; class AccountRepositoryImpl implements AccountRepository { const AccountRepositoryImpl(this._remote); @@ -11,4 +13,14 @@ class AccountRepositoryImpl implements AccountRepository { Future> getLinkedDevices({required String userId}) { return _remote.getLinkedDevices(userId: userId); } + + @override + Future getLoggedUser({required String token}) { + return _remote.getLoggedUser(token: token); + } + + @override + Future updateUser({required String userId, required UpdateUserRequestEntity request}) { + return _remote.updateUser(userId: userId, request: request); + } } diff --git a/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart b/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart index 9dc33f59..bb258786 100644 --- a/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart +++ b/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart @@ -1,5 +1,11 @@ import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; +import 'package:account/src/features/personal_data/domain/entities/user_entity.dart'; abstract class AccountRepository { Future> getLinkedDevices({required String userId}); + + Future updateUser({required String userId, required UpdateUserRequestEntity request}); + + Future getLoggedUser({required String token}); } diff --git a/modules/legacy/modules/account/lib/src/core/providers/account_remote_datasource_provider.dart b/modules/legacy/modules/account/lib/src/core/providers/account_remote_datasource_provider.dart index 89277b0f..a466c656 100644 --- a/modules/legacy/modules/account/lib/src/core/providers/account_remote_datasource_provider.dart +++ b/modules/legacy/modules/account/lib/src/core/providers/account_remote_datasource_provider.dart @@ -1,9 +1,9 @@ import 'package:account/src/core/data/datasource/account_remote_datasource.dart'; import 'package:account/src/core/data/datasource/account_remote_datasource_impl.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -// import 'package:sf_infrastructure/sf_infrastructure.dart'; +import 'package:sf_infrastructure/sf_infrastructure.dart'; final accountRemoteDatasourceProvider = Provider((ref) { - // final questiaRepository = getIt(); - return AccountRemoteDatasourceImpl(/*questiaRepository*/); + final questiaRepository = getIt(); + return AccountRemoteDatasourceImpl(questiaRepository); }); diff --git a/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart b/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart index 8ea067b9..5292c779 100644 --- a/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart @@ -1,4 +1,4 @@ -import 'package:account/src/features/linked_devices/presentation/linked_devices_screen.dart'; +// import 'package:account/src/features/linked_devices/presentation/linked_devices_screen.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -48,7 +48,7 @@ class AccountSettingsScreen extends ConsumerWidget { child: Column( children: [ AppSectionButton( - onPressed: (){}, + onPressed: (){navigationContract.pushTo(AppRoutes.personalData);}, icon: SFIcons.account, text: 'Personal Data' ), @@ -60,10 +60,7 @@ class AccountSettingsScreen extends ConsumerWidget { ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( - onPressed: (){Navigator.push( - context, - MaterialPageRoute(builder: (_) => LinkedDevicesScreen(navigationContract: navigationContract)), - );}, + onPressed: (){navigationContract.pushTo(AppRoutes.linkedDevices);}, icon: Icons.account_circle_outlined, text: 'Linked Devices' ), diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/domain/update_device_use_case.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/update_device_use_case.dart new file mode 100644 index 00000000..1d8d5f56 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/update_device_use_case.dart @@ -0,0 +1,4 @@ + +abstract class UpdateDeviceUseCase { + Future updateDevice({required String userId}); +} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/domain/update_device_use_case_impl.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/update_device_use_case_impl.dart new file mode 100644 index 00000000..ef7822c6 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/update_device_use_case_impl.dart @@ -0,0 +1,15 @@ +import 'package:account/src/core/domain/repositories/account_repository.dart'; +// import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +// import 'package:account/src/features/linked_devices/domain/get_linked_devices_use_case.dart'; +import 'package:account/src/features/linked_devices/domain/update_device_use_case.dart'; + +class UpdateDeviceUseCaseImpl implements UpdateDeviceUseCase { + UpdateDeviceUseCaseImpl(this._repository); + + final AccountRepository _repository; + + @override + Future updateDevice({required String userId}) async { + /*return _repository.updateDevice(userId: userId);*/ + } +} diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/linked_devices_builder.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/linked_devices_builder.dart new file mode 100644 index 00000000..38e11de3 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/linked_devices_builder.dart @@ -0,0 +1,19 @@ +// import 'package:account/src/features/account_settings/presentation/account_settings_screen.dart'; +import 'package:account/src/features/linked_devices/presentation/linked_devices_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 LinkedDevicesBuilder { + const LinkedDevicesBuilder(); + + Page buildPage(BuildContext context, GoRouterState state) { + final NavigationContract navigationContract = GetIt.I(); + + return MaterialPage( + key: state.pageKey, + child: LinkedDevicesScreen(navigationContract: navigationContract), + ); + } +} diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart index 1eeaea61..3e9b0a00 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart @@ -1,4 +1,5 @@ -import 'package:account/src/features/linked_devices/state/linked_devices_view_model.dart'; +import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:account/src/features/linked_devices/presentation/state/linked_devices_view_model.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -9,9 +10,9 @@ import 'package:utils/utils.dart'; class EditLinkedDeviceScreen extends ConsumerWidget { //final NavigationContract navigationContract; - final String deviceName; + final DeviceEntity device; - const EditLinkedDeviceScreen({super.key, required this.deviceName /*required this.navigationContract*/}); + const EditLinkedDeviceScreen({super.key, required this.device /*required this.navigationContract*/}); @override Widget build(BuildContext context, WidgetRef ref) { @@ -45,10 +46,10 @@ class EditLinkedDeviceScreen extends ConsumerWidget { ), ), SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)), - Container( + Expanded(child: Container( padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), - big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) + small: EdgeInsets.symmetric(horizontal: 48, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 47, vertical: 8) ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -82,15 +83,21 @@ class EditLinkedDeviceScreen extends ConsumerWidget { )) ], ), + SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)), CustomTextField( controller: vm.deviceNameController, - hint: deviceName, + hint: device.name, + label: 'Name', ) ], ), - PrimaryButton(text: 'Save', color: Color(0xFF588EA5)) + PrimaryButton( + onPressed: (){vm.updateDevice(device);}, + text: 'Save', + color: Color(0xFF588EA5) + ) ], - ) + )) ), ], ) diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart index f6e8e2e3..2cb0a086 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart @@ -1,5 +1,6 @@ +import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; import 'package:account/src/features/linked_devices/presentation/edit_linked_device_screen.dart'; -import 'package:account/src/features/linked_devices/state/linked_devices_view_model.dart'; +import 'package:account/src/features/linked_devices/presentation/state/linked_devices_view_model.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -68,8 +69,7 @@ class LinkedDevicesScreen extends ConsumerWidget { ), child: ListView.separated( itemBuilder: (BuildContext context, int index)=>LinkedDeviceCard( - name: state.linkedDevices[index].name, - body: state.linkedDevices[index].number, + device: state.linkedDevices[index], isEditing: state.isEditing, ), separatorBuilder: (BuildContext context, int index)=>SizedBox( @@ -87,13 +87,11 @@ class LinkedDevicesScreen extends ConsumerWidget { class LinkedDeviceCard extends ConsumerWidget { - final String name; - final String body; + final DeviceEntity device; final bool isEditing; const LinkedDeviceCard({ - required this.name, - required this.body, + required this.device, required this.isEditing, }); @@ -129,13 +127,13 @@ class LinkedDeviceCard extends ConsumerWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(name, + Text(device.name, style: TextStyle( fontSize: SizeUtils.getByScreen(small: 18, big: 19), fontWeight: FontWeight.w500 ) ), - Text(body, + Text(device.number, style: TextStyle( fontSize: SizeUtils.getByScreen(small: 14, big: 13), ) @@ -208,7 +206,7 @@ class LinkedDeviceCard extends ConsumerWidget { onPressed: (){Navigator.push( context, MaterialPageRoute(builder: (_) => EditLinkedDeviceScreen( - deviceName: name, + device: device, /*navigationContract: navigationContract*/ )), );}, diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/providers/update_device_use_case_provider.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/providers/update_device_use_case_provider.dart new file mode 100644 index 00000000..eb322aec --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/providers/update_device_use_case_provider.dart @@ -0,0 +1,9 @@ +import 'package:account/src/core/providers/account_repository_provider.dart'; +import 'package:account/src/features/linked_devices/domain/update_device_use_case.dart'; +import 'package:account/src/features/linked_devices/domain/update_device_use_case_impl.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +final updateDeviceUseCaseProvider = Provider.autoDispose((ref) { + final authRepository = ref.read(accountRepositoryProvider); + return UpdateDeviceUseCaseImpl(authRepository); +}); diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/state/linked_devices_view_model.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_model.dart similarity index 73% rename from modules/legacy/modules/account/lib/src/features/linked_devices/state/linked_devices_view_model.dart rename to modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_model.dart index 423d1c1d..4a3ead02 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/state/linked_devices_view_model.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_model.dart @@ -1,7 +1,9 @@ import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; import 'package:account/src/features/linked_devices/domain/get_linked_devices_use_case.dart'; +import 'package:account/src/features/linked_devices/domain/update_device_use_case.dart'; import 'package:account/src/features/linked_devices/presentation/providers/get_linked_devices_use_case_provider.dart'; -import 'package:account/src/features/linked_devices/state/linked_devices_view_state.dart'; +import 'package:account/src/features/linked_devices/presentation/providers/update_device_use_case_provider.dart'; +import 'package:account/src/features/linked_devices/presentation/state/linked_devices_view_state.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; // import 'package:sf_localizations/sf_localizations.dart'; @@ -13,12 +15,14 @@ NotifierProvider.autoDispose( class LinkedDevicesViewModel extends Notifier { late final GetLinkedDevicesUseCase _getLinkedDevicesUseCase; + late final UpdateDeviceUseCase _updateDeviceUseCase; late final TextEditingController deviceNameController; @override LinkedDevicesViewState build() { _getLinkedDevicesUseCase = ref.read(getLinkedDevicesUseCaseProvider); + _updateDeviceUseCase = ref.read(updateDeviceUseCaseProvider); deviceNameController = TextEditingController(); deviceNameController.addListener(_onDeviceNameChanged); @@ -49,6 +53,19 @@ class LinkedDevicesViewModel extends Notifier { ); } + void updateDevice(DeviceEntity device) { + final deviceName = state.deviceName; + + if (deviceName.isEmpty) { + state = state.copyWith( + errorMessage: '' + ); + return; + } + + + } + void disposeControllers() { deviceNameController.removeListener(_onDeviceNameChanged); deviceNameController.dispose(); diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/state/linked_devices_view_state.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_state.dart similarity index 86% rename from modules/legacy/modules/account/lib/src/features/linked_devices/state/linked_devices_view_state.dart rename to modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_state.dart index d381c926..62ec03c4 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/state/linked_devices_view_state.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_state.dart @@ -9,6 +9,7 @@ abstract class LinkedDevicesViewState with _$LinkedDevicesViewState { @Default(false) bool isLoading, @Default([]) List linkedDevices, @Default(false) bool isEditing, - @Default('') String deviceName + @Default('') String deviceName, + @Default('') String errorMessage }) = _LinkedDevicesViewState; } diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/state/linked_devices_view_state.freezed.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_state.freezed.dart similarity index 86% rename from modules/legacy/modules/account/lib/src/features/linked_devices/state/linked_devices_view_state.freezed.dart rename to modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_state.freezed.dart index df1cedc8..64b48bae 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/state/linked_devices_view_state.freezed.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_state.freezed.dart @@ -14,7 +14,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$LinkedDevicesViewState { - bool get isLoading; List get linkedDevices; bool get isEditing; String get deviceName; + bool get isLoading; List get linkedDevices; bool get isEditing; String get deviceName; String get errorMessage; /// Create a copy of LinkedDevicesViewState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -25,16 +25,16 @@ $LinkedDevicesViewStateCopyWith get copyWith => _$Linked @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is LinkedDevicesViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&const DeepCollectionEquality().equals(other.linkedDevices, linkedDevices)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is LinkedDevicesViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&const DeepCollectionEquality().equals(other.linkedDevices, linkedDevices)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); } @override -int get hashCode => Object.hash(runtimeType,isLoading,const DeepCollectionEquality().hash(linkedDevices),isEditing,deviceName); +int get hashCode => Object.hash(runtimeType,isLoading,const DeepCollectionEquality().hash(linkedDevices),isEditing,deviceName,errorMessage); @override String toString() { - return 'LinkedDevicesViewState(isLoading: $isLoading, linkedDevices: $linkedDevices, isEditing: $isEditing, deviceName: $deviceName)'; + return 'LinkedDevicesViewState(isLoading: $isLoading, linkedDevices: $linkedDevices, isEditing: $isEditing, deviceName: $deviceName, errorMessage: $errorMessage)'; } @@ -45,7 +45,7 @@ abstract mixin class $LinkedDevicesViewStateCopyWith<$Res> { factory $LinkedDevicesViewStateCopyWith(LinkedDevicesViewState value, $Res Function(LinkedDevicesViewState) _then) = _$LinkedDevicesViewStateCopyWithImpl; @useResult $Res call({ - bool isLoading, List linkedDevices, bool isEditing, String deviceName + bool isLoading, List linkedDevices, bool isEditing, String deviceName, String errorMessage }); @@ -62,12 +62,13 @@ class _$LinkedDevicesViewStateCopyWithImpl<$Res> /// Create a copy of LinkedDevicesViewState /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? linkedDevices = null,Object? isEditing = null,Object? deviceName = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? linkedDevices = null,Object? isEditing = null,Object? deviceName = null,Object? errorMessage = null,}) { return _then(_self.copyWith( isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable as bool,linkedDevices: null == linkedDevices ? _self.linkedDevices : linkedDevices // ignore: cast_nullable_to_non_nullable as List,isEditing: null == isEditing ? _self.isEditing : isEditing // ignore: cast_nullable_to_non_nullable as bool,deviceName: null == deviceName ? _self.deviceName : deviceName // ignore: cast_nullable_to_non_nullable +as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable as String, )); } @@ -153,10 +154,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( bool isLoading, List linkedDevices, bool isEditing, String deviceName)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( bool isLoading, List linkedDevices, bool isEditing, String deviceName, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _LinkedDevicesViewState() when $default != null: -return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.deviceName);case _: +return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.deviceName,_that.errorMessage);case _: return orElse(); } @@ -174,10 +175,10 @@ return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.device /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( bool isLoading, List linkedDevices, bool isEditing, String deviceName) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( bool isLoading, List linkedDevices, bool isEditing, String deviceName, String errorMessage) $default,) {final _that = this; switch (_that) { case _LinkedDevicesViewState(): -return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.deviceName);case _: +return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.deviceName,_that.errorMessage);case _: throw StateError('Unexpected subclass'); } @@ -194,10 +195,10 @@ return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.device /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool isLoading, List linkedDevices, bool isEditing, String deviceName)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool isLoading, List linkedDevices, bool isEditing, String deviceName, String errorMessage)? $default,) {final _that = this; switch (_that) { case _LinkedDevicesViewState() when $default != null: -return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.deviceName);case _: +return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.deviceName,_that.errorMessage);case _: return null; } @@ -209,7 +210,7 @@ return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.device class _LinkedDevicesViewState implements LinkedDevicesViewState { - const _LinkedDevicesViewState({this.isLoading = false, final List linkedDevices = const [], this.isEditing = false, this.deviceName = ''}): _linkedDevices = linkedDevices; + const _LinkedDevicesViewState({this.isLoading = false, final List linkedDevices = const [], this.isEditing = false, this.deviceName = '', this.errorMessage = ''}): _linkedDevices = linkedDevices; @override@JsonKey() final bool isLoading; @@ -222,6 +223,7 @@ class _LinkedDevicesViewState implements LinkedDevicesViewState { @override@JsonKey() final bool isEditing; @override@JsonKey() final String deviceName; +@override@JsonKey() final String errorMessage; /// Create a copy of LinkedDevicesViewState /// with the given fields replaced by the non-null parameter values. @@ -233,16 +235,16 @@ _$LinkedDevicesViewStateCopyWith<_LinkedDevicesViewState> get copyWith => __$Lin @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _LinkedDevicesViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&const DeepCollectionEquality().equals(other._linkedDevices, _linkedDevices)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _LinkedDevicesViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&const DeepCollectionEquality().equals(other._linkedDevices, _linkedDevices)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); } @override -int get hashCode => Object.hash(runtimeType,isLoading,const DeepCollectionEquality().hash(_linkedDevices),isEditing,deviceName); +int get hashCode => Object.hash(runtimeType,isLoading,const DeepCollectionEquality().hash(_linkedDevices),isEditing,deviceName,errorMessage); @override String toString() { - return 'LinkedDevicesViewState(isLoading: $isLoading, linkedDevices: $linkedDevices, isEditing: $isEditing, deviceName: $deviceName)'; + return 'LinkedDevicesViewState(isLoading: $isLoading, linkedDevices: $linkedDevices, isEditing: $isEditing, deviceName: $deviceName, errorMessage: $errorMessage)'; } @@ -253,7 +255,7 @@ abstract mixin class _$LinkedDevicesViewStateCopyWith<$Res> implements $LinkedDe factory _$LinkedDevicesViewStateCopyWith(_LinkedDevicesViewState value, $Res Function(_LinkedDevicesViewState) _then) = __$LinkedDevicesViewStateCopyWithImpl; @override @useResult $Res call({ - bool isLoading, List linkedDevices, bool isEditing, String deviceName + bool isLoading, List linkedDevices, bool isEditing, String deviceName, String errorMessage }); @@ -270,12 +272,13 @@ class __$LinkedDevicesViewStateCopyWithImpl<$Res> /// Create a copy of LinkedDevicesViewState /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? linkedDevices = null,Object? isEditing = null,Object? deviceName = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? linkedDevices = null,Object? isEditing = null,Object? deviceName = null,Object? errorMessage = null,}) { return _then(_LinkedDevicesViewState( isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable as bool,linkedDevices: null == linkedDevices ? _self._linkedDevices : linkedDevices // ignore: cast_nullable_to_non_nullable as List,isEditing: null == isEditing ? _self.isEditing : isEditing // ignore: cast_nullable_to_non_nullable as bool,deviceName: null == deviceName ? _self.deviceName : deviceName // ignore: cast_nullable_to_non_nullable +as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable as String, )); } diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/domain/entities/update_user_request_entity.dart b/modules/legacy/modules/account/lib/src/features/personal_data/domain/entities/update_user_request_entity.dart new file mode 100644 index 00000000..d172b542 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/personal_data/domain/entities/update_user_request_entity.dart @@ -0,0 +1,23 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'update_user_request_entity.freezed.dart'; + +@freezed +abstract class UpdateUserRequestEntity with _$UpdateUserRequestEntity { + const factory UpdateUserRequestEntity({ + required String id, + String? delegationId, + String? email, + String? createdAt, + String? updatedAt, + String? status, + String? role, + String? lastLogin, + String? currentLogin, + String? language, + String? firstName, + String? lastName, + String? hasApiKey, + String? phone, + }) = _UpdateUserRequestEntity; +} diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/domain/entities/update_user_request_entity.freezed.dart b/modules/legacy/modules/account/lib/src/features/personal_data/domain/entities/update_user_request_entity.freezed.dart new file mode 100644 index 00000000..74e60adc --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/personal_data/domain/entities/update_user_request_entity.freezed.dart @@ -0,0 +1,310 @@ +// 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 'update_user_request_entity.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$UpdateUserRequestEntity { + + String get id; String? get delegationId; String? get email; String? get createdAt; String? get updatedAt; String? get status; String? get role; String? get lastLogin; String? get currentLogin; String? get language; String? get firstName; String? get lastName; String? get hasApiKey; String? get phone; +/// Create a copy of UpdateUserRequestEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UpdateUserRequestEntityCopyWith get copyWith => _$UpdateUserRequestEntityCopyWithImpl(this as UpdateUserRequestEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UpdateUserRequestEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone)); +} + + +@override +int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone); + +@override +String toString() { + return 'UpdateUserRequestEntity(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)'; +} + + +} + +/// @nodoc +abstract mixin class $UpdateUserRequestEntityCopyWith<$Res> { + factory $UpdateUserRequestEntityCopyWith(UpdateUserRequestEntity value, $Res Function(UpdateUserRequestEntity) _then) = _$UpdateUserRequestEntityCopyWithImpl; +@useResult +$Res call({ + String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone +}); + + + + +} +/// @nodoc +class _$UpdateUserRequestEntityCopyWithImpl<$Res> + implements $UpdateUserRequestEntityCopyWith<$Res> { + _$UpdateUserRequestEntityCopyWithImpl(this._self, this._then); + + final UpdateUserRequestEntity _self; + final $Res Function(UpdateUserRequestEntity) _then; + +/// Create a copy of UpdateUserRequestEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? delegationId = freezed,Object? email = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? status = freezed,Object? role = freezed,Object? lastLogin = freezed,Object? currentLogin = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? hasApiKey = freezed,Object? phone = freezed,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable +as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable +as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable +as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable +as String?,lastLogin: freezed == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable +as String?,currentLogin: freezed == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable +as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable +as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable +as String?,hasApiKey: freezed == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable +as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + +} + + +/// Adds pattern-matching-related methods to [UpdateUserRequestEntity]. +extension UpdateUserRequestEntityPatterns on UpdateUserRequestEntity { +/// 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( _UpdateUserRequestEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _UpdateUserRequestEntity() 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( _UpdateUserRequestEntity value) $default,){ +final _that = this; +switch (_that) { +case _UpdateUserRequestEntity(): +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( _UpdateUserRequestEntity value)? $default,){ +final _that = this; +switch (_that) { +case _UpdateUserRequestEntity() 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? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _UpdateUserRequestEntity() when $default != null: +return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);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? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone) $default,) {final _that = this; +switch (_that) { +case _UpdateUserRequestEntity(): +return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);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? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone)? $default,) {final _that = this; +switch (_that) { +case _UpdateUserRequestEntity() when $default != null: +return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _UpdateUserRequestEntity implements UpdateUserRequestEntity { + const _UpdateUserRequestEntity({required this.id, this.delegationId, this.email, this.createdAt, this.updatedAt, this.status, this.role, this.lastLogin, this.currentLogin, this.language, this.firstName, this.lastName, this.hasApiKey, this.phone}); + + +@override final String id; +@override final String? delegationId; +@override final String? email; +@override final String? createdAt; +@override final String? updatedAt; +@override final String? status; +@override final String? role; +@override final String? lastLogin; +@override final String? currentLogin; +@override final String? language; +@override final String? firstName; +@override final String? lastName; +@override final String? hasApiKey; +@override final String? phone; + +/// Create a copy of UpdateUserRequestEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$UpdateUserRequestEntityCopyWith<_UpdateUserRequestEntity> get copyWith => __$UpdateUserRequestEntityCopyWithImpl<_UpdateUserRequestEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _UpdateUserRequestEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone)); +} + + +@override +int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone); + +@override +String toString() { + return 'UpdateUserRequestEntity(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)'; +} + + +} + +/// @nodoc +abstract mixin class _$UpdateUserRequestEntityCopyWith<$Res> implements $UpdateUserRequestEntityCopyWith<$Res> { + factory _$UpdateUserRequestEntityCopyWith(_UpdateUserRequestEntity value, $Res Function(_UpdateUserRequestEntity) _then) = __$UpdateUserRequestEntityCopyWithImpl; +@override @useResult +$Res call({ + String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone +}); + + + + +} +/// @nodoc +class __$UpdateUserRequestEntityCopyWithImpl<$Res> + implements _$UpdateUserRequestEntityCopyWith<$Res> { + __$UpdateUserRequestEntityCopyWithImpl(this._self, this._then); + + final _UpdateUserRequestEntity _self; + final $Res Function(_UpdateUserRequestEntity) _then; + +/// Create a copy of UpdateUserRequestEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? delegationId = freezed,Object? email = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? status = freezed,Object? role = freezed,Object? lastLogin = freezed,Object? currentLogin = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? hasApiKey = freezed,Object? phone = freezed,}) { + return _then(_UpdateUserRequestEntity( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable +as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable +as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable +as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable +as String?,lastLogin: freezed == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable +as String?,currentLogin: freezed == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable +as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable +as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable +as String?,hasApiKey: freezed == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable +as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/domain/entities/user_entity.dart b/modules/legacy/modules/account/lib/src/features/personal_data/domain/entities/user_entity.dart new file mode 100644 index 00000000..ccea2ef5 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/personal_data/domain/entities/user_entity.dart @@ -0,0 +1,23 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'user_entity.freezed.dart'; + +@freezed +abstract class UserEntity with _$UserEntity { + const factory UserEntity({ + required String id, + required String delegationId, + required String email, + required String createdAt, + required String updatedAt, + required String status, + required String role, + required String lastLogin, + required String currentLogin, + required String language, + required String firstName, + required String lastName, + required String hasApiKey, + required String phone, + }) = _UserEntity; +} diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/domain/entities/user_entity.freezed.dart b/modules/legacy/modules/account/lib/src/features/personal_data/domain/entities/user_entity.freezed.dart new file mode 100644 index 00000000..5b9e7aee --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/personal_data/domain/entities/user_entity.freezed.dart @@ -0,0 +1,310 @@ +// 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 'user_entity.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$UserEntity { + + String get id; String get delegationId; String get email; String get createdAt; String get updatedAt; String get status; String get role; String get lastLogin; String get currentLogin; String get language; String get firstName; String get lastName; String get hasApiKey; String get phone; +/// Create a copy of UserEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UserEntityCopyWith get copyWith => _$UserEntityCopyWithImpl(this as UserEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UserEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone)); +} + + +@override +int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone); + +@override +String toString() { + return 'UserEntity(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)'; +} + + +} + +/// @nodoc +abstract mixin class $UserEntityCopyWith<$Res> { + factory $UserEntityCopyWith(UserEntity value, $Res Function(UserEntity) _then) = _$UserEntityCopyWithImpl; +@useResult +$Res call({ + String id, String delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone +}); + + + + +} +/// @nodoc +class _$UserEntityCopyWithImpl<$Res> + implements $UserEntityCopyWith<$Res> { + _$UserEntityCopyWithImpl(this._self, this._then); + + final UserEntity _self; + final $Res Function(UserEntity) _then; + +/// Create a copy of UserEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? delegationId = null,Object? email = null,Object? createdAt = null,Object? updatedAt = null,Object? status = null,Object? role = null,Object? lastLogin = null,Object? currentLogin = null,Object? language = null,Object? firstName = null,Object? lastName = null,Object? hasApiKey = null,Object? phone = null,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,delegationId: null == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable +as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable +as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as String,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as String,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable +as String,role: null == role ? _self.role : role // ignore: cast_nullable_to_non_nullable +as String,lastLogin: null == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable +as String,currentLogin: null == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable +as String,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable +as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable +as String,hasApiKey: null == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable +as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [UserEntity]. +extension UserEntityPatterns on UserEntity { +/// 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( _UserEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _UserEntity() 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( _UserEntity value) $default,){ +final _that = this; +switch (_that) { +case _UserEntity(): +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( _UserEntity value)? $default,){ +final _that = this; +switch (_that) { +case _UserEntity() 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 delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _UserEntity() when $default != null: +return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);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 delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone) $default,) {final _that = this; +switch (_that) { +case _UserEntity(): +return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);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 delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone)? $default,) {final _that = this; +switch (_that) { +case _UserEntity() when $default != null: +return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _UserEntity implements UserEntity { + const _UserEntity({required this.id, required this.delegationId, required this.email, required this.createdAt, required this.updatedAt, required this.status, required this.role, required this.lastLogin, required this.currentLogin, required this.language, required this.firstName, required this.lastName, required this.hasApiKey, required this.phone}); + + +@override final String id; +@override final String delegationId; +@override final String email; +@override final String createdAt; +@override final String updatedAt; +@override final String status; +@override final String role; +@override final String lastLogin; +@override final String currentLogin; +@override final String language; +@override final String firstName; +@override final String lastName; +@override final String hasApiKey; +@override final String phone; + +/// Create a copy of UserEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$UserEntityCopyWith<_UserEntity> get copyWith => __$UserEntityCopyWithImpl<_UserEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _UserEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone)); +} + + +@override +int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone); + +@override +String toString() { + return 'UserEntity(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)'; +} + + +} + +/// @nodoc +abstract mixin class _$UserEntityCopyWith<$Res> implements $UserEntityCopyWith<$Res> { + factory _$UserEntityCopyWith(_UserEntity value, $Res Function(_UserEntity) _then) = __$UserEntityCopyWithImpl; +@override @useResult +$Res call({ + String id, String delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone +}); + + + + +} +/// @nodoc +class __$UserEntityCopyWithImpl<$Res> + implements _$UserEntityCopyWith<$Res> { + __$UserEntityCopyWithImpl(this._self, this._then); + + final _UserEntity _self; + final $Res Function(_UserEntity) _then; + +/// Create a copy of UserEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? delegationId = null,Object? email = null,Object? createdAt = null,Object? updatedAt = null,Object? status = null,Object? role = null,Object? lastLogin = null,Object? currentLogin = null,Object? language = null,Object? firstName = null,Object? lastName = null,Object? hasApiKey = null,Object? phone = null,}) { + return _then(_UserEntity( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,delegationId: null == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable +as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable +as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as String,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as String,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable +as String,role: null == role ? _self.role : role // ignore: cast_nullable_to_non_nullable +as String,lastLogin: null == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable +as String,currentLogin: null == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable +as String,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable +as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable +as String,hasApiKey: null == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable +as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case.dart b/modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case.dart new file mode 100644 index 00000000..e72cb24d --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case.dart @@ -0,0 +1,5 @@ +import 'package:account/src/features/personal_data/domain/entities/user_entity.dart'; + +abstract class GetLoggedUserUseCase { + Future getLoggedUser({required String token}); +} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case_impl.dart b/modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case_impl.dart new file mode 100644 index 00000000..5bdacc65 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case_impl.dart @@ -0,0 +1,13 @@ +import 'package:account/src/core/domain/repositories/account_repository.dart'; +import 'package:account/src/features/personal_data/domain/entities/user_entity.dart'; +import 'package:account/src/features/personal_data/domain/get_logged_user_use_case.dart'; + +class GetLoggedUserUseCaseImpl implements GetLoggedUserUseCase { + GetLoggedUserUseCaseImpl(this._repository); + + final AccountRepository _repository; + @override + Future getLoggedUser({required String token}) { + return _repository.getLoggedUser(token: token); + } +} diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/domain/update_user_use_case.dart b/modules/legacy/modules/account/lib/src/features/personal_data/domain/update_user_use_case.dart new file mode 100644 index 00000000..1522c875 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/personal_data/domain/update_user_use_case.dart @@ -0,0 +1,5 @@ +import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; + +abstract class UpdateUserUseCase { + Future updateUser({required String userId, required UpdateUserRequestEntity request}); +} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/domain/update_user_use_case_impl.dart b/modules/legacy/modules/account/lib/src/features/personal_data/domain/update_user_use_case_impl.dart new file mode 100644 index 00000000..16b4a805 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/personal_data/domain/update_user_use_case_impl.dart @@ -0,0 +1,13 @@ +import 'package:account/src/core/domain/repositories/account_repository.dart'; +import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; +import 'package:account/src/features/personal_data/domain/update_user_use_case.dart'; + +class UpdateUserUseCaseImpl implements UpdateUserUseCase { + UpdateUserUseCaseImpl(this._repository); + + final AccountRepository _repository; + @override + Future updateUser({required String userId, required UpdateUserRequestEntity request}) { + return _repository.updateUser(userId: userId, request: request); + } +} diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/personal_data_builder.dart b/modules/legacy/modules/account/lib/src/features/personal_data/personal_data_builder.dart new file mode 100644 index 00000000..b06d2cdc --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/personal_data/personal_data_builder.dart @@ -0,0 +1,19 @@ +// import 'package:account/src/features/account_settings/presentation/account_settings_screen.dart'; +import 'package:account/src/features/personal_data/presentation/personal_data_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 PersonalDataBuilder { + const PersonalDataBuilder(); + + Page buildPage(BuildContext context, GoRouterState state) { + final NavigationContract navigationContract = GetIt.I(); + + return MaterialPage( + key: state.pageKey, + child: PersonalDataScreen(navigationContract: navigationContract), + ); + } +} diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/personal_data_screen.dart b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/personal_data_screen.dart new file mode 100644 index 00000000..dc88d957 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/personal_data_screen.dart @@ -0,0 +1,132 @@ +import 'package:account/src/features/personal_data/presentation/state/personal_data_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_svg/flutter_svg.dart'; +import 'package:navigation/navigation.dart'; +import 'package:sf_localizations/sf_localizations.dart'; +import 'package:utils/utils.dart'; + +class PersonalDataScreen extends ConsumerWidget { + final NavigationContract navigationContract; + + const PersonalDataScreen({super.key, required this.navigationContract}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final vm = ref.read(personalDataViewModelProvider.notifier); + final state = ref.watch(personalDataViewModelProvider); + + final theme = ref.watch(themePortProvider); + + return Scaffold( + backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + body: SafeArea( + child: Column( + children: [ + Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) + ), + child: Stack( + children: [ + IconButton(onPressed: () {Navigator.pop(context);}, + icon: Icon(Icons.arrow_back)), + Center( + child: Text(context.translate('Personal data'), + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 28, big: 27) + ), + ) + ) + ], + ), + ), + SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)), + Expanded(child: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 48, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 47, vertical: 8) + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded(child: SingleChildScrollView(child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Stack( + children: [ + Center(child: SvgPicture.asset('assets/images/ui/profile.svg')), + Center(child: SizedBox( + width: 160, + height: 160, + child: Align(alignment: Alignment.bottomRight, + child: IconButton( + onPressed: (){}, + icon: Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Color(0xFFCAC9C9) + ), + padding: EdgeInsets.all(8), + child: Icon( + Icons.edit_outlined, + color: Colors.white, + size: SizeUtils.getByScreen(small: 32, big: 30), + ), + ), + ) + ) + )) + ], + ), + SizedBox(height: SizeUtils.getByScreen(small: 18, big: 16)), + Text('(Login email)', + style: TextStyle(fontSize: SizeUtils.getByScreen(small: 14, big: 13)) + ), + Text(state.user?.email ?? '', + style: TextStyle(fontSize: SizeUtils.getByScreen(small: 18, big: 17)) + ), + SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)), + CustomTextField( + controller: vm.nameController, + hint: state.user?.firstName ?? '', + label: 'Name', + ), + SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)), + CustomTextField( + controller: vm.phoneController, + hint: state.user?.phone ?? '', + label: 'Phone number', + ), + SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)), + CustomTextField( + controller: vm.emailController, + hint: state.user?.email ?? '', + label: 'Email', + ), + SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)), + CustomTextField( + controller: vm.passwordController, + showPassword: state.showPassword, + hint: '********', + label: 'Password (6 to 12 digits)', + ), + ], + ))), + SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)), + PrimaryButton( + onPressed: vm.updateUser, + text: 'Submit', + color: Color(0xFF588EA5) + ) + ], + )) + ), + ], + ) + ), + ); + } +} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/providers/get_logged_user_use_case_provider.dart b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/providers/get_logged_user_use_case_provider.dart new file mode 100644 index 00000000..eb501024 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/providers/get_logged_user_use_case_provider.dart @@ -0,0 +1,9 @@ +import 'package:account/src/core/providers/account_repository_provider.dart'; +import 'package:account/src/features/personal_data/domain/get_logged_user_use_case.dart'; +import 'package:account/src/features/personal_data/domain/get_logged_user_use_case_impl.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +final getLoggedUserUseCaseProvider = Provider.autoDispose((ref) { + final authRepository = ref.read(accountRepositoryProvider); + return GetLoggedUserUseCaseImpl(authRepository); +}); diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/providers/update_user_use_case_provider.dart b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/providers/update_user_use_case_provider.dart new file mode 100644 index 00000000..699c9075 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/providers/update_user_use_case_provider.dart @@ -0,0 +1,9 @@ +import 'package:account/src/core/providers/account_repository_provider.dart'; +import 'package:account/src/features/personal_data/domain/update_user_use_case.dart'; +import 'package:account/src/features/personal_data/domain/update_user_use_case_impl.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +final updateUserUseCaseProvider = Provider.autoDispose((ref) { + final authRepository = ref.read(accountRepositoryProvider); + return UpdateUserUseCaseImpl(authRepository); +}); diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_model.dart b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_model.dart new file mode 100644 index 00000000..229c285b --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_model.dart @@ -0,0 +1,155 @@ +import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; +import 'package:account/src/features/personal_data/domain/entities/user_entity.dart'; +import 'package:account/src/features/personal_data/domain/get_logged_user_use_case.dart'; +import 'package:account/src/features/personal_data/domain/update_user_use_case.dart'; +import 'package:account/src/features/personal_data/presentation/providers/get_logged_user_use_case_provider.dart'; +import 'package:account/src/features/personal_data/presentation/providers/update_user_use_case_provider.dart'; +import 'package:account/src/features/personal_data/presentation/state/personal_data_view_state.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +// import 'package:sf_localizations/sf_localizations.dart'; + +final personalDataViewModelProvider = +NotifierProvider.autoDispose( + PersonalDataViewModel.new, +); + +class PersonalDataViewModel extends Notifier { + late final GetLoggedUserUseCase _getUserUseCase; + late final UpdateUserUseCase _updateUserUseCase; + + late final TextEditingController nameController; + late final TextEditingController emailController; + late final TextEditingController phoneController; + late final TextEditingController passwordController; + + @override + PersonalDataViewState build() { + _getUserUseCase = ref.read(getLoggedUserUseCaseProvider); + _updateUserUseCase = ref.read(updateUserUseCaseProvider); + + nameController = TextEditingController(); + nameController.addListener(_onNameChanged); + + emailController = TextEditingController(); + emailController.addListener(_onEmailChanged); + + phoneController = TextEditingController(); + phoneController.addListener(_onPhoneChanged); + + passwordController = TextEditingController(); + passwordController.addListener(_onPasswordChanged); + + _getUserUseCase.getLoggedUser(token: 'test') + .then(setUser); + + ref.onDispose(disposeControllers); + + return const PersonalDataViewState(); + } + + void setUser(UserEntity user) { + state = state.copyWith(user: user); + } + + void _onNameChanged() { + final value = nameController.text; + + if (value == state.name) return; + + state = state.copyWith( + name: value, + ); + } + + void _onEmailChanged() { + final value = emailController.text; + + if (value == state.email) return; + + state = state.copyWith( + email: value, + ); + } + + void _onPhoneChanged() { + final value = phoneController.text; + + if (value == state.phoneNumber) return; + + state = state.copyWith( + phoneNumber: value, + ); + } + + void _onPasswordChanged() { + final value = passwordController.text; + + if (value == state.password) return; + + state = state.copyWith( + password: value, + ); + } + + bool _validateForm() { + if (state.name.trim().isEmpty && + state.email.trim().isEmpty && + state.phoneNumber.trim().isEmpty && + state.password.trim().isEmpty) { + state = state.copyWith(errorMessage: 'errorMessageAllFieldsAreEmpty'); + return false; + } + return true; + } + + UpdateUserRequestEntity _toRequest() { + + return UpdateUserRequestEntity( + id: state.user!.id, + //name: state.name.trim(), + email: state.email.trim(), + phone: /*state.dialCode.trim() + */state.phoneNumber.trim(), + ); + } + + Future updateUser() async { + if (state.isLoading) return false; + if (!_validateForm()) return false; + + try { + final request = _toRequest(); + + _updateUserUseCase.updateUser(userId: state.user!.id, request: request); + + return true; + } catch (e) { + if (!ref.mounted) return false; + _finishWithError(message: e.toString()); + return false; + } + + } + + void _finishWithError({required String message}) { + state = state.copyWith( + isLoading: false, + errorMessage: message, + ); + } + + void disposeControllers() { + nameController.removeListener(_onNameChanged); + nameController.dispose(); + + emailController.removeListener(_onEmailChanged); + emailController.dispose(); + + phoneController.removeListener(_onPhoneChanged); + phoneController.dispose(); + + passwordController.removeListener(_onPasswordChanged); + passwordController.dispose(); + + } +} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_state.dart b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_state.dart new file mode 100644 index 00000000..a26ed33f --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_state.dart @@ -0,0 +1,18 @@ +import 'package:account/src/features/personal_data/domain/entities/user_entity.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'personal_data_view_state.freezed.dart'; + +@freezed +abstract class PersonalDataViewState with _$PersonalDataViewState { + const factory PersonalDataViewState({ + @Default(true) bool isLoading, + @Default(null) UserEntity? user, + @Default('') String name, + @Default('') String phoneNumber, + @Default('') String email, + @Default('') String password, + @Default(false) bool showPassword, + @Default('') String errorMessage + }) = _PersonalDataViewState; +} diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_state.freezed.dart b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_state.freezed.dart new file mode 100644 index 00000000..7cdc8c6b --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_state.freezed.dart @@ -0,0 +1,316 @@ +// 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 'personal_data_view_state.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$PersonalDataViewState { + + bool get isLoading; UserEntity? get user; String get name; String get phoneNumber; String get email; String get password; bool get showPassword; String get errorMessage; +/// Create a copy of PersonalDataViewState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$PersonalDataViewStateCopyWith get copyWith => _$PersonalDataViewStateCopyWithImpl(this as PersonalDataViewState, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is PersonalDataViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.user, user) || other.user == user)&&(identical(other.name, name) || other.name == name)&&(identical(other.phoneNumber, phoneNumber) || other.phoneNumber == phoneNumber)&&(identical(other.email, email) || other.email == email)&&(identical(other.password, password) || other.password == password)&&(identical(other.showPassword, showPassword) || other.showPassword == showPassword)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); +} + + +@override +int get hashCode => Object.hash(runtimeType,isLoading,user,name,phoneNumber,email,password,showPassword,errorMessage); + +@override +String toString() { + return 'PersonalDataViewState(isLoading: $isLoading, user: $user, name: $name, phoneNumber: $phoneNumber, email: $email, password: $password, showPassword: $showPassword, errorMessage: $errorMessage)'; +} + + +} + +/// @nodoc +abstract mixin class $PersonalDataViewStateCopyWith<$Res> { + factory $PersonalDataViewStateCopyWith(PersonalDataViewState value, $Res Function(PersonalDataViewState) _then) = _$PersonalDataViewStateCopyWithImpl; +@useResult +$Res call({ + bool isLoading, UserEntity? user, String name, String phoneNumber, String email, String password, bool showPassword, String errorMessage +}); + + +$UserEntityCopyWith<$Res>? get user; + +} +/// @nodoc +class _$PersonalDataViewStateCopyWithImpl<$Res> + implements $PersonalDataViewStateCopyWith<$Res> { + _$PersonalDataViewStateCopyWithImpl(this._self, this._then); + + final PersonalDataViewState _self; + final $Res Function(PersonalDataViewState) _then; + +/// Create a copy of PersonalDataViewState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? user = freezed,Object? name = null,Object? phoneNumber = null,Object? email = null,Object? password = null,Object? showPassword = null,Object? errorMessage = null,}) { + return _then(_self.copyWith( +isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable +as bool,user: freezed == user ? _self.user : user // ignore: cast_nullable_to_non_nullable +as UserEntity?,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,phoneNumber: null == phoneNumber ? _self.phoneNumber : phoneNumber // ignore: cast_nullable_to_non_nullable +as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable +as String,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable +as String,showPassword: null == showPassword ? _self.showPassword : showPassword // ignore: cast_nullable_to_non_nullable +as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable +as String, + )); +} +/// Create a copy of PersonalDataViewState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$UserEntityCopyWith<$Res>? get user { + if (_self.user == null) { + return null; + } + + return $UserEntityCopyWith<$Res>(_self.user!, (value) { + return _then(_self.copyWith(user: value)); + }); +} +} + + +/// Adds pattern-matching-related methods to [PersonalDataViewState]. +extension PersonalDataViewStatePatterns on PersonalDataViewState { +/// 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( _PersonalDataViewState value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _PersonalDataViewState() 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( _PersonalDataViewState value) $default,){ +final _that = this; +switch (_that) { +case _PersonalDataViewState(): +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( _PersonalDataViewState value)? $default,){ +final _that = this; +switch (_that) { +case _PersonalDataViewState() 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( bool isLoading, UserEntity? user, String name, String phoneNumber, String email, String password, bool showPassword, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _PersonalDataViewState() when $default != null: +return $default(_that.isLoading,_that.user,_that.name,_that.phoneNumber,_that.email,_that.password,_that.showPassword,_that.errorMessage);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( bool isLoading, UserEntity? user, String name, String phoneNumber, String email, String password, bool showPassword, String errorMessage) $default,) {final _that = this; +switch (_that) { +case _PersonalDataViewState(): +return $default(_that.isLoading,_that.user,_that.name,_that.phoneNumber,_that.email,_that.password,_that.showPassword,_that.errorMessage);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( bool isLoading, UserEntity? user, String name, String phoneNumber, String email, String password, bool showPassword, String errorMessage)? $default,) {final _that = this; +switch (_that) { +case _PersonalDataViewState() when $default != null: +return $default(_that.isLoading,_that.user,_that.name,_that.phoneNumber,_that.email,_that.password,_that.showPassword,_that.errorMessage);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _PersonalDataViewState implements PersonalDataViewState { + const _PersonalDataViewState({this.isLoading = true, this.user = null, this.name = '', this.phoneNumber = '', this.email = '', this.password = '', this.showPassword = false, this.errorMessage = ''}); + + +@override@JsonKey() final bool isLoading; +@override@JsonKey() final UserEntity? user; +@override@JsonKey() final String name; +@override@JsonKey() final String phoneNumber; +@override@JsonKey() final String email; +@override@JsonKey() final String password; +@override@JsonKey() final bool showPassword; +@override@JsonKey() final String errorMessage; + +/// Create a copy of PersonalDataViewState +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$PersonalDataViewStateCopyWith<_PersonalDataViewState> get copyWith => __$PersonalDataViewStateCopyWithImpl<_PersonalDataViewState>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _PersonalDataViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.user, user) || other.user == user)&&(identical(other.name, name) || other.name == name)&&(identical(other.phoneNumber, phoneNumber) || other.phoneNumber == phoneNumber)&&(identical(other.email, email) || other.email == email)&&(identical(other.password, password) || other.password == password)&&(identical(other.showPassword, showPassword) || other.showPassword == showPassword)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); +} + + +@override +int get hashCode => Object.hash(runtimeType,isLoading,user,name,phoneNumber,email,password,showPassword,errorMessage); + +@override +String toString() { + return 'PersonalDataViewState(isLoading: $isLoading, user: $user, name: $name, phoneNumber: $phoneNumber, email: $email, password: $password, showPassword: $showPassword, errorMessage: $errorMessage)'; +} + + +} + +/// @nodoc +abstract mixin class _$PersonalDataViewStateCopyWith<$Res> implements $PersonalDataViewStateCopyWith<$Res> { + factory _$PersonalDataViewStateCopyWith(_PersonalDataViewState value, $Res Function(_PersonalDataViewState) _then) = __$PersonalDataViewStateCopyWithImpl; +@override @useResult +$Res call({ + bool isLoading, UserEntity? user, String name, String phoneNumber, String email, String password, bool showPassword, String errorMessage +}); + + +@override $UserEntityCopyWith<$Res>? get user; + +} +/// @nodoc +class __$PersonalDataViewStateCopyWithImpl<$Res> + implements _$PersonalDataViewStateCopyWith<$Res> { + __$PersonalDataViewStateCopyWithImpl(this._self, this._then); + + final _PersonalDataViewState _self; + final $Res Function(_PersonalDataViewState) _then; + +/// Create a copy of PersonalDataViewState +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? user = freezed,Object? name = null,Object? phoneNumber = null,Object? email = null,Object? password = null,Object? showPassword = null,Object? errorMessage = null,}) { + return _then(_PersonalDataViewState( +isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable +as bool,user: freezed == user ? _self.user : user // ignore: cast_nullable_to_non_nullable +as UserEntity?,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,phoneNumber: null == phoneNumber ? _self.phoneNumber : phoneNumber // ignore: cast_nullable_to_non_nullable +as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable +as String,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable +as String,showPassword: null == showPassword ? _self.showPassword : showPassword // ignore: cast_nullable_to_non_nullable +as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +/// Create a copy of PersonalDataViewState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$UserEntityCopyWith<$Res>? get user { + if (_self.user == null) { + return null; + } + + return $UserEntityCopyWith<$Res>(_self.user!, (value) { + return _then(_self.copyWith(user: value)); + }); +} +} + +// dart format on diff --git a/packages/design_system/fonts/config.json b/packages/design_system/fonts/config.json index b2d52b8e..f5d60ba5 100644 --- a/packages/design_system/fonts/config.json +++ b/packages/design_system/fonts/config.json @@ -87,7 +87,7 @@ "width": 1000 }, "search": [ - "icon" + "functions" ] }, { diff --git a/packages/navigation/lib/app_routes.dart b/packages/navigation/lib/app_routes.dart index f95c5b2f..7e26ea86 100644 --- a/packages/navigation/lib/app_routes.dart +++ b/packages/navigation/lib/app_routes.dart @@ -18,6 +18,9 @@ class AppRoutes { static const legacy = '/legacy'; static const accountSettings = '$legacy/account_settings'; + static const personalData = '$accountSettings/personal_data'; + static const linkedDevices = '$accountSettings/linked_devices'; + static const legacyDashboard = '$legacy/dashboard'; static const dashboardHub = '$legacyDashboard/hub'; From 3955fbf4bc536376ed4f26cc5a7b93fd7c2be5ce Mon Sep 17 00:00:00 2001 From: aitorarana Date: Tue, 3 Feb 2026 10:57:57 +0100 Subject: [PATCH 07/25] added app_users screen and states --- .../mobile_app/lib/navigation/app_router.dart | 5 + .../datasource/account_remote_datasource.dart | 4 +- .../account_remote_datasource_impl.dart | 51 +++- .../data/models}/entities/user_entity.dart | 0 .../models}/entities/user_entity.freezed.dart | 0 .../get_logged_user_response_model.dart | 2 +- .../repositories/account_repository_impl.dart | 7 +- .../repositories/account_repository.dart | 4 +- .../presentation/account_settings_screen.dart | 4 +- .../features/app_users/app_users_builder.dart | 18 ++ .../domain/get_app_users_use_case.dart | 5 + .../domain/get_app_users_use_case_impl.dart | 14 + .../presentation/app_users_screen.dart | 223 ++++++++++++++ .../get_app_users_use_case_provider.dart | 9 + .../state/app_users_view_model.dart | 33 ++ .../state/app_users_view_state.dart | 14 + .../state/app_users_view_state.freezed.dart | 286 ++++++++++++++++++ .../domain/get_logged_user_use_case.dart | 2 +- .../domain/get_logged_user_use_case_impl.dart | 2 +- .../state/personal_data_view_model.dart | 2 +- .../state/personal_data_view_state.dart | 2 +- packages/navigation/lib/app_routes.dart | 1 + 22 files changed, 677 insertions(+), 11 deletions(-) rename modules/legacy/modules/account/lib/src/{features/personal_data/domain => core/data/models}/entities/user_entity.dart (100%) rename modules/legacy/modules/account/lib/src/{features/personal_data/domain => core/data/models}/entities/user_entity.freezed.dart (100%) create mode 100644 modules/legacy/modules/account/lib/src/features/app_users/app_users_builder.dart create mode 100644 modules/legacy/modules/account/lib/src/features/app_users/domain/get_app_users_use_case.dart create mode 100644 modules/legacy/modules/account/lib/src/features/app_users/domain/get_app_users_use_case_impl.dart create mode 100644 modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart create mode 100644 modules/legacy/modules/account/lib/src/features/app_users/presentation/providers/get_app_users_use_case_provider.dart create mode 100644 modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_model.dart create mode 100644 modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_state.dart create mode 100644 modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_state.freezed.dart diff --git a/apps/mobile_app/lib/navigation/app_router.dart b/apps/mobile_app/lib/navigation/app_router.dart index cb5a85bc..0b5d3a13 100644 --- a/apps/mobile_app/lib/navigation/app_router.dart +++ b/apps/mobile_app/lib/navigation/app_router.dart @@ -58,6 +58,11 @@ void configureAppRouter() { name: 'linked_devices', pageBuilder: LinkedDevicesBuilder().buildPage, ), + GoRoute( + path: AppRoutes.appUsers, + name: 'app_users', + pageBuilder: AppUsersBuilder().buildPage, + ), GoRoute( path: AppRoutes.login, diff --git a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart index 496c1b40..4b5196a3 100644 --- a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart +++ b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart @@ -1,6 +1,6 @@ import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; -import 'package:account/src/features/personal_data/domain/entities/user_entity.dart'; +import 'package:account/src/core/data/models/entities/user_entity.dart'; abstract class AccountRemoteDatasource { Future> getLinkedDevices({required String userId}); @@ -8,4 +8,6 @@ abstract class AccountRemoteDatasource { Future getLoggedUser({required String token}); Future updateUser({required String userId, required UpdateUserRequestEntity request}); + + Future> getAppUsers({required String userId}); } diff --git a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart index 1e5818f4..21090f71 100644 --- a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart +++ b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart @@ -6,7 +6,7 @@ import 'package:account/src/core/data/models/get_logged_user_response_model.dart import 'package:account/src/core/data/models/update_user_request_model.dart'; import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; -import 'package:account/src/features/personal_data/domain/entities/user_entity.dart'; +import 'package:account/src/core/data/models/entities/user_entity.dart'; import 'package:dio/dio.dart'; // import 'package:flutter/material.dart'; import 'package:sf_infrastructure/sf_infrastructure.dart'; @@ -87,6 +87,55 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource { throw _mapDioError(error, defaultMessage: 'Error in verification code'); } } + + @override + Future> getAppUsers({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 = GetLinkedDevicesResponseModel.fromJson(data);*/ + /*final model = GetLinkedDevicesResponseModel(items: [ + GetLinkedDevicesItemResponseModel( + identificator: '1111', + name: 'Carlos', + number: '111111111'), + GetLinkedDevicesItemResponseModel( + identificator: '1112', + name: 'Ana', + number: '222222222'), + ]); + return model.toEntity(); + } on DioException catch (error) { + throw _mapDioError( + error, + defaultMessage: error.message ?? 'Error getting devices', + ); + }*/ + return [ + UserEntity( + id: 'id', + delegationId: 'delegationId', + email: 'email', + createdAt: 'createdAt', + updatedAt: 'updatedAt', + status: 'status', + role: 'role', + lastLogin: 'lastLogin', + currentLogin: 'currentLogin', + language: 'language', + firstName: 'firstName', + lastName: 'lastName', + hasApiKey: 'hasApiKey', + phone: 'phone', + ) + ]; + } } Exception _mapDioError(DioException error, {required String defaultMessage}) { diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/domain/entities/user_entity.dart b/modules/legacy/modules/account/lib/src/core/data/models/entities/user_entity.dart similarity index 100% rename from modules/legacy/modules/account/lib/src/features/personal_data/domain/entities/user_entity.dart rename to modules/legacy/modules/account/lib/src/core/data/models/entities/user_entity.dart diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/domain/entities/user_entity.freezed.dart b/modules/legacy/modules/account/lib/src/core/data/models/entities/user_entity.freezed.dart similarity index 100% rename from modules/legacy/modules/account/lib/src/features/personal_data/domain/entities/user_entity.freezed.dart rename to modules/legacy/modules/account/lib/src/core/data/models/entities/user_entity.freezed.dart diff --git a/modules/legacy/modules/account/lib/src/core/data/models/get_logged_user_response_model.dart b/modules/legacy/modules/account/lib/src/core/data/models/get_logged_user_response_model.dart index 86d040cc..7ba4f44a 100644 --- a/modules/legacy/modules/account/lib/src/core/data/models/get_logged_user_response_model.dart +++ b/modules/legacy/modules/account/lib/src/core/data/models/get_logged_user_response_model.dart @@ -1,4 +1,4 @@ -import 'package:account/src/features/personal_data/domain/entities/user_entity.dart'; +import 'package:account/src/core/data/models/entities/user_entity.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'get_logged_user_response_model.freezed.dart'; diff --git a/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart b/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart index d22d920e..54ae304e 100644 --- a/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart +++ b/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart @@ -2,7 +2,7 @@ import 'package:account/src/core/data/datasource/account_remote_datasource.dart' import 'package:account/src/core/domain/repositories/account_repository.dart'; import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; -import 'package:account/src/features/personal_data/domain/entities/user_entity.dart'; +import 'package:account/src/core/data/models/entities/user_entity.dart'; class AccountRepositoryImpl implements AccountRepository { const AccountRepositoryImpl(this._remote); @@ -23,4 +23,9 @@ class AccountRepositoryImpl implements AccountRepository { Future updateUser({required String userId, required UpdateUserRequestEntity request}) { return _remote.updateUser(userId: userId, request: request); } + + @override + Future> getAppUsers({required String userId}) { + return _remote.getAppUsers(userId: userId); + } } diff --git a/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart b/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart index bb258786..237b7c5e 100644 --- a/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart +++ b/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart @@ -1,6 +1,6 @@ import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; -import 'package:account/src/features/personal_data/domain/entities/user_entity.dart'; +import 'package:account/src/core/data/models/entities/user_entity.dart'; abstract class AccountRepository { Future> getLinkedDevices({required String userId}); @@ -8,4 +8,6 @@ abstract class AccountRepository { Future updateUser({required String userId, required UpdateUserRequestEntity request}); Future getLoggedUser({required String token}); + + Future> getAppUsers({required String userId}); } diff --git a/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart b/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart index 5292c779..16c447f6 100644 --- a/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart @@ -1,4 +1,4 @@ -// import 'package:account/src/features/linked_devices/presentation/linked_devices_screen.dart'; +// import 'package:account/src/features/linked_devices/presentation/app_users_screen.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -66,7 +66,7 @@ class AccountSettingsScreen extends ConsumerWidget { ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( - onPressed: (){}, + onPressed: (){navigationContract.pushTo(AppRoutes.appUsers);}, icon: Icons.groups_outlined, text: 'App Users' ), diff --git a/modules/legacy/modules/account/lib/src/features/app_users/app_users_builder.dart b/modules/legacy/modules/account/lib/src/features/app_users/app_users_builder.dart new file mode 100644 index 00000000..5b06f854 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/app_users/app_users_builder.dart @@ -0,0 +1,18 @@ +import 'package:account/src/features/app_users/presentation/app_users_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 AppUsersBuilder { + const AppUsersBuilder(); + + Page buildPage(BuildContext context, GoRouterState state) { + final NavigationContract navigationContract = GetIt.I(); + + return MaterialPage( + key: state.pageKey, + child: AppUsersScreen(navigationContract: navigationContract), + ); + } +} diff --git a/modules/legacy/modules/account/lib/src/features/app_users/domain/get_app_users_use_case.dart b/modules/legacy/modules/account/lib/src/features/app_users/domain/get_app_users_use_case.dart new file mode 100644 index 00000000..42d0896d --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/app_users/domain/get_app_users_use_case.dart @@ -0,0 +1,5 @@ +import 'package:account/src/core/data/models/entities/user_entity.dart'; + +abstract class GetAppUsersUseCase { + Future> getAppUsers({required String userId}); +} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/app_users/domain/get_app_users_use_case_impl.dart b/modules/legacy/modules/account/lib/src/features/app_users/domain/get_app_users_use_case_impl.dart new file mode 100644 index 00000000..d446e24b --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/app_users/domain/get_app_users_use_case_impl.dart @@ -0,0 +1,14 @@ +import 'package:account/src/core/data/models/entities/user_entity.dart'; +import 'package:account/src/core/domain/repositories/account_repository.dart'; +import 'package:account/src/features/app_users/domain/get_app_users_use_case.dart'; + +class GetAppUsersUseCaseImpl implements GetAppUsersUseCase { + GetAppUsersUseCaseImpl(this._repository); + + final AccountRepository _repository; + + @override + Future> getAppUsers({required String userId}) { + return _repository.getAppUsers(userId: userId); + } +} diff --git a/modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart b/modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart new file mode 100644 index 00000000..65516ec9 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart @@ -0,0 +1,223 @@ +import 'package:account/src/core/data/models/entities/user_entity.dart'; +import 'package:account/src/features/app_users/presentation/state/app_users_view_model.dart'; +import 'package:design_system/design_system.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:navigation/navigation.dart'; +import 'package:sf_localizations/sf_localizations.dart'; +import 'package:utils/utils.dart'; + +class AppUsersScreen extends ConsumerWidget { + final NavigationContract navigationContract; + + const AppUsersScreen({super.key, required this.navigationContract}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final vm = ref.read(appUsersViewModelProvider.notifier); + final state = ref.watch(appUsersViewModelProvider); + + final theme = ref.watch(themePortProvider); + + return Scaffold( + backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + body: SafeArea( + child: Column( + children: [ + Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) + ), + child: Stack( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + IconButton(onPressed: () {Navigator.pop(context);}, + icon: Icon(Icons.arrow_back)), + if (!state.isEditing) ...[ + DecoratedBox( + decoration: BoxDecoration( + color: Color(0xFF588EA5), + shape: BoxShape.circle + ), + child: IconButton(onPressed: vm.toggleIsEditing, + icon: Icon(Icons.edit_outlined, + color: Colors.white, + size: SizeUtils.getByScreen(small: 30, big: 28), + ) + ), + ) + ] + ], + ), + Center( + child: Text(context.translate('App users'), + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 28, big: 27) + ), + ) + ) + ], + ), + ), + SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)), + Expanded( child: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) + ), + child: ListView.separated( + itemBuilder: (BuildContext context, int index)=>AppUserCard( + user: state.appUsers[index], + isEditing: state.isEditing, + ), + separatorBuilder: (BuildContext context, int index)=>SizedBox( + height: SizeUtils.getByScreen(small: 18, big: 17) + ), + itemCount: state.appUsers.length + ), + )), + if (state.isEditing) ...[ + Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 26, vertical: 14), + big: EdgeInsets.symmetric(horizontal: 24, vertical: 12) + ), + child: PrimaryButton( + onPressed: vm.toggleIsEditing, + text: 'Save', + color: Color(0xFF588EA5), + height: SizeUtils.getByScreen(small: 44, big: 42), + ), + ), + ] + ], + ) + ), + ); + } +} + +class AppUserCard extends ConsumerWidget { + + final UserEntity user; + final bool isEditing; + + const AppUserCard({ + required this.user, + required this.isEditing, + }); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.read(themePortProvider); + + return 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(SFIcons.account, + size: SizeUtils.getByScreen(small: 40, big: 44), + color: Color(0xFF588EA5), + weight: 30, + ), + ), + SizedBox(width: SizeUtils.getByScreen(small: 16, big: 15)), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(user.firstName, + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 18, big: 19), + fontWeight: FontWeight.w500 + ) + ), + Text('Account: ${user.email}', + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 14, big: 13), + ) + ), + Text('Role: ${user.role}', + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 14, big: 13), + ) + ) + ], + ) + ), + if (isEditing) ...[ + DecoratedBox( + decoration: BoxDecoration( + color: Color(0xFFFF5D52), + borderRadius: BorderRadius.all(Radius.circular(12)), + ), + child: IconButton( + onPressed: (){showDialog(context: context, builder: (context)=>Dialog( + child: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 32, vertical: 30), + big: EdgeInsets.symmetric(horizontal: 30, vertical: 28) + ), + width: SizeUtils.getByScreen(small: 360, big: 350), + height: SizeUtils.getByScreen(small: 195, big: 185), + child: Column( + children: [ + Text('Are you sure you want to delete this user from the list?', + textAlign: TextAlign.center, + style: TextStyle(fontSize: SizeUtils.getByScreen(small: 19, big: 18)), + ), + SizedBox(height: SizeUtils.getByScreen(small: 28, big: 27)), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded(child: PrimaryButton( + onPressed: (){Navigator.pop(context);}, + text: 'Cancel', + color: Color(0xFF588EA5), + height: SizeUtils.getByScreen(small: 38, big: 36), + radius: SizeUtils.getByScreen(small: 32, big: 34), + )), + SizedBox(width: SizeUtils.getByScreen(small: 4, big: 16)), + Expanded(child: PrimaryButton( + onPressed: (){ + Navigator.pop(context); + }, + text: 'Delete', + color: Color(0xFF588EA5), + height: SizeUtils.getByScreen(small: 38, big: 36), + radius: SizeUtils.getByScreen(small: 32, big: 34), + )) + ], + ) + ], + ), + ), + ));}, + icon: Icon( + Icons.close, + color: Colors.white, + ), + ), + ), + ] + ], + ), + ); + } +} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/app_users/presentation/providers/get_app_users_use_case_provider.dart b/modules/legacy/modules/account/lib/src/features/app_users/presentation/providers/get_app_users_use_case_provider.dart new file mode 100644 index 00000000..e445b16d --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/app_users/presentation/providers/get_app_users_use_case_provider.dart @@ -0,0 +1,9 @@ +import 'package:account/src/core/providers/account_repository_provider.dart'; +import 'package:account/src/features/app_users/domain/get_app_users_use_case.dart'; +import 'package:account/src/features/app_users/domain/get_app_users_use_case_impl.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +final getAppUsersUseCaseProvider = Provider.autoDispose((ref) { + final authRepository = ref.read(accountRepositoryProvider); + return GetAppUsersUseCaseImpl(authRepository); +}); diff --git a/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_model.dart b/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_model.dart new file mode 100644 index 00000000..b19c9008 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_model.dart @@ -0,0 +1,33 @@ +import 'package:account/src/core/data/models/entities/user_entity.dart'; +import 'package:account/src/features/app_users/domain/get_app_users_use_case.dart'; +import 'package:account/src/features/app_users/presentation/providers/get_app_users_use_case_provider.dart'; +import 'package:account/src/features/app_users/presentation/state/app_users_view_state.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +// import 'package:sf_localizations/sf_localizations.dart'; + +final appUsersViewModelProvider = +NotifierProvider.autoDispose( + AppUsersViewModel.new, +); + +class AppUsersViewModel extends Notifier { + late final GetAppUsersUseCase _getAppUsersUseCase; + + @override + AppUsersViewState build() { + _getAppUsersUseCase = ref.read(getAppUsersUseCaseProvider); + + _getAppUsersUseCase.getAppUsers(userId: 'test') + .then(setAppUsers); + + return const AppUsersViewState(); + } + + void setAppUsers(List appUsers) { + state = state.copyWith(appUsers: appUsers); + } + + void toggleIsEditing() { + state = state.copyWith(isEditing: !state.isEditing); + } +} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_state.dart b/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_state.dart new file mode 100644 index 00000000..3c80d320 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_state.dart @@ -0,0 +1,14 @@ +import 'package:account/src/core/data/models/entities/user_entity.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'app_users_view_state.freezed.dart'; + +@freezed +abstract class AppUsersViewState with _$AppUsersViewState { + const factory AppUsersViewState({ + @Default(false) bool isLoading, + @Default([]) List appUsers, + @Default(false) bool isEditing, + @Default('') String errorMessage + }) = _AppUsersViewState; +} diff --git a/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_state.freezed.dart b/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_state.freezed.dart new file mode 100644 index 00000000..952b814c --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_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 'app_users_view_state.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$AppUsersViewState { + + bool get isLoading; List get appUsers; bool get isEditing; String get errorMessage; +/// Create a copy of AppUsersViewState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$AppUsersViewStateCopyWith get copyWith => _$AppUsersViewStateCopyWithImpl(this as AppUsersViewState, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is AppUsersViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&const DeepCollectionEquality().equals(other.appUsers, appUsers)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); +} + + +@override +int get hashCode => Object.hash(runtimeType,isLoading,const DeepCollectionEquality().hash(appUsers),isEditing,errorMessage); + +@override +String toString() { + return 'AppUsersViewState(isLoading: $isLoading, appUsers: $appUsers, isEditing: $isEditing, errorMessage: $errorMessage)'; +} + + +} + +/// @nodoc +abstract mixin class $AppUsersViewStateCopyWith<$Res> { + factory $AppUsersViewStateCopyWith(AppUsersViewState value, $Res Function(AppUsersViewState) _then) = _$AppUsersViewStateCopyWithImpl; +@useResult +$Res call({ + bool isLoading, List appUsers, bool isEditing, String errorMessage +}); + + + + +} +/// @nodoc +class _$AppUsersViewStateCopyWithImpl<$Res> + implements $AppUsersViewStateCopyWith<$Res> { + _$AppUsersViewStateCopyWithImpl(this._self, this._then); + + final AppUsersViewState _self; + final $Res Function(AppUsersViewState) _then; + +/// Create a copy of AppUsersViewState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? appUsers = null,Object? isEditing = null,Object? errorMessage = null,}) { + return _then(_self.copyWith( +isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable +as bool,appUsers: null == appUsers ? _self.appUsers : appUsers // ignore: cast_nullable_to_non_nullable +as List,isEditing: null == isEditing ? _self.isEditing : isEditing // ignore: cast_nullable_to_non_nullable +as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [AppUsersViewState]. +extension AppUsersViewStatePatterns on AppUsersViewState { +/// 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( _AppUsersViewState value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _AppUsersViewState() 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( _AppUsersViewState value) $default,){ +final _that = this; +switch (_that) { +case _AppUsersViewState(): +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( _AppUsersViewState value)? $default,){ +final _that = this; +switch (_that) { +case _AppUsersViewState() 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( bool isLoading, List appUsers, bool isEditing, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _AppUsersViewState() when $default != null: +return $default(_that.isLoading,_that.appUsers,_that.isEditing,_that.errorMessage);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( bool isLoading, List appUsers, bool isEditing, String errorMessage) $default,) {final _that = this; +switch (_that) { +case _AppUsersViewState(): +return $default(_that.isLoading,_that.appUsers,_that.isEditing,_that.errorMessage);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( bool isLoading, List appUsers, bool isEditing, String errorMessage)? $default,) {final _that = this; +switch (_that) { +case _AppUsersViewState() when $default != null: +return $default(_that.isLoading,_that.appUsers,_that.isEditing,_that.errorMessage);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _AppUsersViewState implements AppUsersViewState { + const _AppUsersViewState({this.isLoading = false, final List appUsers = const [], this.isEditing = false, this.errorMessage = ''}): _appUsers = appUsers; + + +@override@JsonKey() final bool isLoading; + final List _appUsers; +@override@JsonKey() List get appUsers { + if (_appUsers is EqualUnmodifiableListView) return _appUsers; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_appUsers); +} + +@override@JsonKey() final bool isEditing; +@override@JsonKey() final String errorMessage; + +/// Create a copy of AppUsersViewState +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$AppUsersViewStateCopyWith<_AppUsersViewState> get copyWith => __$AppUsersViewStateCopyWithImpl<_AppUsersViewState>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppUsersViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&const DeepCollectionEquality().equals(other._appUsers, _appUsers)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); +} + + +@override +int get hashCode => Object.hash(runtimeType,isLoading,const DeepCollectionEquality().hash(_appUsers),isEditing,errorMessage); + +@override +String toString() { + return 'AppUsersViewState(isLoading: $isLoading, appUsers: $appUsers, isEditing: $isEditing, errorMessage: $errorMessage)'; +} + + +} + +/// @nodoc +abstract mixin class _$AppUsersViewStateCopyWith<$Res> implements $AppUsersViewStateCopyWith<$Res> { + factory _$AppUsersViewStateCopyWith(_AppUsersViewState value, $Res Function(_AppUsersViewState) _then) = __$AppUsersViewStateCopyWithImpl; +@override @useResult +$Res call({ + bool isLoading, List appUsers, bool isEditing, String errorMessage +}); + + + + +} +/// @nodoc +class __$AppUsersViewStateCopyWithImpl<$Res> + implements _$AppUsersViewStateCopyWith<$Res> { + __$AppUsersViewStateCopyWithImpl(this._self, this._then); + + final _AppUsersViewState _self; + final $Res Function(_AppUsersViewState) _then; + +/// Create a copy of AppUsersViewState +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? appUsers = null,Object? isEditing = null,Object? errorMessage = null,}) { + return _then(_AppUsersViewState( +isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable +as bool,appUsers: null == appUsers ? _self._appUsers : appUsers // ignore: cast_nullable_to_non_nullable +as List,isEditing: null == isEditing ? _self.isEditing : isEditing // ignore: cast_nullable_to_non_nullable +as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case.dart b/modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case.dart index e72cb24d..155dbc19 100644 --- a/modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case.dart +++ b/modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case.dart @@ -1,4 +1,4 @@ -import 'package:account/src/features/personal_data/domain/entities/user_entity.dart'; +import 'package:account/src/core/data/models/entities/user_entity.dart'; abstract class GetLoggedUserUseCase { Future getLoggedUser({required String token}); diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case_impl.dart b/modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case_impl.dart index 5bdacc65..72794bfe 100644 --- a/modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case_impl.dart +++ b/modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case_impl.dart @@ -1,5 +1,5 @@ import 'package:account/src/core/domain/repositories/account_repository.dart'; -import 'package:account/src/features/personal_data/domain/entities/user_entity.dart'; +import 'package:account/src/core/data/models/entities/user_entity.dart'; import 'package:account/src/features/personal_data/domain/get_logged_user_use_case.dart'; class GetLoggedUserUseCaseImpl implements GetLoggedUserUseCase { diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_model.dart b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_model.dart index 229c285b..75fc5e30 100644 --- a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_model.dart +++ b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_model.dart @@ -1,5 +1,5 @@ import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; -import 'package:account/src/features/personal_data/domain/entities/user_entity.dart'; +import 'package:account/src/core/data/models/entities/user_entity.dart'; import 'package:account/src/features/personal_data/domain/get_logged_user_use_case.dart'; import 'package:account/src/features/personal_data/domain/update_user_use_case.dart'; import 'package:account/src/features/personal_data/presentation/providers/get_logged_user_use_case_provider.dart'; diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_state.dart b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_state.dart index a26ed33f..2e278ef8 100644 --- a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_state.dart +++ b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_state.dart @@ -1,4 +1,4 @@ -import 'package:account/src/features/personal_data/domain/entities/user_entity.dart'; +import 'package:account/src/core/data/models/entities/user_entity.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'personal_data_view_state.freezed.dart'; diff --git a/packages/navigation/lib/app_routes.dart b/packages/navigation/lib/app_routes.dart index 7e26ea86..fdcb4d79 100644 --- a/packages/navigation/lib/app_routes.dart +++ b/packages/navigation/lib/app_routes.dart @@ -20,6 +20,7 @@ class AppRoutes { static const accountSettings = '$legacy/account_settings'; static const personalData = '$accountSettings/personal_data'; static const linkedDevices = '$accountSettings/linked_devices'; + static const appUsers = '$accountSettings/app_users'; static const legacyDashboard = '$legacy/dashboard'; From 54818ead25141c0f59e91f9230b17f4830a9be5e Mon Sep 17 00:00:00 2001 From: aitorarana Date: Wed, 4 Feb 2026 12:45:11 +0100 Subject: [PATCH 08/25] added delete_app_user and update_device use cases --- .../datasource/account_remote_datasource.dart | 9 +- .../account_remote_datasource_impl.dart | 130 ++-- .../models/get_app_users_response_model.dart | 61 ++ .../get_app_users_response_model.freezed.dart | 585 ++++++++++++++++++ .../get_app_users_response_model.g.dart | 59 ++ .../models/update_device_request_model.dart | 41 +- .../update_device_request_model.freezed.dart | 280 +++++++++ .../models/update_device_request_model.g.dart | 22 +- .../repositories/account_repository_impl.dart | 16 + .../repositories/account_repository.dart | 9 +- .../domain/delete_app_user_use_case.dart | 4 + .../domain/delete_app_user_use_case_impl.dart | 13 + .../delete_app_user_use_case_provider.dart | 9 + .../state/app_users_view_model.dart | 27 +- .../state/app_users_view_state.dart | 1 + .../state/app_users_view_state.freezed.dart | 71 ++- .../domain/delete_device_use_case.dart | 4 + .../domain/delete_device_use_case_impl.dart | 13 + .../update_device_request_entity.dart | 11 + ...update_devices_request_entity.freezed.dart | 1 + .../domain/update_device_use_case.dart | 4 +- .../domain/update_device_use_case_impl.dart | 5 +- .../presentation/linked_devices_screen.dart | 13 +- .../delete_device_use_case_provider.dart | 9 + .../get_linked_devices_use_case_provider.dart | 4 +- .../update_device_use_case_provider.dart | 4 +- .../state/linked_devices_view_model.dart | 51 +- .../state/linked_devices_view_state.dart | 2 + .../linked_devices_view_state.freezed.dart | 71 ++- 29 files changed, 1392 insertions(+), 137 deletions(-) create mode 100644 modules/legacy/modules/account/lib/src/core/data/models/get_app_users_response_model.dart create mode 100644 modules/legacy/modules/account/lib/src/core/data/models/get_app_users_response_model.freezed.dart create mode 100644 modules/legacy/modules/account/lib/src/core/data/models/get_app_users_response_model.g.dart create mode 100644 modules/legacy/modules/account/lib/src/core/data/models/update_device_request_model.freezed.dart create mode 100644 modules/legacy/modules/account/lib/src/features/app_users/domain/delete_app_user_use_case.dart create mode 100644 modules/legacy/modules/account/lib/src/features/app_users/domain/delete_app_user_use_case_impl.dart create mode 100644 modules/legacy/modules/account/lib/src/features/app_users/presentation/providers/delete_app_user_use_case_provider.dart create mode 100644 modules/legacy/modules/account/lib/src/features/linked_devices/domain/delete_device_use_case.dart create mode 100644 modules/legacy/modules/account/lib/src/features/linked_devices/domain/delete_device_use_case_impl.dart create mode 100644 modules/legacy/modules/account/lib/src/features/linked_devices/domain/entities/update_device_request_entity.dart create mode 100644 modules/legacy/modules/account/lib/src/features/linked_devices/domain/entities/update_devices_request_entity.freezed.dart create mode 100644 modules/legacy/modules/account/lib/src/features/linked_devices/presentation/providers/delete_device_use_case_provider.dart diff --git a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart index 4b5196a3..c91a7b51 100644 --- a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart +++ b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart @@ -1,13 +1,20 @@ import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart'; import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; import 'package:account/src/core/data/models/entities/user_entity.dart'; abstract class AccountRemoteDatasource { + Future getLoggedUser({required String token}); + Future> getLinkedDevices({required String userId}); - Future getLoggedUser({required String token}); + Future deleteDevice({required String userId, required String deviceId}); + + Future updateDevice({required String userId, required String deviceId, required UpdateDeviceRequestEntity request}); Future updateUser({required String userId, required UpdateUserRequestEntity request}); Future> getAppUsers({required String userId}); + + Future deleteAppUser({required String userId}); } diff --git a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart index 21090f71..204b8dea 100644 --- a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart +++ b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart @@ -1,10 +1,13 @@ import 'dart:convert'; import 'package:account/src/core/data/datasource/account_remote_datasource.dart'; +import 'package:account/src/core/data/models/get_app_users_response_model.dart'; import 'package:account/src/core/data/models/get_linked_devices_response_model.dart'; import 'package:account/src/core/data/models/get_logged_user_response_model.dart'; +import 'package:account/src/core/data/models/update_device_request_model.dart'; import 'package:account/src/core/data/models/update_user_request_model.dart'; import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart'; import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; import 'package:account/src/core/data/models/entities/user_entity.dart'; import 'package:dio/dio.dart'; @@ -19,7 +22,7 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource { @override Future> getLinkedDevices({required String userId}) async { try { - /*final response = await _repository.get>( + final response = await _repository.get>( '/$userId/devices', ); final data = response.data!['items']; @@ -27,8 +30,8 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource { throw Exception('Empty response from /:userId/devices'); } - final model = GetLinkedDevicesResponseModel.fromJson(data);*/ - final model = GetLinkedDevicesResponseModel(items: [ + final model = GetLinkedDevicesResponseModel.fromJson(data); + /*final model = GetLinkedDevicesResponseModel(items: [ GetLinkedDevicesItemResponseModel( identificator: '1111', name: 'Carlos', @@ -37,7 +40,7 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource { identificator: '1112', name: 'Ana', number: '222222222'), - ]); + ]);*/ return model.toEntity(); } on DioException catch (error) { throw _mapDioError( @@ -50,7 +53,7 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource { @override Future getLoggedUser({required String token}) async { try { - /*final response = await _repository.get>( + final response = await _repository.get>( '/users/api/auth/me', ); final data = response.data!['item']; @@ -58,23 +61,47 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource { throw Exception('Empty response from /auth/me'); } - final model = GetUserResponseModel.fromJson(data);*/ - final model = GetLoggedUserResponseModel(item: + final model = GetLoggedUserResponseModel.fromJson(data); + /*final model = GetLoggedUserResponseModel(item: GetLoggedUserItemResponseModel( id: '1111', firstName: 'Juan', email: 'juan@test.com', - phone: '111111111')); - print(model.toEntity()); + phone: '111111111'));*/ return model.toEntity(); } on DioException catch (error) { throw _mapDioError( error, - defaultMessage: error.message ?? 'Error getting devices', + defaultMessage: error.message ?? 'Error getting logged user', ); } } + @override + Future deleteDevice({required String userId, required String deviceId}) async { + try { + await _repository.put( + '/users/$userId/devices/$deviceId', + ); + } on DioException catch (error) { + throw _mapDioError(error, defaultMessage: 'Error to delete device'); + } + } + + @override + Future updateDevice({required String userId, required String deviceId, required UpdateDeviceRequestEntity request}) async { + throw UnimplementedError(); + try { + final body = request.toModel().toJson(); + await _repository.put( + '/users/$userId/devices/$deviceId', + body: body, + ); + } on DioException catch (error) { + throw _mapDioError(error, defaultMessage: 'Error to update device'); + } + } + @override Future updateUser({required String userId, required UpdateUserRequestEntity request}) async { try { @@ -84,14 +111,15 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource { body: body, ); } on DioException catch (error) { - throw _mapDioError(error, defaultMessage: 'Error in verification code'); + throw _mapDioError(error, defaultMessage: 'Error to update user'); } } @override Future> getAppUsers({required String userId}) async { - //try { - /*final response = await _repository.get>( + throw UnimplementedError(); + try { + final response = await _repository.get>( '/$userId/devices', ); final data = response.data!['items']; @@ -99,42 +127,58 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource { throw Exception('Empty response from /:userId/devices'); } - final model = GetLinkedDevicesResponseModel.fromJson(data);*/ - /*final model = GetLinkedDevicesResponseModel(items: [ - GetLinkedDevicesItemResponseModel( - identificator: '1111', - name: 'Carlos', - number: '111111111'), - GetLinkedDevicesItemResponseModel( - identificator: '1112', - name: 'Ana', - number: '222222222'), - ]); + final model = GetAppUsersResponseModel.fromJson(data); + /*final model = GetAppUsersResponseModel(items: [ + GetAppUsersItemResponseModel( + id: 'id', + delegationId: 'delegationId', + email: 'carlos@test.com', + createdAt: 'createdAt', + updatedAt: 'updatedAt', + status: 'status', + role: 'role', + lastLogin: 'lastLogin', + currentLogin: 'currentLogin', + language: 'language', + firstName: 'Carlos', + lastName: 'lastName', + hasApiKey: 'hasApiKey', + phone: 'phone',), + GetAppUsersItemResponseModel( + id: 'id', + delegationId: 'delegationId', + email: 'ana@test.com', + createdAt: 'createdAt', + updatedAt: 'updatedAt', + status: 'status', + role: 'role', + lastLogin: 'lastLogin', + currentLogin: 'currentLogin', + language: 'language', + firstName: 'Ana', + lastName: 'lastName', + hasApiKey: 'hasApiKey', + phone: 'phone',), + ]);*/ return model.toEntity(); } on DioException catch (error) { throw _mapDioError( error, defaultMessage: error.message ?? 'Error getting devices', ); - }*/ - return [ - UserEntity( - id: 'id', - delegationId: 'delegationId', - email: 'email', - createdAt: 'createdAt', - updatedAt: 'updatedAt', - status: 'status', - role: 'role', - lastLogin: 'lastLogin', - currentLogin: 'currentLogin', - language: 'language', - firstName: 'firstName', - lastName: 'lastName', - hasApiKey: 'hasApiKey', - phone: 'phone', - ) - ]; + } + } + + @override + Future deleteAppUser({required String userId}) async { + throw UnimplementedError(); + try { + await _repository.delete( + '/users/$userId', + ); + } on DioException catch (error) { + throw _mapDioError(error, defaultMessage: 'Error to delete device'); + } } } diff --git a/modules/legacy/modules/account/lib/src/core/data/models/get_app_users_response_model.dart b/modules/legacy/modules/account/lib/src/core/data/models/get_app_users_response_model.dart new file mode 100644 index 00000000..dd5c5772 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/data/models/get_app_users_response_model.dart @@ -0,0 +1,61 @@ +import 'package:account/src/core/data/models/entities/user_entity.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'get_app_users_response_model.freezed.dart'; +part 'get_app_users_response_model.g.dart'; + +@freezed +abstract class GetAppUsersResponseModel with _$GetAppUsersResponseModel { + const factory GetAppUsersResponseModel({ + required List items, + }) = _GetAppUsersResponseModel; + + factory GetAppUsersResponseModel.fromJson(Map json) => + _$GetAppUsersResponseModelFromJson(json); + +} + +@freezed +abstract class GetAppUsersItemResponseModel with _$GetAppUsersItemResponseModel { + const factory GetAppUsersItemResponseModel({ + required String id, + required String delegationId, + required String email, + required String createdAt, + required String updatedAt, + required String status, + required String role, + required String lastLogin, + required String currentLogin, + required String language, + required String firstName, + required String lastName, + required String hasApiKey, + required String phone + }) = + _GetAppUsersItemResponseModel; + + factory GetAppUsersItemResponseModel.fromJson(Map json) => + _$GetAppUsersItemResponseModelFromJson(json); +} + +extension GetUsersResponseModelMapper on GetAppUsersResponseModel { + List toEntity() { + return items.map((GetAppUsersItemResponseModel item) => UserEntity( + id: item.id, + delegationId: item.delegationId, + email: item.email, + createdAt: item.createdAt, + updatedAt: item.updatedAt, + status: item.status, + role: item.role, + lastLogin: item.lastLogin, + currentLogin: item.currentLogin, + language: item.language, + firstName: item.firstName, + lastName: item.lastName, + hasApiKey: item.hasApiKey, + phone: item.phone, + )).toList(); + } +} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/core/data/models/get_app_users_response_model.freezed.dart b/modules/legacy/modules/account/lib/src/core/data/models/get_app_users_response_model.freezed.dart new file mode 100644 index 00000000..d2f66345 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/data/models/get_app_users_response_model.freezed.dart @@ -0,0 +1,585 @@ +// 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_app_users_response_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$GetAppUsersResponseModel { + + List get items; +/// Create a copy of GetAppUsersResponseModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$GetAppUsersResponseModelCopyWith get copyWith => _$GetAppUsersResponseModelCopyWithImpl(this as GetAppUsersResponseModel, _$identity); + + /// Serializes this GetAppUsersResponseModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is GetAppUsersResponseModel&&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 'GetAppUsersResponseModel(items: $items)'; +} + + +} + +/// @nodoc +abstract mixin class $GetAppUsersResponseModelCopyWith<$Res> { + factory $GetAppUsersResponseModelCopyWith(GetAppUsersResponseModel value, $Res Function(GetAppUsersResponseModel) _then) = _$GetAppUsersResponseModelCopyWithImpl; +@useResult +$Res call({ + List items +}); + + + + +} +/// @nodoc +class _$GetAppUsersResponseModelCopyWithImpl<$Res> + implements $GetAppUsersResponseModelCopyWith<$Res> { + _$GetAppUsersResponseModelCopyWithImpl(this._self, this._then); + + final GetAppUsersResponseModel _self; + final $Res Function(GetAppUsersResponseModel) _then; + +/// Create a copy of GetAppUsersResponseModel +/// 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 [GetAppUsersResponseModel]. +extension GetAppUsersResponseModelPatterns on GetAppUsersResponseModel { +/// 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( _GetAppUsersResponseModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _GetAppUsersResponseModel() 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( _GetAppUsersResponseModel value) $default,){ +final _that = this; +switch (_that) { +case _GetAppUsersResponseModel(): +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( _GetAppUsersResponseModel value)? $default,){ +final _that = this; +switch (_that) { +case _GetAppUsersResponseModel() 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 _GetAppUsersResponseModel() 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 _GetAppUsersResponseModel(): +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 _GetAppUsersResponseModel() when $default != null: +return $default(_that.items);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _GetAppUsersResponseModel implements GetAppUsersResponseModel { + const _GetAppUsersResponseModel({required final List items}): _items = items; + factory _GetAppUsersResponseModel.fromJson(Map json) => _$GetAppUsersResponseModelFromJson(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 GetAppUsersResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$GetAppUsersResponseModelCopyWith<_GetAppUsersResponseModel> get copyWith => __$GetAppUsersResponseModelCopyWithImpl<_GetAppUsersResponseModel>(this, _$identity); + +@override +Map toJson() { + return _$GetAppUsersResponseModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetAppUsersResponseModel&&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 'GetAppUsersResponseModel(items: $items)'; +} + + +} + +/// @nodoc +abstract mixin class _$GetAppUsersResponseModelCopyWith<$Res> implements $GetAppUsersResponseModelCopyWith<$Res> { + factory _$GetAppUsersResponseModelCopyWith(_GetAppUsersResponseModel value, $Res Function(_GetAppUsersResponseModel) _then) = __$GetAppUsersResponseModelCopyWithImpl; +@override @useResult +$Res call({ + List items +}); + + + + +} +/// @nodoc +class __$GetAppUsersResponseModelCopyWithImpl<$Res> + implements _$GetAppUsersResponseModelCopyWith<$Res> { + __$GetAppUsersResponseModelCopyWithImpl(this._self, this._then); + + final _GetAppUsersResponseModel _self; + final $Res Function(_GetAppUsersResponseModel) _then; + +/// Create a copy of GetAppUsersResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? items = null,}) { + return _then(_GetAppUsersResponseModel( +items: null == items ? _self._items : items // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + + +/// @nodoc +mixin _$GetAppUsersItemResponseModel { + + String get id; String get delegationId; String get email; String get createdAt; String get updatedAt; String get status; String get role; String get lastLogin; String get currentLogin; String get language; String get firstName; String get lastName; String get hasApiKey; String get phone; +/// Create a copy of GetAppUsersItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$GetAppUsersItemResponseModelCopyWith get copyWith => _$GetAppUsersItemResponseModelCopyWithImpl(this as GetAppUsersItemResponseModel, _$identity); + + /// Serializes this GetAppUsersItemResponseModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is GetAppUsersItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone); + +@override +String toString() { + return 'GetAppUsersItemResponseModel(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)'; +} + + +} + +/// @nodoc +abstract mixin class $GetAppUsersItemResponseModelCopyWith<$Res> { + factory $GetAppUsersItemResponseModelCopyWith(GetAppUsersItemResponseModel value, $Res Function(GetAppUsersItemResponseModel) _then) = _$GetAppUsersItemResponseModelCopyWithImpl; +@useResult +$Res call({ + String id, String delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone +}); + + + + +} +/// @nodoc +class _$GetAppUsersItemResponseModelCopyWithImpl<$Res> + implements $GetAppUsersItemResponseModelCopyWith<$Res> { + _$GetAppUsersItemResponseModelCopyWithImpl(this._self, this._then); + + final GetAppUsersItemResponseModel _self; + final $Res Function(GetAppUsersItemResponseModel) _then; + +/// Create a copy of GetAppUsersItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? delegationId = null,Object? email = null,Object? createdAt = null,Object? updatedAt = null,Object? status = null,Object? role = null,Object? lastLogin = null,Object? currentLogin = null,Object? language = null,Object? firstName = null,Object? lastName = null,Object? hasApiKey = null,Object? phone = null,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,delegationId: null == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable +as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable +as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as String,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as String,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable +as String,role: null == role ? _self.role : role // ignore: cast_nullable_to_non_nullable +as String,lastLogin: null == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable +as String,currentLogin: null == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable +as String,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable +as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable +as String,hasApiKey: null == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable +as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [GetAppUsersItemResponseModel]. +extension GetAppUsersItemResponseModelPatterns on GetAppUsersItemResponseModel { +/// 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( _GetAppUsersItemResponseModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _GetAppUsersItemResponseModel() 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( _GetAppUsersItemResponseModel value) $default,){ +final _that = this; +switch (_that) { +case _GetAppUsersItemResponseModel(): +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( _GetAppUsersItemResponseModel value)? $default,){ +final _that = this; +switch (_that) { +case _GetAppUsersItemResponseModel() 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 delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _GetAppUsersItemResponseModel() when $default != null: +return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);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 delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone) $default,) {final _that = this; +switch (_that) { +case _GetAppUsersItemResponseModel(): +return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);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 delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone)? $default,) {final _that = this; +switch (_that) { +case _GetAppUsersItemResponseModel() when $default != null: +return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _GetAppUsersItemResponseModel implements GetAppUsersItemResponseModel { + const _GetAppUsersItemResponseModel({required this.id, required this.delegationId, required this.email, required this.createdAt, required this.updatedAt, required this.status, required this.role, required this.lastLogin, required this.currentLogin, required this.language, required this.firstName, required this.lastName, required this.hasApiKey, required this.phone}); + factory _GetAppUsersItemResponseModel.fromJson(Map json) => _$GetAppUsersItemResponseModelFromJson(json); + +@override final String id; +@override final String delegationId; +@override final String email; +@override final String createdAt; +@override final String updatedAt; +@override final String status; +@override final String role; +@override final String lastLogin; +@override final String currentLogin; +@override final String language; +@override final String firstName; +@override final String lastName; +@override final String hasApiKey; +@override final String phone; + +/// Create a copy of GetAppUsersItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$GetAppUsersItemResponseModelCopyWith<_GetAppUsersItemResponseModel> get copyWith => __$GetAppUsersItemResponseModelCopyWithImpl<_GetAppUsersItemResponseModel>(this, _$identity); + +@override +Map toJson() { + return _$GetAppUsersItemResponseModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetAppUsersItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone); + +@override +String toString() { + return 'GetAppUsersItemResponseModel(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)'; +} + + +} + +/// @nodoc +abstract mixin class _$GetAppUsersItemResponseModelCopyWith<$Res> implements $GetAppUsersItemResponseModelCopyWith<$Res> { + factory _$GetAppUsersItemResponseModelCopyWith(_GetAppUsersItemResponseModel value, $Res Function(_GetAppUsersItemResponseModel) _then) = __$GetAppUsersItemResponseModelCopyWithImpl; +@override @useResult +$Res call({ + String id, String delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone +}); + + + + +} +/// @nodoc +class __$GetAppUsersItemResponseModelCopyWithImpl<$Res> + implements _$GetAppUsersItemResponseModelCopyWith<$Res> { + __$GetAppUsersItemResponseModelCopyWithImpl(this._self, this._then); + + final _GetAppUsersItemResponseModel _self; + final $Res Function(_GetAppUsersItemResponseModel) _then; + +/// Create a copy of GetAppUsersItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? delegationId = null,Object? email = null,Object? createdAt = null,Object? updatedAt = null,Object? status = null,Object? role = null,Object? lastLogin = null,Object? currentLogin = null,Object? language = null,Object? firstName = null,Object? lastName = null,Object? hasApiKey = null,Object? phone = null,}) { + return _then(_GetAppUsersItemResponseModel( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,delegationId: null == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable +as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable +as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as String,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as String,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable +as String,role: null == role ? _self.role : role // ignore: cast_nullable_to_non_nullable +as String,lastLogin: null == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable +as String,currentLogin: null == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable +as String,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable +as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable +as String,hasApiKey: null == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable +as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/account/lib/src/core/data/models/get_app_users_response_model.g.dart b/modules/legacy/modules/account/lib/src/core/data/models/get_app_users_response_model.g.dart new file mode 100644 index 00000000..01413bf1 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/data/models/get_app_users_response_model.g.dart @@ -0,0 +1,59 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'get_app_users_response_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_GetAppUsersResponseModel _$GetAppUsersResponseModelFromJson( + Map json, +) => _GetAppUsersResponseModel( + items: (json['items'] as List) + .map( + (e) => GetAppUsersItemResponseModel.fromJson(e as Map), + ) + .toList(), +); + +Map _$GetAppUsersResponseModelToJson( + _GetAppUsersResponseModel instance, +) => {'items': instance.items}; + +_GetAppUsersItemResponseModel _$GetAppUsersItemResponseModelFromJson( + Map json, +) => _GetAppUsersItemResponseModel( + id: json['id'] as String, + delegationId: json['delegationId'] as String, + email: json['email'] as String, + createdAt: json['createdAt'] as String, + updatedAt: json['updatedAt'] as String, + status: json['status'] as String, + role: json['role'] as String, + lastLogin: json['lastLogin'] as String, + currentLogin: json['currentLogin'] as String, + language: json['language'] as String, + firstName: json['firstName'] as String, + lastName: json['lastName'] as String, + hasApiKey: json['hasApiKey'] as String, + phone: json['phone'] as String, +); + +Map _$GetAppUsersItemResponseModelToJson( + _GetAppUsersItemResponseModel instance, +) => { + 'id': instance.id, + 'delegationId': instance.delegationId, + 'email': instance.email, + 'createdAt': instance.createdAt, + 'updatedAt': instance.updatedAt, + 'status': instance.status, + 'role': instance.role, + 'lastLogin': instance.lastLogin, + 'currentLogin': instance.currentLogin, + 'language': instance.language, + 'firstName': instance.firstName, + 'lastName': instance.lastName, + 'hasApiKey': instance.hasApiKey, + 'phone': instance.phone, +}; diff --git a/modules/legacy/modules/account/lib/src/core/data/models/update_device_request_model.dart b/modules/legacy/modules/account/lib/src/core/data/models/update_device_request_model.dart index 549b055c..d9a4240c 100644 --- a/modules/legacy/modules/account/lib/src/core/data/models/update_device_request_model.dart +++ b/modules/legacy/modules/account/lib/src/core/data/models/update_device_request_model.dart @@ -1,4 +1,4 @@ -/* +import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'update_device_request_model.freezed.dart'; @@ -7,44 +7,17 @@ part 'update_device_request_model.g.dart'; @freezed abstract class UpdateDeviceRequestModel with _$UpdateDeviceRequestModel { const factory UpdateDeviceRequestModel({ - required String deviceIdentificator, - required String lastName, - required String email, - required String phone, - required String language, - required String password, - required List taxResidences, - required List addresses, - // ignore: invalid_annotation_target - @JsonKey(name: 'document') required String documentNumber, - required String documentType, - // ignore: invalid_annotation_target - @JsonKey(name: 'relationType') required String relationship, + required String identificator, + required String name, }) = _UpdateDeviceRequestModel; - factory UpdateDeviceRequestModel.fromCsv(Map json) => - _$UpdateDeviceRequestModelFromCsv(csv); - - @override - @JsonKey(name: 'document') - String get documentNumber; - @override - @JsonKey(name: 'relationType') - String get relationship; + factory UpdateDeviceRequestModel.fromJson(Map json) => + _$UpdateDeviceRequestModelFromJson(json); } extension UpdateDeviceRequestModelMapper on UpdateDeviceRequestEntity { UpdateDeviceRequestModel toModel() => UpdateDeviceRequestModel( - firstName: firstName, - lastName: lastName, - email: email, - phone: phone, - language: language, - password: password, - taxResidences: taxResidences - .map((e) => e.toModel()) - .toList(growable: false), - addresses: addresses.map((e) => e.toModel()).toList(growable: false), + identificator: identificator, + name: name, ); } -*/ diff --git a/modules/legacy/modules/account/lib/src/core/data/models/update_device_request_model.freezed.dart b/modules/legacy/modules/account/lib/src/core/data/models/update_device_request_model.freezed.dart new file mode 100644 index 00000000..5adc47df --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/data/models/update_device_request_model.freezed.dart @@ -0,0 +1,280 @@ +// 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 'update_device_request_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$UpdateDeviceRequestModel { + + String get identificator; String get name; +/// Create a copy of UpdateDeviceRequestModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UpdateDeviceRequestModelCopyWith get copyWith => _$UpdateDeviceRequestModelCopyWithImpl(this as UpdateDeviceRequestModel, _$identity); + + /// Serializes this UpdateDeviceRequestModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UpdateDeviceRequestModel&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.name, name) || other.name == name)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,identificator,name); + +@override +String toString() { + return 'UpdateDeviceRequestModel(identificator: $identificator, name: $name)'; +} + + +} + +/// @nodoc +abstract mixin class $UpdateDeviceRequestModelCopyWith<$Res> { + factory $UpdateDeviceRequestModelCopyWith(UpdateDeviceRequestModel value, $Res Function(UpdateDeviceRequestModel) _then) = _$UpdateDeviceRequestModelCopyWithImpl; +@useResult +$Res call({ + String identificator, String name +}); + + + + +} +/// @nodoc +class _$UpdateDeviceRequestModelCopyWithImpl<$Res> + implements $UpdateDeviceRequestModelCopyWith<$Res> { + _$UpdateDeviceRequestModelCopyWithImpl(this._self, this._then); + + final UpdateDeviceRequestModel _self; + final $Res Function(UpdateDeviceRequestModel) _then; + +/// Create a copy of UpdateDeviceRequestModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? identificator = null,Object? name = null,}) { + return _then(_self.copyWith( +identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable +as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [UpdateDeviceRequestModel]. +extension UpdateDeviceRequestModelPatterns on UpdateDeviceRequestModel { +/// 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( _UpdateDeviceRequestModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _UpdateDeviceRequestModel() 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( _UpdateDeviceRequestModel value) $default,){ +final _that = this; +switch (_that) { +case _UpdateDeviceRequestModel(): +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( _UpdateDeviceRequestModel value)? $default,){ +final _that = this; +switch (_that) { +case _UpdateDeviceRequestModel() 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 identificator, String name)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _UpdateDeviceRequestModel() when $default != null: +return $default(_that.identificator,_that.name);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 identificator, String name) $default,) {final _that = this; +switch (_that) { +case _UpdateDeviceRequestModel(): +return $default(_that.identificator,_that.name);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 identificator, String name)? $default,) {final _that = this; +switch (_that) { +case _UpdateDeviceRequestModel() when $default != null: +return $default(_that.identificator,_that.name);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _UpdateDeviceRequestModel implements UpdateDeviceRequestModel { + const _UpdateDeviceRequestModel({required this.identificator, required this.name}); + factory _UpdateDeviceRequestModel.fromJson(Map json) => _$UpdateDeviceRequestModelFromJson(json); + +@override final String identificator; +@override final String name; + +/// Create a copy of UpdateDeviceRequestModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$UpdateDeviceRequestModelCopyWith<_UpdateDeviceRequestModel> get copyWith => __$UpdateDeviceRequestModelCopyWithImpl<_UpdateDeviceRequestModel>(this, _$identity); + +@override +Map toJson() { + return _$UpdateDeviceRequestModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _UpdateDeviceRequestModel&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.name, name) || other.name == name)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,identificator,name); + +@override +String toString() { + return 'UpdateDeviceRequestModel(identificator: $identificator, name: $name)'; +} + + +} + +/// @nodoc +abstract mixin class _$UpdateDeviceRequestModelCopyWith<$Res> implements $UpdateDeviceRequestModelCopyWith<$Res> { + factory _$UpdateDeviceRequestModelCopyWith(_UpdateDeviceRequestModel value, $Res Function(_UpdateDeviceRequestModel) _then) = __$UpdateDeviceRequestModelCopyWithImpl; +@override @useResult +$Res call({ + String identificator, String name +}); + + + + +} +/// @nodoc +class __$UpdateDeviceRequestModelCopyWithImpl<$Res> + implements _$UpdateDeviceRequestModelCopyWith<$Res> { + __$UpdateDeviceRequestModelCopyWithImpl(this._self, this._then); + + final _UpdateDeviceRequestModel _self; + final $Res Function(_UpdateDeviceRequestModel) _then; + +/// Create a copy of UpdateDeviceRequestModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? identificator = null,Object? name = null,}) { + return _then(_UpdateDeviceRequestModel( +identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable +as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/account/lib/src/core/data/models/update_device_request_model.g.dart b/modules/legacy/modules/account/lib/src/core/data/models/update_device_request_model.g.dart index 7dee7b62..ebcbe6a1 100644 --- a/modules/legacy/modules/account/lib/src/core/data/models/update_device_request_model.g.dart +++ b/modules/legacy/modules/account/lib/src/core/data/models/update_device_request_model.g.dart @@ -1 +1,21 @@ -part of 'update_device_request_model.dart'; \ No newline at end of file +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'update_device_request_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_UpdateDeviceRequestModel _$UpdateDeviceRequestModelFromJson( + Map json, +) => _UpdateDeviceRequestModel( + identificator: json['identificator'] as String, + name: json['name'] as String, +); + +Map _$UpdateDeviceRequestModelToJson( + _UpdateDeviceRequestModel instance, +) => { + 'identificator': instance.identificator, + 'name': instance.name, +}; diff --git a/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart b/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart index 54ae304e..031b5742 100644 --- a/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart +++ b/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart @@ -1,6 +1,7 @@ import 'package:account/src/core/data/datasource/account_remote_datasource.dart'; import 'package:account/src/core/domain/repositories/account_repository.dart'; import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart'; import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; import 'package:account/src/core/data/models/entities/user_entity.dart'; @@ -14,6 +15,16 @@ class AccountRepositoryImpl implements AccountRepository { return _remote.getLinkedDevices(userId: userId); } + @override + Future deleteDevice({required String userId, required String deviceId}) { + return _remote.deleteDevice(userId: userId, deviceId: deviceId); + } + + @override + Future updateDevice({required String userId, required String deviceId, required UpdateDeviceRequestEntity request}) { + return _remote.updateDevice(userId: userId, deviceId: deviceId, request: request); + } + @override Future getLoggedUser({required String token}) { return _remote.getLoggedUser(token: token); @@ -28,4 +39,9 @@ class AccountRepositoryImpl implements AccountRepository { Future> getAppUsers({required String userId}) { return _remote.getAppUsers(userId: userId); } + + @override + Future deleteAppUser({required String userId}) { + return _remote.deleteAppUser(userId: userId); + } } diff --git a/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart b/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart index 237b7c5e..e6c4d87a 100644 --- a/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart +++ b/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart @@ -1,13 +1,20 @@ import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart'; import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; import 'package:account/src/core/data/models/entities/user_entity.dart'; abstract class AccountRepository { Future> getLinkedDevices({required String userId}); - Future updateUser({required String userId, required UpdateUserRequestEntity request}); + Future deleteDevice({required String userId, required String deviceId}); + + Future updateDevice({required String userId, required String deviceId, required UpdateDeviceRequestEntity request}); Future getLoggedUser({required String token}); + Future updateUser({required String userId, required UpdateUserRequestEntity request}); + Future> getAppUsers({required String userId}); + + Future deleteAppUser({required String userId}); } diff --git a/modules/legacy/modules/account/lib/src/features/app_users/domain/delete_app_user_use_case.dart b/modules/legacy/modules/account/lib/src/features/app_users/domain/delete_app_user_use_case.dart new file mode 100644 index 00000000..4e9c4d8a --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/app_users/domain/delete_app_user_use_case.dart @@ -0,0 +1,4 @@ + +abstract class DeleteAppUserUseCase { + Future deleteAppUser({required String userId}); +} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/app_users/domain/delete_app_user_use_case_impl.dart b/modules/legacy/modules/account/lib/src/features/app_users/domain/delete_app_user_use_case_impl.dart new file mode 100644 index 00000000..39ecf380 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/app_users/domain/delete_app_user_use_case_impl.dart @@ -0,0 +1,13 @@ +import 'package:account/src/core/domain/repositories/account_repository.dart'; +import 'package:account/src/features/app_users/domain/delete_app_user_use_case.dart'; + +class DeleteAppUserUseCaseImpl implements DeleteAppUserUseCase { + DeleteAppUserUseCaseImpl(this._repository); + + final AccountRepository _repository; + + @override + Future deleteAppUser({required String userId}) { + return _repository.deleteAppUser(userId: userId); + } +} diff --git a/modules/legacy/modules/account/lib/src/features/app_users/presentation/providers/delete_app_user_use_case_provider.dart b/modules/legacy/modules/account/lib/src/features/app_users/presentation/providers/delete_app_user_use_case_provider.dart new file mode 100644 index 00000000..73928527 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/app_users/presentation/providers/delete_app_user_use_case_provider.dart @@ -0,0 +1,9 @@ +import 'package:account/src/core/providers/account_repository_provider.dart'; +import 'package:account/src/features/app_users/domain/delete_app_user_use_case.dart'; +import 'package:account/src/features/app_users/domain/delete_app_user_use_case_impl.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +final deleteAppUserUseCaseProvider = Provider.autoDispose((ref) { + final authRepository = ref.read(accountRepositoryProvider); + return DeleteAppUserUseCaseImpl(authRepository); +}); diff --git a/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_model.dart b/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_model.dart index b19c9008..990a985b 100644 --- a/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_model.dart +++ b/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_model.dart @@ -1,7 +1,11 @@ import 'package:account/src/core/data/models/entities/user_entity.dart'; +import 'package:account/src/features/app_users/domain/delete_app_user_use_case.dart'; import 'package:account/src/features/app_users/domain/get_app_users_use_case.dart'; +import 'package:account/src/features/app_users/presentation/providers/delete_app_user_use_case_provider.dart'; import 'package:account/src/features/app_users/presentation/providers/get_app_users_use_case_provider.dart'; import 'package:account/src/features/app_users/presentation/state/app_users_view_state.dart'; +import 'package:account/src/features/personal_data/domain/get_logged_user_use_case.dart'; +import 'package:account/src/features/personal_data/presentation/providers/get_logged_user_use_case_provider.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; // import 'package:sf_localizations/sf_localizations.dart'; @@ -11,23 +15,40 @@ NotifierProvider.autoDispose( ); class AppUsersViewModel extends Notifier { + late final GetLoggedUserUseCase _getLoggedUserUseCase; late final GetAppUsersUseCase _getAppUsersUseCase; + late final DeleteAppUserUseCase _deleteAppUserUseCase; @override AppUsersViewState build() { + _getLoggedUserUseCase = ref.read(getLoggedUserUseCaseProvider); _getAppUsersUseCase = ref.read(getAppUsersUseCaseProvider); + _deleteAppUserUseCase = ref.read(deleteAppUserUseCaseProvider); - _getAppUsersUseCase.getAppUsers(userId: 'test') - .then(setAppUsers); + _getLoggedUserUseCase.getLoggedUser(token: 'test').then((user){ + setUser(user); + return _getAppUsersUseCase.getAppUsers(userId: user.id); + }).then(setAppUsers); return const AppUsersViewState(); } + void setUser(UserEntity user) { + state = state.copyWith(loggedUser: user); + } + void setAppUsers(List appUsers) { - state = state.copyWith(appUsers: appUsers); + state = state.copyWith( + appUsers: appUsers, + isLoading: false, + ); } void toggleIsEditing() { state = state.copyWith(isEditing: !state.isEditing); } + + void deleteAppUser() { + _deleteAppUserUseCase.deleteAppUser(userId: state.loggedUser!.id); + } } \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_state.dart b/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_state.dart index 3c80d320..a6e74fff 100644 --- a/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_state.dart +++ b/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_state.dart @@ -7,6 +7,7 @@ part 'app_users_view_state.freezed.dart'; abstract class AppUsersViewState with _$AppUsersViewState { const factory AppUsersViewState({ @Default(false) bool isLoading, + @Default(null) UserEntity? loggedUser, @Default([]) List appUsers, @Default(false) bool isEditing, @Default('') String errorMessage diff --git a/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_state.freezed.dart b/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_state.freezed.dart index 952b814c..6585470c 100644 --- a/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_state.freezed.dart +++ b/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_state.freezed.dart @@ -14,7 +14,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$AppUsersViewState { - bool get isLoading; List get appUsers; bool get isEditing; String get errorMessage; + bool get isLoading; UserEntity? get loggedUser; List get appUsers; bool get isEditing; String get errorMessage; /// Create a copy of AppUsersViewState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -25,16 +25,16 @@ $AppUsersViewStateCopyWith get copyWith => _$AppUsersViewStat @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is AppUsersViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&const DeepCollectionEquality().equals(other.appUsers, appUsers)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is AppUsersViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&const DeepCollectionEquality().equals(other.appUsers, appUsers)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); } @override -int get hashCode => Object.hash(runtimeType,isLoading,const DeepCollectionEquality().hash(appUsers),isEditing,errorMessage); +int get hashCode => Object.hash(runtimeType,isLoading,loggedUser,const DeepCollectionEquality().hash(appUsers),isEditing,errorMessage); @override String toString() { - return 'AppUsersViewState(isLoading: $isLoading, appUsers: $appUsers, isEditing: $isEditing, errorMessage: $errorMessage)'; + return 'AppUsersViewState(isLoading: $isLoading, loggedUser: $loggedUser, appUsers: $appUsers, isEditing: $isEditing, errorMessage: $errorMessage)'; } @@ -45,11 +45,11 @@ abstract mixin class $AppUsersViewStateCopyWith<$Res> { factory $AppUsersViewStateCopyWith(AppUsersViewState value, $Res Function(AppUsersViewState) _then) = _$AppUsersViewStateCopyWithImpl; @useResult $Res call({ - bool isLoading, List appUsers, bool isEditing, String errorMessage + bool isLoading, UserEntity? loggedUser, List appUsers, bool isEditing, String errorMessage }); - +$UserEntityCopyWith<$Res>? get loggedUser; } /// @nodoc @@ -62,16 +62,29 @@ class _$AppUsersViewStateCopyWithImpl<$Res> /// Create a copy of AppUsersViewState /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? appUsers = null,Object? isEditing = null,Object? errorMessage = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? loggedUser = freezed,Object? appUsers = null,Object? isEditing = null,Object? errorMessage = null,}) { return _then(_self.copyWith( isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable -as bool,appUsers: null == appUsers ? _self.appUsers : appUsers // ignore: cast_nullable_to_non_nullable +as bool,loggedUser: freezed == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable +as UserEntity?,appUsers: null == appUsers ? _self.appUsers : appUsers // ignore: cast_nullable_to_non_nullable as List,isEditing: null == isEditing ? _self.isEditing : isEditing // ignore: cast_nullable_to_non_nullable as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable as String, )); } +/// Create a copy of AppUsersViewState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$UserEntityCopyWith<$Res>? get loggedUser { + if (_self.loggedUser == null) { + return null; + } + return $UserEntityCopyWith<$Res>(_self.loggedUser!, (value) { + return _then(_self.copyWith(loggedUser: value)); + }); +} } @@ -153,10 +166,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( bool isLoading, List appUsers, bool isEditing, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( bool isLoading, UserEntity? loggedUser, List appUsers, bool isEditing, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _AppUsersViewState() when $default != null: -return $default(_that.isLoading,_that.appUsers,_that.isEditing,_that.errorMessage);case _: +return $default(_that.isLoading,_that.loggedUser,_that.appUsers,_that.isEditing,_that.errorMessage);case _: return orElse(); } @@ -174,10 +187,10 @@ return $default(_that.isLoading,_that.appUsers,_that.isEditing,_that.errorMessag /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( bool isLoading, List appUsers, bool isEditing, String errorMessage) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( bool isLoading, UserEntity? loggedUser, List appUsers, bool isEditing, String errorMessage) $default,) {final _that = this; switch (_that) { case _AppUsersViewState(): -return $default(_that.isLoading,_that.appUsers,_that.isEditing,_that.errorMessage);case _: +return $default(_that.isLoading,_that.loggedUser,_that.appUsers,_that.isEditing,_that.errorMessage);case _: throw StateError('Unexpected subclass'); } @@ -194,10 +207,10 @@ return $default(_that.isLoading,_that.appUsers,_that.isEditing,_that.errorMessag /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool isLoading, List appUsers, bool isEditing, String errorMessage)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool isLoading, UserEntity? loggedUser, List appUsers, bool isEditing, String errorMessage)? $default,) {final _that = this; switch (_that) { case _AppUsersViewState() when $default != null: -return $default(_that.isLoading,_that.appUsers,_that.isEditing,_that.errorMessage);case _: +return $default(_that.isLoading,_that.loggedUser,_that.appUsers,_that.isEditing,_that.errorMessage);case _: return null; } @@ -209,10 +222,11 @@ return $default(_that.isLoading,_that.appUsers,_that.isEditing,_that.errorMessag class _AppUsersViewState implements AppUsersViewState { - const _AppUsersViewState({this.isLoading = false, final List appUsers = const [], this.isEditing = false, this.errorMessage = ''}): _appUsers = appUsers; + const _AppUsersViewState({this.isLoading = false, this.loggedUser = null, final List appUsers = const [], this.isEditing = false, this.errorMessage = ''}): _appUsers = appUsers; @override@JsonKey() final bool isLoading; +@override@JsonKey() final UserEntity? loggedUser; final List _appUsers; @override@JsonKey() List get appUsers { if (_appUsers is EqualUnmodifiableListView) return _appUsers; @@ -233,16 +247,16 @@ _$AppUsersViewStateCopyWith<_AppUsersViewState> get copyWith => __$AppUsersViewS @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppUsersViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&const DeepCollectionEquality().equals(other._appUsers, _appUsers)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppUsersViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&const DeepCollectionEquality().equals(other._appUsers, _appUsers)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); } @override -int get hashCode => Object.hash(runtimeType,isLoading,const DeepCollectionEquality().hash(_appUsers),isEditing,errorMessage); +int get hashCode => Object.hash(runtimeType,isLoading,loggedUser,const DeepCollectionEquality().hash(_appUsers),isEditing,errorMessage); @override String toString() { - return 'AppUsersViewState(isLoading: $isLoading, appUsers: $appUsers, isEditing: $isEditing, errorMessage: $errorMessage)'; + return 'AppUsersViewState(isLoading: $isLoading, loggedUser: $loggedUser, appUsers: $appUsers, isEditing: $isEditing, errorMessage: $errorMessage)'; } @@ -253,11 +267,11 @@ abstract mixin class _$AppUsersViewStateCopyWith<$Res> implements $AppUsersViewS factory _$AppUsersViewStateCopyWith(_AppUsersViewState value, $Res Function(_AppUsersViewState) _then) = __$AppUsersViewStateCopyWithImpl; @override @useResult $Res call({ - bool isLoading, List appUsers, bool isEditing, String errorMessage + bool isLoading, UserEntity? loggedUser, List appUsers, bool isEditing, String errorMessage }); - +@override $UserEntityCopyWith<$Res>? get loggedUser; } /// @nodoc @@ -270,17 +284,30 @@ class __$AppUsersViewStateCopyWithImpl<$Res> /// Create a copy of AppUsersViewState /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? appUsers = null,Object? isEditing = null,Object? errorMessage = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? loggedUser = freezed,Object? appUsers = null,Object? isEditing = null,Object? errorMessage = null,}) { return _then(_AppUsersViewState( isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable -as bool,appUsers: null == appUsers ? _self._appUsers : appUsers // ignore: cast_nullable_to_non_nullable +as bool,loggedUser: freezed == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable +as UserEntity?,appUsers: null == appUsers ? _self._appUsers : appUsers // ignore: cast_nullable_to_non_nullable as List,isEditing: null == isEditing ? _self.isEditing : isEditing // ignore: cast_nullable_to_non_nullable as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable as String, )); } +/// Create a copy of AppUsersViewState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$UserEntityCopyWith<$Res>? get loggedUser { + if (_self.loggedUser == null) { + return null; + } + return $UserEntityCopyWith<$Res>(_self.loggedUser!, (value) { + return _then(_self.copyWith(loggedUser: value)); + }); +} } // dart format on diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/domain/delete_device_use_case.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/delete_device_use_case.dart new file mode 100644 index 00000000..89642902 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/delete_device_use_case.dart @@ -0,0 +1,4 @@ + +abstract class DeleteDeviceUseCase { + Future deleteDevice({required String userId, required String deviceId}); +} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/domain/delete_device_use_case_impl.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/delete_device_use_case_impl.dart new file mode 100644 index 00000000..e7b01819 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/delete_device_use_case_impl.dart @@ -0,0 +1,13 @@ +import 'package:account/src/core/domain/repositories/account_repository.dart'; +import 'package:account/src/features/linked_devices/domain/delete_device_use_case.dart'; + +class DeleteDeviceUseCaseImpl implements DeleteDeviceUseCase { + DeleteDeviceUseCaseImpl(this._repository); + + final AccountRepository _repository; + + @override + Future deleteDevice({required String userId, required String deviceId}) async { + return _repository.deleteDevice(userId: userId, deviceId: deviceId); + } +} diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/domain/entities/update_device_request_entity.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/entities/update_device_request_entity.dart new file mode 100644 index 00000000..966a4d57 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/entities/update_device_request_entity.dart @@ -0,0 +1,11 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'update_device_request_entity.freezed.dart'; + +@freezed +abstract class UpdateDeviceRequestEntity with _$UpdateDeviceRequestEntity { + const factory UpdateDeviceRequestEntity({ + required String identificator, + required String name, + }) = _UpdateDeviceRequestEntity; +} diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/domain/entities/update_devices_request_entity.freezed.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/entities/update_devices_request_entity.freezed.dart new file mode 100644 index 00000000..1abcd476 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/entities/update_devices_request_entity.freezed.dart @@ -0,0 +1 @@ +part of 'update_device_request_entity.dart'; \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/domain/update_device_use_case.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/update_device_use_case.dart index 1d8d5f56..a21f308b 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/domain/update_device_use_case.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/update_device_use_case.dart @@ -1,4 +1,6 @@ +import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart'; + abstract class UpdateDeviceUseCase { - Future updateDevice({required String userId}); + Future updateDevice({required String userId, required String deviceId, required UpdateDeviceRequestEntity request}); } \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/domain/update_device_use_case_impl.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/update_device_use_case_impl.dart index ef7822c6..2822b149 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/domain/update_device_use_case_impl.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/update_device_use_case_impl.dart @@ -1,4 +1,5 @@ import 'package:account/src/core/domain/repositories/account_repository.dart'; +import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart'; // import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; // import 'package:account/src/features/linked_devices/domain/get_linked_devices_use_case.dart'; import 'package:account/src/features/linked_devices/domain/update_device_use_case.dart'; @@ -9,7 +10,7 @@ class UpdateDeviceUseCaseImpl implements UpdateDeviceUseCase { final AccountRepository _repository; @override - Future updateDevice({required String userId}) async { - /*return _repository.updateDevice(userId: userId);*/ + Future updateDevice({required String userId, required String deviceId, required UpdateDeviceRequestEntity request}) async { + return _repository.updateDevice(userId: userId, deviceId: deviceId, request: request); } } diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart index 2cb0a086..b77dea99 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart @@ -71,6 +71,7 @@ class LinkedDevicesScreen extends ConsumerWidget { itemBuilder: (BuildContext context, int index)=>LinkedDeviceCard( device: state.linkedDevices[index], isEditing: state.isEditing, + onDelete: ()=>vm.deleteDevice(state.linkedDevices[index]), ), separatorBuilder: (BuildContext context, int index)=>SizedBox( height: SizeUtils.getByScreen(small: 18, big: 17) @@ -89,10 +90,12 @@ class LinkedDeviceCard extends ConsumerWidget { final DeviceEntity device; final bool isEditing; + final Function onDelete; const LinkedDeviceCard({ required this.device, required this.isEditing, + required this.onDelete, }); @override @@ -175,7 +178,15 @@ class LinkedDeviceCard extends ConsumerWidget { )), SizedBox(width: SizeUtils.getByScreen(small: 4, big: 16)), Expanded(child: PrimaryButton( - onPressed: (){ + onPressed: () async { + if (!await onDelete()) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: CustomSnackBar( + message: 'AAAAAAAAA', + type: MessageType.warning, + ).build(context)) + ); + } Navigator.pop(context); }, text: 'Delete', diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/providers/delete_device_use_case_provider.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/providers/delete_device_use_case_provider.dart new file mode 100644 index 00000000..a86f43f5 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/providers/delete_device_use_case_provider.dart @@ -0,0 +1,9 @@ +import 'package:account/src/core/providers/account_repository_provider.dart'; +import 'package:account/src/features/linked_devices/domain/delete_device_use_case.dart'; +import 'package:account/src/features/linked_devices/domain/delete_device_use_case_impl.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +final deleteDeviceUseCaseProvider = Provider.autoDispose((ref) { + final accountRepository = ref.read(accountRepositoryProvider); + return DeleteDeviceUseCaseImpl(accountRepository); +}); diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/providers/get_linked_devices_use_case_provider.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/providers/get_linked_devices_use_case_provider.dart index 4a6b96db..667e9026 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/providers/get_linked_devices_use_case_provider.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/providers/get_linked_devices_use_case_provider.dart @@ -4,6 +4,6 @@ import 'package:account/src/features/linked_devices/domain/get_linked_devices_us import 'package:flutter_riverpod/flutter_riverpod.dart'; final getLinkedDevicesUseCaseProvider = Provider.autoDispose((ref) { - final authRepository = ref.read(accountRepositoryProvider); - return GetLinkedDevicesUseCaseImpl(authRepository); + final accountRepository = ref.read(accountRepositoryProvider); + return GetLinkedDevicesUseCaseImpl(accountRepository); }); diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/providers/update_device_use_case_provider.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/providers/update_device_use_case_provider.dart index eb322aec..45b55a4c 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/providers/update_device_use_case_provider.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/providers/update_device_use_case_provider.dart @@ -4,6 +4,6 @@ import 'package:account/src/features/linked_devices/domain/update_device_use_cas import 'package:flutter_riverpod/flutter_riverpod.dart'; final updateDeviceUseCaseProvider = Provider.autoDispose((ref) { - final authRepository = ref.read(accountRepositoryProvider); - return UpdateDeviceUseCaseImpl(authRepository); + final accountRepository = ref.read(accountRepositoryProvider); + return UpdateDeviceUseCaseImpl(accountRepository); }); diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_model.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_model.dart index 4a3ead02..42fdaf8c 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_model.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_model.dart @@ -1,9 +1,15 @@ +import 'package:account/src/core/data/models/entities/user_entity.dart'; +import 'package:account/src/features/linked_devices/domain/delete_device_use_case.dart'; import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart'; import 'package:account/src/features/linked_devices/domain/get_linked_devices_use_case.dart'; import 'package:account/src/features/linked_devices/domain/update_device_use_case.dart'; +import 'package:account/src/features/linked_devices/presentation/providers/delete_device_use_case_provider.dart'; import 'package:account/src/features/linked_devices/presentation/providers/get_linked_devices_use_case_provider.dart'; import 'package:account/src/features/linked_devices/presentation/providers/update_device_use_case_provider.dart'; import 'package:account/src/features/linked_devices/presentation/state/linked_devices_view_state.dart'; +import 'package:account/src/features/personal_data/domain/get_logged_user_use_case.dart'; +import 'package:account/src/features/personal_data/presentation/providers/get_logged_user_use_case_provider.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; // import 'package:sf_localizations/sf_localizations.dart'; @@ -14,20 +20,28 @@ NotifierProvider.autoDispose( ); class LinkedDevicesViewModel extends Notifier { + late final GetLoggedUserUseCase _getLoggedUserUseCase; late final GetLinkedDevicesUseCase _getLinkedDevicesUseCase; late final UpdateDeviceUseCase _updateDeviceUseCase; + late final DeleteDeviceUseCase _deleteDeviceUseCase; late final TextEditingController deviceNameController; @override LinkedDevicesViewState build() { + _getLoggedUserUseCase = ref.read(getLoggedUserUseCaseProvider); _getLinkedDevicesUseCase = ref.read(getLinkedDevicesUseCaseProvider); _updateDeviceUseCase = ref.read(updateDeviceUseCaseProvider); + _deleteDeviceUseCase = ref.read(deleteDeviceUseCaseProvider); deviceNameController = TextEditingController(); deviceNameController.addListener(_onDeviceNameChanged); - _getLinkedDevicesUseCase.getLinkedDevices(userId: 'test') + _getLoggedUserUseCase.getLoggedUser(token: 'test') + .then((UserEntity user){ + setUser(user); + return _getLinkedDevicesUseCase.getLinkedDevices(userId: user.id); + }) .then(setLinkedDevices); ref.onDispose(disposeControllers); @@ -35,6 +49,10 @@ class LinkedDevicesViewModel extends Notifier { return const LinkedDevicesViewState(); } + void setUser(UserEntity user) { + state = state.copyWith(loggedUser: user); + } + void setLinkedDevices(List linkedDevices) { state = state.copyWith(linkedDevices: linkedDevices); } @@ -53,6 +71,31 @@ class LinkedDevicesViewModel extends Notifier { ); } + Future deleteDevice(DeviceEntity device) async { + try { + await _deleteDeviceUseCase.deleteDevice(userId: state.loggedUser!.id, deviceId: device.identificator); + List newList = state.linkedDevices; + newList.remove(device); + + state = state.copyWith( + linkedDevices: newList + ); + + return true; + } catch (e) { + return false; + } + } + + UpdateDeviceRequestEntity _toRequest(DeviceEntity device) { + + return UpdateDeviceRequestEntity( + identificator: device.identificator, + name: state.deviceName.trim(), + // phone: /*state.dialCode.trim() + */state.phoneNumber.trim(), + ); + } + void updateDevice(DeviceEntity device) { final deviceName = state.deviceName; @@ -62,7 +105,11 @@ class LinkedDevicesViewModel extends Notifier { ); return; } - + final userId = 'test'; + _updateDeviceUseCase.updateDevice( + userId: userId, + deviceId: device.identificator, + request: _toRequest(device)); } diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_state.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_state.dart index 62ec03c4..e76f5a0c 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_state.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_state.dart @@ -1,3 +1,4 @@ +import 'package:account/src/core/data/models/entities/user_entity.dart'; import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; @@ -7,6 +8,7 @@ part 'linked_devices_view_state.freezed.dart'; abstract class LinkedDevicesViewState with _$LinkedDevicesViewState { const factory LinkedDevicesViewState({ @Default(false) bool isLoading, + @Default(null) UserEntity? loggedUser, @Default([]) List linkedDevices, @Default(false) bool isEditing, @Default('') String deviceName, diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_state.freezed.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_state.freezed.dart index 64b48bae..55347ca2 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_state.freezed.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_state.freezed.dart @@ -14,7 +14,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$LinkedDevicesViewState { - bool get isLoading; List get linkedDevices; bool get isEditing; String get deviceName; String get errorMessage; + bool get isLoading; UserEntity? get loggedUser; List get linkedDevices; bool get isEditing; String get deviceName; String get errorMessage; /// Create a copy of LinkedDevicesViewState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -25,16 +25,16 @@ $LinkedDevicesViewStateCopyWith get copyWith => _$Linked @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is LinkedDevicesViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&const DeepCollectionEquality().equals(other.linkedDevices, linkedDevices)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is LinkedDevicesViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&const DeepCollectionEquality().equals(other.linkedDevices, linkedDevices)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); } @override -int get hashCode => Object.hash(runtimeType,isLoading,const DeepCollectionEquality().hash(linkedDevices),isEditing,deviceName,errorMessage); +int get hashCode => Object.hash(runtimeType,isLoading,loggedUser,const DeepCollectionEquality().hash(linkedDevices),isEditing,deviceName,errorMessage); @override String toString() { - return 'LinkedDevicesViewState(isLoading: $isLoading, linkedDevices: $linkedDevices, isEditing: $isEditing, deviceName: $deviceName, errorMessage: $errorMessage)'; + return 'LinkedDevicesViewState(isLoading: $isLoading, loggedUser: $loggedUser, linkedDevices: $linkedDevices, isEditing: $isEditing, deviceName: $deviceName, errorMessage: $errorMessage)'; } @@ -45,11 +45,11 @@ abstract mixin class $LinkedDevicesViewStateCopyWith<$Res> { factory $LinkedDevicesViewStateCopyWith(LinkedDevicesViewState value, $Res Function(LinkedDevicesViewState) _then) = _$LinkedDevicesViewStateCopyWithImpl; @useResult $Res call({ - bool isLoading, List linkedDevices, bool isEditing, String deviceName, String errorMessage + bool isLoading, UserEntity? loggedUser, List linkedDevices, bool isEditing, String deviceName, String errorMessage }); - +$UserEntityCopyWith<$Res>? get loggedUser; } /// @nodoc @@ -62,17 +62,30 @@ class _$LinkedDevicesViewStateCopyWithImpl<$Res> /// Create a copy of LinkedDevicesViewState /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? linkedDevices = null,Object? isEditing = null,Object? deviceName = null,Object? errorMessage = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? loggedUser = freezed,Object? linkedDevices = null,Object? isEditing = null,Object? deviceName = null,Object? errorMessage = null,}) { return _then(_self.copyWith( isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable -as bool,linkedDevices: null == linkedDevices ? _self.linkedDevices : linkedDevices // ignore: cast_nullable_to_non_nullable +as bool,loggedUser: freezed == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable +as UserEntity?,linkedDevices: null == linkedDevices ? _self.linkedDevices : linkedDevices // ignore: cast_nullable_to_non_nullable as List,isEditing: null == isEditing ? _self.isEditing : isEditing // ignore: cast_nullable_to_non_nullable as bool,deviceName: null == deviceName ? _self.deviceName : deviceName // ignore: cast_nullable_to_non_nullable as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable as String, )); } +/// Create a copy of LinkedDevicesViewState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$UserEntityCopyWith<$Res>? get loggedUser { + if (_self.loggedUser == null) { + return null; + } + return $UserEntityCopyWith<$Res>(_self.loggedUser!, (value) { + return _then(_self.copyWith(loggedUser: value)); + }); +} } @@ -154,10 +167,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( bool isLoading, List linkedDevices, bool isEditing, String deviceName, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( bool isLoading, UserEntity? loggedUser, List linkedDevices, bool isEditing, String deviceName, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _LinkedDevicesViewState() when $default != null: -return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.deviceName,_that.errorMessage);case _: +return $default(_that.isLoading,_that.loggedUser,_that.linkedDevices,_that.isEditing,_that.deviceName,_that.errorMessage);case _: return orElse(); } @@ -175,10 +188,10 @@ return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.device /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( bool isLoading, List linkedDevices, bool isEditing, String deviceName, String errorMessage) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( bool isLoading, UserEntity? loggedUser, List linkedDevices, bool isEditing, String deviceName, String errorMessage) $default,) {final _that = this; switch (_that) { case _LinkedDevicesViewState(): -return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.deviceName,_that.errorMessage);case _: +return $default(_that.isLoading,_that.loggedUser,_that.linkedDevices,_that.isEditing,_that.deviceName,_that.errorMessage);case _: throw StateError('Unexpected subclass'); } @@ -195,10 +208,10 @@ return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.device /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool isLoading, List linkedDevices, bool isEditing, String deviceName, String errorMessage)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool isLoading, UserEntity? loggedUser, List linkedDevices, bool isEditing, String deviceName, String errorMessage)? $default,) {final _that = this; switch (_that) { case _LinkedDevicesViewState() when $default != null: -return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.deviceName,_that.errorMessage);case _: +return $default(_that.isLoading,_that.loggedUser,_that.linkedDevices,_that.isEditing,_that.deviceName,_that.errorMessage);case _: return null; } @@ -210,10 +223,11 @@ return $default(_that.isLoading,_that.linkedDevices,_that.isEditing,_that.device class _LinkedDevicesViewState implements LinkedDevicesViewState { - const _LinkedDevicesViewState({this.isLoading = false, final List linkedDevices = const [], this.isEditing = false, this.deviceName = '', this.errorMessage = ''}): _linkedDevices = linkedDevices; + const _LinkedDevicesViewState({this.isLoading = false, this.loggedUser = null, final List linkedDevices = const [], this.isEditing = false, this.deviceName = '', this.errorMessage = ''}): _linkedDevices = linkedDevices; @override@JsonKey() final bool isLoading; +@override@JsonKey() final UserEntity? loggedUser; final List _linkedDevices; @override@JsonKey() List get linkedDevices { if (_linkedDevices is EqualUnmodifiableListView) return _linkedDevices; @@ -235,16 +249,16 @@ _$LinkedDevicesViewStateCopyWith<_LinkedDevicesViewState> get copyWith => __$Lin @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _LinkedDevicesViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&const DeepCollectionEquality().equals(other._linkedDevices, _linkedDevices)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _LinkedDevicesViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&const DeepCollectionEquality().equals(other._linkedDevices, _linkedDevices)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); } @override -int get hashCode => Object.hash(runtimeType,isLoading,const DeepCollectionEquality().hash(_linkedDevices),isEditing,deviceName,errorMessage); +int get hashCode => Object.hash(runtimeType,isLoading,loggedUser,const DeepCollectionEquality().hash(_linkedDevices),isEditing,deviceName,errorMessage); @override String toString() { - return 'LinkedDevicesViewState(isLoading: $isLoading, linkedDevices: $linkedDevices, isEditing: $isEditing, deviceName: $deviceName, errorMessage: $errorMessage)'; + return 'LinkedDevicesViewState(isLoading: $isLoading, loggedUser: $loggedUser, linkedDevices: $linkedDevices, isEditing: $isEditing, deviceName: $deviceName, errorMessage: $errorMessage)'; } @@ -255,11 +269,11 @@ abstract mixin class _$LinkedDevicesViewStateCopyWith<$Res> implements $LinkedDe factory _$LinkedDevicesViewStateCopyWith(_LinkedDevicesViewState value, $Res Function(_LinkedDevicesViewState) _then) = __$LinkedDevicesViewStateCopyWithImpl; @override @useResult $Res call({ - bool isLoading, List linkedDevices, bool isEditing, String deviceName, String errorMessage + bool isLoading, UserEntity? loggedUser, List linkedDevices, bool isEditing, String deviceName, String errorMessage }); - +@override $UserEntityCopyWith<$Res>? get loggedUser; } /// @nodoc @@ -272,10 +286,11 @@ class __$LinkedDevicesViewStateCopyWithImpl<$Res> /// Create a copy of LinkedDevicesViewState /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? linkedDevices = null,Object? isEditing = null,Object? deviceName = null,Object? errorMessage = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? loggedUser = freezed,Object? linkedDevices = null,Object? isEditing = null,Object? deviceName = null,Object? errorMessage = null,}) { return _then(_LinkedDevicesViewState( isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable -as bool,linkedDevices: null == linkedDevices ? _self._linkedDevices : linkedDevices // ignore: cast_nullable_to_non_nullable +as bool,loggedUser: freezed == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable +as UserEntity?,linkedDevices: null == linkedDevices ? _self._linkedDevices : linkedDevices // ignore: cast_nullable_to_non_nullable as List,isEditing: null == isEditing ? _self.isEditing : isEditing // ignore: cast_nullable_to_non_nullable as bool,deviceName: null == deviceName ? _self.deviceName : deviceName // ignore: cast_nullable_to_non_nullable as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable @@ -283,7 +298,19 @@ as String, )); } +/// Create a copy of LinkedDevicesViewState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$UserEntityCopyWith<$Res>? get loggedUser { + if (_self.loggedUser == null) { + return null; + } + return $UserEntityCopyWith<$Res>(_self.loggedUser!, (value) { + return _then(_self.copyWith(loggedUser: value)); + }); +} } // dart format on From 16a5ed2e80bfc1a12ee6184942e2842b44c3c023 Mon Sep 17 00:00:00 2001 From: aitorarana Date: Wed, 4 Feb 2026 16:32:33 +0100 Subject: [PATCH 09/25] added account settings texts to I18n --- .../presentation/account_settings_screen.dart | 12 +++++----- .../presentation/app_users_screen.dart | 14 ++++++------ .../edit_linked_device_screen.dart | 6 ++--- .../presentation/linked_devices_screen.dart | 17 +++++--------- .../presentation/personal_data_screen.dart | 14 ++++++------ packages/sf_localizations/assets/l10n/en.json | 22 ++++++++++++++++++- packages/sf_localizations/assets/l10n/es.json | 22 ++++++++++++++++++- .../lib/src/generated/i18n.dart | 21 ++++++++++++++++++ 8 files changed, 91 insertions(+), 37 deletions(-) diff --git a/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart b/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart index 16c447f6..6f2f73d0 100644 --- a/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart @@ -50,34 +50,34 @@ class AccountSettingsScreen extends ConsumerWidget { AppSectionButton( onPressed: (){navigationContract.pushTo(AppRoutes.personalData);}, icon: SFIcons.account, - text: 'Personal Data' + text: I18n.legacyPersonalData ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){}, icon: Icons.add_circle_outline, - text: 'Add a new SaveFamily' + text: I18n.legacyAddNewSF ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){navigationContract.pushTo(AppRoutes.linkedDevices);}, icon: Icons.account_circle_outlined, - text: 'Linked Devices' + text: I18n.legacyLinkedDevices ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){navigationContract.pushTo(AppRoutes.appUsers);}, icon: Icons.groups_outlined, - text: 'App Users' + text: I18n.legacyAppUsers ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){}, icon: SFIcons.privacy, - text: 'User privacy policy' + text: I18n.legacyPrivacyPolicy ), SizedBox(height: SizeUtils.getByScreen(small: 48, big: 47)), - PrimaryButton(text: 'Log out', color: Color(0xFF588EA5)) + PrimaryButton(text: context.translate(I18n.legacyLogOut), color: Color(0xFF588EA5)) ], ), )), diff --git a/modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart b/modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart index 65516ec9..48bf1a18 100644 --- a/modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart @@ -53,7 +53,7 @@ class AppUsersScreen extends ConsumerWidget { ], ), Center( - child: Text(context.translate('App users'), + child: Text(context.translate(I18n.legacyAppUsers), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 28, big: 27) ), @@ -87,7 +87,7 @@ class AppUsersScreen extends ConsumerWidget { ), child: PrimaryButton( onPressed: vm.toggleIsEditing, - text: 'Save', + text: context.translate(I18n.legacySave), color: Color(0xFF588EA5), height: SizeUtils.getByScreen(small: 44, big: 42), ), @@ -148,12 +148,12 @@ class AppUserCard extends ConsumerWidget { fontWeight: FontWeight.w500 ) ), - Text('Account: ${user.email}', + Text(context.translate(I18n.legacyUserAccount, args: {'email': user.email}), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 14, big: 13), ) ), - Text('Role: ${user.role}', + Text(context.translate(I18n.legacyUserRole, args: {'role': user.role}), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 14, big: 13), ) @@ -178,7 +178,7 @@ class AppUserCard extends ConsumerWidget { height: SizeUtils.getByScreen(small: 195, big: 185), child: Column( children: [ - Text('Are you sure you want to delete this user from the list?', + Text(context.translate(I18n.legacyDeleteUserDialog), textAlign: TextAlign.center, style: TextStyle(fontSize: SizeUtils.getByScreen(small: 19, big: 18)), ), @@ -188,7 +188,7 @@ class AppUserCard extends ConsumerWidget { children: [ Expanded(child: PrimaryButton( onPressed: (){Navigator.pop(context);}, - text: 'Cancel', + text: context.translate(I18n.legacyCancel), color: Color(0xFF588EA5), height: SizeUtils.getByScreen(small: 38, big: 36), radius: SizeUtils.getByScreen(small: 32, big: 34), @@ -198,7 +198,7 @@ class AppUserCard extends ConsumerWidget { onPressed: (){ Navigator.pop(context); }, - text: 'Delete', + text: context.translate(I18n.legacyDelete), color: Color(0xFF588EA5), height: SizeUtils.getByScreen(small: 38, big: 36), radius: SizeUtils.getByScreen(small: 32, big: 34), diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart index 3e9b0a00..2d68088b 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart @@ -36,7 +36,7 @@ class EditLinkedDeviceScreen extends ConsumerWidget { IconButton(onPressed: () {Navigator.pop(context);}, icon: Icon(Icons.arrow_back)), Center( - child: Text(context.translate('Edit device'), + child: Text(context.translate(I18n.legacyEditDeviceTitle), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 28, big: 27) ), @@ -87,13 +87,13 @@ class EditLinkedDeviceScreen extends ConsumerWidget { CustomTextField( controller: vm.deviceNameController, hint: device.name, - label: 'Name', + label: context.translate(I18n.legacyName), ) ], ), PrimaryButton( onPressed: (){vm.updateDevice(device);}, - text: 'Save', + text: context.translate(I18n.legacySave), color: Color(0xFF588EA5) ) ], diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart index b77dea99..1694f4ef 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart @@ -52,7 +52,7 @@ class LinkedDevicesScreen extends ConsumerWidget { ], ), Center( - child: Text(context.translate('Linked Devices'), + child: Text(context.translate(I18n.legacyLinkedDevices), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 28, big: 27) ), @@ -161,7 +161,7 @@ class LinkedDeviceCard extends ConsumerWidget { height: SizeUtils.getByScreen(small: 195, big: 185), child: Column( children: [ - Text('Are you sure you want to delete this device from the list?', + Text(context.translate(I18n.legacyDeleteDeviceDialog), textAlign: TextAlign.center, style: TextStyle(fontSize: SizeUtils.getByScreen(small: 19, big: 18)), ), @@ -171,7 +171,7 @@ class LinkedDeviceCard extends ConsumerWidget { children: [ Expanded(child: PrimaryButton( onPressed: (){Navigator.pop(context);}, - text: 'Cancel', + text: context.translate(I18n.legacyCancel), color: Color(0xFF588EA5), height: SizeUtils.getByScreen(small: 38, big: 36), radius: SizeUtils.getByScreen(small: 32, big: 34), @@ -179,17 +179,10 @@ class LinkedDeviceCard extends ConsumerWidget { SizedBox(width: SizeUtils.getByScreen(small: 4, big: 16)), Expanded(child: PrimaryButton( onPressed: () async { - if (!await onDelete()) { - ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: CustomSnackBar( - message: 'AAAAAAAAA', - type: MessageType.warning, - ).build(context)) - ); - } + await onDelete(); Navigator.pop(context); }, - text: 'Delete', + text: context.translate(I18n.legacyDelete), color: Color(0xFF588EA5), height: SizeUtils.getByScreen(small: 38, big: 36), radius: SizeUtils.getByScreen(small: 32, big: 34), diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/personal_data_screen.dart b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/personal_data_screen.dart index dc88d957..0e2858f9 100644 --- a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/personal_data_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/personal_data_screen.dart @@ -34,7 +34,7 @@ class PersonalDataScreen extends ConsumerWidget { IconButton(onPressed: () {Navigator.pop(context);}, icon: Icon(Icons.arrow_back)), Center( - child: Text(context.translate('Personal data'), + child: Text(context.translate(I18n.legacyPersonalData), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 28, big: 27) ), @@ -82,7 +82,7 @@ class PersonalDataScreen extends ConsumerWidget { ], ), SizedBox(height: SizeUtils.getByScreen(small: 18, big: 16)), - Text('(Login email)', + Text(context.translate(I18n.legacyLoginEmail), style: TextStyle(fontSize: SizeUtils.getByScreen(small: 14, big: 13)) ), Text(state.user?.email ?? '', @@ -92,33 +92,33 @@ class PersonalDataScreen extends ConsumerWidget { CustomTextField( controller: vm.nameController, hint: state.user?.firstName ?? '', - label: 'Name', + label: context.translate(I18n.legacyUserNameLabel), ), SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)), CustomTextField( controller: vm.phoneController, hint: state.user?.phone ?? '', - label: 'Phone number', + label: context.translate(I18n.legacyUserPhoneLabel), ), SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)), CustomTextField( controller: vm.emailController, hint: state.user?.email ?? '', - label: 'Email', + label: context.translate(I18n.legacyContactEmailLabel), ), SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)), CustomTextField( controller: vm.passwordController, showPassword: state.showPassword, hint: '********', - label: 'Password (6 to 12 digits)', + label: context.translate(I18n.passwordLabel), ), ], ))), SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)), PrimaryButton( onPressed: vm.updateUser, - text: 'Submit', + text: context.translate(I18n.legacySubmit), color: Color(0xFF588EA5) ) ], diff --git a/packages/sf_localizations/assets/l10n/en.json b/packages/sf_localizations/assets/l10n/en.json index b58dd5dc..b1f48462 100755 --- a/packages/sf_localizations/assets/l10n/en.json +++ b/packages/sf_localizations/assets/l10n/en.json @@ -139,5 +139,25 @@ "watchesOnMap": "Smartwatch on the map", "home": "Home", "location": "Location", - "chat": "Chat" + "chat": "Chat", + "personalData": "Personal Data", + "addNewSF": "Add a new SaveFamily", + "linkedDevices": "Linked Devices", + "appUsers": "App Users", + "privacyPolicy": "User privacy policy", + "logOut": "Log out", + "loginEmail": "(Login email)", + "userNameLabel": "User name", + "userPhoneLabel": "User phone number", + "contactEmailLabel": "Contact email", + "passwordLabel": "Password (6 to 12 digits)", + "submit": "Submit", + "save": "Save", + "editDeviceTitle": "Edit Device", + "name": "Name", + "deleteDeviceDialog": "Are you sure you want to delete this device from the list?", + "cancel": "Cancel", + "delete": "Delete", + "userAccount": "Account: {email}", + "userRole": "Role: {role}" } \ 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 c2e75c56..4242bd58 100644 --- a/packages/sf_localizations/assets/l10n/es.json +++ b/packages/sf_localizations/assets/l10n/es.json @@ -139,5 +139,25 @@ "watchesOnMap": "Reloj inteligente en el mapa", "home": "Inicio", "location": "Mapa", - "chat": "Chat" + "chat": "Chat", + "personalData": "Datos Personales", + "addNewSF": "Añadir un nuevo SaveFamily", + "linkedDevices": "Dispositivos vinculados", + "appUsers": "Usuarios de la App", + "privacyPolicy": "Política de privacidad", + "logOut": "Cerrar sesión", + "loginEmail": "(Correo electrónico)", + "userNameLabel": "Nombre del usuario", + "userPhoneLabel": "Número de teléfono del usuario", + "contactEmailLabel": "Correo de contacto", + "passwordLabel": "Contraseña (de 6 a 12 caracteres)", + "submit": "Enviar", + "save": "Guardar", + "editDeviceTitle": "Editar Dispositivo", + "name": "Nombre", + "deleteDeviceDialog": "¿Estás seguro de que quieres eliminar este dispositivo de la lista?", + "cancel": "Cancelar", + "delete": "Eliminar", + "userAccount": "Cuenta: {email}", + "userRole": "Rol: {role}" } \ 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 bd01ab75..4b254ea3 100755 --- a/packages/sf_localizations/lib/src/generated/i18n.dart +++ b/packages/sf_localizations/lib/src/generated/i18n.dart @@ -170,4 +170,25 @@ class I18n { static const String home = 'home'; static const String location = 'location'; static const String chat = 'chat'; + static const String legacyPersonalData = 'personalData'; + static const String legacyAddNewSF = 'addNewSF'; + static const String legacyLinkedDevices = 'linkedDevices'; + static const String legacyAppUsers = 'appUsers'; + static const String legacyPrivacyPolicy = 'privacyPolicy'; + static const String legacyLogOut = 'logOut'; + static const String legacyLoginEmail = 'loginEmail'; + static const String legacyUserNameLabel = 'userNameLabel'; + static const String legacyUserPhoneLabel = 'userPhoneLabel'; + static const String legacyContactEmailLabel = 'contactEmailLabel'; + static const String passwordLabel = 'passwordLabel'; + static const String legacySubmit = 'submit'; + static const String legacySave = 'save'; + static const String legacyEditDeviceTitle = 'editDeviceTitle'; + static const String legacyName = 'name'; + static const String legacyDeleteDeviceDialog = 'deleteDeviceDialog'; + static const String legacyDeleteUserDialog = 'deleteUserDialog'; + static const String legacyCancel = 'cancel'; + static const String legacyDelete = 'delete'; + static const String legacyUserAccount = 'userAccount'; + static const String legacyUserRole = 'userRole'; } From 1cd18b002c383b6763da146a47c14887f3169638 Mon Sep 17 00:00:00 2001 From: aitorarana Date: Thu, 5 Feb 2026 17:51:52 +0100 Subject: [PATCH 10/25] added functions module and functions and contacts screens, state and use cases --- .idea/modules.xml | 4 +- .../mobile_app/lib/navigation/app_router.dart | 15 + apps/mobile_app/pubspec.yaml | 2 + modules/legacy/melos_legacy.iml | 5 +- .../functions_remote_datasource.dart | 5 + .../functions_remote_datasource_impl.dart | 82 +++++ .../functions_repository_impl.dart | 14 + .../repositories/functions_repository.dart | 5 + .../functions_remote_datasource_provider.dart | 9 + .../functions_repository_provider.dart | 9 + .../features/contacts/contacts_builder.dart | 18 + .../domain/entities/contact_list_entity.dart | 19 ++ .../entities/contact_list_entity.freezed.dart | 301 +++++++++++++++++ .../domain/entities/list_contact_entity.dart | 11 + .../entities/list_contact_entity.freezed.dart | 274 ++++++++++++++++ .../domain/get_contacts_use_case.dart | 5 + .../domain/get_contacts_use_case_impl.dart | 14 + .../presentation/contacts_screen.dart | 212 ++++++++++++ .../presentation/edit_contact_screen.dart | 0 .../providers/get_contacts_provider.dart | 9 + .../state/contacts_view_model.dart | 56 ++++ .../state/contacts_view_state.dart | 16 + .../state/contacts_view_state.freezed.dart | 310 ++++++++++++++++++ .../features/functions/functions_builder.dart | 18 + .../features/functions/functions_screen.dart | 179 ++++++++++ .../features/hub/presentation/hub_screen.dart | 2 +- packages/navigation/lib/app_routes.dart | 3 + .../lib/src/generated/i18n.dart | 21 ++ 28 files changed, 1615 insertions(+), 3 deletions(-) create mode 100644 modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource.dart create mode 100644 modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource_impl.dart create mode 100644 modules/legacy/modules/functions/lib/src/core/data/repositories/functions_repository_impl.dart create mode 100644 modules/legacy/modules/functions/lib/src/core/domain/repositories/functions_repository.dart create mode 100644 modules/legacy/modules/functions/lib/src/core/providers/functions_remote_datasource_provider.dart create mode 100644 modules/legacy/modules/functions/lib/src/core/providers/functions_repository_provider.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/contacts/contacts_builder.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_list_entity.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_list_entity.freezed.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/list_contact_entity.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/list_contact_entity.freezed.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/contacts/domain/get_contacts_use_case.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/contacts/domain/get_contacts_use_case_impl.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/contacts/presentation/contacts_screen.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/contacts/presentation/edit_contact_screen.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/contacts/presentation/providers/get_contacts_provider.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_model.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_state.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_state.freezed.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/functions/functions_builder.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart diff --git a/.idea/modules.xml b/.idea/modules.xml index cfa0d987..b7aa4bbc 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,17 +2,19 @@ + + + - diff --git a/apps/mobile_app/lib/navigation/app_router.dart b/apps/mobile_app/lib/navigation/app_router.dart index 485f4469..e28987b5 100644 --- a/apps/mobile_app/lib/navigation/app_router.dart +++ b/apps/mobile_app/lib/navigation/app_router.dart @@ -1,4 +1,5 @@ import 'package:auth/auth.dart'; +import 'package:functions/functions.dart'; import 'package:legacy_dashboard_shell/legacy_dashboard_builder.dart'; import 'package:dashboard_shell/dashboard_builder.dart'; import 'package:flutter/material.dart'; @@ -40,8 +41,22 @@ void configureAppRouter() { ), ], ), + StatefulShellBranch( + routes: [ + GoRoute( + path: AppRoutes.dashboardFunctions, + name: 'functions', + pageBuilder: FunctionsBuilder().buildPage, + ), + ], + ), ], ), + GoRoute( + path: AppRoutes.contacts, + name: 'contacts', + pageBuilder: ContactsBuilder().buildPage, + ), GoRoute( path: AppRoutes.login, diff --git a/apps/mobile_app/pubspec.yaml b/apps/mobile_app/pubspec.yaml index 9fdc39d3..4e4247a9 100644 --- a/apps/mobile_app/pubspec.yaml +++ b/apps/mobile_app/pubspec.yaml @@ -53,6 +53,8 @@ dependencies: path: ../../modules/legacy/modules/legacy_dashboard_shell splash: path: ../../modules/splash + functions: + path: ../../modules/legacy/modules/functions #packages dependencies go here navigation: path: ../../packages/navigation diff --git a/modules/legacy/melos_legacy.iml b/modules/legacy/melos_legacy.iml index 26a45e79..e8a4d511 100644 --- a/modules/legacy/melos_legacy.iml +++ b/modules/legacy/melos_legacy.iml @@ -17,10 +17,13 @@ + + + - + \ No newline at end of file diff --git a/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource.dart b/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource.dart new file mode 100644 index 00000000..bae23bbc --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource.dart @@ -0,0 +1,5 @@ +import 'package:functions/src/features/contacts/domain/entities/contact_list_entity.dart'; + +abstract class FunctionsRemoteDatasource { + Future getContacts({required String deviceId}); +} diff --git a/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource_impl.dart b/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource_impl.dart new file mode 100644 index 00000000..ffef59af --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource_impl.dart @@ -0,0 +1,82 @@ +import 'dart:convert'; + +import 'package:dio/dio.dart'; +// import 'package:flutter/material.dart'; +import 'package:functions/src/core/data/datasources/functions_remote_datasource.dart'; +import 'package:functions/src/features/contacts/domain/entities/contact_list_entity.dart'; +import 'package:functions/src/features/contacts/domain/entities/list_contact_entity.dart'; +import 'package:sf_infrastructure/sf_infrastructure.dart'; + +class FunctionsRemoteDatasourceImpl implements FunctionsRemoteDatasource { + FunctionsRemoteDatasourceImpl(this._repository); + + final QuestiaRepository _repository; + + @override + Future getContacts({required String deviceId}) async { + /*try { + final response = await _repository.post>( + '/devices/$deviceId/contact-lists', + ); + + final data = response.data; + if (data == null || data.isEmpty) { + throw Exception('Empty response from /devices/:deviceId/contact-lists'); + } + + final model = GetContactsResponseModel.fromJson(data); + return model.toEntity(); + } on DioException catch (error) { + throw _mapDioError(error, defaultMessage: 'Error to get contacts'); + }*/ + return ContactListEntity( + id: 'id', + delegationId: 'delegationId', + userId: 'userId', + groupId: 'groupId', + deviceId: 'deviceId', + type: 'type', + contacts: [ + ListContactEntity(name: 'Ana', phone: '111111111'), + ListContactEntity(name: 'Carlos', phone: '222222222'), + ], + createdAt: 'createdAt', + updatedAt: 'updatedAt' + ); + } +} + +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/legacy/modules/functions/lib/src/core/data/repositories/functions_repository_impl.dart b/modules/legacy/modules/functions/lib/src/core/data/repositories/functions_repository_impl.dart new file mode 100644 index 00000000..4ee55fae --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/core/data/repositories/functions_repository_impl.dart @@ -0,0 +1,14 @@ +import 'package:functions/src/core/data/datasources/functions_remote_datasource.dart'; +import 'package:functions/src/core/domain/repositories/functions_repository.dart'; +import 'package:functions/src/features/contacts/domain/entities/contact_list_entity.dart'; + +class FunctionsRepositoryImpl implements FunctionsRepository { + const FunctionsRepositoryImpl(this._remote); + + final FunctionsRemoteDatasource _remote; + + @override + Future getContacts({required String deviceId}) { + return _remote.getContacts(deviceId: deviceId); + } +} diff --git a/modules/legacy/modules/functions/lib/src/core/domain/repositories/functions_repository.dart b/modules/legacy/modules/functions/lib/src/core/domain/repositories/functions_repository.dart new file mode 100644 index 00000000..3df7fc4e --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/core/domain/repositories/functions_repository.dart @@ -0,0 +1,5 @@ +import 'package:functions/src/features/contacts/domain/entities/contact_list_entity.dart'; + +abstract class FunctionsRepository { + Future getContacts({required String deviceId}); +} diff --git a/modules/legacy/modules/functions/lib/src/core/providers/functions_remote_datasource_provider.dart b/modules/legacy/modules/functions/lib/src/core/providers/functions_remote_datasource_provider.dart new file mode 100644 index 00000000..062ca5d4 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/core/providers/functions_remote_datasource_provider.dart @@ -0,0 +1,9 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:functions/src/core/data/datasources/functions_remote_datasource.dart'; +import 'package:functions/src/core/data/datasources/functions_remote_datasource_impl.dart'; +import 'package:sf_infrastructure/sf_infrastructure.dart'; + +final functionsRemoteDatasourceProvider = Provider((ref) { + final questiaRepository = getIt(); + return FunctionsRemoteDatasourceImpl(questiaRepository); +}); diff --git a/modules/legacy/modules/functions/lib/src/core/providers/functions_repository_provider.dart b/modules/legacy/modules/functions/lib/src/core/providers/functions_repository_provider.dart new file mode 100644 index 00000000..325fa7f8 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/core/providers/functions_repository_provider.dart @@ -0,0 +1,9 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:functions/src/core/providers/functions_remote_datasource_provider.dart'; +import 'package:functions/src/core/data/repositories/functions_repository_impl.dart'; +import 'package:functions/src/core/domain/repositories/functions_repository.dart'; + +final functionsRepositoryProvider = Provider((ref) { + final remote = ref.read(functionsRemoteDatasourceProvider); + return FunctionsRepositoryImpl(remote); +}); diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/contacts_builder.dart b/modules/legacy/modules/functions/lib/src/features/contacts/contacts_builder.dart new file mode 100644 index 00000000..df0822e7 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/contacts/contacts_builder.dart @@ -0,0 +1,18 @@ +import 'presentation/contacts_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 ContactsBuilder { + const ContactsBuilder(); + + Page buildPage(BuildContext context, GoRouterState state) { + final NavigationContract navigationContract = GetIt.I(); + + return MaterialPage( + key: state.pageKey, + child: ContactsScreen(navigationContract: navigationContract), + ); + } +} diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_list_entity.dart b/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_list_entity.dart new file mode 100644 index 00000000..ba87d9eb --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_list_entity.dart @@ -0,0 +1,19 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:functions/src/features/contacts/domain/entities/list_contact_entity.dart'; + +part 'contact_list_entity.freezed.dart'; + +@freezed +abstract class ContactListEntity with _$ContactListEntity { + const factory ContactListEntity({ + required String id, + required String delegationId, + required String userId, + required String groupId, + required String deviceId, + required String type, + required List contacts, + required String createdAt, + required String updatedAt + }) = _ContactListEntity; +} diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_list_entity.freezed.dart b/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_list_entity.freezed.dart new file mode 100644 index 00000000..a32a2dea --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_list_entity.freezed.dart @@ -0,0 +1,301 @@ +// 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 'contact_list_entity.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$ContactListEntity { + + String get id; String get delegationId; String get userId; String get groupId; String get deviceId; String get type; List get contacts; String get createdAt; String get updatedAt; +/// Create a copy of ContactListEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ContactListEntityCopyWith get copyWith => _$ContactListEntityCopyWithImpl(this as ContactListEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ContactListEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.type, type) || other.type == type)&&const DeepCollectionEquality().equals(other.contacts, contacts)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); +} + + +@override +int get hashCode => Object.hash(runtimeType,id,delegationId,userId,groupId,deviceId,type,const DeepCollectionEquality().hash(contacts),createdAt,updatedAt); + +@override +String toString() { + return 'ContactListEntity(id: $id, delegationId: $delegationId, userId: $userId, groupId: $groupId, deviceId: $deviceId, type: $type, contacts: $contacts, createdAt: $createdAt, updatedAt: $updatedAt)'; +} + + +} + +/// @nodoc +abstract mixin class $ContactListEntityCopyWith<$Res> { + factory $ContactListEntityCopyWith(ContactListEntity value, $Res Function(ContactListEntity) _then) = _$ContactListEntityCopyWithImpl; +@useResult +$Res call({ + String id, String delegationId, String userId, String groupId, String deviceId, String type, List contacts, String createdAt, String updatedAt +}); + + + + +} +/// @nodoc +class _$ContactListEntityCopyWithImpl<$Res> + implements $ContactListEntityCopyWith<$Res> { + _$ContactListEntityCopyWithImpl(this._self, this._then); + + final ContactListEntity _self; + final $Res Function(ContactListEntity) _then; + +/// Create a copy of ContactListEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? delegationId = null,Object? userId = null,Object? groupId = null,Object? deviceId = null,Object? type = null,Object? contacts = null,Object? createdAt = null,Object? updatedAt = null,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,delegationId: null == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable +as String,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable +as String,groupId: null == groupId ? _self.groupId : groupId // ignore: cast_nullable_to_non_nullable +as String,deviceId: null == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable +as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as String,contacts: null == contacts ? _self.contacts : contacts // ignore: cast_nullable_to_non_nullable +as List,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as String,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [ContactListEntity]. +extension ContactListEntityPatterns on ContactListEntity { +/// 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( _ContactListEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _ContactListEntity() 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( _ContactListEntity value) $default,){ +final _that = this; +switch (_that) { +case _ContactListEntity(): +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( _ContactListEntity value)? $default,){ +final _that = this; +switch (_that) { +case _ContactListEntity() 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 delegationId, String userId, String groupId, String deviceId, String type, List contacts, String createdAt, String updatedAt)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _ContactListEntity() when $default != null: +return $default(_that.id,_that.delegationId,_that.userId,_that.groupId,_that.deviceId,_that.type,_that.contacts,_that.createdAt,_that.updatedAt);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 delegationId, String userId, String groupId, String deviceId, String type, List contacts, String createdAt, String updatedAt) $default,) {final _that = this; +switch (_that) { +case _ContactListEntity(): +return $default(_that.id,_that.delegationId,_that.userId,_that.groupId,_that.deviceId,_that.type,_that.contacts,_that.createdAt,_that.updatedAt);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 delegationId, String userId, String groupId, String deviceId, String type, List contacts, String createdAt, String updatedAt)? $default,) {final _that = this; +switch (_that) { +case _ContactListEntity() when $default != null: +return $default(_that.id,_that.delegationId,_that.userId,_that.groupId,_that.deviceId,_that.type,_that.contacts,_that.createdAt,_that.updatedAt);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _ContactListEntity implements ContactListEntity { + const _ContactListEntity({required this.id, required this.delegationId, required this.userId, required this.groupId, required this.deviceId, required this.type, required final List contacts, required this.createdAt, required this.updatedAt}): _contacts = contacts; + + +@override final String id; +@override final String delegationId; +@override final String userId; +@override final String groupId; +@override final String deviceId; +@override final String type; + final List _contacts; +@override List get contacts { + if (_contacts is EqualUnmodifiableListView) return _contacts; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_contacts); +} + +@override final String createdAt; +@override final String updatedAt; + +/// Create a copy of ContactListEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$ContactListEntityCopyWith<_ContactListEntity> get copyWith => __$ContactListEntityCopyWithImpl<_ContactListEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _ContactListEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.type, type) || other.type == type)&&const DeepCollectionEquality().equals(other._contacts, _contacts)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); +} + + +@override +int get hashCode => Object.hash(runtimeType,id,delegationId,userId,groupId,deviceId,type,const DeepCollectionEquality().hash(_contacts),createdAt,updatedAt); + +@override +String toString() { + return 'ContactListEntity(id: $id, delegationId: $delegationId, userId: $userId, groupId: $groupId, deviceId: $deviceId, type: $type, contacts: $contacts, createdAt: $createdAt, updatedAt: $updatedAt)'; +} + + +} + +/// @nodoc +abstract mixin class _$ContactListEntityCopyWith<$Res> implements $ContactListEntityCopyWith<$Res> { + factory _$ContactListEntityCopyWith(_ContactListEntity value, $Res Function(_ContactListEntity) _then) = __$ContactListEntityCopyWithImpl; +@override @useResult +$Res call({ + String id, String delegationId, String userId, String groupId, String deviceId, String type, List contacts, String createdAt, String updatedAt +}); + + + + +} +/// @nodoc +class __$ContactListEntityCopyWithImpl<$Res> + implements _$ContactListEntityCopyWith<$Res> { + __$ContactListEntityCopyWithImpl(this._self, this._then); + + final _ContactListEntity _self; + final $Res Function(_ContactListEntity) _then; + +/// Create a copy of ContactListEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? delegationId = null,Object? userId = null,Object? groupId = null,Object? deviceId = null,Object? type = null,Object? contacts = null,Object? createdAt = null,Object? updatedAt = null,}) { + return _then(_ContactListEntity( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,delegationId: null == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable +as String,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable +as String,groupId: null == groupId ? _self.groupId : groupId // ignore: cast_nullable_to_non_nullable +as String,deviceId: null == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable +as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as String,contacts: null == contacts ? _self._contacts : contacts // ignore: cast_nullable_to_non_nullable +as List,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as String,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/list_contact_entity.dart b/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/list_contact_entity.dart new file mode 100644 index 00000000..32bcab66 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/list_contact_entity.dart @@ -0,0 +1,11 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'list_contact_entity.freezed.dart'; + +@freezed +abstract class ListContactEntity with _$ListContactEntity { + const factory ListContactEntity({ + required String name, + required String phone, + }) = _ListContactEntity; +} diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/list_contact_entity.freezed.dart b/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/list_contact_entity.freezed.dart new file mode 100644 index 00000000..efd95bd7 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/list_contact_entity.freezed.dart @@ -0,0 +1,274 @@ +// 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 'list_contact_entity.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$ListContactEntity { + + String get name; String get phone; +/// Create a copy of ListContactEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ListContactEntityCopyWith get copyWith => _$ListContactEntityCopyWithImpl(this as ListContactEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ListContactEntity&&(identical(other.name, name) || other.name == name)&&(identical(other.phone, phone) || other.phone == phone)); +} + + +@override +int get hashCode => Object.hash(runtimeType,name,phone); + +@override +String toString() { + return 'ListContactEntity(name: $name, phone: $phone)'; +} + + +} + +/// @nodoc +abstract mixin class $ListContactEntityCopyWith<$Res> { + factory $ListContactEntityCopyWith(ListContactEntity value, $Res Function(ListContactEntity) _then) = _$ListContactEntityCopyWithImpl; +@useResult +$Res call({ + String name, String phone +}); + + + + +} +/// @nodoc +class _$ListContactEntityCopyWithImpl<$Res> + implements $ListContactEntityCopyWith<$Res> { + _$ListContactEntityCopyWithImpl(this._self, this._then); + + final ListContactEntity _self; + final $Res Function(ListContactEntity) _then; + +/// Create a copy of ListContactEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? name = null,Object? phone = null,}) { + return _then(_self.copyWith( +name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [ListContactEntity]. +extension ListContactEntityPatterns on ListContactEntity { +/// 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( _ListContactEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _ListContactEntity() 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( _ListContactEntity value) $default,){ +final _that = this; +switch (_that) { +case _ListContactEntity(): +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( _ListContactEntity value)? $default,){ +final _that = this; +switch (_that) { +case _ListContactEntity() 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 name, String phone)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _ListContactEntity() when $default != null: +return $default(_that.name,_that.phone);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 name, String phone) $default,) {final _that = this; +switch (_that) { +case _ListContactEntity(): +return $default(_that.name,_that.phone);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 name, String phone)? $default,) {final _that = this; +switch (_that) { +case _ListContactEntity() when $default != null: +return $default(_that.name,_that.phone);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _ListContactEntity implements ListContactEntity { + const _ListContactEntity({required this.name, required this.phone}); + + +@override final String name; +@override final String phone; + +/// Create a copy of ListContactEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$ListContactEntityCopyWith<_ListContactEntity> get copyWith => __$ListContactEntityCopyWithImpl<_ListContactEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _ListContactEntity&&(identical(other.name, name) || other.name == name)&&(identical(other.phone, phone) || other.phone == phone)); +} + + +@override +int get hashCode => Object.hash(runtimeType,name,phone); + +@override +String toString() { + return 'ListContactEntity(name: $name, phone: $phone)'; +} + + +} + +/// @nodoc +abstract mixin class _$ListContactEntityCopyWith<$Res> implements $ListContactEntityCopyWith<$Res> { + factory _$ListContactEntityCopyWith(_ListContactEntity value, $Res Function(_ListContactEntity) _then) = __$ListContactEntityCopyWithImpl; +@override @useResult +$Res call({ + String name, String phone +}); + + + + +} +/// @nodoc +class __$ListContactEntityCopyWithImpl<$Res> + implements _$ListContactEntityCopyWith<$Res> { + __$ListContactEntityCopyWithImpl(this._self, this._then); + + final _ListContactEntity _self; + final $Res Function(_ListContactEntity) _then; + +/// Create a copy of ListContactEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? name = null,Object? phone = null,}) { + return _then(_ListContactEntity( +name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/domain/get_contacts_use_case.dart b/modules/legacy/modules/functions/lib/src/features/contacts/domain/get_contacts_use_case.dart new file mode 100644 index 00000000..bf0dde3f --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/contacts/domain/get_contacts_use_case.dart @@ -0,0 +1,5 @@ +import 'package:functions/src/features/contacts/domain/entities/contact_list_entity.dart'; + +abstract class GetContactsUseCase { + Future getContacts({required String deviceId}); +} diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/domain/get_contacts_use_case_impl.dart b/modules/legacy/modules/functions/lib/src/features/contacts/domain/get_contacts_use_case_impl.dart new file mode 100644 index 00000000..250f0cfb --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/contacts/domain/get_contacts_use_case_impl.dart @@ -0,0 +1,14 @@ +import 'package:functions/src/core/domain/repositories/functions_repository.dart'; +import 'package:functions/src/features/contacts/domain/entities/contact_list_entity.dart'; +import 'package:functions/src/features/contacts/domain/get_contacts_use_case.dart'; + +class GetContactsUseCaseImpl implements GetContactsUseCase { + GetContactsUseCaseImpl(this._repository); + + final FunctionsRepository _repository; + + @override + Future getContacts({required String deviceId}) { + return _repository.getContacts(deviceId: deviceId); + } +} diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/contacts_screen.dart b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/contacts_screen.dart new file mode 100644 index 00000000..ea57f14b --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/contacts_screen.dart @@ -0,0 +1,212 @@ +import 'package:design_system/design_system.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:functions/src/features/contacts/domain/entities/list_contact_entity.dart'; +import 'package:functions/src/features/contacts/presentation/state/contacts_view_model.dart'; +import 'package:navigation/navigation.dart'; +import 'package:sf_localizations/sf_localizations.dart'; +import 'package:utils/utils.dart'; + +class ContactsScreen extends ConsumerWidget { + final NavigationContract navigationContract; + + const ContactsScreen({super.key, required this.navigationContract}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final vm = ref.read(contactsViewModelProvider.notifier); + final state = ref.watch(contactsViewModelProvider); + + final theme = ref.watch(themePortProvider); + + return Scaffold( + backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + body: SafeArea( + child: Column( + children: [ + Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) + ), + child: Stack( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + IconButton(onPressed: () {Navigator.pop(context);}, + icon: Icon(Icons.arrow_back)), + if (!state.isEditing) ...[ + DecoratedBox( + decoration: BoxDecoration( + color: Color(0xFF588EA5), + shape: BoxShape.circle + ), + child: IconButton(onPressed: vm.toggleIsEditing, + icon: Icon(Icons.edit_outlined, + color: Colors.white, + size: SizeUtils.getByScreen(small: 30, big: 28), + ) + ), + ) + ] + ], + ), + Center( + child: Text(context.translate('Agenda'), + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 28, big: 27) + ), + ) + ) + ], + ), + ), + SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)), + Expanded( child: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) + ), + child: ListView.separated( + itemBuilder: (BuildContext context, int index)=>ContactCard( + contact: state.contactList!.contacts[index], + isEditing: state.isEditing, + ), + separatorBuilder: (BuildContext context, int index)=>SizedBox( + height: SizeUtils.getByScreen(small: 18, big: 17) + ), + itemCount: state.contactList?.contacts.length ?? 0 + ), + )), + if (state.isEditing) ...[ + Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 26, vertical: 14), + big: EdgeInsets.symmetric(horizontal: 24, vertical: 12) + ), + ), + ] + ], + ) + ), + ); + } +} + +class ContactCard extends ConsumerWidget { + + final ListContactEntity contact; + final bool isEditing; + + const ContactCard({ + required this.contact, + required this.isEditing, + }); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.read(themePortProvider); + + return 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(SFIcons.account, + size: SizeUtils.getByScreen(small: 40, big: 44), + color: Color(0xFF588EA5), + weight: 30, + ), + ), + SizedBox(width: SizeUtils.getByScreen(small: 16, big: 15)), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(contact.name, + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 18, big: 19), + fontWeight: FontWeight.w500 + ) + ), + Text(contact.phone, + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 14, big: 13), + ) + ) + ], + ) + ), + if (isEditing) ...[ + DecoratedBox( + decoration: BoxDecoration( + color: Color(0xFFFF5D52), + borderRadius: BorderRadius.all(Radius.circular(12)), + ), + child: IconButton( + onPressed: (){showDialog(context: context, builder: (context)=>Dialog( + child: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 32, vertical: 30), + big: EdgeInsets.symmetric(horizontal: 30, vertical: 28) + ), + width: SizeUtils.getByScreen(small: 360, big: 350), + height: SizeUtils.getByScreen(small: 195, big: 185), + child: Column( + children: [ + Text(context.translate(I18n.legacyDeleteUserDialog), + textAlign: TextAlign.center, + style: TextStyle(fontSize: SizeUtils.getByScreen(small: 19, big: 18)), + ), + SizedBox(height: SizeUtils.getByScreen(small: 28, big: 27)), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded(child: PrimaryButton( + onPressed: (){Navigator.pop(context);}, + text: context.translate(I18n.legacyCancel), + color: Color(0xFF588EA5), + height: SizeUtils.getByScreen(small: 38, big: 36), + radius: SizeUtils.getByScreen(small: 32, big: 34), + )), + SizedBox(width: SizeUtils.getByScreen(small: 4, big: 16)), + Expanded(child: PrimaryButton( + onPressed: (){ + Navigator.pop(context); + }, + text: context.translate(I18n.legacyDelete), + color: Color(0xFF588EA5), + height: SizeUtils.getByScreen(small: 38, big: 36), + radius: SizeUtils.getByScreen(small: 32, big: 34), + )) + ], + ) + ], + ), + ), + ));}, + icon: Icon( + Icons.close, + color: Colors.white, + ), + ), + ), + ] + ], + ), + ); + } +} \ No newline at end of file diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/edit_contact_screen.dart b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/edit_contact_screen.dart new file mode 100644 index 00000000..e69de29b diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/providers/get_contacts_provider.dart b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/providers/get_contacts_provider.dart new file mode 100644 index 00000000..913d152f --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/providers/get_contacts_provider.dart @@ -0,0 +1,9 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:functions/src/core/providers/functions_repository_provider.dart'; +import 'package:functions/src/features/contacts/domain/get_contacts_use_case.dart'; +import 'package:functions/src/features/contacts/domain/get_contacts_use_case_impl.dart'; + +final getContactsUseCaseProvider = Provider.autoDispose((ref) { + final functionsRepository = ref.read(functionsRepositoryProvider); + return GetContactsUseCaseImpl(functionsRepository); +}); diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_model.dart b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_model.dart new file mode 100644 index 00000000..1c3d2c98 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_model.dart @@ -0,0 +1,56 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:functions/src/features/contacts/domain/entities/contact_list_entity.dart'; +import 'package:functions/src/features/contacts/domain/get_contacts_use_case.dart'; +import 'package:functions/src/features/contacts/presentation/providers/get_contacts_provider.dart'; +import 'package:functions/src/features/contacts/presentation/state/contacts_view_state.dart'; +// import 'package:sf_localizations/sf_localizations.dart'; + +final contactsViewModelProvider = +NotifierProvider.autoDispose( + ContactsViewModel.new, +); + +class ContactsViewModel extends Notifier { + late final GetContactsUseCase _getContactsUseCase; + + late final TextEditingController nameController; + + @override + ContactsViewState build() { + _getContactsUseCase = ref.read(getContactsUseCaseProvider); + + nameController = TextEditingController(); + + nameController.addListener(_onNameChanged); + + _getContactsUseCase.getContacts(deviceId: '').then(setContacts); + + ref.onDispose(disposeControllers); + + return const ContactsViewState(); + } + + void setContacts(ContactListEntity contactList) { + state = state.copyWith( + contactList: contactList + ); + } + + void toggleIsEditing() { + state = state.copyWith(isEditing: !state.isEditing); + } + + void _onNameChanged() { + final text = nameController.text; + if (text == state.name) return; + + state = state.copyWith(name: text, errorMessage: ''); + } + + void disposeControllers() { + nameController.removeListener(_onNameChanged); + + nameController.dispose(); + } +} diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_state.dart b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_state.dart new file mode 100644 index 00000000..439ee615 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_state.dart @@ -0,0 +1,16 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:functions/src/features/contacts/domain/entities/contact_list_entity.dart'; + +part 'contacts_view_state.freezed.dart'; + +@freezed +abstract class ContactsViewState with _$ContactsViewState { + const factory ContactsViewState({ + @Default(null) ContactListEntity? contactList, + @Default(false) bool isLoading, + @Default(false) bool isEditing, + @Default('') String name, + @Default('') String phone, + @Default('') String errorMessage, + }) = _ContactsViewState; +} diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_state.freezed.dart b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_state.freezed.dart new file mode 100644 index 00000000..1d74938c --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_state.freezed.dart @@ -0,0 +1,310 @@ +// 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 'contacts_view_state.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$ContactsViewState { + + ContactListEntity? get contactList; bool get isLoading; bool get isEditing; String get name; String get phone; String get errorMessage; +/// Create a copy of ContactsViewState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ContactsViewStateCopyWith get copyWith => _$ContactsViewStateCopyWithImpl(this as ContactsViewState, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ContactsViewState&&(identical(other.contactList, contactList) || other.contactList == contactList)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.name, name) || other.name == name)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); +} + + +@override +int get hashCode => Object.hash(runtimeType,contactList,isLoading,isEditing,name,phone,errorMessage); + +@override +String toString() { + return 'ContactsViewState(contactList: $contactList, isLoading: $isLoading, isEditing: $isEditing, name: $name, phone: $phone, errorMessage: $errorMessage)'; +} + + +} + +/// @nodoc +abstract mixin class $ContactsViewStateCopyWith<$Res> { + factory $ContactsViewStateCopyWith(ContactsViewState value, $Res Function(ContactsViewState) _then) = _$ContactsViewStateCopyWithImpl; +@useResult +$Res call({ + ContactListEntity? contactList, bool isLoading, bool isEditing, String name, String phone, String errorMessage +}); + + +$ContactListEntityCopyWith<$Res>? get contactList; + +} +/// @nodoc +class _$ContactsViewStateCopyWithImpl<$Res> + implements $ContactsViewStateCopyWith<$Res> { + _$ContactsViewStateCopyWithImpl(this._self, this._then); + + final ContactsViewState _self; + final $Res Function(ContactsViewState) _then; + +/// Create a copy of ContactsViewState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? contactList = freezed,Object? isLoading = null,Object? isEditing = null,Object? name = null,Object? phone = null,Object? errorMessage = null,}) { + return _then(_self.copyWith( +contactList: freezed == contactList ? _self.contactList : contactList // ignore: cast_nullable_to_non_nullable +as ContactListEntity?,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable +as bool,isEditing: null == isEditing ? _self.isEditing : isEditing // ignore: cast_nullable_to_non_nullable +as bool,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable +as String, + )); +} +/// Create a copy of ContactsViewState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$ContactListEntityCopyWith<$Res>? get contactList { + if (_self.contactList == null) { + return null; + } + + return $ContactListEntityCopyWith<$Res>(_self.contactList!, (value) { + return _then(_self.copyWith(contactList: value)); + }); +} +} + + +/// Adds pattern-matching-related methods to [ContactsViewState]. +extension ContactsViewStatePatterns on ContactsViewState { +/// 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( _ContactsViewState value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _ContactsViewState() 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( _ContactsViewState value) $default,){ +final _that = this; +switch (_that) { +case _ContactsViewState(): +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( _ContactsViewState value)? $default,){ +final _that = this; +switch (_that) { +case _ContactsViewState() 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( ContactListEntity? contactList, bool isLoading, bool isEditing, String name, String phone, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _ContactsViewState() when $default != null: +return $default(_that.contactList,_that.isLoading,_that.isEditing,_that.name,_that.phone,_that.errorMessage);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( ContactListEntity? contactList, bool isLoading, bool isEditing, String name, String phone, String errorMessage) $default,) {final _that = this; +switch (_that) { +case _ContactsViewState(): +return $default(_that.contactList,_that.isLoading,_that.isEditing,_that.name,_that.phone,_that.errorMessage);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( ContactListEntity? contactList, bool isLoading, bool isEditing, String name, String phone, String errorMessage)? $default,) {final _that = this; +switch (_that) { +case _ContactsViewState() when $default != null: +return $default(_that.contactList,_that.isLoading,_that.isEditing,_that.name,_that.phone,_that.errorMessage);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _ContactsViewState implements ContactsViewState { + const _ContactsViewState({this.contactList = null, this.isLoading = false, this.isEditing = false, this.name = '', this.phone = '', this.errorMessage = ''}); + + +@override@JsonKey() final ContactListEntity? contactList; +@override@JsonKey() final bool isLoading; +@override@JsonKey() final bool isEditing; +@override@JsonKey() final String name; +@override@JsonKey() final String phone; +@override@JsonKey() final String errorMessage; + +/// Create a copy of ContactsViewState +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$ContactsViewStateCopyWith<_ContactsViewState> get copyWith => __$ContactsViewStateCopyWithImpl<_ContactsViewState>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _ContactsViewState&&(identical(other.contactList, contactList) || other.contactList == contactList)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.name, name) || other.name == name)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); +} + + +@override +int get hashCode => Object.hash(runtimeType,contactList,isLoading,isEditing,name,phone,errorMessage); + +@override +String toString() { + return 'ContactsViewState(contactList: $contactList, isLoading: $isLoading, isEditing: $isEditing, name: $name, phone: $phone, errorMessage: $errorMessage)'; +} + + +} + +/// @nodoc +abstract mixin class _$ContactsViewStateCopyWith<$Res> implements $ContactsViewStateCopyWith<$Res> { + factory _$ContactsViewStateCopyWith(_ContactsViewState value, $Res Function(_ContactsViewState) _then) = __$ContactsViewStateCopyWithImpl; +@override @useResult +$Res call({ + ContactListEntity? contactList, bool isLoading, bool isEditing, String name, String phone, String errorMessage +}); + + +@override $ContactListEntityCopyWith<$Res>? get contactList; + +} +/// @nodoc +class __$ContactsViewStateCopyWithImpl<$Res> + implements _$ContactsViewStateCopyWith<$Res> { + __$ContactsViewStateCopyWithImpl(this._self, this._then); + + final _ContactsViewState _self; + final $Res Function(_ContactsViewState) _then; + +/// Create a copy of ContactsViewState +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? contactList = freezed,Object? isLoading = null,Object? isEditing = null,Object? name = null,Object? phone = null,Object? errorMessage = null,}) { + return _then(_ContactsViewState( +contactList: freezed == contactList ? _self.contactList : contactList // ignore: cast_nullable_to_non_nullable +as ContactListEntity?,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable +as bool,isEditing: null == isEditing ? _self.isEditing : isEditing // ignore: cast_nullable_to_non_nullable +as bool,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +/// Create a copy of ContactsViewState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$ContactListEntityCopyWith<$Res>? get contactList { + if (_self.contactList == null) { + return null; + } + + return $ContactListEntityCopyWith<$Res>(_self.contactList!, (value) { + return _then(_self.copyWith(contactList: value)); + }); +} +} + +// dart format on diff --git a/modules/legacy/modules/functions/lib/src/features/functions/functions_builder.dart b/modules/legacy/modules/functions/lib/src/features/functions/functions_builder.dart new file mode 100644 index 00000000..186a46cb --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/functions/functions_builder.dart @@ -0,0 +1,18 @@ +import 'package:flutter/material.dart'; +import 'package:functions/src/features/functions/functions_screen.dart'; +import 'package:go_router/go_router.dart'; +import 'package:get_it/get_it.dart'; +import 'package:navigation/navigation.dart'; + +class FunctionsBuilder { + const FunctionsBuilder(); + + Page buildPage(BuildContext context, GoRouterState state) { + final NavigationContract navigationContract = GetIt.I(); + + return MaterialPage( + key: state.pageKey, + child: FunctionsScreen(navigationContract: navigationContract), + ); + } +} diff --git a/modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart b/modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart new file mode 100644 index 00000000..390cee00 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart @@ -0,0 +1,179 @@ +import 'package:design_system/design_system.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:navigation/navigation.dart'; +import 'package:sf_localizations/sf_localizations.dart'; +import 'package:utils/utils.dart'; + +class FunctionsScreen extends ConsumerWidget { + final NavigationContract navigationContract; + + const FunctionsScreen({super.key, required this.navigationContract}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.watch(themePortProvider); + + return Scaffold( + backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + body: SafeArea( + child: Column( + children: [ + Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) + ), + child: Stack( + children: [ + IconButton(onPressed: () {Navigator.pop(context);}, + icon: Icon(Icons.arrow_back)), + Center( + child: Text(context.translate('Device Features'), + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 28, big: 27) + ), + ) + ) + ], + ), + ), + SizedBox(height: SizeUtils.getByScreen(small: 30, big: 28)), + Expanded(child: SingleChildScrollView(child: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) + ), + child: Column( + children: [ + AppSectionButton( + onPressed: (){}, + icon: Icons.menu, + text: 'Remote connection' + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){}, + icon: Icons.menu, + text: 'Calendar' + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){navigationContract.pushTo(AppRoutes.contacts);}, + icon: Icons.menu, + text: 'Contacts' + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){}, + icon: Icons.menu, + text: 'Do not disturb' + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){}, + icon: Icons.menu, + text: 'Safety zone' + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){}, + icon: Icons.menu, + text: 'Video call' + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){}, + icon: Icons.menu, + text: 'Fall notice' + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){}, + icon: Icons.menu, + text: 'Medication reminder' + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){}, + icon: Icons.menu, + text: 'Activity meter' + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){}, + icon: Icons.menu, + text: 'Rewards' + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){}, + icon: Icons.menu, + text: 'Locate your SaveFamily' + ), + ], + ), + ))), + ], + ) + ), + ); + } +} + +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: 14), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 12) + ), + 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: Color(0xFF588EA5), + ), + padding: EdgeInsets.all(SizeUtils.getByScreen(small: 4, big: 12)), + child: Icon(icon, + size: SizeUtils.getByScreen(small: 40, big: 44), + color: theme.getColorFor(ThemeCode.backgroundPrimary), + 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/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart b/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart index 47eb7af8..dc9898d6 100644 --- a/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart @@ -61,7 +61,7 @@ class HubScreen extends ConsumerWidget { text: I18n.sfPay), SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), AppSectionButton( - onPressed: (){}, + onPressed: (){navigationContract.pushTo(AppRoutes.dashboardFunctions);}, icon: SFIcons.functions, text: I18n.functions), SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), diff --git a/packages/navigation/lib/app_routes.dart b/packages/navigation/lib/app_routes.dart index 45ba35c8..63dd0af8 100644 --- a/packages/navigation/lib/app_routes.dart +++ b/packages/navigation/lib/app_routes.dart @@ -20,4 +20,7 @@ class AppRoutes { static const legacyDashboard = '$legacy/dashboard'; static const dashboardHub = '$legacyDashboard/hub'; + static const dashboardFunctions = '$legacyDashboard/functions'; + + static const contacts = '$dashboardFunctions/contacts'; } diff --git a/packages/sf_localizations/lib/src/generated/i18n.dart b/packages/sf_localizations/lib/src/generated/i18n.dart index bd01ab75..4b254ea3 100755 --- a/packages/sf_localizations/lib/src/generated/i18n.dart +++ b/packages/sf_localizations/lib/src/generated/i18n.dart @@ -170,4 +170,25 @@ class I18n { static const String home = 'home'; static const String location = 'location'; static const String chat = 'chat'; + static const String legacyPersonalData = 'personalData'; + static const String legacyAddNewSF = 'addNewSF'; + static const String legacyLinkedDevices = 'linkedDevices'; + static const String legacyAppUsers = 'appUsers'; + static const String legacyPrivacyPolicy = 'privacyPolicy'; + static const String legacyLogOut = 'logOut'; + static const String legacyLoginEmail = 'loginEmail'; + static const String legacyUserNameLabel = 'userNameLabel'; + static const String legacyUserPhoneLabel = 'userPhoneLabel'; + static const String legacyContactEmailLabel = 'contactEmailLabel'; + static const String passwordLabel = 'passwordLabel'; + static const String legacySubmit = 'submit'; + static const String legacySave = 'save'; + static const String legacyEditDeviceTitle = 'editDeviceTitle'; + static const String legacyName = 'name'; + static const String legacyDeleteDeviceDialog = 'deleteDeviceDialog'; + static const String legacyDeleteUserDialog = 'deleteUserDialog'; + static const String legacyCancel = 'cancel'; + static const String legacyDelete = 'delete'; + static const String legacyUserAccount = 'userAccount'; + static const String legacyUserRole = 'userRole'; } From 6049ce0bee34db0bce0c25edef11f7a5d1ad3c4a Mon Sep 17 00:00:00 2001 From: aitorarana Date: Mon, 9 Feb 2026 09:38:58 +0100 Subject: [PATCH 11/25] added edit_contact screen and functions icons --- apps/mobile_app/assets/images/ui/profile.svg | 12 + .../presentation/contacts_screen.dart | 51 ++- .../presentation/edit_contact_screen.dart | 136 +++++++ .../state/contacts_view_model.dart | 15 + .../features/functions/functions_screen.dart | 32 +- .../legacy_main_shell_screen.dart | 2 +- packages/design_system/fonts/SFIcons.ttf | Bin 0 -> 27592 bytes packages/design_system/lib/fonts/SFIcons.ttf | Bin 15708 -> 0 bytes packages/design_system/lib/fonts/config.json | 310 +++++++++++++- .../design_system/lib/src/icons/sf_icons.dart | 383 ++++-------------- packages/design_system/pubspec.yaml | 4 + packages/sf_localizations/assets/l10n/en.json | 22 +- packages/sf_localizations/assets/l10n/es.json | 22 +- 13 files changed, 661 insertions(+), 328 deletions(-) create mode 100644 apps/mobile_app/assets/images/ui/profile.svg create mode 100644 packages/design_system/fonts/SFIcons.ttf delete mode 100755 packages/design_system/lib/fonts/SFIcons.ttf diff --git a/apps/mobile_app/assets/images/ui/profile.svg b/apps/mobile_app/assets/images/ui/profile.svg new file mode 100644 index 00000000..3e1a697c --- /dev/null +++ b/apps/mobile_app/assets/images/ui/profile.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/contacts_screen.dart b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/contacts_screen.dart index ea57f14b..a90a0b13 100644 --- a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/contacts_screen.dart +++ b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/contacts_screen.dart @@ -2,6 +2,7 @@ import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:functions/src/features/contacts/domain/entities/list_contact_entity.dart'; +import 'package:functions/src/features/contacts/presentation/edit_contact_screen.dart'; import 'package:functions/src/features/contacts/presentation/state/contacts_view_model.dart'; import 'package:navigation/navigation.dart'; import 'package:sf_localizations/sf_localizations.dart'; @@ -35,18 +36,18 @@ class ContactsScreen extends ConsumerWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ IconButton(onPressed: () {Navigator.pop(context);}, - icon: Icon(Icons.arrow_back)), + icon: Icon(Icons.arrow_back)), if (!state.isEditing) ...[ DecoratedBox( decoration: BoxDecoration( - color: Color(0xFF588EA5), - shape: BoxShape.circle + color: Color(0xFF588EA5), + shape: BoxShape.circle ), child: IconButton(onPressed: vm.toggleIsEditing, - icon: Icon(Icons.edit_outlined, - color: Colors.white, - size: SizeUtils.getByScreen(small: 30, big: 28), - ) + icon: Icon(Icons.edit_outlined, + color: Colors.white, + size: SizeUtils.getByScreen(small: 30, big: 28), + ) ), ) ] @@ -86,7 +87,20 @@ class ContactsScreen extends ConsumerWidget { big: EdgeInsets.symmetric(horizontal: 24, vertical: 12) ), ), - ] + ], + Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Color(0xFF588EA5), + ), + width: SizeUtils.getByScreen(small: 48, big: 46), + child: CustomTextButton( + onPressed: (){}, + text: '+', + color: Colors.white, + size: SizeUtils.getByScreen(small: 48, big: 47), + ), + ), ], ) ), @@ -204,6 +218,27 @@ class ContactCard extends ConsumerWidget { ), ), ), + SizedBox(width: SizeUtils.getByScreen(small: 16, big: 14)), + DecoratedBox( + decoration: BoxDecoration( + color: Color(0xFF588EA5), + borderRadius: BorderRadius.all(Radius.circular(12)), + ), + child: + IconButton( + onPressed: (){Navigator.push( + context, + MaterialPageRoute(builder: (_) => EditContactScreen( + contact: contact, + /*navigationContract: navigationContract*/ + )), + );}, + icon: Icon( + Icons.edit_outlined, + color: Colors.white, + ), + ), + ), ] ], ), diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/edit_contact_screen.dart b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/edit_contact_screen.dart index e69de29b..dbe78eb8 100644 --- a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/edit_contact_screen.dart +++ b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/edit_contact_screen.dart @@ -0,0 +1,136 @@ +import 'package:design_system/design_system.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:functions/src/features/contacts/domain/entities/list_contact_entity.dart'; +import 'package:functions/src/features/contacts/presentation/state/contacts_view_model.dart'; +// import 'package:navigation/navigation.dart'; +import 'package:sf_localizations/sf_localizations.dart'; +import 'package:utils/utils.dart'; + +class EditContactScreen extends ConsumerWidget { + //final NavigationContract navigationContract; + final ListContactEntity contact; + + const EditContactScreen({super.key, required this.contact +// required this.navigationContract +}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final vm = ref.read(contactsViewModelProvider.notifier); + // final state = ref.watch(linkedDevicesViewModelProvider); + + final theme = ref.watch(themePortProvider); + + return Scaffold( + backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + body: SafeArea( + child: Column( + children: [ + Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) + ), + child: Stack( + children: [ + IconButton(onPressed: () {Navigator.pop(context);}, + icon: Icon(Icons.arrow_back)), + Center( + child: Text(context.translate('Edit Contact'), + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 28, big: 27) + ), + ) + ) + ], + ), + ), + SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)), + Expanded(child: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 48, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 47, vertical: 8) + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Stack( + children: [ + Center(child: SvgPicture.asset('assets/images/ui/profile.svg')), + Center(child: SizedBox( + width: 160, + height: 160, + child: Align(alignment: Alignment.bottomRight, + child: IconButton( + onPressed: (){}, + icon: Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Color(0xFFCAC9C9) + ), + padding: EdgeInsets.all(8), + child: Icon( + Icons.edit_outlined, + color: Colors.white, + size: SizeUtils.getByScreen(small: 32, big: 30), + ), + ), + ) + ) + )) + ], + ), + SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)), + CustomTextField( + controller: vm.nameController, + hint: contact.name, + label: context.translate(I18n.legacyName), + ), + SizedBox(height: SizeUtils.getByScreen(small: 28, big: 26)), + Stack( + children: [ + CustomTextField( + controller: vm.phoneController, + keyboardType: TextInputType.number, + hint: contact.phone, + label: context.translate('Phone number'), + ), + Align( + alignment: Alignment.centerRight, + child: IconButton( + onPressed: (){}, + icon: DecoratedBox( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Color(0xFF588EA5) + ), + child: Icon( + SFIcons.contactsCircle, + color: Colors.white, + ) + ) + ), + ) + ], + ) + ], + ), + PrimaryButton( + onPressed: (){vm.updateContact(contact);}, + text: context.translate(I18n.legacySave), + color: Color(0xFF588EA5) + ) + ], + )) + ), + ], + ) + ), + ); + } +} diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_model.dart b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_model.dart index 1c3d2c98..b792c2a5 100644 --- a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_model.dart +++ b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_model.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:functions/src/features/contacts/domain/entities/contact_list_entity.dart'; +import 'package:functions/src/features/contacts/domain/entities/list_contact_entity.dart'; import 'package:functions/src/features/contacts/domain/get_contacts_use_case.dart'; import 'package:functions/src/features/contacts/presentation/providers/get_contacts_provider.dart'; import 'package:functions/src/features/contacts/presentation/state/contacts_view_state.dart'; @@ -15,14 +16,17 @@ class ContactsViewModel extends Notifier { late final GetContactsUseCase _getContactsUseCase; late final TextEditingController nameController; + late final TextEditingController phoneController; @override ContactsViewState build() { _getContactsUseCase = ref.read(getContactsUseCaseProvider); nameController = TextEditingController(); + phoneController = TextEditingController(); nameController.addListener(_onNameChanged); + phoneController.addListener(_onPhoneChanged); _getContactsUseCase.getContacts(deviceId: '').then(setContacts); @@ -48,9 +52,20 @@ class ContactsViewModel extends Notifier { state = state.copyWith(name: text, errorMessage: ''); } + void _onPhoneChanged() { + final text = phoneController.text; + if (text == state.phone) return; + + state = state.copyWith(phone: text, errorMessage: ''); + } + + void updateContact(ListContactEntity contact) {} + void disposeControllers() { nameController.removeListener(_onNameChanged); + phoneController.removeListener(_onPhoneChanged); nameController.dispose(); + phoneController.dispose(); } } diff --git a/modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart b/modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart index 390cee00..e51d970d 100644 --- a/modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart +++ b/modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart @@ -48,67 +48,67 @@ class FunctionsScreen extends ConsumerWidget { children: [ AppSectionButton( onPressed: (){}, - icon: Icons.menu, + icon: SFIcons.connection, text: 'Remote connection' ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){}, - icon: Icons.menu, + icon: SFIcons.calendarCircle, text: 'Calendar' ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){navigationContract.pushTo(AppRoutes.contacts);}, - icon: Icons.menu, + icon: SFIcons.contactsCircle, text: 'Contacts' ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){}, - icon: Icons.menu, + icon: SFIcons.doNotDisturbCircle, text: 'Do not disturb' ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){}, - icon: Icons.menu, + icon: SFIcons.locationAreaCircle, text: 'Safety zone' ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){}, - icon: Icons.menu, + icon: SFIcons.videoCallCircle, text: 'Video call' ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){}, - icon: Icons.menu, + icon: SFIcons.fallCircle, text: 'Fall notice' ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){}, - icon: Icons.menu, + icon: SFIcons.medicationCircle, text: 'Medication reminder' ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){}, - icon: Icons.menu, + icon: SFIcons.activityCircle, text: 'Activity meter' ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){}, - icon: Icons.menu, + icon: SFIcons.rewardsCircle, text: 'Rewards' ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){}, - icon: Icons.menu, + icon: SFIcons.locateSfCircle, text: 'Locate your SaveFamily' ), ], @@ -153,12 +153,12 @@ class AppSectionButton extends ConsumerWidget { Container( decoration: BoxDecoration( shape: BoxShape.circle, - color: Color(0xFF588EA5), - ), - padding: EdgeInsets.all(SizeUtils.getByScreen(small: 4, big: 12)), - child: Icon(icon, - size: SizeUtils.getByScreen(small: 40, big: 44), color: theme.getColorFor(ThemeCode.backgroundPrimary), + ), + padding: EdgeInsets.all(SizeUtils.getByScreen(small: 0, big: 0)), + child: Icon(icon, + size: SizeUtils.getByScreen(small: 52, big: 48), + color: Color(0xFF588EA5), weight: 30, ), ), diff --git a/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_screen.dart b/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_screen.dart index b86d9016..7c49bca7 100644 --- a/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_screen.dart +++ b/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_screen.dart @@ -51,7 +51,7 @@ class LegacyDashboardScreen extends ConsumerWidget { label: context.translate(I18n.location), ), NavigationDestination( - icon: Icon(Icons.chat_outlined), + icon: Icon(SFIcons.chat), label: context.translate(I18n.chat), ), ], diff --git a/packages/design_system/fonts/SFIcons.ttf b/packages/design_system/fonts/SFIcons.ttf new file mode 100644 index 0000000000000000000000000000000000000000..2703601ac085604f116cec273f8ebc018c313ebd GIT binary patch literal 27592 zcmd_Td6*nmc`sb2_O7kFda2%~_ifgmp6P8C&7#q0A1&5svt>&jNh52dk;WR0EP0Vv zjBPN+CN>ab2oT2@Y}SxKh=U2?0tqI-g+Rh~2}@`QI6R5r-Z-At{hg{FNp_U`k>|-@ zU#9z1pE`Bw)LGvBeNPQT7=}@qI~k5Ct)JdCk$hwB7KR}MDBZbjy0?EcwW$~958{0H zp%XJVia&7Q!7yAm!-&Zn=5Ido&a-d-KEt?PVwh{5J~}&dxc7M1k5TsrNVTIVkT>z) zM*caZ?9mfT=OzmmUPgPULpIDW9GdywXFk6U_fO&aQzvH5-AMkL-HdA?oF`AtoR~ee zWsk)$ho4{=_N5yaPA|RTO}EZ6%nc7S3_rl2@7#_H#~4OPU3lffEBwFGl2`rhuuD+- z{tpgsKHy&UYewZ7w8l@KSxT<_;@&y_U%A~lml>9p;*YkpgB@cQ?K4`c;KMK%>~rV3 z!jza%hMinDwUaUCXO>Pf5r)6)`sH~tKX=0n+IQ|Gs7J37ln_Q-Ddk=w4>JPBdJ9Wu z>_O+3{DA2r=mE6&@;aC2c|eGLpBMKcU4D%NB)#hVvcB+Gb^i6Od!MAMi1R8E@^*Vy=m(#?LVJgB z&*zZ1nDCen*ULs{$J&oQLGIxg<$~ybp6;#XO77zO6hEO z;}=kZa-QIcOo;KIL~isn`Ww~8>c(W_>c+vw(Z;F98yZhv04!n6dU0i_v8J)tzOvA` z!?}XH|NS39i;K)Td|uDo&%D9@Jj7tW@N^bW;?YBqkpNXL^h0GdMrRDhjb50Hm+>)v zCcs!s5Uqp(t5K$ni7{~|!6ca!lV&nZmdP=Brogl_9ZVU-pBMaWv0SZ znHp1P2ADx+h#6*9F(bf$F=m`u%}g+Bm`P?WvyNHMY+yDro0!ea6tjid%4}n{GgqOD z6wd#<|7mmrxbL>60kZ;xuoH!!Mk`S&)MzEFD${5s3UiHCqOjO#B}zdWt%TKQ8m&a> zO{0|n5lo|%D2z5*2~ff`S_$yNG+GIe!!%k6FvK)k3DCqeS_yE)G+GG|#xz<9u*Ni6 z2~fv0S_$ySG+GIe$TV6BFv&Dp3DC(jS_yEG+GH5#WY$8xWzPD30TH7T8Yw?Mk@jHm_{oB2SF#C1Z-p)B_{zdnMR+JfT2vI z-$}q#rU6Py6R?(P3^@t-%QS|a1WaZctDFR!W*Q?-0(LWvQ6~YfSi?|mA~qmaJ`_kDYq$qtZrA|p#EHY zT(9Vl>OU|l#*6MrPsKCudDhb~Kjme;$Gm^#tNA|b`;Gsg|LFh|c(?Vj;4PuWaI$Tv z?R9O9*x^_+KA-R;J2Nk2Ka_hR|8U{0?Hk&^+HqUQKX<;n>s>ue&rbA_(2jDe*~cla zkyO1_$)_bE`h&#kuT^?U3dcMbY8GG6!fCDfOHCs_EgjZgApg@0g~y%693uW3+7s*%Zt=uT-4_dW)EnmoI(vm@>Oj`6?!}Qs$ zT$}{0a({i46pBO=*;8BZOn=@Cht0p|`M;;XpHJWQ_=G#BdqwNIx$PU*&4uS^@otXW zO@DE^ZsYd(YXXv2&v{mF+ddIahkQj}C>@^I-r?eOZ@)2+N-StysEc z+k(5-edCr}O2utE4x|Uu>A^{Q;8xiM_kHoV%lx#RKNKjR)_ zFMtN8fRDg1(r?9xUrgsmNTpV{J94QXt!~iHRA|32uR+UCJ6p(9%j6|YMjG>RYUV(F zaIk)0=7%epQ~S1T?!n*YEq}a{>D#%JEr!hZ(FuH?8T#6*>f1LidtY^fedqaU+HVJz zB=!`gy(FJ@lR_SAn!w`ut^P5rrVUbnG4|g8FfY6SK+?bTB^_X6=W$fo!e)g1nEk%CHn3`EO-t-MD1Gpy?3JvOT7{0DE^Ue;?N`bFw3iH|!KMWv?MuxfB@Y#w zJWz@OvSF_?B@bxx!mqivvwz1VK^w$;F9GBh@<4P7y;g7(kP@WGPeE8>yMwDk!UMHk z`EHi2bXP}*PULbYhDNL16_)GD@2uXZTEr4=tLLRn zUAq;q30wx9n`FO_XM&TGOaYH76xl+aJ|q}tgBBhh4A?MQ$X$-p?CVon!DA}Q#G#?x zQyU5$sx&$?I66Ggqkh!LM)c;c@}B8O`}d%-gXfQOpXS;jJLSNG!NrIKlyMW$1~SY`I+qp$EtmuNrU0@4 z;~ZvvrIem?PI(QGX`x(X??1R2oMoe=>f|O}laGu3<M;K)hKf0F6z zPqXXOeWfi;4a;TPq=Gzr`&L=LP6-8-hvc85_M6jvpp9XZU2le;>Ps*GNxHu;!>-Si zmXEYq~!?RE&gWK@y{qEO6Wn9N*5IX5P#^!+Ze^TLDnCvM5z6^-&g-Hb{qQLq`?MSg(zd zDg~8Solux+U8K-OKQ`TzM7Pu4MLJIJ|94eh^CW|ShuNQM4$o?x0$iMr%@5EMAzyfH zncX*9pWH!Mi6!NMj`ZwZ58gGK?&wI=vSCxr_$8LL)NuAaQkzs>VKSy6rQ!i8}(B zRuh?k#4i7nT}GS5bL#E172?!ppCYUvutW;>6k_>6ARo*1Hjfo^F~2U(2!d`(Jhw~X zUCL!ArtI~F{Bp=J1%cyu$u!(9{J9NN=9X!5rs0tlMfSY5g4=`EE`Lr>q0R3L1bqHB zk3Sgx(k_=k&ji;l+N$m}Lc4HRtElxLyB(+U<@}VhF^%%mavt>fqq$SZr(p(PxgFJQ|@|cTiaG*1g6VQg=MS>*59hiDzO3P?7+On5? z`H5!v3ATrppdi!SWS5|gmR!OSNJHJASCHfd2P?pOLA}fU!Lk(;ZIq~s7FrMZ4VI&V zALSC#N=8`8keBwnb!Z@!8mZOaevKXzV{RppjCU8iqHEU?GI8o{k43WCYBoC<$>l29 zEa~uuLfKGg&FaCSO)k(bhaAN`~#ep2-rK3@9Jha?`E7XLiX?xngZsoFIB zBJCalAsZ#2;E-?G&tVlcN}fT5L)Yu6a5$xtcRoT(n%C3gTdvpHpqCJDkmxoK{fWJv zDe%xj9z?B33Rr|*{B}VgYOzp=*c8aQ)G=Si*s}LcJzETo)%f1zhD@22>(!4hoxLYh z>HH=N^({Sb+PhWH`sNZ{mCQY7mp)#t%WOHbAptcLJR1}E26hA0?QQUD33XIS$fwEc zH0{0b)k10gc};s>%dkUW`6z&Z_q;|6?b|QPwSKBGJM#2v#aPI&6fjAxA0jLfF|Yq# zZvEk7RF=4z#Pu|kkI&(87p{O)&%Tu^D(6s(YA%1FQLD#=KjIqf-@?uj1Pu2=UtQ0f zf&J`Z@TiEhYtaZ(p3=t8ap5QB+b%9G3LzVgy#RZ#!Z%|FWuMn{)4CFs6PsBhElZ@qm}Uo>av;$|t}>k?!s zTf6qezFPB_-3iq&RA?*ifbqqbZJmVuiY!Lru73NdyW$a1?zfNkSd?M6zRiER?8>Rj z?)d3=zwEDWE62jAQfmF~&9`sbbo=Jr>vR3lP`q5o42i1RKVIKgtL>{Ny75#zTXDOa zw?JW`>JkMxtl4ecH@R`xRbWvNE=fAhf?#S*%oijd8<9Y0r~m}49wvZN=xLaGN+?aN z9amkx-AX1cq6QO5tNDDaFNQDsA`Xe}Wa5`e>y1szo#^(EpC!8!&F8ITIBBtWqjGlw zb(X!(4P>>IOaz<1wvt@dN;ZR@?u48C{Ec?YtEmhl+I@Z*eU^bOIp``A%pQiRQ&Lk! zKWur9W=IvP1cfWm1&0mw*GQnH{kEhhdPSgh0;rp#EUTqIU%aQ5u!z=t$x7h&ht0T^ zV1wkWJ;DbtEPEvHp%>qi=tm#pNw=~&*KM7@}mJf2|Zt;F%NgtY5I-h3t0;x2BnEf#*30UV=d= zo29zb2+2#SYEGckaAnl>-y$Eh(T}!J$)hQUiLl>menvC|93(?!?@vQkQuCT&uct*Xxh>$`uyK-B&#|Oq(4Bz(09*DW&8jVQe<`dii6VHlM(&4tw8>DF zCCL<*B%-<~&xPLdDRvn)SRbqbu%?if)dZ?bux3g5La>&XFvSJ|je(k7%LiM^86`we zq^M$JX9ITLw(M|Mn>`*M=Rf(z``<8s?MJNMp<89;Bl$gfujn2D#U61B-(5aO>Fdn8 zen02)^q8wQU$GIy6s4?$7vc@#g=)?^imFQB4~) zI#;m|P_xm&Os84#d03-Aah<=*Q}q!yrs8Rq^h?wq0)_^H) ziIZubbIzvFaC1a95{$ONtCGy}kMbn_T1b%zr821Z!?_lpGqfk$SU?_2z zQY7#Z@E5UQj|e)6J^nh_R*_JBCr^G~$X7y}CU@frMpMA&4`T$uBq$9aVar5?JkJp{jMU@TbA`w057WshXi$wB~2>VFA zJ}{5^CkE;#arbGyEr2V&jx{OI@KxzpP!?Ro3`cy)Hr-N;P@uUS@wsUY92~y#2#4iCdpzlQS64jk>FK^}>eplL_E@aleNldfUC$2-Ru40amHn;Njsn$K zKsO}OmPRm#HZV{K7o~t0zy#wEC}V!12KQH~QfsTf0E;WhP*<@1-Me$=nvN}XRSf!M z-6tsZkvzw`U16`w?IIFSh-;_H$~+N7&KFWmS?1-fSCqW2U?F^Jn*6gE9n5+YAy^mkV<1V6p%KQy00ax$C`-W^d>mpcHPmKuws9Ee z)Fu-HDT@(qbt%*7(SPQ4$RfwpdAPa(>I!)eG?fk2<^z_$1Kr+|>Fem4 zXHTX3YP!d58Xxd@^Wnh3$>le1s2+t<6glb~s~esgOUGi$E;@i+u8|}>Dt7;maShl| zrkNS$c0d_`8a8$tRsuoEAGBr90OU`MNuoA(01G9X7^P$R8YcDrnq%+CP(lmR0&s$Y z2jT;QjP`sGL#Sp!bq&9jql3hB&?&MJe}rT}m0^&@6tF+(xqjQ!u3LvY3oaAJ3g7Cj z6ZyhK-skO%t{G`xqt^CVQouV@-d)BwWqJK_q>>*fZQpfww>Qd#yd8J%uOxdin&pBF z80FLOu3rPt*$h?Me^#&wN(&D?#Zw}=-$6& z)6ScR+6yiZFtV8+r}G$IJ<>6*R(1y@zc-{>{k!`5cJ-&+6T4|EGD|+@op*-+qQ#a+}8n< z8oaI@)Kf?*1qijEXo2!5A=H9a5Ho3zt3n2XO3>mcv#4gMFRDLScR(1m0lf7Z_jS41 zK@3-=@a_#;nyEv(cZ|Jz!@=>Pfob1U9ry3r`$>=IsalPEdU5MRYj*58c>Ug8_jf$y zn;sY<)5X$rJzJvZC;qH?e=;$2z7&ld7`|)A`E-Un)?F@@?mYI3W2~|H&7-MICVhU# zUBd?=(A;f3Vv!FS5@yALKO1 z5CZ!s5a;5vXcy(Y!|w%~^?e#jRsjycCaC1BIA} z{d;n5Z0YJ!ptJLxg%e}(AZlddQT<&3k2?`KhMIBfUAcjQ(TXQt2vp`Ao#r0Rqu4Yc!lnF*#n1)$@oP}-#N;JyaXd(5tJOGs86^h&_2VU&ApaMX;7-h>o+ykS1 ztq#49trS_PNBN8d-+|2(A!s<*HOdN(P?AZFf>ssSuMYM!mpZqNz~;2AlRP*uIxsgG zjOVkpYDZ==Xhk_O>*HIj4r!dho-WTaLIB$89xr;>Q&Dm=M)zI^TR;enmqau|2-Lhngp zleaV&9Z8I}`vZm^E{-Ke$~nX8tPkUfDS9tpmcqs{{$1QOY)>WX?}u7IJyvlt20zwC zrI}K6NRcMQB?=WbucPb~1UzV#P4<30qc6W=@Zo~H)VZOPE#pu!3SrLu%6()H*_(~* zFDAc}Ebb5IUj9>Vy{a}hX@wZCcQk(oHSr}UI&?l((3)q+b0pjRZgVo6BOS?NG1>f9 zE=R)6pVEjr$G0~P>QI8ma}#q7DC;e-%)FQR7<%6FY-Cc@m)EkH*-iz=@pn1FL%aCCz?MG$5`Jt#)WWCKz>Bm3L)b8q^CCvTL){Irq#RBzG*N9M9sKl!-FXl_FI(k1=K53T(_ zw02&S9sOd^cGmxUYbW*D!T%P9XZ{Li&Suqi)Z6}rr>1S&ljA>&BD!V@ICR$bkVDR+ zACN^jvRZK|4U=ZzXPgUXhxuGu}csVZ~X!uY9;{us;lZlA2CdfK~IjTW+;T!9~8-#aVW zLcTQg*prV9X_n%1%VWcx z0wpCTNF9C&XbLTaJ$#fJcBq{LOH!+!?-?EKA*+K4nDL%>e#z$MowoV$&coD#@fi=k zonAL_zizaLeX(aW-jiJRCW>+LY@(Pr?Cweu&-306R3aX;M{mhyR9`R=9XDwEp&gSQ zNE($psa7ncazcvcz#9C5Nriq#Bn8LFT=oGuUAdBBRVA!8*Lu8#HttZg;Pov3pXQ5X z1KH4g(FL8S`2`wdz&2^PfoK2u>(1{#{{$`JZlNXIlqkOBN_g7}g*I=(mH4AS^0+Co znIC9=AzEl_D@4g)^9z@yE~j)w*8CaxUK@1A3XNQ&$}*`TM90mE5W(wIqp6IsfPXiE zjXy}OM3`XMi5yc>0_OiXG5`%lp2Q;=8pVQhIym0BhZj3-Z{z%UZ90b4^Vf|s{kSajUf$YJ>| zbAgV6q{Lac840KjH8A5gJ1`4Ij~=5#@hW1(PmBOBYZ5<70%1`#l@3GUB~9i7bMdS{ z>CuB>EvgVh_zpa7dv*P4Jrx>0P%rMN=$@2s?TJL9kiQqEI>Ah(d?}CK7Eq&KO!_kk zQ!tc>77QDnmrYd&`-yJxk}mORtAm|w^9EV8mC<(VB;*}a*3FF!99-|_EuHwof`9+` zn$0^muA{az*!nOpOY9dgD@?9hZV3`q6EX}0Gb*$Jr-o_l5fx0xd!7oL=gshXmqw)K zlUh=1J}IfnI=gV_YhSaC%2{X>WC*g@=iw1 zgKehKjG*^0)5OxscQ9@~*ZLb4KbF;RTiXzx`9m}IF zx7uMV)V@Zi(q}6%!HbGZhO0SdcPjKcLZ&UAp-**$V}X)NxE}#_nLZKhqz@dW=Ck`v zjoyxQ$nL%E*wK;EvIMb4S3Mq8mqLEaQldsptZXYDmOH|4_auXQSWTF35yKtw@lcQH z_1CNW_J4c-zG|HnU81nnh$?=T_2Vv$wxLOiB9%u+jvia9nX;n3MKeA6+j7$*5!IE5 z6}$lt&$A*db&+mGQS+f_ui<88N!4V9bRE=O3NP?3S4dWMiyNcO-1aq9dW)obg0P19 ztoU2vmZElV=!~R@9!!{0Camd%q#~@(^pzsNI6*r`dwAj(0=fqQ#h-jj(y!3_75Oc) z@-=(Rul%)71xb}nP13yVZm(M2+L4b(jVac_paImaYW(s>`*Fg!^c~;Pbu`17b1LL`XfLJtj zyz8fCFlhcb9G1Ms(5+>-ASGTF!vQr19?Q!t&q*#fTP>d-)V)$Tw7iy9XaB5gToa`x zU)ftJZY%MEA7Pr?i(YhxQZR|ns&pJN{%#qOzl5vBhQ<`00kkaCM`z2!}yKDO3^U^?l9!(c)!40?BcPO12#^w`npj`?`chOCgX~7{Dp0APDgZ4*JnV`P zZhTS!5-MGCZofxwpUA(juG#M*cPrPeAsyv*WvDaPy?O6ccdj~$hm0X4eyC!4$;$Wj&Cd_@B_|WT z!>sS|_JM(I0|TVHXG>4dmTR`+kXUH1jO(T$J-{B*U>`26>oEL&qhno3WPREb4?nSZ z`-nv3WU;evY<|3UV2$?X_wLxQz52U6%CWVD*#~ZagKutfa?bb2c`nemJ<>DWy}29T z;hxlq@d+c4*_5h8WEZ*kO(&~+eY)=7QTF|)j*e}sFaHqzvOBk>hbX6t-J5h6^xsI= zo8li^0sf^R^;9A0909ea9%dU6sk}qk8Fe60hcm@9>JAw}5EAm#n3VES8cb`ad=R!N zaur!9ZLmZ_TMHIaE6x>@is6oB4cB4FZyASL`dxtSBVJFo=y&ygFc{~3<;lsiPlyHS ziN8GAJS|!uR79EgHGlIP(Rvp2g!d8GIX02$Y5v^mNSbD{1HsN+W8#tKw^UhF;4I@r z!R1y-r|LB%5_7@+@GZmbHb|%8VMC!FZ(h2i9*f-J+E#78tGdl~N3_j3`wn?1&P%>? z%W_;0edox*ulFTVX0p>F2d&PeInY_*Sy=$ZZQic9G+ve@!>f|J1F_~7!{af?UGzwI zfL*u~cKu1_DcI>g!+f3jF|$mbBp)H4CSM~zB>%?BY?y^qmb1wmh#jzuav(^yG{$O0 z9somvXo0E4{K3*2gn1VQ&aQ!$w*)v?=%f6rPz~CO4$!S$E5plAR}c8p2m3EV07{#YQ2!GCWk@eSTki16w5+#~l3hD?_Kk4txX{NwAo-r|a@t5nWM zk8DU3qa-aZkC~e|JDER zhe+P8xpufT`>-x z&>dIQU)Zt)YNZArpfVSBRlwv33$uNleX%#w{1(rXe7@KAKw#4x-~6`O9di5;p>C6O z@Tq|b#FYr&4uPgp5FC^p!nH*sV&%b1J_< zh+7c?L8hpqmrCAX0^ks+0&x#QHJq$eb#q+)RAA@Imv$+2Rav$xzpHw`jBQN(1GU}u zHm2t9@~&G;TQVK_H65jCbE`Ss*D;ar$ZqXppS^4Y)AiLYTPF9^Zj-?D`P=GyC%0gS z)AIAYYoWAtV0^G+O@5%OYXEHwjSp_cre8aj4z{Gn5#yeKjb|9L4vnRAqKn5`!cD#G zY|OE3xf#r~#ED>o1rDY&>eF^?J}Jix1uiJ1ir{^%ps4yq0o4y_+NZA33)Y@MR_UjE zgwmmYB^x;9VS6WgS(6}m!^=fk<$m}}9>|3?SJCtla+dhay}5F3RMs?8)7WPqqHCIv zHhn=KjmkMs4Ol+w<>nvSF*{qDN3U|Zu9CBn=bnS#@Q9lA`?KoMb2JL(x%X*a4d2Vh zUBK?)Er_i;>5Q8i1;^l_Xbq97Kp2>#n%j0RjGt~e#X3X8E3$6zcT9kzaKY3?CkfWD zD%`8Kfzg?q3V8g=ggEj#_V*-e`>HX|a3~yPi<3o!>~$D*U&QN;`0DPS@PiwuKR=*v z)B{>bORF18gPJAsZr28K_7UCG#$Imz()8!TFGq5Idwx3U?3kFJ>b{!a>y=}c)cmkL zC0mK*Rj70DPpPL(@dqAJpb+ap85DF_S7oKCjlmisk3Bc9269?!&YlC3 zV%F?AgIxR~?93*1r&r*WpMp2S7FF%FZ+SN1YyWp1P)r)<%#0mf4W-F8Kww_0xy$nK zTav+Sv-=TIwzBoy=w@_g?S(lqPPz zuD}1foA0@Ke}Dh}o44^kJ}XGu6+s$;Zfg*?yn&Os4Kfv5g&|3FZAXO2Z<>Ff3Vq{Q zlkx$TN7 za5XfH6%*-Bl2)r=w@^%pvZ#ssZE+qE5%cI+#( zH8?yFTZ0Lwh#G+7#z9R09}Hwz#tesD<1{S9UN%Vf0<;c#g`YizWIXDTOGP)&{{69idn?syW$(Uk&`eJU4_@Trm7sq7)@Tp;N>@+x*5i5* zLPRbpboBK1?b>}r+cvgpG72b%8<79>Fp2Ei7U zEiPRhmShBqcl)eTI;9CNLl7YH`gBp$T>^Wv%Z$ix9F`*{Ryrd8Lu4qB*j!k(kjiFL z3+M17i4cZ^Y8dO*)4h4><5QcvduZmGp<`VlH=0!Lp?>eQcnxIT08_0}@PJ7AG5`luA@hVP}7t{UIb7H3$nRE9)*@O!EdL7}JEI zFK?ww%@47h;r6<9?ES-!!Lc1OLPXyHpC@?30r^|7(v)Z1kbv zk4C_kz#>S@zFr2f(>Ql(j}U<;1~tIq4tj48?ygLr zUOfj$_I zM}6EL#5e-9IfRShXxA(Bl?B=XDVWD`rFSBl7=yup_Qk@n7o>^yg&qr14M#U+Cr$-) zp60Q$7{`^GBI-CTjA6@55M~8B;+12Cj-HG1qQLTO{oyAbuH)AQy#c|{?AX+nXWucx z!KQhK2;~v#V}53CCXd~YFs`Cra_6#+yGu-0m)~Pxp91Z*@uF zexL?K&@H+7qvk(K1cq6WbIH8oQZ+@CUdNL){Oe^-ak);2yxOJ+a`P@+l@(1fB$f}! zWDAVBs?z*NrBgCo?ffckQYlCiB+spvTngUhA;c7qxDNOH5*B)131G_=x@V*3s?q)Ud@0Zq~=Kep%*xguM~YA*#fw^vut(Xo3|!SKgm>7mn0F zp55PHpDn=b@8&okS`MIb;^R2P9=in|+P5qUm}Ef|36TZ<9lckl-HGkp&t&$Ny01#m zS{!y9;F72Yn!gq;>`aZj1;6MWZS#1|-0HTNoJ$uxF){1MPG&P86fG_wMAyWFMl_#s zds%-V=r+WF`<%%ISS=dyxHWHgFvNMxb~&KB1)oa>hf^(=U-V={K^0LLo(SjBV}k6F zxFGLi$=^^YsIOX8$4IgI_M(p@QsX0VKB@PDY;#0p^X=_<*yv=QR!(LzNmSk$oEQ#U zgOf#$Xjl8aZb8-Y#sYzo3wwS3s+QjWkaCi8D} zX^IkHRY{WYE)lIiKzLb6AR@S0Z!lnMb(R}DpX$pJUqB)St1X~%%L5G9ntZV?)na}{%( zxs&=T?7f7Lcg&Q~in^z28GW0H6Vq0y;e|UF^S@2G9TQA#bkO^3k0Ep-dq)F&M-sT2 zhw`Fi9c;-%B{Clz2Gj~pcP~?g38El1^QBt9wk~Y`WjaWH9852NfPA*17>4rd!+T$S zYF~Z-Fs=9M1NmIY@EgsiaqtJz?Cw4(`ZYV`Xbc;;`Y5kFSM?CTYUT!WZ@FBw1=60(ZK-s{n zM?eBNkvys(=jtbXz*r->T+##&h9|f)x<_CU=gx9I9%PFn^i>iW4^WsD_z7BZ4Z?N^ zMrCQN*Hl6*7Y(JkWCY|TBJjlRhbNwgo0WX_3efNjD|E-3$70=tl<`*-HJ-fR9d0A! zn{1qJ$BMrf(K-Rp2g7nBmNVcco`5QA7=jKSENRUpp4B}r#B>Y9?ZO*6DB%FDqCdRs z&+sk{ra{By(M7@IwxTLw-I5SY<)ficESn5rNTLVBe1dQ4G^Wk_e-h)WeR zQ0*xP;a28d9kHkB+ehKEvSCMrcAkU|JIow}?0hF62oO`xivXT{8rw(MGDnw@0tQ{> zj8(Tr*}|2Vl!Awpp^yU!lLj5qI~;q50|{_qNPZ5@UJU+0tvqZ%MRt^pvm*I~C7S2L zqo)97R|iEl$bRt)h^->xeH_PXlK4eZj*N7R=7uY*iC18=g8nI8$YK*mTU$^fSzgng z(jYl_UDyfFvO90SnZDiQpRq}z9vmAjc|4`jv0jgdydy9gIcJLB2h$sont3&lf|!(s z7vK*}v3oR3K6l0W&9lM*k02V?3!JMXOe$f#^h>y2g{%@Og;>F=KK_mhc_`p(e%)tT zKGN+EH2*Q=@${}d8S1a&JG9rKfH=ZQ>|0o3{t#a%CjM#Pr$kIrqW4>*`${XrapV?k?1wEA3h5P>h@gROD>M|1f#PU&#u})5%&g zSxc}9`V)iLk?bNpgdye5yhh_!dqed zcdgqN^(YWjAi%P$o^I<1nE?bcBN&1<*{gKRllBaWin|+Rh4um<4WlL zt4dMwGf4@NWW;N_UWRDsK67t(B#GB}h%$nLU|>>Z zu^WFIr^pFx3B&SmJJSQIvPV(;d;EWy%iX@IBOkVwGK$u{@%Be=&*hr$a~o>Jki5Zk zcz-yJR~q@mf}*>twbbe{bEMr7H}*d0*$MPJGE1w{5iihCG!I2ne4t zTxXyb`4!X48(T*-69J@_e;)wagy8L>Qsu!lAtS_b+>R>^v-#yXZM5^JnXs(7_;#Oa z_&}Jddk}mS8JrGVr}z0dL5ariBhZS%88eG5v6+O+WyBC(c9{%8?U)0AIeWh$-IECb zLd1ye39l4r`aq;x{Wz!&Xti3lbvj6J} zGyDt-;ko(EM9EAbh^sg$X+tF0H8jxMXHvfUZair;**3m5!zR1%AeI~@$-4;0#z)t3 ztxG<0M&M+42PMOlqHJFFl8slK_6NgOo4@(3ghGjrx}kR`9@Q!G@#G-HadH`)g%N|l z4p^M0!V^G;ZbzXri4O&$!jY^&0VfH=iEAF^pw0W$d;b2Zo-96z~ zcivD=sqTNi!i>DB@9?Y{HlLhMyTYOC%2Tz;m*O#57^r(cl9MkS$C?3<%J?2;_O;~hADNE21Wd7gwc z!Q}d3zNx2ScPaGS@1}t`YC-D6WZ+Y_>Q^L36k;H(I-VhLAi9Bu(y?L8A0$=^J2w7- z=g~<;RA_%tpieUCff#c~zxK7;&j0J-Vo#vW40uAUMP#@{qG7M@24)Q2r#Zum?ce-_1mvfbHdw?Sd9vo~7$j$HFcI*E>di1N;UU<{YgGHZ4 ztYlE=Nx3A;jo4Z;dZj6BMm3&o{(}U)RhBr3n7VqOrngymF(TJ%TB=X(CZR59Z6fj9 zHq%_XK<5_b&X$~}+iwXSwq=C7VaNOcW|smHmCPtgW)P$4i2c5nEafw{{BThm z2Ov?XqiAbWx&Lqlut2XBm&7+obxVL!tRa|8TLr(xZ`12*k90SbPX zd7AkU?AD)xz54U8Q-6c`HuD4KA3$%Y=K^a1WAP|nkqDJ4*cXRY0)j!yo}4dWk0HX1 z*q{v{h%5uivBp>k04<`A1>~UV+B6$L1LYBdUa(fh8iO7cL|7Q>SmPC2E3^g_!bS=R zE6^&i=1K@0g(iU)DwZpS;D2RfWVPEeTnZ3XaCx7Zxq9Cl@@+h;>b{bg@F3Fa!g@Twjwnc@eGb-WM> zxmOF49tr0quGbskcy_hm>mcliDo%in<}78cAVvcvm)IN4xW$R^XZ}lCArD(_-3##K zjgVg>Pjacu>#kYzmWOUXG-5{6S!`eAWkC_1+wm8F{K(Ex+WT+sSBy7HDw`()-pH|U z|99!Inm2peG!dK746o!$TD+VKMl_L(s)0DiP6)~fi$RI&v6m$39pYtd{R=}+uImvG zx5ix&OW}>Yl8KJ~S2WVvrx?a|MVBpKFoF}mk4@puD-mt+)piF{pE;n+an)frWu{7% zNGLZT^8jUXHf%m+hF?CvZE~W}o=y#g&6myaP%7PCn3!zOK9%k4wRax$hN+XklYNnv zZ`(LN(y^Zw?C%&E-)P_3>lY= zeoHIQA-}Vg=aJvn$_seM(7{%o{&$2Et-ONB(4|&h#haFX4>JQ@9M5?WekUhS7=zgV z-2vq+@>8vH4*6?Zc^>(rt-QckFC1Z>Ew9w$o!e5rP;-~LklO1hZatBCyy+gT$-Jq zU!Z5x>o%hN^p4pZ&dkp&w$55VyJr_q&n=ux_7zL5lJ&DEXBTIdW)IUxoxbUY{-vcO z$s>ykCz9)0Z64$FAkM~w5G1E8WxX`LaWsVtm0h2hM!5v5KE2nWjj&uZ9Xz3DSH)yMeaP=f)Gx~c1 z@0+AGXbHVOkI%xzYtw*$jjj5pnH{)(16rELQx@?Cl*_NZ`fRuTq|cP zSJzpOIw$RVGxn1YqnT{Gl=E4GEGYDR@RRBujF5F;)RS(hkxIm9(4m5E}1OB7LNvl;Jn6k{WhQ4v;~3 zP>0DX1V+<6!Q*5#nILP(Bz&st$a-w++(`vKh16ckCPUT9HE_151m;& zy|B1ueh#BPJ9F|de{^>KM*ZZ%(%g|bXZWWzTC~z>6-c`@dvb{q0b}OInZ>0OIGa8M z{4~za%+Jp*tv-Bs3%Y!>&pDkwb8u;K=FpN|Cf=~HaKrqpgwCCqJ99!hJ#*9C$s10) zj+{Aph)(rs;q(%k2n6|Zq4Y*C4GJYPBUv_N` zo%V}Y@HDDp~>Y)r+$;t$DSfZVgt_IaiKc%z91$ xMje=Nt{G^2?xwk=o1IgAah763>v4wN_U!Z#=OTaT=**IN5n2x{I7q-S{}&guQk(z) literal 0 HcmV?d00001 diff --git a/packages/design_system/lib/fonts/SFIcons.ttf b/packages/design_system/lib/fonts/SFIcons.ttf deleted file mode 100755 index 8c2c553fb7966bf6586a04bf5af6ed8163f4858a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15708 zcmd^md3+pKooBtO?&_Qjd$+43bHij5`9P8?g2Ycy$yMM14!Z3`3xs&0T_RYh)2cq|{<+PsIWEH!bXi4zzr^#K({mH!gAet6g<&ku;`!E@@l(ghE(YyM0MF6c@tNv@ zu6z%}R0bJ_6OPR-EPnlsPyLi(x<~MAW-xbd*X1J&V~$-`FTZX211)*SXN^{Z(!DP8 zonx*wZ!r$8Mr-`?&7Xd9`Hr?zray3_c(yVuEyaiSw1)W(BWO>w)Q&I1T-KiT_jab8 z>0{Upo3@WI>>RSti7oR=r=HC(~0mkE4IRB|$y<2;DW*FCigM>s)JGQ}o*Hwfe?*>;<$9Aw6|j zrRDelhQMfsX+Z*3N(=7TO_ZCMpW#_y+$iB|iCSwdUn|vmYuDEf)(+Q> z*S>HWI}XS;*4j|sUE8ab&*|l8dG&{&uN#?3W*XmlW>Nc|LM4Lj<1m^TyKTX)+c3TZ z*d;Pf#)Z)(#>2>rm+_&!p9wHQ;8K{WW9pd(Cc;FS7!zj_Op-}4X(q!oGFhgHX~sHQ znH1IGVgyPo!?;nkZDbLbAfC@zt4N-s#H6u~VuNetD z#ng;M@uy}aidQuwQL3#O2|LQvj6`X?W+dz~Q!^69x0;c#^GwZ1l*81F1Z-exMgm?i zH6sB-n3|D*D@@Huz#67zB;XHIGZHX~sTm14#ng-h>|$z00-iB7BLU->nvsBeOwCBZ zLZ)UU;3HEr5-^jg83{Pb)QkjdWokwO-ZC{K0fU*Ek$}rg%}Bs%re-AIH&ZhbFrBFx z2{;ex(-W|tsX^Y*1Ug`9O?m=FFtuhqfi{>L=$xp zP$yG6s3*`VQ#-6DP%KlM(-UZysU6c3sFUr zu-A3$!xV2wtWqwf;}*hu{Y1%^i)|!^YnltFxtD}sTu^^22t*d*LE$CxPf{R2?s-v2 z1O)YhsJ%mt7lUyinbz;+*STT#pP3B|lZvM^1=>+FNf#?du8-vXO1V-_XVQtd#YrrQ zIPX<@=-5WCf%ug|zS2iBIbz}2cxC_8&Mlj! zf>X43l;cL}9gmx~?3}*AXYq(B_qrWB2ZHf{oRb6b;K0tTjT1e2XJ;%jKZs&qlMls% z^O0DmGw%^ic8ZnYAeZOZ^IR|J3m8n|7T&`9yne;6i|XTy3snL$|i)cI+C9cg5pf8|Z~wqZNGcyYG9y$MeDWe)oe~Z8c@QMjZ+} zaHz}woqLGA41N*=ZUI|JUa2QuKA!F+#d1ZP$d!2*)1Z?n(s=={e#J{Cn@N-k2&$gkjEN41KM%Y|HdW-__F)8rgZg@SOIUr~weLr$Ud#%Pl`>I4A+vWs7H)99&!JbF3HI&`6$NKXQ;ld{$-|8$&i_*Fkyp1 zRTYz6beIEjT^+=ZzNhW%rzn4rW7xRl>4N0@9t)->SWKK4WmA4OV z7%krh+ypIy&uw6ThA|--NFsxwGC4Mrri1t!Sige7{XPvxGpW@y&3+&zWZaV7J}}We zx_vN{by)hwyZU-MTOCh3lOa*vUD%T^j82Z`^P|M!XzlFj>l*K~II@|+?W5fj19rRQ z&Iqxm#ZXdwCXafB{2o-+>HK5d-*b)715%JD8!;~nNXA8Y4aoqPcq-2O44eb{#(=Uw z;}oF2TuPrgy}S&}R8Y>d_Z(aYX|cuP5Xmi~U_Huvm!6jb9dY(JrR$}y;>uZ;zMAOB z$Jx#Cj`kr{z;;O*s~{h}<2tK#zdhi$f7tp4YJVi&0p1vt*v(S#(T@1iSL6AP1iLxW zzBFkxk!bT}Tp3``QT;_${60{9xtGZ09Kp<;d;o-LwE*Y6XpYjU+l7TRlP^W93T`*&(nWm0a4BOF|1@!ssI5 zv#?9Q)5>VK7^l)mdm(yl_EEx`%`CC_TQl`(pD$gXYEzHoQuSVuA2*vt$ztMm+f6q6 zst3vHkpo_9z$ux{9A~mfPL~ZIms7HGOSC)5>9*SKR`=BvTyFHXdYslwomckxWN)3@ z>kq!T+h(RuX4`JstEhKEr*M~1WDKPBqgP%nPdSa!s5~wB5;8?js5_7yUPXS_GL`(} z$Vk(lBU0Jiu==-GL@Imy-O1Etdg>%Ks_W~TSRz&`<_H)BSTBgHL^hBYDdnmqQQ{YP z{3MZ-K(50|s5JsU13dwKcx}W_65QDKv)hG)FfJ^4$al}G zg|locEkQv--Kv$K4?{2E2(+OV@T)$Mt4a4s+fuTLwn>6N z=`!FU_Ho!?P_(G*@^LHjJZ&-a@k}aRf->hfr^*e`8@P2#lkpA$cK2|iqobhy$R4n( zKXOY!0Z{V`;E9j7Cscv*Fmf^8@$|Di|ExoH$|lPbPgqRI81nNdyO-Koq@?li72e$o zM%G8b!J*%>&tn$_%AUc612>7WU@#_MPu?1-Fj4(yT4m1yfseFi~KwmC~0MPu`sF>&|F#V?gAR<@8BjKE}q%mx7OV+X07s-d5u)KMcL9VhP-gwKCo z2*kzb1mQU$!FEIBqW}uta{?{Yny=`!UTXd6`t;RmEOc0kn53MC3QKsv^-uNI*B+v} z#A(tX#$kLskKry~gQm`XoEj>pP>WhF|3jb_{N*omHTGX%v-^R=ZLqyIGbfl2Fdv1y zN;?Tf**+*E<~{(?1>LTJRLm50p;rQlA;hla$*MZ3D{b2dl}oT@3Yu7gjgTV{eLhOB z*ph-KLI5#}We{Xg9yN0)q16FJ%cX?R+d%StWLj*HcyXI{WiN=l)PM(iefuT1qPP#a z6vf5<^Gf#Zi>s=j{*}hRPMV$BX3KW7C?^6PTkrVz9a}rXDW}M9v-sp@v(=I;-#D|c ztp2to;&3`0uvT0?=XWk?HVOMZD<5jG<+ZD5YY6eyymq}?p#t0ZssFL+&GA(&USFHH zdP_SB^}$$sZ1d>0JGO4UW83KFR6ZPNC}a}dyu*=STiI7G@2f;wFe=8jyIkt6Fj%O$ zL{ScVc02b2ZY_KSu+Gg_G#!0I09py~g65+U5*Q6tfI!tf1Xv0?4WOrtQo`PGrKLNR zXjCB%ev z7t7LC@;UnQbCK2ve(VKIzJa`ksb5s0pQUU0Y!vnCmFUq3JFP^HM&EwBjAmup=!dwl zxe_Xr=mLL$e(&-}rlWrsQOf9SxeoP|VY7b2z6#y%3T+L;f69;)6fd)rP%%qwr(Tk_ z#7ZeM<%Y|vuDpx9Un4)-Loto6bRok2RQ(3;G~;4%I@r4%PQGpF8ImEHrQbLeCw@;} z>lR(QlcGAU?^ZwV2})8(VzW=0Oi!|+bq{^DN8Zu?*}qnwev&@m;`EbKWrzEKhTzaN-b$h_lrUMBF{rs3*;V{M_Zi^`=UkS7cInL zqcRtE%h%W?_!DJ#1K>>|hSvn9i@&T`(iwj_Z2^d#1Uv?2b~)`gj5ErJU`SEJM$7uN zyyn^Au9sTfGUuJW|DOA%Z+uE=>%Prue=5Bv?crU$;Mlz`^Q%jzD1RN_l=pJ7yH#4V zZU11e!pg1|Y0G|MgX4#sbFpr@DBX~Z2c}8yJqh_%Px^1XUVD?XPZ0W?O>5YDsoUsa zqDd;sZq}KP?DsaiOEPhBVu4eC4}pQ@QJwz-+`n);!IuM|mpn6qRp!8dBjCVr|Clvp z0-PC;<7I7)KpmP@LK9A4^SK#^q@G>$_+}IkMc@$hL4&R^%HKb2YMlYywd&Kcki9uKQX*c z4zaw`oylz#qV*PU!vmph#n1yc4SOdhd^n7E5!mi0{Oyc zv=zZ7(bivq*vb)V@1)6Jo72U>)(yKyL%D#-(K?V8tcmcR8=HINQoC3usAuTf$ldLo z0l(GTyF=n!;e=I4541W=fm~>G_lB*3V%qGMcJz9!{y=9t8bq7j5bu_=_P9N+n8-WWU@8<6qb}a$Q{+%69SX4zRw|v-s6W$L znMLabQ=JcQ-jFSqu5c{*xcK^G2c;K>mqeN_Wiy(;+pGj%yyCV zTifqyX?4dNnwuNq?$(yOw!hWyYOJqsbgk&m@auWu!D?ly*x7e&c4Vl<0={A4HEjei z)R2KC*IiTdx`v1F(P8rMe7Gy^iMYi2C>Vj_ad<_m z6E0KYuyb%dg@ay}2xi*5!=HXwJ`d#MOH>9sOjyV_3bHoRrvls!=cfYdjB*`zW~x?S4g%*Kqq| zn*X&9yl5k^14B?ZA`itnlkNvg(jAR(7W$xAXiiy*&XD6!TdAWqkjp`RXB+d|CH*Bq*Z=YXLgJzytFELq>lx z)DUV}P+P;Rr06064hkZT@Ow!DTp12ofPno~>rFeh@4l_4DPxo1tdQ4TH;~Q@q-9T2 zcztink|!u^a3 zz(;j}IdT&|9R7{+7co%@QBmW1H5 z@j~OevHHer-B`A(YbmEGj{&8jLE(4}e&xcZQ&TaQBRJ5TT9*#D19&Ddf&MmEh_nwM z+|@zCu8sy-hh8E?4Cu)Ye{AWCjdh)Mjh#C?=OZl*4J}k9)?jwT^cij#c5pk5qd`TX z-tz|151;yq0#C6E5={c@rl_RR9VKlblV2)G>^)*aTzcDS3T9mGO@mEr0he}XCdj$o z{vg>y_9jCIa?zhea|eQ{OJCv+7@>CVpflE1K#vf_j3SCrR~Hbwe;k zve8^Fs{SyQB0=?adOAdpGYliv*^cPTR^|rm@~yBEKhHdanHyf#M2yB24EtSkaOy#b z)tiSB7?mreQh^3YZOLWA@$35Ua#4c2>Y2JwmtRss1Hj&C?oiv?!fDzMb+-U$m`J)L zU)7F%fqa>|{MGM7$R5qKimTgjKj3+PlEw-Uhk(6q1S`&HQ3dUyMK2Iy@Q9aIA_fPp zyng#HWF_7mgX^O!?vpPi$CLkHzhn#AF4-}ZAbQT%t%NMtiym>wBYKKWsLNi^=WxsD zOQJ_TVsvP8M4G>@&E>2%B)$CCD=~|A#4lE2ChBFWBcy&q?~kkvw@bf@#nk6S`>(9l zU)e?V8+7s{t3@*oAg)1ik?K}cCOa3WG47Pc&^XA`bSA~+peJ&$Rj_Fs|IXJM zG_QR{X6u9M8#DIi7W<6)MzEfhUs-Dow)(6Oib5tp+|Rn(lCZm2MUoWta)3>?x&Kam zGmsH+1VGc}fcv{>tQx|hnaCDhm{7@~aZoBVu)*-|Q?`i!3s@~tOrJ^x`&p8Uema^< zhR%dix#-zwu0NEN$y@F)obUe;AY-AF`hqJ;G58$ZWTA63N2Zb`FZq(&scyxwfGfJ1 z7Z${S>Up^$$Gp5>3mpEb=Y_@(5DN$*N_Y*Ii(1lxhMKSQ(P7OF)_wV5rk~jk8ak;( z>mYOJ7Yq=Afw%=%>OVx-68;cf#!$h88VNpuiV4VEtu9q2A%)CE&96^I7nB~OGt{Ep z^}@>n?+JQCMMNBXH5~|@L2-hP2i;R^7GJ4qa%GY&Yx)OyJKz1W;i#KUW~#gQytHR` zb!k^a{J}=)-65e{zz$-rErp9O($Dmn4@fY+}7_q1c)h2h06cXNORygg1r@KE?So`e02V zmn&9}_8TK|AQTFi9cG8avazoqdVKX88zTOU_;M(SCPx2F8|%G6Xu-N3d^`6|ZY_Mw zur&M>1$Cu`vJwfb4tLnEkmZFKd~ zI_c74V!HbPERD)Qs-c@>DRYeGAR4@8i7Ftvc!b1AtonkTF26~z4tvm{ZghJxb=*Wa z<8d$jAN2wmB!lV&8}u*r1sd;URT}zqA2_rB%z-m!X$f~LE#bEF{6$;DQ?xc+40xph+I#8k7 zRk5E1{<{eLjecse0>H3Yb+a}CSERqfPB_8+OU`uI8U0#R#E63WqB9i|e-v|O#DSBf zcuGC6{-D$2`H83KIiTO1-A{Bp$!!qRPShpgj5GGNh!{>GL?GZv{BhLjeBUYcrISqq z2SvFc|HOlaMft~&6x*Kccw!kp=za{tS2~EfQ-38@0^O8^qm(c;i;j9bsl%3B#4*J5#Kh(+hEFNFKVZ-|4i|U&+*9ymWFyYLEoe|G~sZzf2z)#0+ zELYmw9ytVPei*Af>%Yu86^c-G{ZMDOWPgE379?Po!Wa5CfXFmV+!e-05`P z)ZkL&RpFREaGwSiArGS2ja~)Kv_m2=z*?PIyT{Ilyu|4f6t5R!fu6BSZdXxs$K;JOkw_-}ez*RAw#b|X0cj<$^}J{md~oKgETybaK6^~eQu^LIJ5 zeO+Unon!O#@@{8&#;A`*I__QmCN~XR9|5OS+>*jElax|enF{!dnQ9D9LJbB;b2He# z7AwJ2*$Zt6^@k=CNvGR1Z4ig4OzMxNmVmAs23jPNHN`py5O3`KQuM!h6wl)^I1xxKY2K297lvvSlsnLv5mh#zTHrhhL0}bC zC|B&G_OQP|Z-zRCXSDH&K+nnBAy2py+Ev9?RquTKn^{-5}+uDZ`+4TBs`>=GK zG~AILNN1DRb+G4F9c;O&G&HnfPx*EWPQI9Kuk770gp)5z&zWpqfy~mmioj(s7ZqkwTdXtXs^VB3=O5RlPQYhus;L}8*BLP08ePyr5W35*#>XRBst|N-aP7SrMQ>(}B^*v~}Iz-WL z<)zjh(P6c#LcdiMt^Mbxg_Q5LU@94U&6g4kn4Py#km)eHe1yFKnJ?i4ZV}$y?a&N0 zwNTr8!^)H?_N=nq>DmD_j-n5RE_AiZs(fly9yTQDN`}sQG&3<`SZ~yfl%=OVxnM|F zpU&ww^$Yqvh_I&TY$&<(T`Z3~h1yFXTEq$CY;Q2dMCXAR4*y6Y^9ZS8wEB$FHV-lX5!2Tt$L=l7q!`}Bc){=n%SCfSrUTXx#b zmTs1VHt4bra#n88N<-D=ZVPYQY3118tG|c^UO6Xm^0!2HSQa1gnB0%Q5{i(BD9T~C z_^rpT3_!_j1x-2Dszq+XViS7dX)tn(yu9n+IdyY9SL+oWQx)lW#}MB zbG|~){8D2aK!a~ZtDAvyk?LX8c0)uk;nt>N2_ihdl0N=41t)_lkA(Me%P|C$Yv2Cvm= zVmXVcwcYBjtB+tfM^r>xXEdiL`f2ZhGHTloC(9t z$+1~0LI?Nv&`IyK;qZm-hX~?k1MNZLo0q*?3H|t$W;p2L1uilORDJv5ElHF#w9@_7 zkTEBN(xX!F(wQ9_1~QHDSa(pmBn7);@y5)+hQ{Qh$)+|5nyODPws{0rqLrnCP)&tDfj67jHWRsC+87J9m*tQ0o}aq;@M5%aeKwkJ&zGVHPeEQUpQB(EA{G65k z`*ab=W*(oe&M%rLrso!_!qm*n+;DXo$W%RKnVg$HIX-{LIyrs|P<^q=FI30pCl2$I zQ`5k4yMEg~wXkTJ1R2aup!w|N+>R5A(^Iq6L&Es{{M^ay)yc(m(~G9+p{YfFVs7r} zRMlLa8K0Uq-!gTmI%ht1cy6{TOdPJ>GCw!Fi;|cF4--e%Pt8wER~`7%=;6hKC#DbX zm=&t0Fe=Dx`_$}F$Fce9WOcrZK^L&5*`uO1n$`h^v&>CS(n&ZbPRuXN&99%H!m3Y> z&mJ-zu1+5lXXh5DCa3h}F9@_~dD0G$=VEnskrKRf{Mh*X;tZaKCqRSFljGCV)x~v( z4h><-r)B+d_{71*`SFQGt<1czh!!RaL=(-5+Ve6z?G!rtx?BdpmS2g}bKoS)lQ7c- zb(n7+zoj~DUYwe#&O7Gk7Qq6>rU6aU;klWrZDnrZ`SC+ja|2*IbF;f=HP}@T?V39= zd#HLSxa!?{3e}Z2=7q!K^Hulq&MuGa0Yv9+(a>UfYW6EdmbqgTVHPY4)%jbdCaTus TC#nmyL|WOVu{nMBHMIY~JX Date: Tue, 10 Feb 2026 17:25:23 +0100 Subject: [PATCH 12/25] fix contacts endpoint and entity --- .../domain/entities/contact_entity.dart | 17 + .../entities/contact_entity.freezed.dart | 292 +++++++++++++++++ .../domain/entities/contact_list_entity.dart | 19 -- .../entities/contact_list_entity.freezed.dart | 301 ------------------ .../domain/entities/list_contact_entity.dart | 11 - .../entities/list_contact_entity.freezed.dart | 274 ---------------- .../presentation/contacts_screen.dart | 18 +- .../presentation/edit_contact_screen.dart | 4 +- .../state/contacts_view_model.dart | 21 +- .../state/contacts_view_state.dart | 4 +- .../state/contacts_view_state.freezed.dart | 80 ++--- 11 files changed, 367 insertions(+), 674 deletions(-) create mode 100644 modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_entity.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_entity.freezed.dart delete mode 100644 modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_list_entity.dart delete mode 100644 modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_list_entity.freezed.dart delete mode 100644 modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/list_contact_entity.dart delete mode 100644 modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/list_contact_entity.freezed.dart diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_entity.dart b/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_entity.dart new file mode 100644 index 00000000..8b64a666 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_entity.dart @@ -0,0 +1,17 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'contact_entity.freezed.dart'; + +@freezed +abstract class ContactEntity with _$ContactEntity { + const factory ContactEntity({ + required String id, + required String name, + required String phone, + required String? delegationId, + required String? groupId, + required String? userId, + required int createdAt, + required int? updatedAt, + }) = _ContactEntity; +} diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_entity.freezed.dart b/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_entity.freezed.dart new file mode 100644 index 00000000..07643816 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_entity.freezed.dart @@ -0,0 +1,292 @@ +// 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 'contact_entity.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$ContactEntity { + + String get id; String get name; String get phone; String? get delegationId; String? get groupId; String? get userId; int get createdAt; int? get updatedAt; +/// Create a copy of ContactEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ContactEntityCopyWith get copyWith => _$ContactEntityCopyWithImpl(this as ContactEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ContactEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); +} + + +@override +int get hashCode => Object.hash(runtimeType,id,name,phone,delegationId,groupId,userId,createdAt,updatedAt); + +@override +String toString() { + return 'ContactEntity(id: $id, name: $name, phone: $phone, delegationId: $delegationId, groupId: $groupId, userId: $userId, createdAt: $createdAt, updatedAt: $updatedAt)'; +} + + +} + +/// @nodoc +abstract mixin class $ContactEntityCopyWith<$Res> { + factory $ContactEntityCopyWith(ContactEntity value, $Res Function(ContactEntity) _then) = _$ContactEntityCopyWithImpl; +@useResult +$Res call({ + String id, String name, String phone, String? delegationId, String? groupId, String? userId, int createdAt, int? updatedAt +}); + + + + +} +/// @nodoc +class _$ContactEntityCopyWithImpl<$Res> + implements $ContactEntityCopyWith<$Res> { + _$ContactEntityCopyWithImpl(this._self, this._then); + + final ContactEntity _self; + final $Res Function(ContactEntity) _then; + +/// Create a copy of ContactEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? name = null,Object? phone = null,Object? delegationId = freezed,Object? groupId = freezed,Object? userId = freezed,Object? createdAt = null,Object? updatedAt = freezed,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable +as String?,groupId: freezed == groupId ? _self.groupId : groupId // ignore: cast_nullable_to_non_nullable +as String?,userId: freezed == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable +as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as int,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as int?, + )); +} + +} + + +/// Adds pattern-matching-related methods to [ContactEntity]. +extension ContactEntityPatterns on ContactEntity { +/// 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( _ContactEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _ContactEntity() 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( _ContactEntity value) $default,){ +final _that = this; +switch (_that) { +case _ContactEntity(): +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( _ContactEntity value)? $default,){ +final _that = this; +switch (_that) { +case _ContactEntity() 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 name, String phone, String? delegationId, String? groupId, String? userId, int createdAt, int? updatedAt)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _ContactEntity() when $default != null: +return $default(_that.id,_that.name,_that.phone,_that.delegationId,_that.groupId,_that.userId,_that.createdAt,_that.updatedAt);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 name, String phone, String? delegationId, String? groupId, String? userId, int createdAt, int? updatedAt) $default,) {final _that = this; +switch (_that) { +case _ContactEntity(): +return $default(_that.id,_that.name,_that.phone,_that.delegationId,_that.groupId,_that.userId,_that.createdAt,_that.updatedAt);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 name, String phone, String? delegationId, String? groupId, String? userId, int createdAt, int? updatedAt)? $default,) {final _that = this; +switch (_that) { +case _ContactEntity() when $default != null: +return $default(_that.id,_that.name,_that.phone,_that.delegationId,_that.groupId,_that.userId,_that.createdAt,_that.updatedAt);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _ContactEntity implements ContactEntity { + const _ContactEntity({required this.id, required this.name, required this.phone, required this.delegationId, required this.groupId, required this.userId, required this.createdAt, required this.updatedAt}); + + +@override final String id; +@override final String name; +@override final String phone; +@override final String? delegationId; +@override final String? groupId; +@override final String? userId; +@override final int createdAt; +@override final int? updatedAt; + +/// Create a copy of ContactEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$ContactEntityCopyWith<_ContactEntity> get copyWith => __$ContactEntityCopyWithImpl<_ContactEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _ContactEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); +} + + +@override +int get hashCode => Object.hash(runtimeType,id,name,phone,delegationId,groupId,userId,createdAt,updatedAt); + +@override +String toString() { + return 'ContactEntity(id: $id, name: $name, phone: $phone, delegationId: $delegationId, groupId: $groupId, userId: $userId, createdAt: $createdAt, updatedAt: $updatedAt)'; +} + + +} + +/// @nodoc +abstract mixin class _$ContactEntityCopyWith<$Res> implements $ContactEntityCopyWith<$Res> { + factory _$ContactEntityCopyWith(_ContactEntity value, $Res Function(_ContactEntity) _then) = __$ContactEntityCopyWithImpl; +@override @useResult +$Res call({ + String id, String name, String phone, String? delegationId, String? groupId, String? userId, int createdAt, int? updatedAt +}); + + + + +} +/// @nodoc +class __$ContactEntityCopyWithImpl<$Res> + implements _$ContactEntityCopyWith<$Res> { + __$ContactEntityCopyWithImpl(this._self, this._then); + + final _ContactEntity _self; + final $Res Function(_ContactEntity) _then; + +/// Create a copy of ContactEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? name = null,Object? phone = null,Object? delegationId = freezed,Object? groupId = freezed,Object? userId = freezed,Object? createdAt = null,Object? updatedAt = freezed,}) { + return _then(_ContactEntity( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable +as String?,groupId: freezed == groupId ? _self.groupId : groupId // ignore: cast_nullable_to_non_nullable +as String?,userId: freezed == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable +as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as int,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as int?, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_list_entity.dart b/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_list_entity.dart deleted file mode 100644 index ba87d9eb..00000000 --- a/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_list_entity.dart +++ /dev/null @@ -1,19 +0,0 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:functions/src/features/contacts/domain/entities/list_contact_entity.dart'; - -part 'contact_list_entity.freezed.dart'; - -@freezed -abstract class ContactListEntity with _$ContactListEntity { - const factory ContactListEntity({ - required String id, - required String delegationId, - required String userId, - required String groupId, - required String deviceId, - required String type, - required List contacts, - required String createdAt, - required String updatedAt - }) = _ContactListEntity; -} diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_list_entity.freezed.dart b/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_list_entity.freezed.dart deleted file mode 100644 index a32a2dea..00000000 --- a/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/contact_list_entity.freezed.dart +++ /dev/null @@ -1,301 +0,0 @@ -// 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 'contact_list_entity.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; -/// @nodoc -mixin _$ContactListEntity { - - String get id; String get delegationId; String get userId; String get groupId; String get deviceId; String get type; List get contacts; String get createdAt; String get updatedAt; -/// Create a copy of ContactListEntity -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$ContactListEntityCopyWith get copyWith => _$ContactListEntityCopyWithImpl(this as ContactListEntity, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ContactListEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.type, type) || other.type == type)&&const DeepCollectionEquality().equals(other.contacts, contacts)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); -} - - -@override -int get hashCode => Object.hash(runtimeType,id,delegationId,userId,groupId,deviceId,type,const DeepCollectionEquality().hash(contacts),createdAt,updatedAt); - -@override -String toString() { - return 'ContactListEntity(id: $id, delegationId: $delegationId, userId: $userId, groupId: $groupId, deviceId: $deviceId, type: $type, contacts: $contacts, createdAt: $createdAt, updatedAt: $updatedAt)'; -} - - -} - -/// @nodoc -abstract mixin class $ContactListEntityCopyWith<$Res> { - factory $ContactListEntityCopyWith(ContactListEntity value, $Res Function(ContactListEntity) _then) = _$ContactListEntityCopyWithImpl; -@useResult -$Res call({ - String id, String delegationId, String userId, String groupId, String deviceId, String type, List contacts, String createdAt, String updatedAt -}); - - - - -} -/// @nodoc -class _$ContactListEntityCopyWithImpl<$Res> - implements $ContactListEntityCopyWith<$Res> { - _$ContactListEntityCopyWithImpl(this._self, this._then); - - final ContactListEntity _self; - final $Res Function(ContactListEntity) _then; - -/// Create a copy of ContactListEntity -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? delegationId = null,Object? userId = null,Object? groupId = null,Object? deviceId = null,Object? type = null,Object? contacts = null,Object? createdAt = null,Object? updatedAt = null,}) { - return _then(_self.copyWith( -id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable -as String,delegationId: null == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable -as String,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable -as String,groupId: null == groupId ? _self.groupId : groupId // ignore: cast_nullable_to_non_nullable -as String,deviceId: null == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable -as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable -as String,contacts: null == contacts ? _self.contacts : contacts // ignore: cast_nullable_to_non_nullable -as List,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable -as String,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable -as String, - )); -} - -} - - -/// Adds pattern-matching-related methods to [ContactListEntity]. -extension ContactListEntityPatterns on ContactListEntity { -/// 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( _ContactListEntity value)? $default,{required TResult orElse(),}){ -final _that = this; -switch (_that) { -case _ContactListEntity() 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( _ContactListEntity value) $default,){ -final _that = this; -switch (_that) { -case _ContactListEntity(): -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( _ContactListEntity value)? $default,){ -final _that = this; -switch (_that) { -case _ContactListEntity() 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 delegationId, String userId, String groupId, String deviceId, String type, List contacts, String createdAt, String updatedAt)? $default,{required TResult orElse(),}) {final _that = this; -switch (_that) { -case _ContactListEntity() when $default != null: -return $default(_that.id,_that.delegationId,_that.userId,_that.groupId,_that.deviceId,_that.type,_that.contacts,_that.createdAt,_that.updatedAt);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 delegationId, String userId, String groupId, String deviceId, String type, List contacts, String createdAt, String updatedAt) $default,) {final _that = this; -switch (_that) { -case _ContactListEntity(): -return $default(_that.id,_that.delegationId,_that.userId,_that.groupId,_that.deviceId,_that.type,_that.contacts,_that.createdAt,_that.updatedAt);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 delegationId, String userId, String groupId, String deviceId, String type, List contacts, String createdAt, String updatedAt)? $default,) {final _that = this; -switch (_that) { -case _ContactListEntity() when $default != null: -return $default(_that.id,_that.delegationId,_that.userId,_that.groupId,_that.deviceId,_that.type,_that.contacts,_that.createdAt,_that.updatedAt);case _: - return null; - -} -} - -} - -/// @nodoc - - -class _ContactListEntity implements ContactListEntity { - const _ContactListEntity({required this.id, required this.delegationId, required this.userId, required this.groupId, required this.deviceId, required this.type, required final List contacts, required this.createdAt, required this.updatedAt}): _contacts = contacts; - - -@override final String id; -@override final String delegationId; -@override final String userId; -@override final String groupId; -@override final String deviceId; -@override final String type; - final List _contacts; -@override List get contacts { - if (_contacts is EqualUnmodifiableListView) return _contacts; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_contacts); -} - -@override final String createdAt; -@override final String updatedAt; - -/// Create a copy of ContactListEntity -/// with the given fields replaced by the non-null parameter values. -@override @JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -_$ContactListEntityCopyWith<_ContactListEntity> get copyWith => __$ContactListEntityCopyWithImpl<_ContactListEntity>(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _ContactListEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.type, type) || other.type == type)&&const DeepCollectionEquality().equals(other._contacts, _contacts)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); -} - - -@override -int get hashCode => Object.hash(runtimeType,id,delegationId,userId,groupId,deviceId,type,const DeepCollectionEquality().hash(_contacts),createdAt,updatedAt); - -@override -String toString() { - return 'ContactListEntity(id: $id, delegationId: $delegationId, userId: $userId, groupId: $groupId, deviceId: $deviceId, type: $type, contacts: $contacts, createdAt: $createdAt, updatedAt: $updatedAt)'; -} - - -} - -/// @nodoc -abstract mixin class _$ContactListEntityCopyWith<$Res> implements $ContactListEntityCopyWith<$Res> { - factory _$ContactListEntityCopyWith(_ContactListEntity value, $Res Function(_ContactListEntity) _then) = __$ContactListEntityCopyWithImpl; -@override @useResult -$Res call({ - String id, String delegationId, String userId, String groupId, String deviceId, String type, List contacts, String createdAt, String updatedAt -}); - - - - -} -/// @nodoc -class __$ContactListEntityCopyWithImpl<$Res> - implements _$ContactListEntityCopyWith<$Res> { - __$ContactListEntityCopyWithImpl(this._self, this._then); - - final _ContactListEntity _self; - final $Res Function(_ContactListEntity) _then; - -/// Create a copy of ContactListEntity -/// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? delegationId = null,Object? userId = null,Object? groupId = null,Object? deviceId = null,Object? type = null,Object? contacts = null,Object? createdAt = null,Object? updatedAt = null,}) { - return _then(_ContactListEntity( -id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable -as String,delegationId: null == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable -as String,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable -as String,groupId: null == groupId ? _self.groupId : groupId // ignore: cast_nullable_to_non_nullable -as String,deviceId: null == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable -as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable -as String,contacts: null == contacts ? _self._contacts : contacts // ignore: cast_nullable_to_non_nullable -as List,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable -as String,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable -as String, - )); -} - - -} - -// dart format on diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/list_contact_entity.dart b/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/list_contact_entity.dart deleted file mode 100644 index 32bcab66..00000000 --- a/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/list_contact_entity.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; - -part 'list_contact_entity.freezed.dart'; - -@freezed -abstract class ListContactEntity with _$ListContactEntity { - const factory ListContactEntity({ - required String name, - required String phone, - }) = _ListContactEntity; -} diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/list_contact_entity.freezed.dart b/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/list_contact_entity.freezed.dart deleted file mode 100644 index efd95bd7..00000000 --- a/modules/legacy/modules/functions/lib/src/features/contacts/domain/entities/list_contact_entity.freezed.dart +++ /dev/null @@ -1,274 +0,0 @@ -// 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 'list_contact_entity.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; -/// @nodoc -mixin _$ListContactEntity { - - String get name; String get phone; -/// Create a copy of ListContactEntity -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$ListContactEntityCopyWith get copyWith => _$ListContactEntityCopyWithImpl(this as ListContactEntity, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ListContactEntity&&(identical(other.name, name) || other.name == name)&&(identical(other.phone, phone) || other.phone == phone)); -} - - -@override -int get hashCode => Object.hash(runtimeType,name,phone); - -@override -String toString() { - return 'ListContactEntity(name: $name, phone: $phone)'; -} - - -} - -/// @nodoc -abstract mixin class $ListContactEntityCopyWith<$Res> { - factory $ListContactEntityCopyWith(ListContactEntity value, $Res Function(ListContactEntity) _then) = _$ListContactEntityCopyWithImpl; -@useResult -$Res call({ - String name, String phone -}); - - - - -} -/// @nodoc -class _$ListContactEntityCopyWithImpl<$Res> - implements $ListContactEntityCopyWith<$Res> { - _$ListContactEntityCopyWithImpl(this._self, this._then); - - final ListContactEntity _self; - final $Res Function(ListContactEntity) _then; - -/// Create a copy of ListContactEntity -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? name = null,Object? phone = null,}) { - return _then(_self.copyWith( -name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable -as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable -as String, - )); -} - -} - - -/// Adds pattern-matching-related methods to [ListContactEntity]. -extension ListContactEntityPatterns on ListContactEntity { -/// 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( _ListContactEntity value)? $default,{required TResult orElse(),}){ -final _that = this; -switch (_that) { -case _ListContactEntity() 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( _ListContactEntity value) $default,){ -final _that = this; -switch (_that) { -case _ListContactEntity(): -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( _ListContactEntity value)? $default,){ -final _that = this; -switch (_that) { -case _ListContactEntity() 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 name, String phone)? $default,{required TResult orElse(),}) {final _that = this; -switch (_that) { -case _ListContactEntity() when $default != null: -return $default(_that.name,_that.phone);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 name, String phone) $default,) {final _that = this; -switch (_that) { -case _ListContactEntity(): -return $default(_that.name,_that.phone);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 name, String phone)? $default,) {final _that = this; -switch (_that) { -case _ListContactEntity() when $default != null: -return $default(_that.name,_that.phone);case _: - return null; - -} -} - -} - -/// @nodoc - - -class _ListContactEntity implements ListContactEntity { - const _ListContactEntity({required this.name, required this.phone}); - - -@override final String name; -@override final String phone; - -/// Create a copy of ListContactEntity -/// with the given fields replaced by the non-null parameter values. -@override @JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -_$ListContactEntityCopyWith<_ListContactEntity> get copyWith => __$ListContactEntityCopyWithImpl<_ListContactEntity>(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _ListContactEntity&&(identical(other.name, name) || other.name == name)&&(identical(other.phone, phone) || other.phone == phone)); -} - - -@override -int get hashCode => Object.hash(runtimeType,name,phone); - -@override -String toString() { - return 'ListContactEntity(name: $name, phone: $phone)'; -} - - -} - -/// @nodoc -abstract mixin class _$ListContactEntityCopyWith<$Res> implements $ListContactEntityCopyWith<$Res> { - factory _$ListContactEntityCopyWith(_ListContactEntity value, $Res Function(_ListContactEntity) _then) = __$ListContactEntityCopyWithImpl; -@override @useResult -$Res call({ - String name, String phone -}); - - - - -} -/// @nodoc -class __$ListContactEntityCopyWithImpl<$Res> - implements _$ListContactEntityCopyWith<$Res> { - __$ListContactEntityCopyWithImpl(this._self, this._then); - - final _ListContactEntity _self; - final $Res Function(_ListContactEntity) _then; - -/// Create a copy of ListContactEntity -/// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? name = null,Object? phone = null,}) { - return _then(_ListContactEntity( -name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable -as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable -as String, - )); -} - - -} - -// dart format on diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/contacts_screen.dart b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/contacts_screen.dart index a90a0b13..4b5f2f24 100644 --- a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/contacts_screen.dart +++ b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/contacts_screen.dart @@ -1,7 +1,7 @@ import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:functions/src/features/contacts/domain/entities/list_contact_entity.dart'; +import 'package:functions/src/features/contacts/domain/entities/contact_entity.dart'; import 'package:functions/src/features/contacts/presentation/edit_contact_screen.dart'; import 'package:functions/src/features/contacts/presentation/state/contacts_view_model.dart'; import 'package:navigation/navigation.dart'; @@ -66,25 +66,25 @@ class ContactsScreen extends ConsumerWidget { SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)), Expanded( child: Container( padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), - big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) + small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) ), child: ListView.separated( itemBuilder: (BuildContext context, int index)=>ContactCard( - contact: state.contactList!.contacts[index], + contact: state.contacts[index], isEditing: state.isEditing, ), separatorBuilder: (BuildContext context, int index)=>SizedBox( - height: SizeUtils.getByScreen(small: 18, big: 17) + height: SizeUtils.getByScreen(small: 18, big: 17) ), - itemCount: state.contactList?.contacts.length ?? 0 + itemCount: state.contacts.length ), )), if (state.isEditing) ...[ Container( padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 26, vertical: 14), - big: EdgeInsets.symmetric(horizontal: 24, vertical: 12) + small: EdgeInsets.symmetric(horizontal: 26, vertical: 14), + big: EdgeInsets.symmetric(horizontal: 24, vertical: 12) ), ), ], @@ -110,7 +110,7 @@ class ContactsScreen extends ConsumerWidget { class ContactCard extends ConsumerWidget { - final ListContactEntity contact; + final ContactEntity contact; final bool isEditing; const ContactCard({ diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/edit_contact_screen.dart b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/edit_contact_screen.dart index dbe78eb8..519fdf98 100644 --- a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/edit_contact_screen.dart +++ b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/edit_contact_screen.dart @@ -2,7 +2,7 @@ import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:functions/src/features/contacts/domain/entities/list_contact_entity.dart'; +import 'package:functions/src/features/contacts/domain/entities/contact_entity.dart'; import 'package:functions/src/features/contacts/presentation/state/contacts_view_model.dart'; // import 'package:navigation/navigation.dart'; import 'package:sf_localizations/sf_localizations.dart'; @@ -10,7 +10,7 @@ import 'package:utils/utils.dart'; class EditContactScreen extends ConsumerWidget { //final NavigationContract navigationContract; - final ListContactEntity contact; + final ContactEntity contact; const EditContactScreen({super.key, required this.contact // required this.navigationContract diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_model.dart b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_model.dart index b792c2a5..d199d571 100644 --- a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_model.dart +++ b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_model.dart @@ -1,10 +1,11 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:functions/src/features/contacts/domain/entities/contact_list_entity.dart'; -import 'package:functions/src/features/contacts/domain/entities/list_contact_entity.dart'; +import 'package:functions/src/features/contacts/domain/entities/contact_entity.dart'; import 'package:functions/src/features/contacts/domain/get_contacts_use_case.dart'; -import 'package:functions/src/features/contacts/presentation/providers/get_contacts_provider.dart'; +import 'package:functions/src/features/contacts/presentation/providers/get_contacts_use_case_provider.dart'; import 'package:functions/src/features/contacts/presentation/state/contacts_view_state.dart'; +// import 'package:legacy_shared/src/providers/logged_user_provider.dart'; +// import 'package:legacy_shared/src/data/models/entities/user_entity.dart'; // import 'package:sf_localizations/sf_localizations.dart'; final contactsViewModelProvider = @@ -18,26 +19,30 @@ class ContactsViewModel extends Notifier { late final TextEditingController nameController; late final TextEditingController phoneController; + // late final UserEntity loggedUser; + @override ContactsViewState build() { _getContactsUseCase = ref.read(getContactsUseCaseProvider); + // loggedUser = ref.read(loggedUserProvider); + nameController = TextEditingController(); phoneController = TextEditingController(); nameController.addListener(_onNameChanged); phoneController.addListener(_onPhoneChanged); - _getContactsUseCase.getContacts(deviceId: '').then(setContacts); + _getContactsUseCase.getContacts(userId: '').then(setContacts); ref.onDispose(disposeControllers); return const ContactsViewState(); } - void setContacts(ContactListEntity contactList) { + void setContacts(List contacts) { state = state.copyWith( - contactList: contactList + contacts: contacts ); } @@ -59,7 +64,9 @@ class ContactsViewModel extends Notifier { state = state.copyWith(phone: text, errorMessage: ''); } - void updateContact(ListContactEntity contact) {} + void updateContact(ContactEntity contact) { + + } void disposeControllers() { nameController.removeListener(_onNameChanged); diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_state.dart b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_state.dart index 439ee615..b3b17bd5 100644 --- a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_state.dart +++ b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_state.dart @@ -1,12 +1,12 @@ import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:functions/src/features/contacts/domain/entities/contact_list_entity.dart'; +import 'package:functions/src/features/contacts/domain/entities/contact_entity.dart'; part 'contacts_view_state.freezed.dart'; @freezed abstract class ContactsViewState with _$ContactsViewState { const factory ContactsViewState({ - @Default(null) ContactListEntity? contactList, + @Default([]) List contacts, @Default(false) bool isLoading, @Default(false) bool isEditing, @Default('') String name, diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_state.freezed.dart b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_state.freezed.dart index 1d74938c..b6647030 100644 --- a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_state.freezed.dart +++ b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/state/contacts_view_state.freezed.dart @@ -14,7 +14,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$ContactsViewState { - ContactListEntity? get contactList; bool get isLoading; bool get isEditing; String get name; String get phone; String get errorMessage; + List get contacts; bool get isLoading; bool get isEditing; String get name; String get phone; String get errorMessage; /// Create a copy of ContactsViewState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -25,16 +25,16 @@ $ContactsViewStateCopyWith get copyWith => _$ContactsViewStat @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ContactsViewState&&(identical(other.contactList, contactList) || other.contactList == contactList)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.name, name) || other.name == name)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is ContactsViewState&&const DeepCollectionEquality().equals(other.contacts, contacts)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.name, name) || other.name == name)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); } @override -int get hashCode => Object.hash(runtimeType,contactList,isLoading,isEditing,name,phone,errorMessage); +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(contacts),isLoading,isEditing,name,phone,errorMessage); @override String toString() { - return 'ContactsViewState(contactList: $contactList, isLoading: $isLoading, isEditing: $isEditing, name: $name, phone: $phone, errorMessage: $errorMessage)'; + return 'ContactsViewState(contacts: $contacts, isLoading: $isLoading, isEditing: $isEditing, name: $name, phone: $phone, errorMessage: $errorMessage)'; } @@ -45,11 +45,11 @@ abstract mixin class $ContactsViewStateCopyWith<$Res> { factory $ContactsViewStateCopyWith(ContactsViewState value, $Res Function(ContactsViewState) _then) = _$ContactsViewStateCopyWithImpl; @useResult $Res call({ - ContactListEntity? contactList, bool isLoading, bool isEditing, String name, String phone, String errorMessage + List contacts, bool isLoading, bool isEditing, String name, String phone, String errorMessage }); -$ContactListEntityCopyWith<$Res>? get contactList; + } /// @nodoc @@ -62,10 +62,10 @@ class _$ContactsViewStateCopyWithImpl<$Res> /// Create a copy of ContactsViewState /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? contactList = freezed,Object? isLoading = null,Object? isEditing = null,Object? name = null,Object? phone = null,Object? errorMessage = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? contacts = null,Object? isLoading = null,Object? isEditing = null,Object? name = null,Object? phone = null,Object? errorMessage = null,}) { return _then(_self.copyWith( -contactList: freezed == contactList ? _self.contactList : contactList // ignore: cast_nullable_to_non_nullable -as ContactListEntity?,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable +contacts: null == contacts ? _self.contacts : contacts // ignore: cast_nullable_to_non_nullable +as List,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable as bool,isEditing: null == isEditing ? _self.isEditing : isEditing // ignore: cast_nullable_to_non_nullable as bool,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable @@ -73,19 +73,7 @@ as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage as String, )); } -/// Create a copy of ContactsViewState -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$ContactListEntityCopyWith<$Res>? get contactList { - if (_self.contactList == null) { - return null; - } - return $ContactListEntityCopyWith<$Res>(_self.contactList!, (value) { - return _then(_self.copyWith(contactList: value)); - }); -} } @@ -167,10 +155,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( ContactListEntity? contactList, bool isLoading, bool isEditing, String name, String phone, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( List contacts, bool isLoading, bool isEditing, String name, String phone, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _ContactsViewState() when $default != null: -return $default(_that.contactList,_that.isLoading,_that.isEditing,_that.name,_that.phone,_that.errorMessage);case _: +return $default(_that.contacts,_that.isLoading,_that.isEditing,_that.name,_that.phone,_that.errorMessage);case _: return orElse(); } @@ -188,10 +176,10 @@ return $default(_that.contactList,_that.isLoading,_that.isEditing,_that.name,_th /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( ContactListEntity? contactList, bool isLoading, bool isEditing, String name, String phone, String errorMessage) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( List contacts, bool isLoading, bool isEditing, String name, String phone, String errorMessage) $default,) {final _that = this; switch (_that) { case _ContactsViewState(): -return $default(_that.contactList,_that.isLoading,_that.isEditing,_that.name,_that.phone,_that.errorMessage);case _: +return $default(_that.contacts,_that.isLoading,_that.isEditing,_that.name,_that.phone,_that.errorMessage);case _: throw StateError('Unexpected subclass'); } @@ -208,10 +196,10 @@ return $default(_that.contactList,_that.isLoading,_that.isEditing,_that.name,_th /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( ContactListEntity? contactList, bool isLoading, bool isEditing, String name, String phone, String errorMessage)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( List contacts, bool isLoading, bool isEditing, String name, String phone, String errorMessage)? $default,) {final _that = this; switch (_that) { case _ContactsViewState() when $default != null: -return $default(_that.contactList,_that.isLoading,_that.isEditing,_that.name,_that.phone,_that.errorMessage);case _: +return $default(_that.contacts,_that.isLoading,_that.isEditing,_that.name,_that.phone,_that.errorMessage);case _: return null; } @@ -223,10 +211,16 @@ return $default(_that.contactList,_that.isLoading,_that.isEditing,_that.name,_th class _ContactsViewState implements ContactsViewState { - const _ContactsViewState({this.contactList = null, this.isLoading = false, this.isEditing = false, this.name = '', this.phone = '', this.errorMessage = ''}); + const _ContactsViewState({final List contacts = const [], this.isLoading = false, this.isEditing = false, this.name = '', this.phone = '', this.errorMessage = ''}): _contacts = contacts; -@override@JsonKey() final ContactListEntity? contactList; + final List _contacts; +@override@JsonKey() List get contacts { + if (_contacts is EqualUnmodifiableListView) return _contacts; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_contacts); +} + @override@JsonKey() final bool isLoading; @override@JsonKey() final bool isEditing; @override@JsonKey() final String name; @@ -243,16 +237,16 @@ _$ContactsViewStateCopyWith<_ContactsViewState> get copyWith => __$ContactsViewS @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _ContactsViewState&&(identical(other.contactList, contactList) || other.contactList == contactList)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.name, name) || other.name == name)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _ContactsViewState&&const DeepCollectionEquality().equals(other._contacts, _contacts)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.name, name) || other.name == name)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); } @override -int get hashCode => Object.hash(runtimeType,contactList,isLoading,isEditing,name,phone,errorMessage); +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_contacts),isLoading,isEditing,name,phone,errorMessage); @override String toString() { - return 'ContactsViewState(contactList: $contactList, isLoading: $isLoading, isEditing: $isEditing, name: $name, phone: $phone, errorMessage: $errorMessage)'; + return 'ContactsViewState(contacts: $contacts, isLoading: $isLoading, isEditing: $isEditing, name: $name, phone: $phone, errorMessage: $errorMessage)'; } @@ -263,11 +257,11 @@ abstract mixin class _$ContactsViewStateCopyWith<$Res> implements $ContactsViewS factory _$ContactsViewStateCopyWith(_ContactsViewState value, $Res Function(_ContactsViewState) _then) = __$ContactsViewStateCopyWithImpl; @override @useResult $Res call({ - ContactListEntity? contactList, bool isLoading, bool isEditing, String name, String phone, String errorMessage + List contacts, bool isLoading, bool isEditing, String name, String phone, String errorMessage }); -@override $ContactListEntityCopyWith<$Res>? get contactList; + } /// @nodoc @@ -280,10 +274,10 @@ class __$ContactsViewStateCopyWithImpl<$Res> /// Create a copy of ContactsViewState /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? contactList = freezed,Object? isLoading = null,Object? isEditing = null,Object? name = null,Object? phone = null,Object? errorMessage = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? contacts = null,Object? isLoading = null,Object? isEditing = null,Object? name = null,Object? phone = null,Object? errorMessage = null,}) { return _then(_ContactsViewState( -contactList: freezed == contactList ? _self.contactList : contactList // ignore: cast_nullable_to_non_nullable -as ContactListEntity?,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable +contacts: null == contacts ? _self._contacts : contacts // ignore: cast_nullable_to_non_nullable +as List,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable as bool,isEditing: null == isEditing ? _self.isEditing : isEditing // ignore: cast_nullable_to_non_nullable as bool,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable @@ -292,19 +286,7 @@ as String, )); } -/// Create a copy of ContactsViewState -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$ContactListEntityCopyWith<$Res>? get contactList { - if (_self.contactList == null) { - return null; - } - return $ContactListEntityCopyWith<$Res>(_self.contactList!, (value) { - return _then(_self.copyWith(contactList: value)); - }); -} } // dart format on From da90ed94ea097ca19ec1f2ab95536ecedee252ed Mon Sep 17 00:00:00 2001 From: aitorarana Date: Tue, 10 Feb 2026 17:30:58 +0100 Subject: [PATCH 13/25] create legacy_shared package and added page_layout and logged_user_provider --- .idea/modules.xml | 1 + modules/legacy/melos_legacy.iml | 3 + modules/legacy/modules/functions/pubspec.yaml | 114 ++++ .../legacy_shared_remote_datasource.dart | 5 + .../legacy_shared_remote_datasource_impl.dart | 75 +++ .../src/data/models/entities/user_entity.dart | 23 + .../models/entities/user_entity.freezed.dart | 310 +++++++++ .../get_logged_user_response_model.dart | 60 ++ ...et_logged_user_response_model.freezed.dart | 597 ++++++++++++++++++ .../get_logged_user_response_model.g.dart | 57 ++ .../legacy_shared_repository.dart | 6 + .../legacy_shared_repository_impl.dart | 15 + ...acy_shared_remote_datasource_provider.dart | 9 + .../legacy_shared_repository_provider.dart | 10 + .../src/providers/logged_user_provider.dart | 20 + .../lib/src/widgets/layouts/page_layout.dart | 52 ++ .../packages/legacy_shared/pubspec.yaml | 69 ++ 17 files changed, 1426 insertions(+) create mode 100644 modules/legacy/modules/functions/pubspec.yaml create mode 100644 modules/legacy/packages/legacy_shared/lib/src/data/datasource/legacy_shared_remote_datasource.dart create mode 100644 modules/legacy/packages/legacy_shared/lib/src/data/datasource/legacy_shared_remote_datasource_impl.dart create mode 100644 modules/legacy/packages/legacy_shared/lib/src/data/models/entities/user_entity.dart create mode 100644 modules/legacy/packages/legacy_shared/lib/src/data/models/entities/user_entity.freezed.dart create mode 100644 modules/legacy/packages/legacy_shared/lib/src/data/models/get_logged_user_response_model.dart create mode 100644 modules/legacy/packages/legacy_shared/lib/src/data/models/get_logged_user_response_model.freezed.dart create mode 100644 modules/legacy/packages/legacy_shared/lib/src/data/models/get_logged_user_response_model.g.dart create mode 100644 modules/legacy/packages/legacy_shared/lib/src/data/repositories/legacy_shared_repository.dart create mode 100644 modules/legacy/packages/legacy_shared/lib/src/data/repositories/legacy_shared_repository_impl.dart create mode 100644 modules/legacy/packages/legacy_shared/lib/src/providers/legacy_shared_remote_datasource_provider.dart create mode 100644 modules/legacy/packages/legacy_shared/lib/src/providers/legacy_shared_repository_provider.dart create mode 100644 modules/legacy/packages/legacy_shared/lib/src/providers/logged_user_provider.dart create mode 100644 modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart create mode 100644 modules/legacy/packages/legacy_shared/pubspec.yaml diff --git a/.idea/modules.xml b/.idea/modules.xml index b7aa4bbc..54a5b847 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -13,6 +13,7 @@ + diff --git a/modules/legacy/melos_legacy.iml b/modules/legacy/melos_legacy.iml index e8a4d511..f4ba9b32 100644 --- a/modules/legacy/melos_legacy.iml +++ b/modules/legacy/melos_legacy.iml @@ -20,6 +20,9 @@ + + + diff --git a/modules/legacy/modules/functions/pubspec.yaml b/modules/legacy/modules/functions/pubspec.yaml new file mode 100644 index 00000000..d6fedac9 --- /dev/null +++ b/modules/legacy/modules/functions/pubspec.yaml @@ -0,0 +1,114 @@ +name: functions +description: "A new Flutter project." + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# +# This version is used _only_ for the Runner app, which is used if you just do +# a `flutter run`. It has no impact on any other native host app that you embed +# your Flutter project into. +version: 1.0.0+1 + +environment: + sdk: ^3.9.2 + +dependencies: + flutter: + sdk: flutter + #modules dependencies go here + + #packages dependencies go here + design_system: + path: ../../../../packages/design_system + navigation: + path: ../../../../packages/navigation + sf_localizations: + path: ../../../../packages/sf_localizations + sf_infrastructure: + path: ../../../../packages/sf_infrastructure + utils: + path: ../../../../packages/utils + fonts: + path: ../../../../packages/fonts + legacy_shared: + path: ../../packages/legacy_shared + #dependencies go here + flutter_svg: ^2.2.1 + get_it: ^9.0.5 + go_router: ^17.0.0 + flutter_riverpod: ^3.0.3 + freezed_annotation: ^3.1.0 + freezed: ^3.2.3 + dio: ^5.9.0 + json_annotation: ^4.9.0 + json_serializable: ^6.11.2 + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.8 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^5.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +flutter: + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add Flutter specific assets to your application, add an assets section, + # like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/to/resolution-aware-images + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/to/asset-from-package + + # To add Flutter specific custom fonts to your application, add a fonts + # section here, in this "flutter" section. Each entry in this list should + # have a "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/to/font-from-package + + + # This section identifies your Flutter project as a module meant for + # embedding in a native host app. These identifiers should _not_ ordinarily + # be changed after generation - they are used to ensure that the tooling can + # maintain consistency when adding or modifying assets and plugins. + # They also do not have any bearing on your native host application's + # identifiers, which may be completely independent or the same as these. + module: + androidX: true + androidPackage: com.example.functions + iosBundleIdentifier: com.example.functions diff --git a/modules/legacy/packages/legacy_shared/lib/src/data/datasource/legacy_shared_remote_datasource.dart b/modules/legacy/packages/legacy_shared/lib/src/data/datasource/legacy_shared_remote_datasource.dart new file mode 100644 index 00000000..f760be5d --- /dev/null +++ b/modules/legacy/packages/legacy_shared/lib/src/data/datasource/legacy_shared_remote_datasource.dart @@ -0,0 +1,5 @@ +import 'package:legacy_shared/src/data/models/entities/user_entity.dart'; + +abstract class LegacySharedRemoteDatasource { + Future getLoggedUser({required String token}); +} diff --git a/modules/legacy/packages/legacy_shared/lib/src/data/datasource/legacy_shared_remote_datasource_impl.dart b/modules/legacy/packages/legacy_shared/lib/src/data/datasource/legacy_shared_remote_datasource_impl.dart new file mode 100644 index 00000000..30a09326 --- /dev/null +++ b/modules/legacy/packages/legacy_shared/lib/src/data/datasource/legacy_shared_remote_datasource_impl.dart @@ -0,0 +1,75 @@ +import 'dart:convert'; + +import 'package:dio/dio.dart'; +import 'package:legacy_shared/src/data/datasource/legacy_shared_remote_datasource.dart'; +import 'package:legacy_shared/src/data/models/entities/user_entity.dart'; +import 'package:legacy_shared/src/data/models/get_logged_user_response_model.dart'; +import 'package:sf_infrastructure/sf_infrastructure.dart'; + +class LegacySharedRemoteDatasourceImpl implements LegacySharedRemoteDatasource { + LegacySharedRemoteDatasourceImpl(this._repository); + + final QuestiaRepository _repository; + + @override + Future getLoggedUser({required String token}) async { + try { + final response = await _repository.get>( + '/users/api/auth/me', + ); + final data = response.data!['item']; + if (data == null || data.isEmpty) { + throw Exception('Empty response from /auth/me'); + } + + final model = GetLoggedUserResponseModel.fromJson(data); + /*final model = GetLoggedUserResponseModel(item: + GetLoggedUserItemResponseModel( + id: '1111', + firstName: 'Juan', + email: 'juan@test.com', + phone: '111111111'));*/ + return model.toEntity(); + } on DioException catch (error) { + throw _mapDioError( + error, + defaultMessage: error.message ?? 'Error getting logged user', + ); + } + } +} + +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/legacy/packages/legacy_shared/lib/src/data/models/entities/user_entity.dart b/modules/legacy/packages/legacy_shared/lib/src/data/models/entities/user_entity.dart new file mode 100644 index 00000000..ccea2ef5 --- /dev/null +++ b/modules/legacy/packages/legacy_shared/lib/src/data/models/entities/user_entity.dart @@ -0,0 +1,23 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'user_entity.freezed.dart'; + +@freezed +abstract class UserEntity with _$UserEntity { + const factory UserEntity({ + required String id, + required String delegationId, + required String email, + required String createdAt, + required String updatedAt, + required String status, + required String role, + required String lastLogin, + required String currentLogin, + required String language, + required String firstName, + required String lastName, + required String hasApiKey, + required String phone, + }) = _UserEntity; +} diff --git a/modules/legacy/packages/legacy_shared/lib/src/data/models/entities/user_entity.freezed.dart b/modules/legacy/packages/legacy_shared/lib/src/data/models/entities/user_entity.freezed.dart new file mode 100644 index 00000000..5b9e7aee --- /dev/null +++ b/modules/legacy/packages/legacy_shared/lib/src/data/models/entities/user_entity.freezed.dart @@ -0,0 +1,310 @@ +// 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 'user_entity.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$UserEntity { + + String get id; String get delegationId; String get email; String get createdAt; String get updatedAt; String get status; String get role; String get lastLogin; String get currentLogin; String get language; String get firstName; String get lastName; String get hasApiKey; String get phone; +/// Create a copy of UserEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UserEntityCopyWith get copyWith => _$UserEntityCopyWithImpl(this as UserEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UserEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone)); +} + + +@override +int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone); + +@override +String toString() { + return 'UserEntity(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)'; +} + + +} + +/// @nodoc +abstract mixin class $UserEntityCopyWith<$Res> { + factory $UserEntityCopyWith(UserEntity value, $Res Function(UserEntity) _then) = _$UserEntityCopyWithImpl; +@useResult +$Res call({ + String id, String delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone +}); + + + + +} +/// @nodoc +class _$UserEntityCopyWithImpl<$Res> + implements $UserEntityCopyWith<$Res> { + _$UserEntityCopyWithImpl(this._self, this._then); + + final UserEntity _self; + final $Res Function(UserEntity) _then; + +/// Create a copy of UserEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? delegationId = null,Object? email = null,Object? createdAt = null,Object? updatedAt = null,Object? status = null,Object? role = null,Object? lastLogin = null,Object? currentLogin = null,Object? language = null,Object? firstName = null,Object? lastName = null,Object? hasApiKey = null,Object? phone = null,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,delegationId: null == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable +as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable +as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as String,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as String,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable +as String,role: null == role ? _self.role : role // ignore: cast_nullable_to_non_nullable +as String,lastLogin: null == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable +as String,currentLogin: null == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable +as String,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable +as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable +as String,hasApiKey: null == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable +as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [UserEntity]. +extension UserEntityPatterns on UserEntity { +/// 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( _UserEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _UserEntity() 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( _UserEntity value) $default,){ +final _that = this; +switch (_that) { +case _UserEntity(): +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( _UserEntity value)? $default,){ +final _that = this; +switch (_that) { +case _UserEntity() 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 delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _UserEntity() when $default != null: +return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);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 delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone) $default,) {final _that = this; +switch (_that) { +case _UserEntity(): +return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);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 delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone)? $default,) {final _that = this; +switch (_that) { +case _UserEntity() when $default != null: +return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _UserEntity implements UserEntity { + const _UserEntity({required this.id, required this.delegationId, required this.email, required this.createdAt, required this.updatedAt, required this.status, required this.role, required this.lastLogin, required this.currentLogin, required this.language, required this.firstName, required this.lastName, required this.hasApiKey, required this.phone}); + + +@override final String id; +@override final String delegationId; +@override final String email; +@override final String createdAt; +@override final String updatedAt; +@override final String status; +@override final String role; +@override final String lastLogin; +@override final String currentLogin; +@override final String language; +@override final String firstName; +@override final String lastName; +@override final String hasApiKey; +@override final String phone; + +/// Create a copy of UserEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$UserEntityCopyWith<_UserEntity> get copyWith => __$UserEntityCopyWithImpl<_UserEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _UserEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone)); +} + + +@override +int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone); + +@override +String toString() { + return 'UserEntity(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)'; +} + + +} + +/// @nodoc +abstract mixin class _$UserEntityCopyWith<$Res> implements $UserEntityCopyWith<$Res> { + factory _$UserEntityCopyWith(_UserEntity value, $Res Function(_UserEntity) _then) = __$UserEntityCopyWithImpl; +@override @useResult +$Res call({ + String id, String delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone +}); + + + + +} +/// @nodoc +class __$UserEntityCopyWithImpl<$Res> + implements _$UserEntityCopyWith<$Res> { + __$UserEntityCopyWithImpl(this._self, this._then); + + final _UserEntity _self; + final $Res Function(_UserEntity) _then; + +/// Create a copy of UserEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? delegationId = null,Object? email = null,Object? createdAt = null,Object? updatedAt = null,Object? status = null,Object? role = null,Object? lastLogin = null,Object? currentLogin = null,Object? language = null,Object? firstName = null,Object? lastName = null,Object? hasApiKey = null,Object? phone = null,}) { + return _then(_UserEntity( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,delegationId: null == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable +as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable +as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as String,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as String,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable +as String,role: null == role ? _self.role : role // ignore: cast_nullable_to_non_nullable +as String,lastLogin: null == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable +as String,currentLogin: null == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable +as String,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable +as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable +as String,hasApiKey: null == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable +as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/packages/legacy_shared/lib/src/data/models/get_logged_user_response_model.dart b/modules/legacy/packages/legacy_shared/lib/src/data/models/get_logged_user_response_model.dart new file mode 100644 index 00000000..02bd7f91 --- /dev/null +++ b/modules/legacy/packages/legacy_shared/lib/src/data/models/get_logged_user_response_model.dart @@ -0,0 +1,60 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:legacy_shared/src/data/models/entities/user_entity.dart'; + +part 'get_logged_user_response_model.freezed.dart'; +part 'get_logged_user_response_model.g.dart'; + +@freezed +abstract class GetLoggedUserResponseModel with _$GetLoggedUserResponseModel { + const factory GetLoggedUserResponseModel({ + required GetLoggedUserItemResponseModel item, + }) = _GetLoggedUserResponseModel; + + factory GetLoggedUserResponseModel.fromJson(Map json) => + _$GetLoggedUserResponseModelFromJson(json); +} + +@freezed +abstract class GetLoggedUserItemResponseModel with _$GetLoggedUserItemResponseModel { + const factory GetLoggedUserItemResponseModel({ + required String id, + String? delegationId, + String? email, + String? createdAt, + String? updatedAt, + String? status, + String? role, + String? lastLogin, + String? currentLogin, + String? language, + String? firstName, + String? lastName, + String? hasApiKey, + String? phone, + }) = + _GetLoggedUserItemResponseModel; + + factory GetLoggedUserItemResponseModel.fromJson(Map json) => + _$GetLoggedUserItemResponseModelFromJson(json); +} + +extension GetLoggedUserResponseModelMapper on GetLoggedUserResponseModel { + UserEntity toEntity() { + return UserEntity( + id: item.id, + delegationId: item.delegationId ?? '', + email: item.email ?? '', + createdAt: item.createdAt ?? '', + updatedAt: item.updatedAt ?? '', + status: item.status ?? '', + role: item.role ?? '', + lastLogin: item.lastLogin ?? '', + currentLogin: item.currentLogin ?? '', + language: item.language ?? '', + firstName: item.firstName ?? '', + lastName: item.lastName ?? '', + hasApiKey: item.hasApiKey ?? '', + phone: item.phone ?? '' + ); + } +} \ No newline at end of file diff --git a/modules/legacy/packages/legacy_shared/lib/src/data/models/get_logged_user_response_model.freezed.dart b/modules/legacy/packages/legacy_shared/lib/src/data/models/get_logged_user_response_model.freezed.dart new file mode 100644 index 00000000..15722cae --- /dev/null +++ b/modules/legacy/packages/legacy_shared/lib/src/data/models/get_logged_user_response_model.freezed.dart @@ -0,0 +1,597 @@ +// 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_logged_user_response_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$GetLoggedUserResponseModel { + + GetLoggedUserItemResponseModel get item; +/// Create a copy of GetLoggedUserResponseModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$GetLoggedUserResponseModelCopyWith get copyWith => _$GetLoggedUserResponseModelCopyWithImpl(this as GetLoggedUserResponseModel, _$identity); + + /// Serializes this GetLoggedUserResponseModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is GetLoggedUserResponseModel&&(identical(other.item, item) || other.item == item)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,item); + +@override +String toString() { + return 'GetLoggedUserResponseModel(item: $item)'; +} + + +} + +/// @nodoc +abstract mixin class $GetLoggedUserResponseModelCopyWith<$Res> { + factory $GetLoggedUserResponseModelCopyWith(GetLoggedUserResponseModel value, $Res Function(GetLoggedUserResponseModel) _then) = _$GetLoggedUserResponseModelCopyWithImpl; +@useResult +$Res call({ + GetLoggedUserItemResponseModel item +}); + + +$GetLoggedUserItemResponseModelCopyWith<$Res> get item; + +} +/// @nodoc +class _$GetLoggedUserResponseModelCopyWithImpl<$Res> + implements $GetLoggedUserResponseModelCopyWith<$Res> { + _$GetLoggedUserResponseModelCopyWithImpl(this._self, this._then); + + final GetLoggedUserResponseModel _self; + final $Res Function(GetLoggedUserResponseModel) _then; + +/// Create a copy of GetLoggedUserResponseModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? item = null,}) { + return _then(_self.copyWith( +item: null == item ? _self.item : item // ignore: cast_nullable_to_non_nullable +as GetLoggedUserItemResponseModel, + )); +} +/// Create a copy of GetLoggedUserResponseModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$GetLoggedUserItemResponseModelCopyWith<$Res> get item { + + return $GetLoggedUserItemResponseModelCopyWith<$Res>(_self.item, (value) { + return _then(_self.copyWith(item: value)); + }); +} +} + + +/// Adds pattern-matching-related methods to [GetLoggedUserResponseModel]. +extension GetLoggedUserResponseModelPatterns on GetLoggedUserResponseModel { +/// 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( _GetLoggedUserResponseModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _GetLoggedUserResponseModel() 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( _GetLoggedUserResponseModel value) $default,){ +final _that = this; +switch (_that) { +case _GetLoggedUserResponseModel(): +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( _GetLoggedUserResponseModel value)? $default,){ +final _that = this; +switch (_that) { +case _GetLoggedUserResponseModel() 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( GetLoggedUserItemResponseModel item)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _GetLoggedUserResponseModel() when $default != null: +return $default(_that.item);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( GetLoggedUserItemResponseModel item) $default,) {final _that = this; +switch (_that) { +case _GetLoggedUserResponseModel(): +return $default(_that.item);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( GetLoggedUserItemResponseModel item)? $default,) {final _that = this; +switch (_that) { +case _GetLoggedUserResponseModel() when $default != null: +return $default(_that.item);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _GetLoggedUserResponseModel implements GetLoggedUserResponseModel { + const _GetLoggedUserResponseModel({required this.item}); + factory _GetLoggedUserResponseModel.fromJson(Map json) => _$GetLoggedUserResponseModelFromJson(json); + +@override final GetLoggedUserItemResponseModel item; + +/// Create a copy of GetLoggedUserResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$GetLoggedUserResponseModelCopyWith<_GetLoggedUserResponseModel> get copyWith => __$GetLoggedUserResponseModelCopyWithImpl<_GetLoggedUserResponseModel>(this, _$identity); + +@override +Map toJson() { + return _$GetLoggedUserResponseModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetLoggedUserResponseModel&&(identical(other.item, item) || other.item == item)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,item); + +@override +String toString() { + return 'GetLoggedUserResponseModel(item: $item)'; +} + + +} + +/// @nodoc +abstract mixin class _$GetLoggedUserResponseModelCopyWith<$Res> implements $GetLoggedUserResponseModelCopyWith<$Res> { + factory _$GetLoggedUserResponseModelCopyWith(_GetLoggedUserResponseModel value, $Res Function(_GetLoggedUserResponseModel) _then) = __$GetLoggedUserResponseModelCopyWithImpl; +@override @useResult +$Res call({ + GetLoggedUserItemResponseModel item +}); + + +@override $GetLoggedUserItemResponseModelCopyWith<$Res> get item; + +} +/// @nodoc +class __$GetLoggedUserResponseModelCopyWithImpl<$Res> + implements _$GetLoggedUserResponseModelCopyWith<$Res> { + __$GetLoggedUserResponseModelCopyWithImpl(this._self, this._then); + + final _GetLoggedUserResponseModel _self; + final $Res Function(_GetLoggedUserResponseModel) _then; + +/// Create a copy of GetLoggedUserResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? item = null,}) { + return _then(_GetLoggedUserResponseModel( +item: null == item ? _self.item : item // ignore: cast_nullable_to_non_nullable +as GetLoggedUserItemResponseModel, + )); +} + +/// Create a copy of GetLoggedUserResponseModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$GetLoggedUserItemResponseModelCopyWith<$Res> get item { + + return $GetLoggedUserItemResponseModelCopyWith<$Res>(_self.item, (value) { + return _then(_self.copyWith(item: value)); + }); +} +} + + +/// @nodoc +mixin _$GetLoggedUserItemResponseModel { + + String get id; String? get delegationId; String? get email; String? get createdAt; String? get updatedAt; String? get status; String? get role; String? get lastLogin; String? get currentLogin; String? get language; String? get firstName; String? get lastName; String? get hasApiKey; String? get phone; +/// Create a copy of GetLoggedUserItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$GetLoggedUserItemResponseModelCopyWith get copyWith => _$GetLoggedUserItemResponseModelCopyWithImpl(this as GetLoggedUserItemResponseModel, _$identity); + + /// Serializes this GetLoggedUserItemResponseModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is GetLoggedUserItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone); + +@override +String toString() { + return 'GetLoggedUserItemResponseModel(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)'; +} + + +} + +/// @nodoc +abstract mixin class $GetLoggedUserItemResponseModelCopyWith<$Res> { + factory $GetLoggedUserItemResponseModelCopyWith(GetLoggedUserItemResponseModel value, $Res Function(GetLoggedUserItemResponseModel) _then) = _$GetLoggedUserItemResponseModelCopyWithImpl; +@useResult +$Res call({ + String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone +}); + + + + +} +/// @nodoc +class _$GetLoggedUserItemResponseModelCopyWithImpl<$Res> + implements $GetLoggedUserItemResponseModelCopyWith<$Res> { + _$GetLoggedUserItemResponseModelCopyWithImpl(this._self, this._then); + + final GetLoggedUserItemResponseModel _self; + final $Res Function(GetLoggedUserItemResponseModel) _then; + +/// Create a copy of GetLoggedUserItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? delegationId = freezed,Object? email = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? status = freezed,Object? role = freezed,Object? lastLogin = freezed,Object? currentLogin = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? hasApiKey = freezed,Object? phone = freezed,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable +as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable +as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable +as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable +as String?,lastLogin: freezed == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable +as String?,currentLogin: freezed == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable +as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable +as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable +as String?,hasApiKey: freezed == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable +as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + +} + + +/// Adds pattern-matching-related methods to [GetLoggedUserItemResponseModel]. +extension GetLoggedUserItemResponseModelPatterns on GetLoggedUserItemResponseModel { +/// 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( _GetLoggedUserItemResponseModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _GetLoggedUserItemResponseModel() 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( _GetLoggedUserItemResponseModel value) $default,){ +final _that = this; +switch (_that) { +case _GetLoggedUserItemResponseModel(): +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( _GetLoggedUserItemResponseModel value)? $default,){ +final _that = this; +switch (_that) { +case _GetLoggedUserItemResponseModel() 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? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _GetLoggedUserItemResponseModel() when $default != null: +return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);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? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone) $default,) {final _that = this; +switch (_that) { +case _GetLoggedUserItemResponseModel(): +return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);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? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone)? $default,) {final _that = this; +switch (_that) { +case _GetLoggedUserItemResponseModel() when $default != null: +return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _GetLoggedUserItemResponseModel implements GetLoggedUserItemResponseModel { + const _GetLoggedUserItemResponseModel({required this.id, this.delegationId, this.email, this.createdAt, this.updatedAt, this.status, this.role, this.lastLogin, this.currentLogin, this.language, this.firstName, this.lastName, this.hasApiKey, this.phone}); + factory _GetLoggedUserItemResponseModel.fromJson(Map json) => _$GetLoggedUserItemResponseModelFromJson(json); + +@override final String id; +@override final String? delegationId; +@override final String? email; +@override final String? createdAt; +@override final String? updatedAt; +@override final String? status; +@override final String? role; +@override final String? lastLogin; +@override final String? currentLogin; +@override final String? language; +@override final String? firstName; +@override final String? lastName; +@override final String? hasApiKey; +@override final String? phone; + +/// Create a copy of GetLoggedUserItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$GetLoggedUserItemResponseModelCopyWith<_GetLoggedUserItemResponseModel> get copyWith => __$GetLoggedUserItemResponseModelCopyWithImpl<_GetLoggedUserItemResponseModel>(this, _$identity); + +@override +Map toJson() { + return _$GetLoggedUserItemResponseModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetLoggedUserItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone); + +@override +String toString() { + return 'GetLoggedUserItemResponseModel(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)'; +} + + +} + +/// @nodoc +abstract mixin class _$GetLoggedUserItemResponseModelCopyWith<$Res> implements $GetLoggedUserItemResponseModelCopyWith<$Res> { + factory _$GetLoggedUserItemResponseModelCopyWith(_GetLoggedUserItemResponseModel value, $Res Function(_GetLoggedUserItemResponseModel) _then) = __$GetLoggedUserItemResponseModelCopyWithImpl; +@override @useResult +$Res call({ + String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone +}); + + + + +} +/// @nodoc +class __$GetLoggedUserItemResponseModelCopyWithImpl<$Res> + implements _$GetLoggedUserItemResponseModelCopyWith<$Res> { + __$GetLoggedUserItemResponseModelCopyWithImpl(this._self, this._then); + + final _GetLoggedUserItemResponseModel _self; + final $Res Function(_GetLoggedUserItemResponseModel) _then; + +/// Create a copy of GetLoggedUserItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? delegationId = freezed,Object? email = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? status = freezed,Object? role = freezed,Object? lastLogin = freezed,Object? currentLogin = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? hasApiKey = freezed,Object? phone = freezed,}) { + return _then(_GetLoggedUserItemResponseModel( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable +as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable +as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable +as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable +as String?,lastLogin: freezed == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable +as String?,currentLogin: freezed == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable +as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable +as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable +as String?,hasApiKey: freezed == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable +as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/packages/legacy_shared/lib/src/data/models/get_logged_user_response_model.g.dart b/modules/legacy/packages/legacy_shared/lib/src/data/models/get_logged_user_response_model.g.dart new file mode 100644 index 00000000..7ad418b7 --- /dev/null +++ b/modules/legacy/packages/legacy_shared/lib/src/data/models/get_logged_user_response_model.g.dart @@ -0,0 +1,57 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'get_logged_user_response_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_GetLoggedUserResponseModel _$GetLoggedUserResponseModelFromJson( + Map json, +) => _GetLoggedUserResponseModel( + item: GetLoggedUserItemResponseModel.fromJson( + json['item'] as Map, + ), +); + +Map _$GetLoggedUserResponseModelToJson( + _GetLoggedUserResponseModel instance, +) => {'item': instance.item}; + +_GetLoggedUserItemResponseModel _$GetLoggedUserItemResponseModelFromJson( + Map json, +) => _GetLoggedUserItemResponseModel( + id: json['id'] as String, + delegationId: json['delegationId'] as String?, + email: json['email'] as String?, + createdAt: json['createdAt'] as String?, + updatedAt: json['updatedAt'] as String?, + status: json['status'] as String?, + role: json['role'] as String?, + lastLogin: json['lastLogin'] as String?, + currentLogin: json['currentLogin'] as String?, + language: json['language'] as String?, + firstName: json['firstName'] as String?, + lastName: json['lastName'] as String?, + hasApiKey: json['hasApiKey'] as String?, + phone: json['phone'] as String?, +); + +Map _$GetLoggedUserItemResponseModelToJson( + _GetLoggedUserItemResponseModel instance, +) => { + 'id': instance.id, + 'delegationId': instance.delegationId, + 'email': instance.email, + 'createdAt': instance.createdAt, + 'updatedAt': instance.updatedAt, + 'status': instance.status, + 'role': instance.role, + 'lastLogin': instance.lastLogin, + 'currentLogin': instance.currentLogin, + 'language': instance.language, + 'firstName': instance.firstName, + 'lastName': instance.lastName, + 'hasApiKey': instance.hasApiKey, + 'phone': instance.phone, +}; diff --git a/modules/legacy/packages/legacy_shared/lib/src/data/repositories/legacy_shared_repository.dart b/modules/legacy/packages/legacy_shared/lib/src/data/repositories/legacy_shared_repository.dart new file mode 100644 index 00000000..13854552 --- /dev/null +++ b/modules/legacy/packages/legacy_shared/lib/src/data/repositories/legacy_shared_repository.dart @@ -0,0 +1,6 @@ +import 'package:legacy_shared/src/data/models/entities/user_entity.dart'; + +abstract class LegacySharedRepository { + + Future getLoggedUser({required String token}); +} diff --git a/modules/legacy/packages/legacy_shared/lib/src/data/repositories/legacy_shared_repository_impl.dart b/modules/legacy/packages/legacy_shared/lib/src/data/repositories/legacy_shared_repository_impl.dart new file mode 100644 index 00000000..dac7b5df --- /dev/null +++ b/modules/legacy/packages/legacy_shared/lib/src/data/repositories/legacy_shared_repository_impl.dart @@ -0,0 +1,15 @@ +import 'package:legacy_shared/src/data/datasource/legacy_shared_remote_datasource.dart'; +import 'package:legacy_shared/src/data/models/entities/user_entity.dart'; + +import 'legacy_shared_repository.dart'; + +class LegacySharedRepositoryImpl implements LegacySharedRepository { + const LegacySharedRepositoryImpl(this._remote); + + final LegacySharedRemoteDatasource _remote; + + @override + Future getLoggedUser({required String token}) { + return _remote.getLoggedUser(token: token); + } +} diff --git a/modules/legacy/packages/legacy_shared/lib/src/providers/legacy_shared_remote_datasource_provider.dart b/modules/legacy/packages/legacy_shared/lib/src/providers/legacy_shared_remote_datasource_provider.dart new file mode 100644 index 00000000..8eea29f6 --- /dev/null +++ b/modules/legacy/packages/legacy_shared/lib/src/providers/legacy_shared_remote_datasource_provider.dart @@ -0,0 +1,9 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:legacy_shared/src/data/datasource/legacy_shared_remote_datasource.dart'; +import 'package:legacy_shared/src/data/datasource/legacy_shared_remote_datasource_impl.dart'; +import 'package:sf_infrastructure/sf_infrastructure.dart'; + +final legacySharedRemoteDatasourceProvider = Provider((ref) { + final questiaRepository = getIt(); + return LegacySharedRemoteDatasourceImpl(questiaRepository); +}); diff --git a/modules/legacy/packages/legacy_shared/lib/src/providers/legacy_shared_repository_provider.dart b/modules/legacy/packages/legacy_shared/lib/src/providers/legacy_shared_repository_provider.dart new file mode 100644 index 00000000..a155ffed --- /dev/null +++ b/modules/legacy/packages/legacy_shared/lib/src/providers/legacy_shared_repository_provider.dart @@ -0,0 +1,10 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:legacy_shared/src/data/repositories/legacy_shared_repository.dart'; +import 'package:legacy_shared/src/data/repositories/legacy_shared_repository_impl.dart'; + +import 'legacy_shared_remote_datasource_provider.dart'; + +final legacySharedRepositoryProvider = Provider((ref) { + final remote = ref.read(legacySharedRemoteDatasourceProvider); + return LegacySharedRepositoryImpl(remote); +}); diff --git a/modules/legacy/packages/legacy_shared/lib/src/providers/logged_user_provider.dart b/modules/legacy/packages/legacy_shared/lib/src/providers/logged_user_provider.dart new file mode 100644 index 00000000..9b8a5fee --- /dev/null +++ b/modules/legacy/packages/legacy_shared/lib/src/providers/logged_user_provider.dart @@ -0,0 +1,20 @@ +import 'dart:async'; + +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:legacy_shared/src/data/models/entities/user_entity.dart'; + +import 'legacy_shared_repository_provider.dart'; + +final loggedUserProvider = AsyncNotifierProvider.autoDispose( + LoggedUserNotifier.new, + ); + +class LoggedUserNotifier extends AsyncNotifier { + late final legacySharedRepository; + + @override + FutureOr build() { + legacySharedRepository = ref.read(legacySharedRepositoryProvider); + return legacySharedRepository.getLoggedUser(token: ''); + } +} diff --git a/modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart b/modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart new file mode 100644 index 00000000..beeee9cf --- /dev/null +++ b/modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart @@ -0,0 +1,52 @@ +import 'package:flutter/material.dart'; +import 'package:utils/src/size_utils.dart'; + +class PageLayout extends StatelessWidget{ + + final String title; + final Widget body; + final Widget? footer; + + const PageLayout({ + super.key, + required this.title, + required this.body, + this.footer + }); + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + body: SafeArea( + child: Column( + children: [ + Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) + ), + child: Stack( + children: [ + IconButton(onPressed: () {Navigator.pop(context);}, + icon: Icon(Icons.arrow_back)), + Center( + child: Text(title, + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 28, big: 27) + ), + ) + ) + ], + ), + ), + SizedBox(height: SizeUtils.getByScreen(small: 30, big: 28)), + body, + ?footer + ], + ) + ), + ); + } + +} \ No newline at end of file diff --git a/modules/legacy/packages/legacy_shared/pubspec.yaml b/modules/legacy/packages/legacy_shared/pubspec.yaml new file mode 100644 index 00000000..d41caa9e --- /dev/null +++ b/modules/legacy/packages/legacy_shared/pubspec.yaml @@ -0,0 +1,69 @@ +name: legacy_shared +description: "A new Flutter project." +version: 0.0.1 +homepage: + +environment: + sdk: ^3.9.2 + flutter: ">=1.17.0" + +dependencies: + flutter: + sdk: flutter + #modules dependencies go here + auth: + path: ../../../../modules/auth + #packages dependencies go here + design_system: + path: ../../../../packages/design_system + utils: + path: ../../../../packages/utils + #dependencies go here + get_it: ^9.0.5 + flutter_riverpod: ^3.0.3 + freezed_annotation: ^3.1.0 + freezed: ^3.2.3 + json_annotation: ^4.9.0 + json_serializable: ^6.11.2 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^5.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # To add assets to your package, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + # + # For details regarding assets in packages, see + # https://flutter.dev/to/asset-from-package + # + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/to/resolution-aware-images + + # To add custom fonts to your package, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts in packages, see + # https://flutter.dev/to/font-from-package From 46b7ba4a1d532a148c6aac5c5dd58f01f6c88c7d Mon Sep 17 00:00:00 2001 From: aitorarana Date: Tue, 10 Feb 2026 17:33:18 +0100 Subject: [PATCH 14/25] added remote_connection screens and state --- .../mobile_app/lib/navigation/app_router.dart | 5 + .../functions_remote_datasource.dart | 9 +- .../functions_remote_datasource_impl.dart | 88 ++++-- .../functions_repository_impl.dart | 17 +- .../repositories/functions_repository.dart | 9 +- .../domain/get_contacts_use_case.dart | 4 +- .../domain/get_contacts_use_case_impl.dart | 6 +- ...rt => get_contacts_use_case_provider.dart} | 0 .../features/functions/functions_screen.dart | 2 +- .../domain/entities/picture_entity.dart | 12 + .../entities/picture_entity.freezed.dart | 277 +++++++++++++++++ .../domain/get_pictures_use_case.dart | 5 + .../domain/get_pictures_use_case_impl.dart | 14 + .../domain/take_picture_use_case.dart | 5 + .../domain/take_picture_use_case_impl.dart | 14 + .../get_pictures_use_case_provider.dart | 9 + .../take_picture_use_case_provider.dart | 9 + .../presentation/remote_camera_screen.dart | 76 +++++ .../remote_connection_screen.dart | 104 +++++++ .../state/remote_connection_view_model.dart | 84 +++++ .../state/remote_connection_view_state.dart | 16 + .../remote_connection_view_state.freezed.dart | 292 ++++++++++++++++++ .../remote_connection_builder.dart | 18 ++ packages/design_system/fonts/SFIcons.ttf | Bin 27592 -> 27984 bytes packages/design_system/lib/fonts/config.json | 14 + .../design_system/lib/src/icons/sf_icons.dart | 1 + packages/navigation/lib/app_routes.dart | 1 + 27 files changed, 1058 insertions(+), 33 deletions(-) rename modules/legacy/modules/functions/lib/src/features/contacts/presentation/providers/{get_contacts_provider.dart => get_contacts_use_case_provider.dart} (100%) create mode 100644 modules/legacy/modules/functions/lib/src/features/remote_connection/domain/entities/picture_entity.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/remote_connection/domain/entities/picture_entity.freezed.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/remote_connection/domain/get_pictures_use_case.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/remote_connection/domain/get_pictures_use_case_impl.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/remote_connection/domain/take_picture_use_case.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/remote_connection/domain/take_picture_use_case_impl.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/providers/get_pictures_use_case_provider.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/providers/take_picture_use_case_provider.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_camera_screen.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_connection_screen.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_model.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_state.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_state.freezed.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/remote_connection/remote_connection_builder.dart diff --git a/apps/mobile_app/lib/navigation/app_router.dart b/apps/mobile_app/lib/navigation/app_router.dart index e28987b5..36c3baee 100644 --- a/apps/mobile_app/lib/navigation/app_router.dart +++ b/apps/mobile_app/lib/navigation/app_router.dart @@ -57,6 +57,11 @@ void configureAppRouter() { name: 'contacts', pageBuilder: ContactsBuilder().buildPage, ), + GoRoute( + path: AppRoutes.remoteConnection, + name: 'remote_connection', + pageBuilder: RemoteConnectionBuilder().buildPage, + ), GoRoute( path: AppRoutes.login, diff --git a/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource.dart b/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource.dart index bae23bbc..dffa0475 100644 --- a/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource.dart +++ b/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource.dart @@ -1,5 +1,10 @@ -import 'package:functions/src/features/contacts/domain/entities/contact_list_entity.dart'; +import 'package:functions/src/features/contacts/domain/entities/contact_entity.dart'; +import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart'; abstract class FunctionsRemoteDatasource { - Future getContacts({required String deviceId}); + Future> getContacts({required String userId}); + + Future> getPictures({required String userId}); + + Future takePicture({required String userId}); } diff --git a/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource_impl.dart b/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource_impl.dart index ffef59af..37a434ca 100644 --- a/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource_impl.dart +++ b/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource_impl.dart @@ -3,8 +3,8 @@ import 'dart:convert'; import 'package:dio/dio.dart'; // import 'package:flutter/material.dart'; import 'package:functions/src/core/data/datasources/functions_remote_datasource.dart'; -import 'package:functions/src/features/contacts/domain/entities/contact_list_entity.dart'; -import 'package:functions/src/features/contacts/domain/entities/list_contact_entity.dart'; +import 'package:functions/src/features/contacts/domain/entities/contact_entity.dart'; +import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart'; import 'package:sf_infrastructure/sf_infrastructure.dart'; class FunctionsRemoteDatasourceImpl implements FunctionsRemoteDatasource { @@ -13,15 +13,15 @@ class FunctionsRemoteDatasourceImpl implements FunctionsRemoteDatasource { final QuestiaRepository _repository; @override - Future getContacts({required String deviceId}) async { + Future> getContacts({required String userId}) async { /*try { - final response = await _repository.post>( - '/devices/$deviceId/contact-lists', + final response = await _repository.get>( + '/users/$userId/contacts', ); final data = response.data; if (data == null || data.isEmpty) { - throw Exception('Empty response from /devices/:deviceId/contact-lists'); + throw Exception('Empty response from /users/:userId/contacts'); } final model = GetContactsResponseModel.fromJson(data); @@ -29,20 +29,68 @@ class FunctionsRemoteDatasourceImpl implements FunctionsRemoteDatasource { } on DioException catch (error) { throw _mapDioError(error, defaultMessage: 'Error to get contacts'); }*/ - return ContactListEntity( - id: 'id', - delegationId: 'delegationId', - userId: 'userId', - groupId: 'groupId', - deviceId: 'deviceId', - type: 'type', - contacts: [ - ListContactEntity(name: 'Ana', phone: '111111111'), - ListContactEntity(name: 'Carlos', phone: '222222222'), - ], - createdAt: 'createdAt', - updatedAt: 'updatedAt' - ); + return [ + ContactEntity( + id: '1111', + name: 'Ana', + phone: '111111111', + createdAt: 1, + delegationId: null, + groupId: null, + userId: null, + updatedAt: null, + ), + ContactEntity( + id: '1112', + name: 'Carlos', + phone: '222222222', + createdAt: 2, + delegationId: null, + groupId: null, + userId: null, + updatedAt: null, + ), + ]; + } + + @override + Future> getPictures({required String userId}) async { + /*try { + final response = await _repository.get>( + '', + ); + + final data = response.data; + if (data == null || data.isEmpty) { + throw Exception('Empty response from /users/:userId/contacts'); + } + + final model = GetContactsResponseModel.fromJson(data); + return model.toEntity(); + } on DioException catch (error) { + throw _mapDioError(error, defaultMessage: 'Error to get contacts'); + }*/ + return []; + } + + @override + Future takePicture({required String userId}) async { + /*try { + final response = await _repository.get>( + '', + ); + + final data = response.data; + if (data == null || data.isEmpty) { + throw Exception('Empty response from /users/:userId/contacts'); + } + + final model = GetContactsResponseModel.fromJson(data); + return model.toEntity(); + } on DioException catch (error) { + throw _mapDioError(error, defaultMessage: 'Error to get contacts'); + }*/ + return PictureEntity(id: '1', userId: '1111', createdAt: 1111); } } diff --git a/modules/legacy/modules/functions/lib/src/core/data/repositories/functions_repository_impl.dart b/modules/legacy/modules/functions/lib/src/core/data/repositories/functions_repository_impl.dart index 4ee55fae..05b906cb 100644 --- a/modules/legacy/modules/functions/lib/src/core/data/repositories/functions_repository_impl.dart +++ b/modules/legacy/modules/functions/lib/src/core/data/repositories/functions_repository_impl.dart @@ -1,6 +1,7 @@ import 'package:functions/src/core/data/datasources/functions_remote_datasource.dart'; import 'package:functions/src/core/domain/repositories/functions_repository.dart'; -import 'package:functions/src/features/contacts/domain/entities/contact_list_entity.dart'; +import 'package:functions/src/features/contacts/domain/entities/contact_entity.dart'; +import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart'; class FunctionsRepositoryImpl implements FunctionsRepository { const FunctionsRepositoryImpl(this._remote); @@ -8,7 +9,17 @@ class FunctionsRepositoryImpl implements FunctionsRepository { final FunctionsRemoteDatasource _remote; @override - Future getContacts({required String deviceId}) { - return _remote.getContacts(deviceId: deviceId); + Future> getContacts({required String userId}) { + return _remote.getContacts(userId: userId); + } + + @override + Future> getPictures({required String userId}) { + return _remote.getPictures(userId: userId); + } + + @override + Future takePicture({required String userId}) { + return _remote.takePicture(userId: userId); } } diff --git a/modules/legacy/modules/functions/lib/src/core/domain/repositories/functions_repository.dart b/modules/legacy/modules/functions/lib/src/core/domain/repositories/functions_repository.dart index 3df7fc4e..567342ca 100644 --- a/modules/legacy/modules/functions/lib/src/core/domain/repositories/functions_repository.dart +++ b/modules/legacy/modules/functions/lib/src/core/domain/repositories/functions_repository.dart @@ -1,5 +1,10 @@ -import 'package:functions/src/features/contacts/domain/entities/contact_list_entity.dart'; +import 'package:functions/src/features/contacts/domain/entities/contact_entity.dart'; +import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart'; abstract class FunctionsRepository { - Future getContacts({required String deviceId}); + Future> getContacts({required String userId}); + + Future> getPictures({required String userId}); + + Future takePicture({required String userId}); } diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/domain/get_contacts_use_case.dart b/modules/legacy/modules/functions/lib/src/features/contacts/domain/get_contacts_use_case.dart index bf0dde3f..122ed392 100644 --- a/modules/legacy/modules/functions/lib/src/features/contacts/domain/get_contacts_use_case.dart +++ b/modules/legacy/modules/functions/lib/src/features/contacts/domain/get_contacts_use_case.dart @@ -1,5 +1,5 @@ -import 'package:functions/src/features/contacts/domain/entities/contact_list_entity.dart'; +import 'package:functions/src/features/contacts/domain/entities/contact_entity.dart'; abstract class GetContactsUseCase { - Future getContacts({required String deviceId}); + Future> getContacts({required String userId}); } diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/domain/get_contacts_use_case_impl.dart b/modules/legacy/modules/functions/lib/src/features/contacts/domain/get_contacts_use_case_impl.dart index 250f0cfb..b94fb73c 100644 --- a/modules/legacy/modules/functions/lib/src/features/contacts/domain/get_contacts_use_case_impl.dart +++ b/modules/legacy/modules/functions/lib/src/features/contacts/domain/get_contacts_use_case_impl.dart @@ -1,5 +1,5 @@ import 'package:functions/src/core/domain/repositories/functions_repository.dart'; -import 'package:functions/src/features/contacts/domain/entities/contact_list_entity.dart'; +import 'package:functions/src/features/contacts/domain/entities/contact_entity.dart'; import 'package:functions/src/features/contacts/domain/get_contacts_use_case.dart'; class GetContactsUseCaseImpl implements GetContactsUseCase { @@ -8,7 +8,7 @@ class GetContactsUseCaseImpl implements GetContactsUseCase { final FunctionsRepository _repository; @override - Future getContacts({required String deviceId}) { - return _repository.getContacts(deviceId: deviceId); + Future> getContacts({required String userId}) { + return _repository.getContacts(userId: userId); } } diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/providers/get_contacts_provider.dart b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/providers/get_contacts_use_case_provider.dart similarity index 100% rename from modules/legacy/modules/functions/lib/src/features/contacts/presentation/providers/get_contacts_provider.dart rename to modules/legacy/modules/functions/lib/src/features/contacts/presentation/providers/get_contacts_use_case_provider.dart diff --git a/modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart b/modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart index e51d970d..d2a65176 100644 --- a/modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart +++ b/modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart @@ -47,7 +47,7 @@ class FunctionsScreen extends ConsumerWidget { child: Column( children: [ AppSectionButton( - onPressed: (){}, + onPressed: (){navigationContract.pushTo(AppRoutes.remoteConnection);}, icon: SFIcons.connection, text: 'Remote connection' ), diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/entities/picture_entity.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/entities/picture_entity.dart new file mode 100644 index 00000000..22df5bc6 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/entities/picture_entity.dart @@ -0,0 +1,12 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'picture_entity.freezed.dart'; + +@freezed +abstract class PictureEntity with _$PictureEntity { + const factory PictureEntity({ + required String id, + required String? userId, + required int createdAt, + }) = _PictureEntity; +} diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/entities/picture_entity.freezed.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/entities/picture_entity.freezed.dart new file mode 100644 index 00000000..f08a6dcc --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/entities/picture_entity.freezed.dart @@ -0,0 +1,277 @@ +// 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 'picture_entity.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$PictureEntity { + + String get id; String? get userId; int get createdAt; +/// Create a copy of PictureEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$PictureEntityCopyWith get copyWith => _$PictureEntityCopyWithImpl(this as PictureEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is PictureEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)); +} + + +@override +int get hashCode => Object.hash(runtimeType,id,userId,createdAt); + +@override +String toString() { + return 'PictureEntity(id: $id, userId: $userId, createdAt: $createdAt)'; +} + + +} + +/// @nodoc +abstract mixin class $PictureEntityCopyWith<$Res> { + factory $PictureEntityCopyWith(PictureEntity value, $Res Function(PictureEntity) _then) = _$PictureEntityCopyWithImpl; +@useResult +$Res call({ + String id, String? userId, int createdAt +}); + + + + +} +/// @nodoc +class _$PictureEntityCopyWithImpl<$Res> + implements $PictureEntityCopyWith<$Res> { + _$PictureEntityCopyWithImpl(this._self, this._then); + + final PictureEntity _self; + final $Res Function(PictureEntity) _then; + +/// Create a copy of PictureEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? userId = freezed,Object? createdAt = null,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,userId: freezed == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable +as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as int, + )); +} + +} + + +/// Adds pattern-matching-related methods to [PictureEntity]. +extension PictureEntityPatterns on PictureEntity { +/// 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( _PictureEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _PictureEntity() 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( _PictureEntity value) $default,){ +final _that = this; +switch (_that) { +case _PictureEntity(): +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( _PictureEntity value)? $default,){ +final _that = this; +switch (_that) { +case _PictureEntity() 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? userId, int createdAt)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _PictureEntity() when $default != null: +return $default(_that.id,_that.userId,_that.createdAt);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? userId, int createdAt) $default,) {final _that = this; +switch (_that) { +case _PictureEntity(): +return $default(_that.id,_that.userId,_that.createdAt);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? userId, int createdAt)? $default,) {final _that = this; +switch (_that) { +case _PictureEntity() when $default != null: +return $default(_that.id,_that.userId,_that.createdAt);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _PictureEntity implements PictureEntity { + const _PictureEntity({required this.id, required this.userId, required this.createdAt}); + + +@override final String id; +@override final String? userId; +@override final int createdAt; + +/// Create a copy of PictureEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$PictureEntityCopyWith<_PictureEntity> get copyWith => __$PictureEntityCopyWithImpl<_PictureEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _PictureEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)); +} + + +@override +int get hashCode => Object.hash(runtimeType,id,userId,createdAt); + +@override +String toString() { + return 'PictureEntity(id: $id, userId: $userId, createdAt: $createdAt)'; +} + + +} + +/// @nodoc +abstract mixin class _$PictureEntityCopyWith<$Res> implements $PictureEntityCopyWith<$Res> { + factory _$PictureEntityCopyWith(_PictureEntity value, $Res Function(_PictureEntity) _then) = __$PictureEntityCopyWithImpl; +@override @useResult +$Res call({ + String id, String? userId, int createdAt +}); + + + + +} +/// @nodoc +class __$PictureEntityCopyWithImpl<$Res> + implements _$PictureEntityCopyWith<$Res> { + __$PictureEntityCopyWithImpl(this._self, this._then); + + final _PictureEntity _self; + final $Res Function(_PictureEntity) _then; + +/// Create a copy of PictureEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? userId = freezed,Object? createdAt = null,}) { + return _then(_PictureEntity( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,userId: freezed == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable +as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as int, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/get_pictures_use_case.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/get_pictures_use_case.dart new file mode 100644 index 00000000..225c09cf --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/get_pictures_use_case.dart @@ -0,0 +1,5 @@ +import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart'; + +abstract class GetPicturesUseCase { + Future> getPictures({required String userId}); +} diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/get_pictures_use_case_impl.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/get_pictures_use_case_impl.dart new file mode 100644 index 00000000..b38a448a --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/get_pictures_use_case_impl.dart @@ -0,0 +1,14 @@ +import 'package:functions/src/core/domain/repositories/functions_repository.dart'; +import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart'; +import 'package:functions/src/features/remote_connection/domain/get_pictures_use_case.dart'; + +class GetPicturesUseCaseImpl implements GetPicturesUseCase { + GetPicturesUseCaseImpl(this._repository); + + final FunctionsRepository _repository; + + @override + Future> getPictures({required String userId}) { + return _repository.getPictures(userId: userId); + } +} \ No newline at end of file diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/take_picture_use_case.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/take_picture_use_case.dart new file mode 100644 index 00000000..f994cd62 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/take_picture_use_case.dart @@ -0,0 +1,5 @@ +import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart'; + +abstract class TakePictureUseCase { + Future takePicture({required String userId}); +} diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/take_picture_use_case_impl.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/take_picture_use_case_impl.dart new file mode 100644 index 00000000..3ab8c59c --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/take_picture_use_case_impl.dart @@ -0,0 +1,14 @@ +import 'package:functions/src/core/domain/repositories/functions_repository.dart'; +import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart'; +import 'package:functions/src/features/remote_connection/domain/take_picture_use_case.dart'; + +class TakePictureUseCaseImpl implements TakePictureUseCase { + TakePictureUseCaseImpl(this._repository); + + final FunctionsRepository _repository; + + @override + Future takePicture({required String userId}) { + return _repository.takePicture(userId: userId); + } +} \ No newline at end of file diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/providers/get_pictures_use_case_provider.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/providers/get_pictures_use_case_provider.dart new file mode 100644 index 00000000..47bcc413 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/providers/get_pictures_use_case_provider.dart @@ -0,0 +1,9 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:functions/src/core/providers/functions_repository_provider.dart'; +import 'package:functions/src/features/remote_connection/domain/get_pictures_use_case.dart'; +import 'package:functions/src/features/remote_connection/domain/get_pictures_use_case_impl.dart'; + +final getPicturesUseCaseProvider = Provider.autoDispose((ref) { + final functionsRepository = ref.read(functionsRepositoryProvider); + return GetPicturesUseCaseImpl(functionsRepository); +}); diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/providers/take_picture_use_case_provider.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/providers/take_picture_use_case_provider.dart new file mode 100644 index 00000000..9c46b688 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/providers/take_picture_use_case_provider.dart @@ -0,0 +1,9 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:functions/src/core/providers/functions_repository_provider.dart'; +import 'package:functions/src/features/remote_connection/domain/take_picture_use_case.dart'; +import 'package:functions/src/features/remote_connection/domain/take_picture_use_case_impl.dart'; + +final takePictureUseCaseProvider = Provider.autoDispose((ref) { + final functionsRepository = ref.read(functionsRepositoryProvider); + return TakePictureUseCaseImpl(functionsRepository); +}); diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_camera_screen.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_camera_screen.dart new file mode 100644 index 00000000..9d4fc72f --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_camera_screen.dart @@ -0,0 +1,76 @@ +// import 'package:account/src/features/linked_devices/presentation/app_users_screen.dart'; +import 'package:design_system/design_system.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:functions/src/features/remote_connection/presentation/state/remote_connection_view_model.dart'; +import 'package:navigation/navigation.dart'; +import 'package:sf_localizations/sf_localizations.dart'; +import 'package:utils/utils.dart'; +import 'package:legacy_shared/legacy_shared.dart'; + +class RemoteCameraScreen extends ConsumerWidget { + final NavigationContract navigationContract; + + const RemoteCameraScreen({super.key, required this.navigationContract}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.watch(themePortProvider); + + final viewModel = ref.read(remoteConnectionViewModelProvider.notifier); + final viewState = ref.watch(remoteConnectionViewModelProvider); + + return PageLayout( + title: context.translate('Remote camera'), + body: Expanded(child: GridView.count( + primary: false, + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 24, vertical: 12), + big: EdgeInsets.symmetric(horizontal: 23, vertical: 11) + ), + crossAxisSpacing: 11, + mainAxisSpacing: 11, + crossAxisCount: 3, + childAspectRatio: 0.8, + children: List.generate(12, (int index)=> + Container( + height: SizeUtils.getByScreen(small: 110, big: 105), + width: SizeUtils.getByScreen(small: 60, big: 58), + color: Colors.grey[200], + child: SvgPicture.asset('assets/images/ui/face.svg'), + ) + ), + )), + footer: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(vertical: 12, horizontal: 26), + big: EdgeInsets.symmetric(vertical: 10, horizontal: 25) + ), + child: PrimaryButton( + onPressed: () { + showDialog(context: context, builder: (context)=>Dialog( + child: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 32, vertical: 30), + big: EdgeInsets.symmetric(horizontal: 30, vertical: 28) + ), + width: SizeUtils.getByScreen(small: 360, big: 350), + height: SizeUtils.getByScreen(small: 195, big: 185), + child: Text(context.translate('Loading photo...'), + textAlign: TextAlign.center, + style: TextStyle(fontSize: SizeUtils.getByScreen(small: 19, big: 18)), + ), + ), + )); + viewModel.takePicture(); + Navigator.pop(context); + }, + text: context.translate('Take a picture'), + color: Color(0xFF588EA5), + height: SizeUtils.getByScreen(small: 36, big: 35), + ), + ) + ); + } +} \ No newline at end of file diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_connection_screen.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_connection_screen.dart new file mode 100644 index 00000000..17e0d416 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_connection_screen.dart @@ -0,0 +1,104 @@ +// import 'package:account/src/features/linked_devices/presentation/app_users_screen.dart'; +import 'package:design_system/design_system.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:functions/src/features/remote_connection/presentation/remote_camera_screen.dart'; +import 'package:legacy_shared/legacy_shared.dart'; +import 'package:navigation/navigation.dart'; +import 'package:sf_localizations/sf_localizations.dart'; +import 'package:utils/utils.dart'; + +class RemoteConnectionScreen extends ConsumerWidget { + final NavigationContract navigationContract; + + const RemoteConnectionScreen({super.key, required this.navigationContract}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + // final theme = ref.watch(themePortProvider); + + return PageLayout( + title: 'Remote Connection', + body: SingleChildScrollView(child: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) + ), + child: Column( + children: [ + AppSectionButton( + onPressed: (){Navigator.push(context, MaterialPageRoute( + builder: (_)=>RemoteCameraScreen(navigationContract: navigationContract) + ));}, + icon: Icons.photo_camera_outlined, + text: 'Remote camera' + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){}, + icon: SFIcons.listen, + text: 'Remote listening' + ), + ], + ), + )), + ); + } +} + +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: 20), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 18) + ), + 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/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_model.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_model.dart new file mode 100644 index 00000000..b7b8f03a --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_model.dart @@ -0,0 +1,84 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart'; +import 'package:functions/src/features/remote_connection/domain/get_pictures_use_case.dart'; +import 'package:functions/src/features/remote_connection/domain/take_picture_use_case.dart'; +import 'package:functions/src/features/remote_connection/presentation/providers/get_pictures_use_case_provider.dart'; +import 'package:functions/src/features/remote_connection/presentation/providers/take_picture_use_case_provider.dart'; +import 'package:functions/src/features/remote_connection/presentation/state/remote_connection_view_state.dart'; +// import 'package:legacy_shared/src/providers/logged_user_provider.dart'; +// import 'package:legacy_shared/src/data/models/entities/user_entity.dart'; +// import 'package:sf_localizations/sf_localizations.dart'; + +final remoteConnectionViewModelProvider = +NotifierProvider.autoDispose( + RemoteConnectionViewModel.new, +); + +class RemoteConnectionViewModel extends Notifier { + late final GetPicturesUseCase _getPicturesUseCase; + late final TakePictureUseCase _takePictureUseCase; + + late final TextEditingController nameController; + late final TextEditingController phoneController; + + // late final UserEntity loggedUser; + + @override + RemoteConnectionViewState build() { + _getPicturesUseCase = ref.read(getPicturesUseCaseProvider); + _takePictureUseCase = ref.read(takePictureUseCaseProvider); + + // loggedUser = ref.read(loggedUserProvider); + + phoneController = TextEditingController(); + + phoneController.addListener(_onPhoneChanged); + + // _getPicturesUseCase.getImages(userId: '').then(setImages); + + ref.onDispose(disposeControllers); + + return const RemoteConnectionViewState(); + } + + void setImages(List pictures) { + state = state.copyWith( + pictures: pictures + ); + } + + void _onPhoneChanged() { + final text = phoneController.text; + if (text == state.phone) return; + + state = state.copyWith(phone: text, errorMessage: ''); + } + + void takePicture() { + try { + state = state.copyWith(isTakingPicture: true); + + _takePictureUseCase.takePicture(userId: '') + .then((picture) { + List pictures = state.pictures; + pictures.add(picture); + state = state.copyWith( + isTakingPicture: true, + + ); + }); + } catch (e){ + state = state.copyWith( + isTakingPicture: false, + errorMessage: e.toString(), + ); + } + } + + void disposeControllers() { + phoneController.removeListener(_onPhoneChanged); + + phoneController.dispose(); + } +} diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_state.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_state.dart new file mode 100644 index 00000000..f0475062 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_state.dart @@ -0,0 +1,16 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart'; + +part 'remote_connection_view_state.freezed.dart'; + +@freezed +abstract class RemoteConnectionViewState with _$RemoteConnectionViewState { + const factory RemoteConnectionViewState({ + @Default('') String phone, + @Default([]) List pictures, + @Default(true) bool isLoadingImages, + @Default(false) bool isTakingPicture, + @Default(false) bool isCalling, + @Default('') String errorMessage + }) = _RemoteConnectionViewState; +} diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_state.freezed.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_state.freezed.dart new file mode 100644 index 00000000..a7111a7f --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_state.freezed.dart @@ -0,0 +1,292 @@ +// 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 'remote_connection_view_state.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$RemoteConnectionViewState { + + String get phone; List get pictures; bool get isLoadingImages; bool get isTakingPicture; bool get isCalling; String get errorMessage; +/// Create a copy of RemoteConnectionViewState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$RemoteConnectionViewStateCopyWith get copyWith => _$RemoteConnectionViewStateCopyWithImpl(this as RemoteConnectionViewState, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is RemoteConnectionViewState&&(identical(other.phone, phone) || other.phone == phone)&&const DeepCollectionEquality().equals(other.pictures, pictures)&&(identical(other.isLoadingImages, isLoadingImages) || other.isLoadingImages == isLoadingImages)&&(identical(other.isTakingPicture, isTakingPicture) || other.isTakingPicture == isTakingPicture)&&(identical(other.isCalling, isCalling) || other.isCalling == isCalling)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); +} + + +@override +int get hashCode => Object.hash(runtimeType,phone,const DeepCollectionEquality().hash(pictures),isLoadingImages,isTakingPicture,isCalling,errorMessage); + +@override +String toString() { + return 'RemoteConnectionViewState(phone: $phone, pictures: $pictures, isLoadingImages: $isLoadingImages, isTakingPicture: $isTakingPicture, isCalling: $isCalling, errorMessage: $errorMessage)'; +} + + +} + +/// @nodoc +abstract mixin class $RemoteConnectionViewStateCopyWith<$Res> { + factory $RemoteConnectionViewStateCopyWith(RemoteConnectionViewState value, $Res Function(RemoteConnectionViewState) _then) = _$RemoteConnectionViewStateCopyWithImpl; +@useResult +$Res call({ + String phone, List pictures, bool isLoadingImages, bool isTakingPicture, bool isCalling, String errorMessage +}); + + + + +} +/// @nodoc +class _$RemoteConnectionViewStateCopyWithImpl<$Res> + implements $RemoteConnectionViewStateCopyWith<$Res> { + _$RemoteConnectionViewStateCopyWithImpl(this._self, this._then); + + final RemoteConnectionViewState _self; + final $Res Function(RemoteConnectionViewState) _then; + +/// Create a copy of RemoteConnectionViewState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? phone = null,Object? pictures = null,Object? isLoadingImages = null,Object? isTakingPicture = null,Object? isCalling = null,Object? errorMessage = null,}) { + return _then(_self.copyWith( +phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String,pictures: null == pictures ? _self.pictures : pictures // ignore: cast_nullable_to_non_nullable +as List,isLoadingImages: null == isLoadingImages ? _self.isLoadingImages : isLoadingImages // ignore: cast_nullable_to_non_nullable +as bool,isTakingPicture: null == isTakingPicture ? _self.isTakingPicture : isTakingPicture // ignore: cast_nullable_to_non_nullable +as bool,isCalling: null == isCalling ? _self.isCalling : isCalling // ignore: cast_nullable_to_non_nullable +as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [RemoteConnectionViewState]. +extension RemoteConnectionViewStatePatterns on RemoteConnectionViewState { +/// 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( _RemoteConnectionViewState value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _RemoteConnectionViewState() 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( _RemoteConnectionViewState value) $default,){ +final _that = this; +switch (_that) { +case _RemoteConnectionViewState(): +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( _RemoteConnectionViewState value)? $default,){ +final _that = this; +switch (_that) { +case _RemoteConnectionViewState() 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 phone, List pictures, bool isLoadingImages, bool isTakingPicture, bool isCalling, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _RemoteConnectionViewState() when $default != null: +return $default(_that.phone,_that.pictures,_that.isLoadingImages,_that.isTakingPicture,_that.isCalling,_that.errorMessage);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 phone, List pictures, bool isLoadingImages, bool isTakingPicture, bool isCalling, String errorMessage) $default,) {final _that = this; +switch (_that) { +case _RemoteConnectionViewState(): +return $default(_that.phone,_that.pictures,_that.isLoadingImages,_that.isTakingPicture,_that.isCalling,_that.errorMessage);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 phone, List pictures, bool isLoadingImages, bool isTakingPicture, bool isCalling, String errorMessage)? $default,) {final _that = this; +switch (_that) { +case _RemoteConnectionViewState() when $default != null: +return $default(_that.phone,_that.pictures,_that.isLoadingImages,_that.isTakingPicture,_that.isCalling,_that.errorMessage);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _RemoteConnectionViewState implements RemoteConnectionViewState { + const _RemoteConnectionViewState({this.phone = '', final List pictures = const [], this.isLoadingImages = true, this.isTakingPicture = false, this.isCalling = false, this.errorMessage = ''}): _pictures = pictures; + + +@override@JsonKey() final String phone; + final List _pictures; +@override@JsonKey() List get pictures { + if (_pictures is EqualUnmodifiableListView) return _pictures; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_pictures); +} + +@override@JsonKey() final bool isLoadingImages; +@override@JsonKey() final bool isTakingPicture; +@override@JsonKey() final bool isCalling; +@override@JsonKey() final String errorMessage; + +/// Create a copy of RemoteConnectionViewState +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$RemoteConnectionViewStateCopyWith<_RemoteConnectionViewState> get copyWith => __$RemoteConnectionViewStateCopyWithImpl<_RemoteConnectionViewState>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _RemoteConnectionViewState&&(identical(other.phone, phone) || other.phone == phone)&&const DeepCollectionEquality().equals(other._pictures, _pictures)&&(identical(other.isLoadingImages, isLoadingImages) || other.isLoadingImages == isLoadingImages)&&(identical(other.isTakingPicture, isTakingPicture) || other.isTakingPicture == isTakingPicture)&&(identical(other.isCalling, isCalling) || other.isCalling == isCalling)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); +} + + +@override +int get hashCode => Object.hash(runtimeType,phone,const DeepCollectionEquality().hash(_pictures),isLoadingImages,isTakingPicture,isCalling,errorMessage); + +@override +String toString() { + return 'RemoteConnectionViewState(phone: $phone, pictures: $pictures, isLoadingImages: $isLoadingImages, isTakingPicture: $isTakingPicture, isCalling: $isCalling, errorMessage: $errorMessage)'; +} + + +} + +/// @nodoc +abstract mixin class _$RemoteConnectionViewStateCopyWith<$Res> implements $RemoteConnectionViewStateCopyWith<$Res> { + factory _$RemoteConnectionViewStateCopyWith(_RemoteConnectionViewState value, $Res Function(_RemoteConnectionViewState) _then) = __$RemoteConnectionViewStateCopyWithImpl; +@override @useResult +$Res call({ + String phone, List pictures, bool isLoadingImages, bool isTakingPicture, bool isCalling, String errorMessage +}); + + + + +} +/// @nodoc +class __$RemoteConnectionViewStateCopyWithImpl<$Res> + implements _$RemoteConnectionViewStateCopyWith<$Res> { + __$RemoteConnectionViewStateCopyWithImpl(this._self, this._then); + + final _RemoteConnectionViewState _self; + final $Res Function(_RemoteConnectionViewState) _then; + +/// Create a copy of RemoteConnectionViewState +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? phone = null,Object? pictures = null,Object? isLoadingImages = null,Object? isTakingPicture = null,Object? isCalling = null,Object? errorMessage = null,}) { + return _then(_RemoteConnectionViewState( +phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String,pictures: null == pictures ? _self._pictures : pictures // ignore: cast_nullable_to_non_nullable +as List,isLoadingImages: null == isLoadingImages ? _self.isLoadingImages : isLoadingImages // ignore: cast_nullable_to_non_nullable +as bool,isTakingPicture: null == isTakingPicture ? _self.isTakingPicture : isTakingPicture // ignore: cast_nullable_to_non_nullable +as bool,isCalling: null == isCalling ? _self.isCalling : isCalling // ignore: cast_nullable_to_non_nullable +as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/remote_connection_builder.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/remote_connection_builder.dart new file mode 100644 index 00000000..db019964 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/remote_connection_builder.dart @@ -0,0 +1,18 @@ +import 'package:flutter/material.dart'; +import 'package:functions/src/features/remote_connection/presentation/remote_connection_screen.dart'; +import 'package:go_router/go_router.dart'; +import 'package:get_it/get_it.dart'; +import 'package:navigation/navigation.dart'; + +class RemoteConnectionBuilder { + const RemoteConnectionBuilder(); + + Page buildPage(BuildContext context, GoRouterState state) { + final NavigationContract navigationContract = GetIt.I(); + + return MaterialPage( + key: state.pageKey, + child: RemoteConnectionScreen(navigationContract: navigationContract), + ); + } +} diff --git a/packages/design_system/fonts/SFIcons.ttf b/packages/design_system/fonts/SFIcons.ttf index 2703601ac085604f116cec273f8ebc018c313ebd..caf8ca272821a0f1e693e7068a3de0d958822c3e 100644 GIT binary patch delta 1072 zcmXw$O>7fK6oB8`-K^KKWgBpu=FbM(ySDRVu(Rv9qKRV%n-EN5aOyUqDs@AMQzgV! zl9r-K4lON^=8(!9dg`GCloLW&;s6{FAcVNU4JjNz2&7fHAT>yBRVjVW&>esK&Aj(! zJUjF7DLz@pRZqDC09ODYH$Iau-hK4$4gkLgK#WXIe|zHoxPJhk-UjfQRG7#g-@S0A zooZhYkpcyzA>kSIZxi0a%>1d;t<8UEy;nqfdUia&uK)QEz*wOC+D!gb5g&60Dfa=5 zcb?48Oq32af8qc*K>==~I6F80)4??=o-zXn@t<#dVp%|{C0=g4xpB<;(K|5lIz{01 zwO{Z3@6CTVr-Z-x9E~O5YEgP>^Rg8umhf$L71PLZ7c1-BMECGk25=DgtzIX&p8kFq z1Z<@_&0woV^e#QDYkFMYr)Mffz6CRtWnONnt=kOqaGKhASf;kJ)mGt3?4;LkR+EGkRmTJU_bc`qYQ)8`Hlex$lo(yhRT3`moIWWXWvIR*@q&of|z ze1QSA4_s!zVe%RS=xFGvj2IUKf3&G>zc}sAtFBhpot^96Mfr1O(bw-!`Tq(mwRg7v z){*HP?z$EfsvE|IXqf}pJk6cu6SNoFEruH%jgAJpK{SX~q?bW#uv^d_#9mZ;LXofw z9c^fLVz>`AwI|XOi6Ol-HHdBt(!7x9_JtIdY79HyhbX`b47G>_JyHA+-AXT()yQ6~ zEfqvh$gRXs>*Fx}@!_olFeLn5|r&yu{&XHCH&!8N}(S Qx%r8c)tg^gkf(e54|bUEX#fBK delta 726 zcmXw$T}YEr7{~wTeYde0~S!OnB zEMAB%DhezXQ8(|c7hXk#ghUWXA6_J!>#&O=T>tIRIsEvY^E~G{=fJbFD&Bn-MR%?X z5O)CtBdKu4wpN=1bT43YjVGtiKfdzt8{pUg&X(e_aJ1_}#}A%eBm3eE*as}DTrZNQ zcxrOW*INF=`*=q9lj%tK>(bk!tRG_jMJha%5g)Wc=IXh3O@vdi?C_2=+kxmKK-MKL6dH7yeIRl^WH(5oviUBkD1u!wCesE3mgyX=&EC%VKs7A zo8wF6j~pXr!TMdxjq+-O9y+8zFFmHfAv&%=ADvd`pA0pAu2c>`iVJ{{VX$&JzFt diff --git a/packages/design_system/lib/fonts/config.json b/packages/design_system/lib/fonts/config.json index c6ebc923..8e472872 100755 --- a/packages/design_system/lib/fonts/config.json +++ b/packages/design_system/lib/fonts/config.json @@ -1131,6 +1131,20 @@ "search": [ "icon" ] + }, + { + "uid": "c2dafca4f49d11a68d647573fb4b3c0c", + "css": "listen", + "code": 59472, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M332.2 16C503.5 15.9 643.6 151.4 643.6 319.4 643.6 454.3 578.7 524 520.1 583.3 461.9 642.2 412.3 689.1 412.3 790.5 412.3 897.9 323 984 214 984 104.9 984 16 897.8 16 790.5V703.7C15.9 696.6 18.8 689.7 23.8 684.7L23.8 684.6C28.9 679.6 35.8 676.7 42.9 676.7 49.2 676.7 55.3 678.9 60.1 682.9L62.1 684.7 63.9 686.7C67.8 691.5 70 697.5 69.9 703.7V790.5C69.9 867.6 133.4 930.3 214 930.3 294.5 930.3 358.3 867.6 358.3 790.5 358.3 667.3 424.3 603.8 481.9 545.6L503.1 523.8C523.7 502.1 542.4 480 557.2 454 576.6 419.6 589.6 377.6 589.6 319.4 589.6 181.8 475 69.7 332.2 69.6 189.4 69.6 74.8 181.8 74.8 319.4 74.8 326.6 72 333.4 66.9 338.4L66.9 338.5C61.8 343.5 54.9 346.4 47.8 346.4 40.6 346.4 33.7 343.5 28.6 338.4L28.6 338.4C23.5 333.3 20.7 326.3 20.8 319.1 20.9 151.2 160.9 16 332.2 16ZM331.5 133C437.6 133 524.6 217.1 524.7 321.5 524.8 328.8 521.9 335.7 516.9 340.8L516.8 340.8C511.7 345.9 504.9 348.7 497.7 348.7 490.6 348.7 483.6 345.9 478.5 340.8 473.5 335.7 470.6 328.8 470.7 321.5 470.6 247.4 409 186.7 331.5 186.7 253.9 186.7 192 247.6 192 321.7V322.5L192 322.9 186.1 435.1C247.9 450.3 290.9 512.6 290.9 583 290.9 663.4 234.7 735.2 158 735.4 157.9 735.4 157.9 735.4 157.9 735.4 157.8 735.4 157.8 735.4 157.8 735.4V735.4C150.7 735.4 143.9 732.7 138.8 727.7 134.2 723.3 131.4 717.5 130.8 711.2L130.6 708.5 130.8 705.8C131.4 699.6 134.2 693.7 138.8 689.3 143.9 684.3 150.7 681.6 157.8 681.7L161.5 681.6C200.3 679.1 237 639.4 237 583 236.9 524.8 198 484.6 157.8 484.6V484.6C150.3 484.6 143.2 481.6 138.1 476.3 133 470.9 130.3 463.6 130.8 456.1L138 321 138.3 311.3C143.9 211.7 229 133 331.5 133Z", + "width": 660 + }, + "search": [ + "icon" + ] } ] } \ No newline at end of file diff --git a/packages/design_system/lib/src/icons/sf_icons.dart b/packages/design_system/lib/src/icons/sf_icons.dart index 3298d941..7447078f 100644 --- a/packages/design_system/lib/src/icons/sf_icons.dart +++ b/packages/design_system/lib/src/icons/sf_icons.dart @@ -86,6 +86,7 @@ class SFIcons { static const IconData privacy = IconData(0xe841, fontFamily: _kFontFam, fontPackage: _kFontPkg); static const IconData watch = IconData(0xe843, fontFamily: _kFontFam, fontPackage: _kFontPkg); static const IconData handshake = IconData(0xe844, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData listen = IconData(0xe850, fontFamily: _kFontFam, fontPackage: _kFontPkg); static const IconData share = IconData(0xe858, fontFamily: _kFontFam, fontPackage: _kFontPkg); static const IconData favoriteOutlined = IconData(0xe859, fontFamily: _kFontFam, fontPackage: _kFontPkg); static const IconData renovationSelected = IconData(0xe862, fontFamily: _kFontFam, fontPackage: _kFontPkg); diff --git a/packages/navigation/lib/app_routes.dart b/packages/navigation/lib/app_routes.dart index 63dd0af8..c5f5de4d 100644 --- a/packages/navigation/lib/app_routes.dart +++ b/packages/navigation/lib/app_routes.dart @@ -23,4 +23,5 @@ class AppRoutes { static const dashboardFunctions = '$legacyDashboard/functions'; static const contacts = '$dashboardFunctions/contacts'; + static const remoteConnection = '$dashboardFunctions/remote_connection'; } From f8ff70c35d87780b3f4818ada5509da2cf702eac Mon Sep 17 00:00:00 2001 From: aitorarana Date: Wed, 11 Feb 2026 11:57:45 +0100 Subject: [PATCH 15/25] fixed remote connection dialogs and edit contact screen --- .../functions_repository_impl.dart | 6 +- .../presentation/edit_contact_screen.dart | 32 ++++---- .../presentation/remote_camera_screen.dart | 14 ++-- .../remote_connection_screen.dart | 78 ++++++++++++++++++- .../state/remote_connection_view_model.dart | 27 +++++-- 5 files changed, 126 insertions(+), 31 deletions(-) diff --git a/modules/legacy/modules/functions/lib/src/core/data/repositories/functions_repository_impl.dart b/modules/legacy/modules/functions/lib/src/core/data/repositories/functions_repository_impl.dart index 05b906cb..bd6969d5 100644 --- a/modules/legacy/modules/functions/lib/src/core/data/repositories/functions_repository_impl.dart +++ b/modules/legacy/modules/functions/lib/src/core/data/repositories/functions_repository_impl.dart @@ -14,12 +14,14 @@ class FunctionsRepositoryImpl implements FunctionsRepository { } @override - Future> getPictures({required String userId}) { + Future> getPictures({required String userId}) async { + await Future.delayed(const Duration(milliseconds: 2000)); return _remote.getPictures(userId: userId); } @override - Future takePicture({required String userId}) { + Future takePicture({required String userId}) async { + await Future.delayed(const Duration(milliseconds: 2000)); return _remote.takePicture(userId: userId); } } diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/edit_contact_screen.dart b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/edit_contact_screen.dart index 519fdf98..eba3b459 100644 --- a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/edit_contact_screen.dart +++ b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/edit_contact_screen.dart @@ -100,22 +100,26 @@ class EditContactScreen extends ConsumerWidget { hint: contact.phone, label: context.translate('Phone number'), ), - Align( - alignment: Alignment.centerRight, - child: IconButton( - onPressed: (){}, - icon: DecoratedBox( - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Color(0xFF588EA5) - ), - child: Icon( - SFIcons.contactsCircle, - color: Colors.white, + SizedBox( + height: SizeUtils.getByScreen(small: 90, big: 85), + child: Align( + alignment: Alignment.bottomRight, + child: IconButton( + onPressed: (){}, + icon: DecoratedBox( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Color(0xFF588EA5) + ), + child: Icon( + SFIcons.contactsCircle, + color: Colors.white, + size: SizeUtils.getByScreen(small: 40, big: 38), + ) ) - ) + ), ), - ) + ), ], ) ], diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_camera_screen.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_camera_screen.dart index 9d4fc72f..12afa923 100644 --- a/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_camera_screen.dart +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_camera_screen.dart @@ -48,22 +48,22 @@ class RemoteCameraScreen extends ConsumerWidget { big: EdgeInsets.symmetric(vertical: 10, horizontal: 25) ), child: PrimaryButton( - onPressed: () { + onPressed: () async { showDialog(context: context, builder: (context)=>Dialog( child: Container( padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 32, vertical: 30), - big: EdgeInsets.symmetric(horizontal: 30, vertical: 28) + small: EdgeInsets.symmetric(horizontal: 32, vertical: 30), + big: EdgeInsets.symmetric(horizontal: 30, vertical: 28) ), width: SizeUtils.getByScreen(small: 360, big: 350), height: SizeUtils.getByScreen(small: 195, big: 185), - child: Text(context.translate('Loading photo...'), + child: Center(child: Text(context.translate('Loading photo...'), textAlign: TextAlign.center, - style: TextStyle(fontSize: SizeUtils.getByScreen(small: 19, big: 18)), - ), + style: TextStyle(fontSize: SizeUtils.getByScreen(small: 26, big: 25)), + )), ), )); - viewModel.takePicture(); + await viewModel.takePicture(); Navigator.pop(context); }, text: context.translate('Take a picture'), diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_connection_screen.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_connection_screen.dart index 17e0d416..06c92051 100644 --- a/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_connection_screen.dart +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_connection_screen.dart @@ -3,6 +3,7 @@ import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:functions/src/features/remote_connection/presentation/remote_camera_screen.dart'; +import 'package:functions/src/features/remote_connection/presentation/state/remote_connection_view_model.dart'; import 'package:legacy_shared/legacy_shared.dart'; import 'package:navigation/navigation.dart'; import 'package:sf_localizations/sf_localizations.dart'; @@ -17,6 +18,9 @@ class RemoteConnectionScreen extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { // final theme = ref.watch(themePortProvider); + final viewModel = ref.read(remoteConnectionViewModelProvider.notifier); + final viewState = ref.watch(remoteConnectionViewModelProvider); + return PageLayout( title: 'Remote Connection', body: SingleChildScrollView(child: Container( @@ -35,7 +39,10 @@ class RemoteConnectionScreen extends ConsumerWidget { ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( - onPressed: (){}, + onPressed: (){showDialog(context: context, builder: (context)=>Dialog( + child: CallDialog( + ) + ));}, icon: SFIcons.listen, text: 'Remote listening' ), @@ -46,6 +53,75 @@ class RemoteConnectionScreen extends ConsumerWidget { } } +class CallDialog extends ConsumerWidget { + + @override + Widget build(BuildContext context, WidgetRef ref) { + + final viewModel = ref.read(remoteConnectionViewModelProvider.notifier); + final viewState = ref.watch(remoteConnectionViewModelProvider); + + return Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 26, vertical: 20), + big: EdgeInsets.symmetric(horizontal: 24, vertical: 18) + ), + width: SizeUtils.getByScreen(small: 390, big: 380), + height: SizeUtils.getByScreen(small: 250, big: 243), + child: Column( + children: [ + Stack( + children: [ + Center(child: Text(context.translate('Remote listening'), + textAlign: TextAlign.center, + style: TextStyle(fontSize: SizeUtils.getByScreen(small: 19, big: 18)), + )), + Align( + alignment: Alignment.centerRight, + child: IconButton( + onPressed: (){Navigator.pop(context);}, + icon: Icon(Icons.close, color: Color(0xFF588EA5)), + ) + ) + ], + ), + SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), + CustomTextField( + controller: viewModel.phoneController, + hint: context.translate('Insert your phone number'), + keyboardType: TextInputType.number, + ), + if (viewState.errorMessage.isNotEmpty) ...[ + const SizedBox(height: 4), + Text( + viewState.errorMessage, + textAlign: TextAlign.center, + style: const TextStyle( + color: Color.fromRGBO(239, 17, 17, 1), + fontSize: 12, + ), + ), + ], + SizedBox(height: SizeUtils.getByScreen(small: 28, big: 27)), + PrimaryButton( + onPressed: () async { + await viewModel.call(); + if (viewState.errorMessage.isEmpty){ + Navigator.pop(context); + } + }, + text: context.translate('Call me'), + color: Color(0xFF588EA5), + height: SizeUtils.getByScreen(small: 38, big: 36), + radius: SizeUtils.getByScreen(small: 32, big: 34), + ), + ], + ), + ); + } + +} + class AppSectionButton extends ConsumerWidget { final GestureTapCallback onPressed; diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_model.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_model.dart index b7b8f03a..5f56e935 100644 --- a/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_model.dart +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_model.dart @@ -19,11 +19,12 @@ class RemoteConnectionViewModel extends Notifier { late final GetPicturesUseCase _getPicturesUseCase; late final TakePictureUseCase _takePictureUseCase; - late final TextEditingController nameController; late final TextEditingController phoneController; // late final UserEntity loggedUser; + static final RegExp _phoneRegex = RegExp(r'^\+?\d{6,15}$'); + @override RemoteConnectionViewState build() { _getPicturesUseCase = ref.read(getPicturesUseCaseProvider); @@ -35,7 +36,7 @@ class RemoteConnectionViewModel extends Notifier { phoneController.addListener(_onPhoneChanged); - // _getPicturesUseCase.getImages(userId: '').then(setImages); + _getPicturesUseCase.getPictures(userId: '').then(setImages); ref.onDispose(disposeControllers); @@ -44,7 +45,7 @@ class RemoteConnectionViewModel extends Notifier { void setImages(List pictures) { state = state.copyWith( - pictures: pictures + pictures: pictures ); } @@ -55,17 +56,16 @@ class RemoteConnectionViewModel extends Notifier { state = state.copyWith(phone: text, errorMessage: ''); } - void takePicture() { + Future takePicture() async { try { state = state.copyWith(isTakingPicture: true); - _takePictureUseCase.takePicture(userId: '') + await _takePictureUseCase.takePicture(userId: '') .then((picture) { List pictures = state.pictures; - pictures.add(picture); + //pictures.add(picture); state = state.copyWith( isTakingPicture: true, - ); }); } catch (e){ @@ -76,6 +76,19 @@ class RemoteConnectionViewModel extends Notifier { } } + Future call() async { + final phone = phoneController.text; + if (phone.isEmpty){ + state = state.copyWith(errorMessage: 'errorMessagePhoneIsEmpty'); + return; + } + if (!_phoneRegex.hasMatch(phone)) { + state = state.copyWith(errorMessage: 'errorMessagePhoneIsInvalid'); + return; + } + + } + void disposeControllers() { phoneController.removeListener(_onPhoneChanged); From a53cfb24eaf7c570fa1a57ef47a3bdd748e5b346 Mon Sep 17 00:00:00 2001 From: aitorarana Date: Thu, 12 Feb 2026 15:48:11 +0100 Subject: [PATCH 16/25] Added locate device screen, state and endpoints --- .../mobile_app/lib/navigation/app_router.dart | 5 + .../functions_remote_datasource.dart | 3 + .../functions_remote_datasource_impl.dart | 18 ++ .../locate_device_request_entity.dart | 11 + .../locate_device_request_entity.freezed.dart | 274 +++++++++++++++++ .../models/send_command_request_model.dart | 24 ++ .../send_command_request_model.freezed.dart | 280 ++++++++++++++++++ .../models/send_command_request_model.g.dart | 21 ++ .../functions_repository_impl.dart | 7 + .../repositories/functions_repository.dart | 3 + .../features/functions/functions_screen.dart | 42 ++- .../domain/locate_device_use_case.dart | 5 + .../domain/locate_device_use_case_impl.dart | 14 + .../locate_device/locate_device_builder.dart | 18 ++ .../presentation/locate_device_screen.dart | 148 +++++++++ .../locate_device_use_case_provider.dart | 9 + .../state/locate_device_view_model.dart | 62 ++++ .../state/locate_device_view_state.dart | 11 + .../locate_device_view_state.freezed.dart | 277 +++++++++++++++++ .../legacy_main_shell_screen.dart | 2 +- .../lib/src/widgets/layouts/page_layout.dart | 2 +- packages/design_system/fonts/SFIcons.ttf | Bin 27984 -> 29300 bytes packages/design_system/lib/fonts/config.json | 84 +++++- .../design_system/lib/src/icons/sf_icons.dart | 6 +- packages/navigation/lib/app_routes.dart | 1 + 25 files changed, 1295 insertions(+), 32 deletions(-) create mode 100644 modules/legacy/modules/functions/lib/src/core/data/models/entities/locate_device_request_entity.dart create mode 100644 modules/legacy/modules/functions/lib/src/core/data/models/entities/locate_device_request_entity.freezed.dart create mode 100644 modules/legacy/modules/functions/lib/src/core/data/models/send_command_request_model.dart create mode 100644 modules/legacy/modules/functions/lib/src/core/data/models/send_command_request_model.freezed.dart create mode 100644 modules/legacy/modules/functions/lib/src/core/data/models/send_command_request_model.g.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/locate_device/domain/locate_device_use_case.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/locate_device/domain/locate_device_use_case_impl.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/locate_device/locate_device_builder.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/locate_device/presentation/locate_device_screen.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/locate_device/presentation/providers/locate_device_use_case_provider.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/locate_device/presentation/state/locate_device_view_model.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/locate_device/presentation/state/locate_device_view_state.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/locate_device/presentation/state/locate_device_view_state.freezed.dart diff --git a/apps/mobile_app/lib/navigation/app_router.dart b/apps/mobile_app/lib/navigation/app_router.dart index 36c3baee..fea0972e 100644 --- a/apps/mobile_app/lib/navigation/app_router.dart +++ b/apps/mobile_app/lib/navigation/app_router.dart @@ -62,6 +62,11 @@ void configureAppRouter() { name: 'remote_connection', pageBuilder: RemoteConnectionBuilder().buildPage, ), + GoRoute( + path: AppRoutes.locateDevice, + name: 'locate_device', + pageBuilder: LocateDeviceBuilder().buildPage, + ), GoRoute( path: AppRoutes.login, diff --git a/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource.dart b/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource.dart index dffa0475..4db51388 100644 --- a/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource.dart +++ b/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource.dart @@ -1,3 +1,4 @@ +import 'package:functions/src/core/data/models/entities/locate_device_request_entity.dart'; import 'package:functions/src/features/contacts/domain/entities/contact_entity.dart'; import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart'; @@ -7,4 +8,6 @@ abstract class FunctionsRemoteDatasource { Future> getPictures({required String userId}); Future takePicture({required String userId}); + + Future locateDevice({required LocateDeviceRequestEntity request}); } diff --git a/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource_impl.dart b/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource_impl.dart index 37a434ca..ee555d94 100644 --- a/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource_impl.dart +++ b/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource_impl.dart @@ -3,6 +3,8 @@ import 'dart:convert'; import 'package:dio/dio.dart'; // import 'package:flutter/material.dart'; import 'package:functions/src/core/data/datasources/functions_remote_datasource.dart'; +import 'package:functions/src/core/data/models/entities/locate_device_request_entity.dart'; +import 'package:functions/src/core/data/models/send_command_request_model.dart'; import 'package:functions/src/features/contacts/domain/entities/contact_entity.dart'; import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart'; import 'package:sf_infrastructure/sf_infrastructure.dart'; @@ -92,6 +94,22 @@ class FunctionsRemoteDatasourceImpl implements FunctionsRemoteDatasource { }*/ return PictureEntity(id: '1', userId: '1111', createdAt: 1111); } + + @override + Future locateDevice({required LocateDeviceRequestEntity request}) async { + try { + final body = request.toModel().toJson(); + await _repository.post( + '/commands', + body: body, + ); + } on DioException catch (error) { + throw _mapDioError( + error, + defaultMessage: error.response?.data ?? 'Error to locate device', + ); + } + } } Exception _mapDioError(DioException error, {required String defaultMessage}) { diff --git a/modules/legacy/modules/functions/lib/src/core/data/models/entities/locate_device_request_entity.dart b/modules/legacy/modules/functions/lib/src/core/data/models/entities/locate_device_request_entity.dart new file mode 100644 index 00000000..8646a2bd --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/core/data/models/entities/locate_device_request_entity.dart @@ -0,0 +1,11 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'locate_device_request_entity.freezed.dart'; + +@freezed +abstract class LocateDeviceRequestEntity with _$LocateDeviceRequestEntity { + + const factory LocateDeviceRequestEntity({ + required String deviceName, + }) = _LocateDeviceRequestEntity; +} diff --git a/modules/legacy/modules/functions/lib/src/core/data/models/entities/locate_device_request_entity.freezed.dart b/modules/legacy/modules/functions/lib/src/core/data/models/entities/locate_device_request_entity.freezed.dart new file mode 100644 index 00000000..9f79acf1 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/core/data/models/entities/locate_device_request_entity.freezed.dart @@ -0,0 +1,274 @@ +// 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 'locate_device_request_entity.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$LocateDeviceRequestEntity { + + String get deviceName; dynamic get command; +/// Create a copy of LocateDeviceRequestEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$LocateDeviceRequestEntityCopyWith get copyWith => _$LocateDeviceRequestEntityCopyWithImpl(this as LocateDeviceRequestEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is LocateDeviceRequestEntity&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)&&const DeepCollectionEquality().equals(other.command, command)); +} + + +@override +int get hashCode => Object.hash(runtimeType,deviceName,const DeepCollectionEquality().hash(command)); + +@override +String toString() { + return 'LocateDeviceRequestEntity(deviceName: $deviceName, command: $command)'; +} + + +} + +/// @nodoc +abstract mixin class $LocateDeviceRequestEntityCopyWith<$Res> { + factory $LocateDeviceRequestEntityCopyWith(LocateDeviceRequestEntity value, $Res Function(LocateDeviceRequestEntity) _then) = _$LocateDeviceRequestEntityCopyWithImpl; +@useResult +$Res call({ + String deviceName, dynamic command +}); + + + + +} +/// @nodoc +class _$LocateDeviceRequestEntityCopyWithImpl<$Res> + implements $LocateDeviceRequestEntityCopyWith<$Res> { + _$LocateDeviceRequestEntityCopyWithImpl(this._self, this._then); + + final LocateDeviceRequestEntity _self; + final $Res Function(LocateDeviceRequestEntity) _then; + +/// Create a copy of LocateDeviceRequestEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? deviceName = null,Object? command = freezed,}) { + return _then(_self.copyWith( +deviceName: null == deviceName ? _self.deviceName : deviceName // ignore: cast_nullable_to_non_nullable +as String,command: freezed == command ? _self.command : command // ignore: cast_nullable_to_non_nullable +as dynamic, + )); +} + +} + + +/// Adds pattern-matching-related methods to [LocateDeviceRequestEntity]. +extension LocateDeviceRequestEntityPatterns on LocateDeviceRequestEntity { +/// 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( _LocateDeviceRequestEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _LocateDeviceRequestEntity() 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( _LocateDeviceRequestEntity value) $default,){ +final _that = this; +switch (_that) { +case _LocateDeviceRequestEntity(): +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( _LocateDeviceRequestEntity value)? $default,){ +final _that = this; +switch (_that) { +case _LocateDeviceRequestEntity() 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 deviceName, dynamic command)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _LocateDeviceRequestEntity() when $default != null: +return $default(_that.deviceName,_that.command);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 deviceName, dynamic command) $default,) {final _that = this; +switch (_that) { +case _LocateDeviceRequestEntity(): +return $default(_that.deviceName,_that.command);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 deviceName, dynamic command)? $default,) {final _that = this; +switch (_that) { +case _LocateDeviceRequestEntity() when $default != null: +return $default(_that.deviceName,_that.command);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _LocateDeviceRequestEntity implements LocateDeviceRequestEntity { + const _LocateDeviceRequestEntity({required this.deviceName, this.command}); + + +@override final String deviceName; +@override final dynamic command; + +/// Create a copy of LocateDeviceRequestEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$LocateDeviceRequestEntityCopyWith<_LocateDeviceRequestEntity> get copyWith => __$LocateDeviceRequestEntityCopyWithImpl<_LocateDeviceRequestEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _LocateDeviceRequestEntity&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)&&const DeepCollectionEquality().equals(other.command, command)); +} + + +@override +int get hashCode => Object.hash(runtimeType,deviceName,const DeepCollectionEquality().hash(command)); + +@override +String toString() { + return 'LocateDeviceRequestEntity(deviceName: $deviceName, command: $command)'; +} + + +} + +/// @nodoc +abstract mixin class _$LocateDeviceRequestEntityCopyWith<$Res> implements $LocateDeviceRequestEntityCopyWith<$Res> { + factory _$LocateDeviceRequestEntityCopyWith(_LocateDeviceRequestEntity value, $Res Function(_LocateDeviceRequestEntity) _then) = __$LocateDeviceRequestEntityCopyWithImpl; +@override @useResult +$Res call({ + String deviceName, dynamic command +}); + + + + +} +/// @nodoc +class __$LocateDeviceRequestEntityCopyWithImpl<$Res> + implements _$LocateDeviceRequestEntityCopyWith<$Res> { + __$LocateDeviceRequestEntityCopyWithImpl(this._self, this._then); + + final _LocateDeviceRequestEntity _self; + final $Res Function(_LocateDeviceRequestEntity) _then; + +/// Create a copy of LocateDeviceRequestEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? deviceName = null,Object? command = freezed,}) { + return _then(_LocateDeviceRequestEntity( +deviceName: null == deviceName ? _self.deviceName : deviceName // ignore: cast_nullable_to_non_nullable +as String,command: freezed == command ? _self.command : command // ignore: cast_nullable_to_non_nullable +as dynamic, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/functions/lib/src/core/data/models/send_command_request_model.dart b/modules/legacy/modules/functions/lib/src/core/data/models/send_command_request_model.dart new file mode 100644 index 00000000..296155ec --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/core/data/models/send_command_request_model.dart @@ -0,0 +1,24 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:functions/src/core/data/models/entities/locate_device_request_entity.dart'; + +part 'send_command_request_model.freezed.dart'; +part 'send_command_request_model.g.dart'; + +@freezed +abstract class SendCommandRequestModel with _$SendCommandRequestModel { + const factory SendCommandRequestModel({ + required String deviceName, + required String command, + }) = _SendCommandRequestModel; + + factory SendCommandRequestModel.fromJson(Map json) => + _$SendCommandRequestModelFromJson(json); + +} + +extension SendCommandRequestModelMapper on LocateDeviceRequestEntity { + SendCommandRequestModel toModel() => SendCommandRequestModel( + deviceName: deviceName, + command: 'FIND_DEVICE', + ); +} diff --git a/modules/legacy/modules/functions/lib/src/core/data/models/send_command_request_model.freezed.dart b/modules/legacy/modules/functions/lib/src/core/data/models/send_command_request_model.freezed.dart new file mode 100644 index 00000000..229b6834 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/core/data/models/send_command_request_model.freezed.dart @@ -0,0 +1,280 @@ +// 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 'send_command_request_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$SendCommandRequestModel { + + String get deviceName; String get command; +/// Create a copy of SendCommandRequestModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$SendCommandRequestModelCopyWith get copyWith => _$SendCommandRequestModelCopyWithImpl(this as SendCommandRequestModel, _$identity); + + /// Serializes this SendCommandRequestModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is SendCommandRequestModel&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)&&(identical(other.command, command) || other.command == command)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,deviceName,command); + +@override +String toString() { + return 'SendCommandRequestModel(deviceName: $deviceName, command: $command)'; +} + + +} + +/// @nodoc +abstract mixin class $SendCommandRequestModelCopyWith<$Res> { + factory $SendCommandRequestModelCopyWith(SendCommandRequestModel value, $Res Function(SendCommandRequestModel) _then) = _$SendCommandRequestModelCopyWithImpl; +@useResult +$Res call({ + String deviceName, String command +}); + + + + +} +/// @nodoc +class _$SendCommandRequestModelCopyWithImpl<$Res> + implements $SendCommandRequestModelCopyWith<$Res> { + _$SendCommandRequestModelCopyWithImpl(this._self, this._then); + + final SendCommandRequestModel _self; + final $Res Function(SendCommandRequestModel) _then; + +/// Create a copy of SendCommandRequestModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? deviceName = null,Object? command = null,}) { + return _then(_self.copyWith( +deviceName: null == deviceName ? _self.deviceName : deviceName // ignore: cast_nullable_to_non_nullable +as String,command: null == command ? _self.command : command // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [SendCommandRequestModel]. +extension SendCommandRequestModelPatterns on SendCommandRequestModel { +/// 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( _SendCommandRequestModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _SendCommandRequestModel() 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( _SendCommandRequestModel value) $default,){ +final _that = this; +switch (_that) { +case _SendCommandRequestModel(): +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( _SendCommandRequestModel value)? $default,){ +final _that = this; +switch (_that) { +case _SendCommandRequestModel() 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 deviceName, String command)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _SendCommandRequestModel() when $default != null: +return $default(_that.deviceName,_that.command);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 deviceName, String command) $default,) {final _that = this; +switch (_that) { +case _SendCommandRequestModel(): +return $default(_that.deviceName,_that.command);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 deviceName, String command)? $default,) {final _that = this; +switch (_that) { +case _SendCommandRequestModel() when $default != null: +return $default(_that.deviceName,_that.command);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _SendCommandRequestModel implements SendCommandRequestModel { + const _SendCommandRequestModel({required this.deviceName, required this.command}); + factory _SendCommandRequestModel.fromJson(Map json) => _$SendCommandRequestModelFromJson(json); + +@override final String deviceName; +@override final String command; + +/// Create a copy of SendCommandRequestModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$SendCommandRequestModelCopyWith<_SendCommandRequestModel> get copyWith => __$SendCommandRequestModelCopyWithImpl<_SendCommandRequestModel>(this, _$identity); + +@override +Map toJson() { + return _$SendCommandRequestModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _SendCommandRequestModel&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)&&(identical(other.command, command) || other.command == command)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,deviceName,command); + +@override +String toString() { + return 'SendCommandRequestModel(deviceName: $deviceName, command: $command)'; +} + + +} + +/// @nodoc +abstract mixin class _$SendCommandRequestModelCopyWith<$Res> implements $SendCommandRequestModelCopyWith<$Res> { + factory _$SendCommandRequestModelCopyWith(_SendCommandRequestModel value, $Res Function(_SendCommandRequestModel) _then) = __$SendCommandRequestModelCopyWithImpl; +@override @useResult +$Res call({ + String deviceName, String command +}); + + + + +} +/// @nodoc +class __$SendCommandRequestModelCopyWithImpl<$Res> + implements _$SendCommandRequestModelCopyWith<$Res> { + __$SendCommandRequestModelCopyWithImpl(this._self, this._then); + + final _SendCommandRequestModel _self; + final $Res Function(_SendCommandRequestModel) _then; + +/// Create a copy of SendCommandRequestModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? deviceName = null,Object? command = null,}) { + return _then(_SendCommandRequestModel( +deviceName: null == deviceName ? _self.deviceName : deviceName // ignore: cast_nullable_to_non_nullable +as String,command: null == command ? _self.command : command // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/functions/lib/src/core/data/models/send_command_request_model.g.dart b/modules/legacy/modules/functions/lib/src/core/data/models/send_command_request_model.g.dart new file mode 100644 index 00000000..eae14744 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/core/data/models/send_command_request_model.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'send_command_request_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_SendCommandRequestModel _$SendCommandRequestModelFromJson( + Map json, +) => _SendCommandRequestModel( + deviceName: json['deviceName'] as String, + command: json['command'] as String, +); + +Map _$SendCommandRequestModelToJson( + _SendCommandRequestModel instance, +) => { + 'deviceName': instance.deviceName, + 'command': instance.command, +}; diff --git a/modules/legacy/modules/functions/lib/src/core/data/repositories/functions_repository_impl.dart b/modules/legacy/modules/functions/lib/src/core/data/repositories/functions_repository_impl.dart index bd6969d5..59cf7ac5 100644 --- a/modules/legacy/modules/functions/lib/src/core/data/repositories/functions_repository_impl.dart +++ b/modules/legacy/modules/functions/lib/src/core/data/repositories/functions_repository_impl.dart @@ -1,4 +1,5 @@ import 'package:functions/src/core/data/datasources/functions_remote_datasource.dart'; +import 'package:functions/src/core/data/models/entities/locate_device_request_entity.dart'; import 'package:functions/src/core/domain/repositories/functions_repository.dart'; import 'package:functions/src/features/contacts/domain/entities/contact_entity.dart'; import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart'; @@ -24,4 +25,10 @@ class FunctionsRepositoryImpl implements FunctionsRepository { await Future.delayed(const Duration(milliseconds: 2000)); return _remote.takePicture(userId: userId); } + + @override + Future locateDevice({required LocateDeviceRequestEntity request}) async { + await Future.delayed(const Duration(milliseconds: 2000)); + return _remote.locateDevice(request: request); + } } diff --git a/modules/legacy/modules/functions/lib/src/core/domain/repositories/functions_repository.dart b/modules/legacy/modules/functions/lib/src/core/domain/repositories/functions_repository.dart index 567342ca..44813f87 100644 --- a/modules/legacy/modules/functions/lib/src/core/domain/repositories/functions_repository.dart +++ b/modules/legacy/modules/functions/lib/src/core/domain/repositories/functions_repository.dart @@ -1,3 +1,4 @@ +import 'package:functions/src/core/data/models/entities/locate_device_request_entity.dart'; import 'package:functions/src/features/contacts/domain/entities/contact_entity.dart'; import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart'; @@ -7,4 +8,6 @@ abstract class FunctionsRepository { Future> getPictures({required String userId}); Future takePicture({required String userId}); + + Future locateDevice({required LocateDeviceRequestEntity request}); } diff --git a/modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart b/modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart index d2a65176..7f2d1a9c 100644 --- a/modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart +++ b/modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart @@ -70,12 +70,6 @@ class FunctionsScreen extends ConsumerWidget { text: 'Do not disturb' ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), - AppSectionButton( - onPressed: (){}, - icon: SFIcons.locationAreaCircle, - text: 'Safety zone' - ), - SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){}, icon: SFIcons.videoCallCircle, @@ -84,19 +78,13 @@ class FunctionsScreen extends ConsumerWidget { SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){}, - icon: SFIcons.fallCircle, - text: 'Fall notice' + icon: SFIcons.healthCircle, + text: 'Health' ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){}, - icon: SFIcons.medicationCircle, - text: 'Medication reminder' - ), - SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), - AppSectionButton( - onPressed: (){}, - icon: SFIcons.activityCircle, + icon: SFIcons.healthCircle, text: 'Activity meter' ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), @@ -108,6 +96,30 @@ class FunctionsScreen extends ConsumerWidget { SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){}, + icon: Icons.call_outlined, + text: 'Call watch' + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){}, + icon: SFIcons.screenTime, + text: 'Apps use' + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){}, + icon: Icons.app_registration_sharp, + text: 'Apps supervision' + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){}, + icon: SFIcons.friendsCircle, + text: 'Make friends' + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){navigationContract.pushTo(AppRoutes.locateDevice);}, icon: SFIcons.locateSfCircle, text: 'Locate your SaveFamily' ), diff --git a/modules/legacy/modules/functions/lib/src/features/locate_device/domain/locate_device_use_case.dart b/modules/legacy/modules/functions/lib/src/features/locate_device/domain/locate_device_use_case.dart new file mode 100644 index 00000000..e6fc5bfd --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/locate_device/domain/locate_device_use_case.dart @@ -0,0 +1,5 @@ +import 'package:functions/src/core/data/models/entities/locate_device_request_entity.dart'; + +abstract class LocateDeviceUseCase { + Future locateDevice({required LocateDeviceRequestEntity request}); +} \ No newline at end of file diff --git a/modules/legacy/modules/functions/lib/src/features/locate_device/domain/locate_device_use_case_impl.dart b/modules/legacy/modules/functions/lib/src/features/locate_device/domain/locate_device_use_case_impl.dart new file mode 100644 index 00000000..0acc44d2 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/locate_device/domain/locate_device_use_case_impl.dart @@ -0,0 +1,14 @@ +import 'package:functions/src/core/data/models/entities/locate_device_request_entity.dart'; +import 'package:functions/src/core/domain/repositories/functions_repository.dart'; +import 'package:functions/src/features/locate_device/domain/locate_device_use_case.dart'; + +class LocateDeviceUseCaseImpl implements LocateDeviceUseCase { + LocateDeviceUseCaseImpl(this._repository); + + final FunctionsRepository _repository; + + @override + Future locateDevice({required LocateDeviceRequestEntity request}) async { + return _repository.locateDevice(request: request); + } +} diff --git a/modules/legacy/modules/functions/lib/src/features/locate_device/locate_device_builder.dart b/modules/legacy/modules/functions/lib/src/features/locate_device/locate_device_builder.dart new file mode 100644 index 00000000..8120c702 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/locate_device/locate_device_builder.dart @@ -0,0 +1,18 @@ +import 'package:flutter/material.dart'; +import 'package:functions/src/features/locate_device/presentation/locate_device_screen.dart'; +import 'package:go_router/go_router.dart'; +import 'package:get_it/get_it.dart'; +import 'package:navigation/navigation.dart'; + +class LocateDeviceBuilder { + const LocateDeviceBuilder(); + + Page buildPage(BuildContext context, GoRouterState state) { + final NavigationContract navigationContract = GetIt.I(); + + return MaterialPage( + key: state.pageKey, + child: LocateDeviceScreen(navigationContract: navigationContract), + ); + } +} diff --git a/modules/legacy/modules/functions/lib/src/features/locate_device/presentation/locate_device_screen.dart b/modules/legacy/modules/functions/lib/src/features/locate_device/presentation/locate_device_screen.dart new file mode 100644 index 00000000..7d367592 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/locate_device/presentation/locate_device_screen.dart @@ -0,0 +1,148 @@ +import 'package:design_system/design_system.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:functions/src/features/locate_device/presentation/state/locate_device_view_model.dart'; +import 'package:navigation/navigation.dart'; +import 'package:sf_localizations/sf_localizations.dart'; +import 'package:utils/utils.dart'; +import 'package:legacy_shared/legacy_shared.dart'; + +class LocateDeviceScreen extends ConsumerWidget { + final NavigationContract navigationContract; + + const LocateDeviceScreen({super.key, required this.navigationContract}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + + return PageLayout( + title: context.translate('Find your device'), + body: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 16), + big: EdgeInsets.symmetric(horizontal: 15) + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(context.translate('Locate your SaveFamily in nearby locations'), + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 18, big: 17), + fontWeight: FontWeight.w500, + ) + ), + SizedBox(height: SizeUtils.getByScreen(small: 10, big: 8)), + Text('This function allows you to find the device indoors or in places close to you. When you press the button, the smartwatch will start beeping and you will be able to hear it.', + style: TextStyle( + fontSize: 16 + )) + ], + ), + ), + footer: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(vertical: 12, horizontal: 26), + big: EdgeInsets.symmetric(vertical: 10, horizontal: 25) + ), + child: PrimaryButton( + onPressed: () { + showDialog(context: context, builder: (context)=>Dialog( + child: LocateDialog(), + )); + }, + text: context.translate('Locate my SaveFamily'), + color: Color(0xFF588EA5), + height: SizeUtils.getByScreen(small: 36, big: 35), + ), + ) + ); + } +} + +class LocateDialog extends ConsumerWidget { + + @override + Widget build(BuildContext context, WidgetRef ref) { + + final viewModel = ref.read(locateDeviceViewModelProvider.notifier); + final viewState = ref.watch(locateDeviceViewModelProvider); + + return Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 32, vertical: 30), + big: EdgeInsets.symmetric(horizontal: 30, vertical: 28) + ), + width: SizeUtils.getByScreen(small: 360, big: 350), + height: SizeUtils.getByScreen(small: 210, big: 205), + child: Column( + children: [ + if (viewState.isLoading) + Expanded(child: Center(child: Text(context.translate('Sending...'), + textAlign: TextAlign.center, + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 25, big: 24), + ), + ))), + if (viewState.isComplete) + Expanded(child: Center(child: Text(context.translate('Sent successfully'), + textAlign: TextAlign.center, + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 25, big: 24), + ), + ))), + if (viewState.errorMessage.isNotEmpty) ...[ + Expanded(child: Center(child: Text(context.translate('The device is not connected to the Internet'), + textAlign: TextAlign.center, + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 20, big: 19), + ), + ))), + SizedBox(height: SizeUtils.getByScreen(small: 24, big: 23)), + Expanded(child: PrimaryButton( + onPressed: (){ + Navigator.pop(context); + viewModel.endLocation(); + }, + text: context.translate('OK'), + color: Color(0xFF588EA5), + height: SizeUtils.getByScreen(small: 38, big: 36), + radius: SizeUtils.getByScreen(small: 32, big: 34), + )), + ], + if (!viewState.isComplete && !viewState.isLoading && viewState.errorMessage.isEmpty) ...[ + Text(context.translate('You are going to activate the remote location of your device. It will start ringing.'), + textAlign: TextAlign.center, + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 19, big: 18), + ), + ), + SizedBox(height: SizeUtils.getByScreen(small: 24, big: 23)), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded(child: PrimaryButton( + onPressed: (){Navigator.pop(context);}, + text: context.translate(I18n.legacyCancel), + color: Color(0xFF588EA5), + height: SizeUtils.getByScreen(small: 38, big: 36), + radius: SizeUtils.getByScreen(small: 32, big: 34), + )), + SizedBox(width: SizeUtils.getByScreen(small: 4, big: 16)), + Expanded(child: PrimaryButton( + onPressed: () { + viewModel.locateDevice(); + }, + text: context.translate(I18n.accept), + color: Color(0xFF588EA5), + height: SizeUtils.getByScreen(small: 38, big: 36), + radius: SizeUtils.getByScreen(small: 32, big: 34), + )) + ], + ) + ] + ], + ), + ); + } + +} \ No newline at end of file diff --git a/modules/legacy/modules/functions/lib/src/features/locate_device/presentation/providers/locate_device_use_case_provider.dart b/modules/legacy/modules/functions/lib/src/features/locate_device/presentation/providers/locate_device_use_case_provider.dart new file mode 100644 index 00000000..05e7ac49 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/locate_device/presentation/providers/locate_device_use_case_provider.dart @@ -0,0 +1,9 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:functions/src/core/providers/functions_repository_provider.dart'; +import 'package:functions/src/features/locate_device/domain/locate_device_use_case.dart'; +import 'package:functions/src/features/locate_device/domain/locate_device_use_case_impl.dart'; + +final locateDeviceUseCaseProvider = Provider.autoDispose((ref) { + final functionsRepository = ref.read(functionsRepositoryProvider); + return LocateDeviceUseCaseImpl(functionsRepository); +}); diff --git a/modules/legacy/modules/functions/lib/src/features/locate_device/presentation/state/locate_device_view_model.dart b/modules/legacy/modules/functions/lib/src/features/locate_device/presentation/state/locate_device_view_model.dart new file mode 100644 index 00000000..779431ce --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/locate_device/presentation/state/locate_device_view_model.dart @@ -0,0 +1,62 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:functions/src/core/data/models/entities/locate_device_request_entity.dart'; +import 'package:functions/src/features/locate_device/domain/locate_device_use_case.dart'; +import 'package:functions/src/features/locate_device/presentation/providers/locate_device_use_case_provider.dart'; +import 'package:functions/src/features/locate_device/presentation/state/locate_device_view_state.dart'; +// import 'package:legacy_shared/src/providers/logged_user_provider.dart'; +// import 'package:sf_localizations/sf_localizations.dart'; + +final locateDeviceViewModelProvider = + NotifierProvider.autoDispose( + LocateDeviceViewModel.new, + ); + +class LocateDeviceViewModel extends Notifier { + late final LocateDeviceUseCase _locateDeviceUseCase; + + late final TextEditingController nameController; + late final TextEditingController phoneController; + + // late final UserEntity loggedUser; + + @override + LocateDeviceViewState build() { + _locateDeviceUseCase = ref.read(locateDeviceUseCaseProvider); + + // loggedUser = ref.read(loggedUserProvider); + + return const LocateDeviceViewState(); + } + + Future locateDevice() async { + try { + state = state.copyWith( + isLoading: true, + isComplete: false, + errorMessage: '', + ); + + LocateDeviceRequestEntity request = LocateDeviceRequestEntity(deviceName: ''); + await _locateDeviceUseCase.locateDevice(request: request); + + state = state.copyWith( + isLoading: false, + isComplete: true, + ); + } catch (e) { + state = state.copyWith( + isLoading: false, + isComplete: false, + errorMessage: e.toString(), + ); + } + } + + void endLocation() { + state = state.copyWith( + errorMessage: '', + + ); + } +} diff --git a/modules/legacy/modules/functions/lib/src/features/locate_device/presentation/state/locate_device_view_state.dart b/modules/legacy/modules/functions/lib/src/features/locate_device/presentation/state/locate_device_view_state.dart new file mode 100644 index 00000000..467e8f54 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/locate_device/presentation/state/locate_device_view_state.dart @@ -0,0 +1,11 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +part 'locate_device_view_state.freezed.dart'; + +@freezed +abstract class LocateDeviceViewState with _$LocateDeviceViewState { + const factory LocateDeviceViewState({ + @Default(false) bool isLoading, + @Default(false) bool isComplete, + @Default('') String errorMessage, + }) = _LocateDeviceViewState; +} \ No newline at end of file diff --git a/modules/legacy/modules/functions/lib/src/features/locate_device/presentation/state/locate_device_view_state.freezed.dart b/modules/legacy/modules/functions/lib/src/features/locate_device/presentation/state/locate_device_view_state.freezed.dart new file mode 100644 index 00000000..0fce616f --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/locate_device/presentation/state/locate_device_view_state.freezed.dart @@ -0,0 +1,277 @@ +// 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 'locate_device_view_state.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$LocateDeviceViewState { + + bool get isLoading; bool get isComplete; String get errorMessage; +/// Create a copy of LocateDeviceViewState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$LocateDeviceViewStateCopyWith get copyWith => _$LocateDeviceViewStateCopyWithImpl(this as LocateDeviceViewState, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is LocateDeviceViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isComplete, isComplete) || other.isComplete == isComplete)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); +} + + +@override +int get hashCode => Object.hash(runtimeType,isLoading,isComplete,errorMessage); + +@override +String toString() { + return 'LocateDeviceViewState(isLoading: $isLoading, isComplete: $isComplete, errorMessage: $errorMessage)'; +} + + +} + +/// @nodoc +abstract mixin class $LocateDeviceViewStateCopyWith<$Res> { + factory $LocateDeviceViewStateCopyWith(LocateDeviceViewState value, $Res Function(LocateDeviceViewState) _then) = _$LocateDeviceViewStateCopyWithImpl; +@useResult +$Res call({ + bool isLoading, bool isComplete, String errorMessage +}); + + + + +} +/// @nodoc +class _$LocateDeviceViewStateCopyWithImpl<$Res> + implements $LocateDeviceViewStateCopyWith<$Res> { + _$LocateDeviceViewStateCopyWithImpl(this._self, this._then); + + final LocateDeviceViewState _self; + final $Res Function(LocateDeviceViewState) _then; + +/// Create a copy of LocateDeviceViewState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? isComplete = null,Object? errorMessage = null,}) { + return _then(_self.copyWith( +isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable +as bool,isComplete: null == isComplete ? _self.isComplete : isComplete // ignore: cast_nullable_to_non_nullable +as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [LocateDeviceViewState]. +extension LocateDeviceViewStatePatterns on LocateDeviceViewState { +/// 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( _LocateDeviceViewState value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _LocateDeviceViewState() 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( _LocateDeviceViewState value) $default,){ +final _that = this; +switch (_that) { +case _LocateDeviceViewState(): +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( _LocateDeviceViewState value)? $default,){ +final _that = this; +switch (_that) { +case _LocateDeviceViewState() 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( bool isLoading, bool isComplete, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _LocateDeviceViewState() when $default != null: +return $default(_that.isLoading,_that.isComplete,_that.errorMessage);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( bool isLoading, bool isComplete, String errorMessage) $default,) {final _that = this; +switch (_that) { +case _LocateDeviceViewState(): +return $default(_that.isLoading,_that.isComplete,_that.errorMessage);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( bool isLoading, bool isComplete, String errorMessage)? $default,) {final _that = this; +switch (_that) { +case _LocateDeviceViewState() when $default != null: +return $default(_that.isLoading,_that.isComplete,_that.errorMessage);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _LocateDeviceViewState implements LocateDeviceViewState { + const _LocateDeviceViewState({this.isLoading = false, this.isComplete = false, this.errorMessage = ''}); + + +@override@JsonKey() final bool isLoading; +@override@JsonKey() final bool isComplete; +@override@JsonKey() final String errorMessage; + +/// Create a copy of LocateDeviceViewState +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$LocateDeviceViewStateCopyWith<_LocateDeviceViewState> get copyWith => __$LocateDeviceViewStateCopyWithImpl<_LocateDeviceViewState>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _LocateDeviceViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isComplete, isComplete) || other.isComplete == isComplete)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); +} + + +@override +int get hashCode => Object.hash(runtimeType,isLoading,isComplete,errorMessage); + +@override +String toString() { + return 'LocateDeviceViewState(isLoading: $isLoading, isComplete: $isComplete, errorMessage: $errorMessage)'; +} + + +} + +/// @nodoc +abstract mixin class _$LocateDeviceViewStateCopyWith<$Res> implements $LocateDeviceViewStateCopyWith<$Res> { + factory _$LocateDeviceViewStateCopyWith(_LocateDeviceViewState value, $Res Function(_LocateDeviceViewState) _then) = __$LocateDeviceViewStateCopyWithImpl; +@override @useResult +$Res call({ + bool isLoading, bool isComplete, String errorMessage +}); + + + + +} +/// @nodoc +class __$LocateDeviceViewStateCopyWithImpl<$Res> + implements _$LocateDeviceViewStateCopyWith<$Res> { + __$LocateDeviceViewStateCopyWithImpl(this._self, this._then); + + final _LocateDeviceViewState _self; + final $Res Function(_LocateDeviceViewState) _then; + +/// Create a copy of LocateDeviceViewState +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? isComplete = null,Object? errorMessage = null,}) { + return _then(_LocateDeviceViewState( +isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable +as bool,isComplete: null == isComplete ? _self.isComplete : isComplete // ignore: cast_nullable_to_non_nullable +as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_screen.dart b/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_screen.dart index 7c49bca7..0b051380 100644 --- a/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_screen.dart +++ b/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_screen.dart @@ -47,7 +47,7 @@ class LegacyDashboardScreen extends ConsumerWidget { label: context.translate(I18n.functions), ), NavigationDestination( - icon: Icon(Icons.location_on_outlined), + icon: Icon(SFIcons.locationOutlined), label: context.translate(I18n.location), ), NavigationDestination( diff --git a/modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart b/modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart index beeee9cf..860a1c8c 100644 --- a/modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart +++ b/modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart @@ -41,7 +41,7 @@ class PageLayout extends StatelessWidget{ ), ), SizedBox(height: SizeUtils.getByScreen(small: 30, big: 28)), - body, + Expanded(child: body), ?footer ], ) diff --git a/packages/design_system/fonts/SFIcons.ttf b/packages/design_system/fonts/SFIcons.ttf index caf8ca272821a0f1e693e7068a3de0d958822c3e..ef3076f16e34e88849f8e40dddacc78198cfe69d 100644 GIT binary patch delta 2049 zcmY*aO>7(25uVv4x#aRcB$p;-@mE^PBA1kwBI%e4MMjEj%Tn!F5+x=^99g1F$)x_w zxK1O3iDEad5d=or7Djrg0~Bt6qD32_KvVRPLk=yFL(rc?6SOf<2Us`-0u*x41TEEB zZFA@@zWLtFyq$eBZ{F^QAK~5uyd7@!PQ(E4bpR+YHWoHM|KO9)0oWpd;mXDOi_3k- zUo-;nHGt>u)T#?hsjCkiH1|FsTO)(|CZ2GYc#LUruO$J-UGt9`ugI6w0ryu z0MoC@|BJ@L)eZb3bBcV2NDr+oG^(x5sW}1Q66ws|#`@*vOYw_c01XPFy9P*0IlI3K zpbzhVwf}G3m#XFeuDJsXSp$DryL;X~{0PjfqR#kqclzkpOwU$zU$SM=jlif@y3|N> zOgo4h_>cB&Jc&Qt{RnMnWJP-Ewf(Q!_nF0o=d>5%Jg^6&1TjxbeGYV(pa6%#K^BW5 zDYBALO3Iirt(29DazUvno60Ta?frcK1(Xzdk135_c-NJd>TSQG>*_*^a|O2P zz6Gztcj^A#!F>mQ-u?so6Z168z%0=6(LnP%?e|dMZt3;BPA#K)m3QCJf5x<)rgsrw zg!rrmC=yR=fD$o9Q2|d9&uf5D;)(_sBfg*ko+755R{`V1>l)xV@rDLCLADd6%&`Swt ziN&1A*{~ba87hgy$4yHIT&-MnC2PIh&*Qx1#Ubk;m7UM7d)+ZtUH3)yko7|8FZSx;qGB~z>q$Y zmBiFw(67%+!@UB-*rSR5sMo-iq@78QXH48luE~s9oV1O3R6nVpr+wRD1MFF_LxPS^ z85RM0smrLwF|mMYIly?`HYOU0C0VuXR8&R|w5ag{$PJ0HBvQ*I$xk)+INb&!cK~U3 zwZ_zX(5tqg+NY|@G^B|$hr4(#INIkQ6y3i}Ro07^L-MmHQzqN^gg;#xFUegaQ$a_!zh9h6xWz$#VXKm4 zxcGQQuKYOtFiP>d~KRBKB|;l0xO^^H<#eRp>XGoM&d*%qgmr5A8!GTj#75r&owNO~yR>jBtC(0+{aT5K@ z%jM~T!NGy)^771E#m)nt%jLtv#kcUKzS!9K%=nF5=ToZ{yK*;38H@Gp{(W?!7w6i^ zm3u~<#WK#}{O+GtE-_jD^5Rytx;C@Ys9Kk|R;p`Dmq%B&7VA}Wv)b6GZY?xl*s40z hpKo(zeeLuM&HBn(b*Vj4|2=1+KX$!YYdaew{{^-_(-Z&z delta 746 zcmY+BUr19?9LK-s-aFY=m=7Tp>Ky1?b5>LeL7*#JbLv_SR#6nUHQUPlvlSY`w7<(F z2Irxkih9sJi7@b`9!3e35cSf_dWkT&LZ>qOK42&c~YDxR`4lqS%J|9!ZlI)|@PjfryxjC-J!kN_Isd`|T z0;!x#TuVRf&(q@QRzPuq(NTsfR{(>xvRT6?G1y-{UD4$`v`lAco2D+MHOVM+Fr=U5+mTqvK!~PEWKBZNJv3xwKx*&$DtPpObAn8O^3~lX@1@)Mu(ahgtqZo}+R#{JHXn7ny-S zGZ@U`uvBuWFmG6uGN%EJKsWh}06pZ30=UTZe{^t!oDhI6NlOaQOHK)JjGPg`O`a6s zIC)9{5BZiLgFYJE7QjosBLLl+c2|G_@;w0t$@c~Dk+TAvAU_bmPo5UwBsnj@5PgK+ zoOpy~W@AB#zcr1v9c+Bkw7qHG(qJhzms%!T&)X*2dhBld`tC`G)A6F+@AP#n>`@94 m^XEf_4<1h|3-J2*Y+)&WRpQ~)dsD3%N=I)*)8o8zwEHh1E61(? diff --git a/packages/design_system/lib/fonts/config.json b/packages/design_system/lib/fonts/config.json index 8e472872..560b854f 100755 --- a/packages/design_system/lib/fonts/config.json +++ b/packages/design_system/lib/fonts/config.json @@ -1076,20 +1076,6 @@ "icon" ] }, - { - "uid": "d9ab0ada4a6bda3f4f974dd8d154b5bf", - "css": "activityCircle", - "code": 59527, - "src": "custom_icons", - "selected": true, - "svg": { - "path": "M672.8 298.3C624.2 285.8 582.8 302.2 550.3 339.4 532.9 359.4 517.4 381.4 500 404.1 479.6 378.4 462.6 353.5 442.2 331.8 398.2 285.1 325.6 281.9 279.9 322.3 231.3 365.6 226.3 433.3 269.7 484.6 334.8 562.1 400.1 639 465.5 716.2 475.7 728.3 486.2 740.5 497 753.6 577.9 660.3 657 569.6 735.2 478.3 757.2 452.4 764.1 420.2 756.9 386.7 747 340.7 718.5 310.1 672.8 298.3ZM500 0C224 0 0 223.7 0 500 0 776.3 224 1000 500 1000 776.3 1000 1000 776 1000 500 1000.3 223.7 776.3 0 500 0ZM776.6 522C693.8 618.6 610.1 714.2 526.6 810.1 503.6 836.4 489.8 836.1 467.8 810.1 385.7 713.2 303.5 616 221.4 518.7 176.4 465.5 169.5 388.6 203 326.2 235.2 265.8 302.6 230.3 371.2 236.5 423.8 241.5 465.5 265.4 500.7 306.5 535.1 265.8 576.5 241.8 628.5 236.9 698.8 230.3 765.8 265.4 798 326.5 831.5 391.3 824.2 466.5 776.6 522Z", - "width": 1000 - }, - "search": [ - "icon" - ] - }, { "uid": "05dd5a74c484decee45995f6ee723ea2", "css": "rewardsCircle", @@ -1145,6 +1131,76 @@ "search": [ "icon" ] + }, + { + "uid": "623cc2ff909ec2281a19d64b238c18a1", + "css": "screenTime", + "code": 59473, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M696.6 468.8C799.4 468.8 882.8 552.1 882.8 654.9 882.8 757.8 799.4 841.1 696.6 841.1 593.8 841.1 510.4 757.8 510.4 654.9 510.4 552.1 593.8 468.8 696.6 468.8ZM569.7 130.2C611.7 130.2 645.8 164.3 645.8 206.4L645.8 440.8C548.8 463.7 476.6 550.9 476.6 654.9 476.6 660.6 476.8 666.3 477.2 671.9L400.4 671.9C386.4 671.9 375 683.2 375 697.3 375 710.1 384.6 720.7 396.9 722.4L400.4 722.7H485L487.1 722.5C497.5 754.7 515 783.5 537.9 807.3L315.8 807.3C273.7 807.3 239.6 773.2 239.6 731.1V206.4C239.6 164.3 273.7 130.2 315.8 130.2H569.7ZM662.8 536.5C653.4 536.5 645.8 544 645.8 553.4V688.8C645.8 698.1 653.4 705.7 662.8 705.7H764.4C773.7 705.7 781.3 698.1 781.3 688.8 781.3 679.5 773.7 671.9 764.4 671.9H679.7V553.4C679.7 544 672.1 536.5 662.8 536.5Z", + "width": 1000 + }, + "search": [ + "icon" + ] + }, + { + "uid": "f91b4ca494bb312e01f6e0981e7a05dc", + "css": "friendsCircle", + "code": 59474, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M632.1 435C674.4 435.3 709.6 400.5 709.6 358.1 709.6 316 675.1 281.2 633 280.9 590.7 280.6 555.8 315 555.5 357.1 555.2 399.8 589.7 434.6 632.1 435ZM292.4 542.7C294.3 527.9 286.5 513.1 272.7 510.2 260.2 507.6 246.7 508.5 233.9 507.6 233.9 528.3 233.9 547.3 233.9 567.3 244.4 567.3 254.6 567.7 264.5 567.3 278.3 567 290.4 556.2 292.4 542.7ZM386 435C428.1 435.3 463.2 400.5 463.5 358.4 463.9 315.7 429.4 280.9 387 280.9 344.6 280.9 309.5 315.4 309.5 357.8 309.1 400.1 343.6 434.6 386 435ZM534.5 470.8C531.9 470.8 530.6 470.4 528.9 470.4 475.4 470.4 422.1 470.4 368.6 470.4 359.7 470.4 350.9 471.4 342.3 473.1 329.2 475.7 317 480.6 305.5 488.2 325.9 507.9 333.4 531.5 324.2 557.8 312.7 591.3 286.8 604.1 252.3 602.8 252.3 641.9 252.3 680 252.3 718.8 265.8 718.8 278.6 718.8 292 718.8 292 715.8 292 713.9 292 711.6 292 689.9 292 667.9 292 646.2 292 643.9 292 641.6 292.4 639.3 294 630.1 302.2 623.9 310.8 624.5 320 625.2 327.2 632.4 327.2 641.9 327.5 665.2 327.2 688.6 327.2 712.2 327.2 714.5 327.2 716.8 327.2 719.1 379.1 719.1 430 719.1 481.3 719.1 481.3 716.5 481.3 714.2 481.3 711.9 481.3 669.8 480.9 627.8 481.3 585.7 481.6 542 498 505.3 529.6 475 531.9 473.7 532.8 472.4 534.5 470.8ZM500 0C223.7 0 0 224 0 500 0 776.3 224 1000 500 1000 776.3 1000 1000 776 1000 500 1000 223.7 776.3 0 500 0ZM801.6 589.7C798 597.6 792 602.8 782.5 603.2 782.5 605.8 782.5 608.1 782.5 610.1 782.5 651.1 782.5 692.2 782.5 733.2 782.5 747.7 775.6 754.6 761.2 754.6 586.7 754.6 412.3 754.6 237.8 754.6 223.4 754.6 216.5 747.7 216.5 733.2 216.5 692.2 216.5 651.1 216.5 610.1 216.5 607.8 216.5 605.5 216.5 602.8 206.6 602.8 201.4 597.2 197.4 589.7 197.4 555.2 197.4 520.4 197.4 485.9 201.7 475.7 209.6 472.1 220.4 472.7 234.6 473.4 248.7 473.1 262.8 472.7 264.5 472.7 266.8 472.7 267.7 471.7 281.2 460.2 296.3 451.1 313.1 444.5 256.2 394.9 266.8 317.7 304.9 279.2 345.3 238.8 408 233.9 453.7 268.4 475.7 285.2 489.8 307.5 495.4 334.8 503 372.2 493.1 405.1 467.8 434.3 495.4 434.3 521.7 434.3 549.3 434.3 527.3 409.3 517.1 381.1 519.7 348.9 522.3 316.4 536.8 289.4 562.4 269.4 607.1 234.2 670.2 237.8 710.2 277.6 730.9 298 742.4 322.9 743.8 352.2 745.4 392.6 729 424.8 698.1 448.8 708.9 456.3 719.1 463.9 729.6 471.1 731.3 472.1 733.6 472.7 735.5 472.7 749.7 472.7 763.8 473.4 777.9 472.7 788.8 472.4 796.6 476 800.9 485.9 801.6 520.7 801.6 555.2 801.6 589.7ZM678.1 565C664.9 536.5 671.8 510.5 694.2 488.2 670.2 473.4 644.9 467.5 617.6 471.4 557.5 480.3 517.7 527.6 517.7 588 517.7 629.4 517.7 670.8 517.7 712.2 517.7 714.2 517.7 716.5 517.7 718.5 569.3 718.5 620.6 718.5 671.8 718.5 671.8 715.8 671.8 713.9 671.8 711.6 671.8 688.2 671.8 664.9 671.8 641.6 671.8 632.1 679 624.8 688.6 624.2 697.4 623.5 705.3 630.1 707 639.3 707.3 641.6 707.3 643.9 707.3 646.2 707.3 668.2 707.3 690.2 707.3 712.2 707.3 714.2 707.6 716.5 707.6 718.8 721.1 718.8 733.9 718.8 747 718.8 747 679.7 747 641.3 747 602.8 715.8 604.5 691.2 594 678.1 565ZM707.3 537.1C707 552.6 718.5 566.4 733.6 567.3 744.4 568 754.9 567.3 766.1 567.3 766.1 547.3 766.1 527.9 766.1 508.5 755.3 508.5 745.1 508.2 734.6 508.5 719.4 508.9 707.6 521.7 707.3 537.1Z", + "width": 1000 + }, + "search": [ + "icon" + ] + }, + { + "uid": "d9ab0ada4a6bda3f4f974dd8d154b5bf", + "css": "healthCircle", + "code": 59527, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M672.8 298.3C624.2 285.8 582.8 302.2 550.3 339.4 532.9 359.4 517.4 381.4 500 404.1 479.6 378.4 462.6 353.5 442.2 331.8 398.2 285.1 325.6 281.9 279.9 322.3 231.3 365.6 226.3 433.3 269.7 484.6 334.8 562.1 400.1 639 465.5 716.2 475.7 728.3 486.2 740.5 497 753.6 577.9 660.3 657 569.6 735.2 478.3 757.2 452.4 764.1 420.2 756.9 386.7 747 340.7 718.5 310.1 672.8 298.3ZM500 0C224 0 0 223.7 0 500 0 776.3 224 1000 500 1000 776.3 1000 1000 776 1000 500 1000.3 223.7 776.3 0 500 0ZM776.6 522C693.8 618.6 610.1 714.2 526.6 810.1 503.6 836.4 489.8 836.1 467.8 810.1 385.7 713.2 303.5 616 221.4 518.7 176.4 465.5 169.5 388.6 203 326.2 235.2 265.8 302.6 230.3 371.2 236.5 423.8 241.5 465.5 265.4 500.7 306.5 535.1 265.8 576.5 241.8 628.5 236.9 698.8 230.3 765.8 265.4 798 326.5 831.5 391.3 824.2 466.5 776.6 522Z", + "width": 1000 + }, + "search": [ + "icon" + ] + }, + { + "uid": "505c0f357adb29dfe5230da603bd2b07", + "css": "temperature", + "code": 59475, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M621 665.3C621 691.6 613.2 717.4 598.5 739.2 583.9 761.1 563.1 778.2 538.8 788.3 514.5 798.3 487.8 801 461.9 795.8 436.1 790.7 412.4 778 393.8 759.4 375.2 740.8 362.5 717.1 357.4 691.3 352.3 665.5 354.9 638.7 365 614.4 375 590.1 392.1 569.3 414 554.7 435.9 540.1 461.6 532.3 487.9 532.3 523.2 532.3 557 546.3 582 571.2 606.9 596.2 621 630 621 665.3ZM798.4 665.3C798.4 706.2 790.3 746.6 774.7 784.3 759 822 736.1 856.3 707.2 885.1 678.3 914 644 936.8 606.2 952.4 568.5 967.9 528 975.9 487.2 975.8 474.9 975.8 462.7 975.1 450.5 973.6 383.8 965.1 321.6 935.3 273.1 888.7 224.7 842.1 192.5 781.1 181.3 714.8 171.9 657.1 179.1 597.9 202 544.1 224.8 490.3 262.5 444.1 310.5 410.8V177.4C310.5 130.4 329.2 85.2 362.4 52 395.7 18.7 440.8 0 487.9 0 535 0 580.1 18.7 613.4 52 646.6 85.2 665.3 130.4 665.3 177.4V410.8C706.3 439.4 739.8 477.5 762.9 521.8 786.1 566.1 798.3 615.3 798.4 665.3ZM709.7 665.3C709.6 626.4 699.3 588.3 679.8 554.6 660.4 521 632.4 493 598.8 473.5 592.1 469.6 586.5 464 582.6 457.3 578.7 450.5 576.6 442.9 576.6 435.1V177.4C576.6 153.9 567.3 131.3 550.6 114.7 534 98.1 511.4 88.7 487.9 88.7 464.4 88.7 441.8 98.1 425.2 114.7 408.5 131.3 399.2 153.9 399.2 177.4V435.1C399.2 442.9 397.1 450.5 393.2 457.3 389.3 464 383.8 469.6 377 473.5 343.3 493 315.3 521 295.8 554.7 276.4 588.4 266.1 626.7 266.1 665.6 266.1 704.5 276.4 742.8 295.9 776.5 315.4 810.2 343.4 838.2 377.1 857.7 410.8 877.1 449.1 887.3 488 887.3 527 887.3 565.2 877 598.9 857.5 632.6 838 660.6 810 680.1 776.3 699.5 742.5 709.7 704.3 709.7 665.3ZM221.8 88.7H44.4C32.6 88.7 21.3 93.4 13 101.7 4.7 110 0 121.3 0 133.1 0 144.8 4.7 156.1 13 164.4 21.3 172.7 32.6 177.4 44.4 177.4H221.8C233.5 177.4 244.8 172.7 253.1 164.4 261.5 156.1 266.1 144.8 266.1 133.1 266.1 121.3 261.5 110 253.1 101.7 244.8 93.4 233.5 88.7 221.8 88.7ZM266.1 310.5C266.1 298.7 261.5 287.4 253.1 279.1 244.8 270.8 233.5 266.1 221.8 266.1H133.1C121.3 266.1 110 270.8 101.7 279.1 93.4 287.4 88.7 298.7 88.7 310.5 88.7 322.2 93.4 333.5 101.7 341.8 110 350.2 121.3 354.8 133.1 354.8H221.8C233.5 354.8 244.8 350.2 253.1 341.8 261.5 333.5 266.1 322.2 266.1 310.5Z", + "width": 806 + }, + "search": [ + "icon" + ] + }, + { + "uid": "415b9dee17fa463032aa6f9d83a6df07", + "css": "locationOutlined", + "code": 59478, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M191.8 423.4C191.8 296.4 300.4 193.5 434.4 193.5 568.4 193.5 677 296.4 677 423.4 677 550.3 568.4 653.2 434.4 653.2 300.4 653.2 191.8 550.3 191.8 423.4ZM434.4 266.1C342.8 266.1 268.4 336.5 268.4 423.4 268.4 510.2 342.8 580.6 434.4 580.6 526.1 580.6 600.4 510.2 600.4 423.4 600.4 336.5 526.1 266.1 434.4 266.1ZM1.5 368.1C19.6 160.1 203.1 0 423.4 0H445.5C665.8 0 849.2 160.1 867.3 368.1 877 479.8 840.6 590.7 765.7 677.5L520.9 961.2C476.2 1012.9 392.7 1012.9 348 961.2L103.2 677.5C28.3 590.7-8.2 479.8 1.5 368.1ZM423.4 72.6C243 72.6 92.7 203.7 77.9 374 69.8 467 100.1 559.4 162.5 631.6L407.3 915.2C421.3 931.5 447.6 931.5 461.6 915.2L706.4 631.6C768.7 559.4 799.1 467 791 374 776.1 203.7 625.9 72.6 445.5 72.6H423.4Z", + "width": 893 + }, + "search": [ + "icon" + ] } ] } \ No newline at end of file diff --git a/packages/design_system/lib/src/icons/sf_icons.dart b/packages/design_system/lib/src/icons/sf_icons.dart index 7447078f..62b691ef 100644 --- a/packages/design_system/lib/src/icons/sf_icons.dart +++ b/packages/design_system/lib/src/icons/sf_icons.dart @@ -87,6 +87,10 @@ class SFIcons { static const IconData watch = IconData(0xe843, fontFamily: _kFontFam, fontPackage: _kFontPkg); static const IconData handshake = IconData(0xe844, fontFamily: _kFontFam, fontPackage: _kFontPkg); static const IconData listen = IconData(0xe850, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData screenTime = IconData(0xe851, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData friendsCircle = IconData(0xe852, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData temperature = IconData(0xe853, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData locationOutlined = IconData(0xe856, fontFamily: _kFontFam, fontPackage: _kFontPkg); static const IconData share = IconData(0xe858, fontFamily: _kFontFam, fontPackage: _kFontPkg); static const IconData favoriteOutlined = IconData(0xe859, fontFamily: _kFontFam, fontPackage: _kFontPkg); static const IconData renovationSelected = IconData(0xe862, fontFamily: _kFontFam, fontPackage: _kFontPkg); @@ -102,7 +106,7 @@ class SFIcons { static const IconData videoCallCircle = IconData(0xe884, fontFamily: _kFontFam, fontPackage: _kFontPkg); static const IconData fallCircle = IconData(0xe885, fontFamily: _kFontFam, fontPackage: _kFontPkg); static const IconData medicationCircle = IconData(0xe886, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData activityCircle = IconData(0xe887, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData healthCircle = IconData(0xe887, fontFamily: _kFontFam, fontPackage: _kFontPkg); static const IconData rewardsCircle = IconData(0xe888, fontFamily: _kFontFam, fontPackage: _kFontPkg); static const IconData locateSfCircle = IconData(0xe889, fontFamily: _kFontFam, fontPackage: _kFontPkg); static const IconData chat = IconData(0xe88a, fontFamily: _kFontFam, fontPackage: _kFontPkg); diff --git a/packages/navigation/lib/app_routes.dart b/packages/navigation/lib/app_routes.dart index c5f5de4d..aff2367a 100644 --- a/packages/navigation/lib/app_routes.dart +++ b/packages/navigation/lib/app_routes.dart @@ -24,4 +24,5 @@ class AppRoutes { static const contacts = '$dashboardFunctions/contacts'; static const remoteConnection = '$dashboardFunctions/remote_connection'; + static const locateDevice = '$dashboardFunctions/locateDevice'; } From e4c0a23ded0a8a0b8559c8d9fcd6ea853674ef4f Mon Sep 17 00:00:00 2001 From: aitorarana Date: Thu, 12 Feb 2026 17:27:55 +0100 Subject: [PATCH 17/25] Added call watch dialog --- .../flutter/generated_plugin_registrant.cc | 4 + .../linux/flutter/generated_plugins.cmake | 1 + .../locate_device_request_entity.freezed.dart | 43 ++- .../features/functions/functions_screen.dart | 11 +- .../state/call_watch_view_model.dart | 61 ++++ .../state/call_watch_view_state.dart | 11 + .../state/call_watch_view_state.freezed.dart | 274 ++++++++++++++++++ .../functions/widgets/call_watch_dialog.dart | 71 +++++ modules/legacy/modules/functions/pubspec.yaml | 1 + 9 files changed, 450 insertions(+), 27 deletions(-) create mode 100644 modules/legacy/modules/functions/lib/src/features/functions/state/call_watch_view_model.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/functions/state/call_watch_view_state.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/functions/state/call_watch_view_state.freezed.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/functions/widgets/call_watch_dialog.dart diff --git a/apps/mobile_app/linux/flutter/generated_plugin_registrant.cc b/apps/mobile_app/linux/flutter/generated_plugin_registrant.cc index e71a16d2..f6f23bfe 100644 --- a/apps/mobile_app/linux/flutter/generated_plugin_registrant.cc +++ b/apps/mobile_app/linux/flutter/generated_plugin_registrant.cc @@ -6,6 +6,10 @@ #include "generated_plugin_registrant.h" +#include void fl_register_plugins(FlPluginRegistry* registry) { + g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); + url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); } diff --git a/apps/mobile_app/linux/flutter/generated_plugins.cmake b/apps/mobile_app/linux/flutter/generated_plugins.cmake index 2e1de87a..f16b4c34 100644 --- a/apps/mobile_app/linux/flutter/generated_plugins.cmake +++ b/apps/mobile_app/linux/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + url_launcher_linux ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/modules/legacy/modules/functions/lib/src/core/data/models/entities/locate_device_request_entity.freezed.dart b/modules/legacy/modules/functions/lib/src/core/data/models/entities/locate_device_request_entity.freezed.dart index 9f79acf1..5cf32e85 100644 --- a/modules/legacy/modules/functions/lib/src/core/data/models/entities/locate_device_request_entity.freezed.dart +++ b/modules/legacy/modules/functions/lib/src/core/data/models/entities/locate_device_request_entity.freezed.dart @@ -14,7 +14,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$LocateDeviceRequestEntity { - String get deviceName; dynamic get command; + String get deviceName; /// Create a copy of LocateDeviceRequestEntity /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -25,16 +25,16 @@ $LocateDeviceRequestEntityCopyWith get copyWith => _$ @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is LocateDeviceRequestEntity&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)&&const DeepCollectionEquality().equals(other.command, command)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is LocateDeviceRequestEntity&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)); } @override -int get hashCode => Object.hash(runtimeType,deviceName,const DeepCollectionEquality().hash(command)); +int get hashCode => Object.hash(runtimeType,deviceName); @override String toString() { - return 'LocateDeviceRequestEntity(deviceName: $deviceName, command: $command)'; + return 'LocateDeviceRequestEntity(deviceName: $deviceName)'; } @@ -45,7 +45,7 @@ abstract mixin class $LocateDeviceRequestEntityCopyWith<$Res> { factory $LocateDeviceRequestEntityCopyWith(LocateDeviceRequestEntity value, $Res Function(LocateDeviceRequestEntity) _then) = _$LocateDeviceRequestEntityCopyWithImpl; @useResult $Res call({ - String deviceName, dynamic command + String deviceName }); @@ -62,11 +62,10 @@ class _$LocateDeviceRequestEntityCopyWithImpl<$Res> /// Create a copy of LocateDeviceRequestEntity /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? deviceName = null,Object? command = freezed,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? deviceName = null,}) { return _then(_self.copyWith( deviceName: null == deviceName ? _self.deviceName : deviceName // ignore: cast_nullable_to_non_nullable -as String,command: freezed == command ? _self.command : command // ignore: cast_nullable_to_non_nullable -as dynamic, +as String, )); } @@ -151,10 +150,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String deviceName, dynamic command)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String deviceName)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _LocateDeviceRequestEntity() when $default != null: -return $default(_that.deviceName,_that.command);case _: +return $default(_that.deviceName);case _: return orElse(); } @@ -172,10 +171,10 @@ return $default(_that.deviceName,_that.command);case _: /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String deviceName, dynamic command) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String deviceName) $default,) {final _that = this; switch (_that) { case _LocateDeviceRequestEntity(): -return $default(_that.deviceName,_that.command);case _: +return $default(_that.deviceName);case _: throw StateError('Unexpected subclass'); } @@ -192,10 +191,10 @@ return $default(_that.deviceName,_that.command);case _: /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String deviceName, dynamic command)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String deviceName)? $default,) {final _that = this; switch (_that) { case _LocateDeviceRequestEntity() when $default != null: -return $default(_that.deviceName,_that.command);case _: +return $default(_that.deviceName);case _: return null; } @@ -207,11 +206,10 @@ return $default(_that.deviceName,_that.command);case _: class _LocateDeviceRequestEntity implements LocateDeviceRequestEntity { - const _LocateDeviceRequestEntity({required this.deviceName, this.command}); + const _LocateDeviceRequestEntity({required this.deviceName}); @override final String deviceName; -@override final dynamic command; /// Create a copy of LocateDeviceRequestEntity /// with the given fields replaced by the non-null parameter values. @@ -223,16 +221,16 @@ _$LocateDeviceRequestEntityCopyWith<_LocateDeviceRequestEntity> get copyWith => @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _LocateDeviceRequestEntity&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)&&const DeepCollectionEquality().equals(other.command, command)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _LocateDeviceRequestEntity&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName)); } @override -int get hashCode => Object.hash(runtimeType,deviceName,const DeepCollectionEquality().hash(command)); +int get hashCode => Object.hash(runtimeType,deviceName); @override String toString() { - return 'LocateDeviceRequestEntity(deviceName: $deviceName, command: $command)'; + return 'LocateDeviceRequestEntity(deviceName: $deviceName)'; } @@ -243,7 +241,7 @@ abstract mixin class _$LocateDeviceRequestEntityCopyWith<$Res> implements $Locat factory _$LocateDeviceRequestEntityCopyWith(_LocateDeviceRequestEntity value, $Res Function(_LocateDeviceRequestEntity) _then) = __$LocateDeviceRequestEntityCopyWithImpl; @override @useResult $Res call({ - String deviceName, dynamic command + String deviceName }); @@ -260,11 +258,10 @@ class __$LocateDeviceRequestEntityCopyWithImpl<$Res> /// Create a copy of LocateDeviceRequestEntity /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? deviceName = null,Object? command = freezed,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? deviceName = null,}) { return _then(_LocateDeviceRequestEntity( deviceName: null == deviceName ? _self.deviceName : deviceName // ignore: cast_nullable_to_non_nullable -as String,command: freezed == command ? _self.command : command // ignore: cast_nullable_to_non_nullable -as dynamic, +as String, )); } diff --git a/modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart b/modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart index 7f2d1a9c..6a58eece 100644 --- a/modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart +++ b/modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart @@ -1,6 +1,7 @@ import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:functions/src/features/functions/widgets/call_watch_dialog.dart'; import 'package:navigation/navigation.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; @@ -95,9 +96,11 @@ class FunctionsScreen extends ConsumerWidget { ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( - onPressed: (){}, - icon: Icons.call_outlined, - text: 'Call watch' + onPressed: (){showDialog(context: context, builder: (context)=>Dialog( + child: CallWatchDialog() + ));}, + icon: Icons.call_outlined, + text: 'Call watch' ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( @@ -109,7 +112,7 @@ class FunctionsScreen extends ConsumerWidget { AppSectionButton( onPressed: (){}, icon: Icons.app_registration_sharp, - text: 'Apps supervision' + text: 'Apps surveillance' ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( diff --git a/modules/legacy/modules/functions/lib/src/features/functions/state/call_watch_view_model.dart b/modules/legacy/modules/functions/lib/src/features/functions/state/call_watch_view_model.dart new file mode 100644 index 00000000..cc749ff4 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/functions/state/call_watch_view_model.dart @@ -0,0 +1,61 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:functions/src/features/functions/state/call_watch_view_state.dart'; +import 'package:url_launcher/url_launcher.dart'; + +final callWatchViewModelProvider = +NotifierProvider.autoDispose( + CallWatchViewModel.new, +); + +class CallWatchViewModel extends Notifier { + + late final TextEditingController phoneController; + + static final RegExp _phoneRegex = RegExp(r'^\+?\d{6,15}$'); + + @override + CallWatchViewState build() { + + phoneController = TextEditingController(); + + phoneController.addListener(_onPhoneChanged); + + ref.onDispose(disposeControllers); + + return const CallWatchViewState(); + } + + void _onPhoneChanged() { + final text = phoneController.text; + if (text == state.phone) return; + + state = state.copyWith(phone: text, errorMessage: ''); + } + + void call() async { + final phone = state.phone; + if (phone.isEmpty){ + state = state.copyWith(errorMessage: 'errorMessagePhoneIsEmpty'); + return; + } + if (!_phoneRegex.hasMatch(phone)) { + state = state.copyWith(errorMessage: 'errorMessagePhoneIsInvalid'); + return; + } + + final url = Uri(scheme: 'tel', path: phone); + + if (await canLaunchUrl(url)) { + launchUrl(url); + } else { + throw 'Could not launch $url'; + } + } + + void disposeControllers() { + phoneController.removeListener(_onPhoneChanged); + + phoneController.dispose(); + } +} diff --git a/modules/legacy/modules/functions/lib/src/features/functions/state/call_watch_view_state.dart b/modules/legacy/modules/functions/lib/src/features/functions/state/call_watch_view_state.dart new file mode 100644 index 00000000..1b6d38b4 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/functions/state/call_watch_view_state.dart @@ -0,0 +1,11 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'call_watch_view_state.freezed.dart'; + +@freezed +abstract class CallWatchViewState with _$CallWatchViewState { + const factory CallWatchViewState({ + @Default('') String phone, + @Default('') String errorMessage, + }) = _CallWatchViewState; +} diff --git a/modules/legacy/modules/functions/lib/src/features/functions/state/call_watch_view_state.freezed.dart b/modules/legacy/modules/functions/lib/src/features/functions/state/call_watch_view_state.freezed.dart new file mode 100644 index 00000000..09f3d35a --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/functions/state/call_watch_view_state.freezed.dart @@ -0,0 +1,274 @@ +// 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 'call_watch_view_state.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$CallWatchViewState { + + String get phone; String get errorMessage; +/// Create a copy of CallWatchViewState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$CallWatchViewStateCopyWith get copyWith => _$CallWatchViewStateCopyWithImpl(this as CallWatchViewState, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is CallWatchViewState&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); +} + + +@override +int get hashCode => Object.hash(runtimeType,phone,errorMessage); + +@override +String toString() { + return 'CallWatchViewState(phone: $phone, errorMessage: $errorMessage)'; +} + + +} + +/// @nodoc +abstract mixin class $CallWatchViewStateCopyWith<$Res> { + factory $CallWatchViewStateCopyWith(CallWatchViewState value, $Res Function(CallWatchViewState) _then) = _$CallWatchViewStateCopyWithImpl; +@useResult +$Res call({ + String phone, String errorMessage +}); + + + + +} +/// @nodoc +class _$CallWatchViewStateCopyWithImpl<$Res> + implements $CallWatchViewStateCopyWith<$Res> { + _$CallWatchViewStateCopyWithImpl(this._self, this._then); + + final CallWatchViewState _self; + final $Res Function(CallWatchViewState) _then; + +/// Create a copy of CallWatchViewState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? phone = null,Object? errorMessage = null,}) { + return _then(_self.copyWith( +phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [CallWatchViewState]. +extension CallWatchViewStatePatterns on CallWatchViewState { +/// 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( _CallWatchViewState value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _CallWatchViewState() 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( _CallWatchViewState value) $default,){ +final _that = this; +switch (_that) { +case _CallWatchViewState(): +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( _CallWatchViewState value)? $default,){ +final _that = this; +switch (_that) { +case _CallWatchViewState() 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 phone, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _CallWatchViewState() when $default != null: +return $default(_that.phone,_that.errorMessage);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 phone, String errorMessage) $default,) {final _that = this; +switch (_that) { +case _CallWatchViewState(): +return $default(_that.phone,_that.errorMessage);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 phone, String errorMessage)? $default,) {final _that = this; +switch (_that) { +case _CallWatchViewState() when $default != null: +return $default(_that.phone,_that.errorMessage);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _CallWatchViewState implements CallWatchViewState { + const _CallWatchViewState({this.phone = '', this.errorMessage = ''}); + + +@override@JsonKey() final String phone; +@override@JsonKey() final String errorMessage; + +/// Create a copy of CallWatchViewState +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$CallWatchViewStateCopyWith<_CallWatchViewState> get copyWith => __$CallWatchViewStateCopyWithImpl<_CallWatchViewState>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _CallWatchViewState&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); +} + + +@override +int get hashCode => Object.hash(runtimeType,phone,errorMessage); + +@override +String toString() { + return 'CallWatchViewState(phone: $phone, errorMessage: $errorMessage)'; +} + + +} + +/// @nodoc +abstract mixin class _$CallWatchViewStateCopyWith<$Res> implements $CallWatchViewStateCopyWith<$Res> { + factory _$CallWatchViewStateCopyWith(_CallWatchViewState value, $Res Function(_CallWatchViewState) _then) = __$CallWatchViewStateCopyWithImpl; +@override @useResult +$Res call({ + String phone, String errorMessage +}); + + + + +} +/// @nodoc +class __$CallWatchViewStateCopyWithImpl<$Res> + implements _$CallWatchViewStateCopyWith<$Res> { + __$CallWatchViewStateCopyWithImpl(this._self, this._then); + + final _CallWatchViewState _self; + final $Res Function(_CallWatchViewState) _then; + +/// Create a copy of CallWatchViewState +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? phone = null,Object? errorMessage = null,}) { + return _then(_CallWatchViewState( +phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/functions/lib/src/features/functions/widgets/call_watch_dialog.dart b/modules/legacy/modules/functions/lib/src/features/functions/widgets/call_watch_dialog.dart new file mode 100644 index 00000000..5276a08d --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/functions/widgets/call_watch_dialog.dart @@ -0,0 +1,71 @@ +import 'package:design_system/design_system.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:functions/src/features/functions/state/call_watch_view_model.dart'; +import 'package:sf_localizations/sf_localizations.dart'; +import 'package:utils/utils.dart'; + +class CallWatchDialog extends ConsumerWidget { + + @override + Widget build(BuildContext context, WidgetRef ref) { + + final viewModel = ref.read(callWatchViewModelProvider.notifier); + final viewState = ref.watch(callWatchViewModelProvider); + + return Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 26, vertical: 20), + big: EdgeInsets.symmetric(horizontal: 24, vertical: 18) + ), + width: SizeUtils.getByScreen(small: 390, big: 380), + height: SizeUtils.getByScreen(small: 250, big: 243), + child: Column( + children: [ + Stack( + children: [ + Center(child: Text(context.translate('Call watch'), + textAlign: TextAlign.center, + style: TextStyle(fontSize: SizeUtils.getByScreen(small: 19, big: 18)), + )), + Align( + alignment: Alignment.centerRight, + child: IconButton( + onPressed: (){Navigator.pop(context);}, + icon: Icon(Icons.close, color: Color(0xFF588EA5)), + ) + ) + ], + ), + SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), + CustomTextField( + controller: viewModel.phoneController, + hint: context.translate('Main contact phone number'), + keyboardType: TextInputType.number, + ), + if (viewState.errorMessage.isNotEmpty) + Padding( + padding: const EdgeInsets.only(top: 12), + child: Text( + viewState.errorMessage, + textAlign: TextAlign.center, + style: TextStyle( + color: Theme.of(context).colorScheme.error, + fontSize: 13, + ), + ), + ), + SizedBox(height: SizeUtils.getByScreen(small: 28, big: 27)), + PrimaryButton( + onPressed: viewModel.call, + text: context.translate('Call me'), + color: Color(0xFF588EA5), + height: SizeUtils.getByScreen(small: 38, big: 36), + radius: SizeUtils.getByScreen(small: 32, big: 34), + ), + ], + ), + ); + } + +} \ No newline at end of file diff --git a/modules/legacy/modules/functions/pubspec.yaml b/modules/legacy/modules/functions/pubspec.yaml index d6fedac9..3f784c19 100644 --- a/modules/legacy/modules/functions/pubspec.yaml +++ b/modules/legacy/modules/functions/pubspec.yaml @@ -50,6 +50,7 @@ dependencies: dio: ^5.9.0 json_annotation: ^4.9.0 json_serializable: ^6.11.2 + url_launcher: ^6.3.2 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. From e5818952466777119848e1e21d8ff264dc5969ce Mon Sep 17 00:00:00 2001 From: aitorarana Date: Mon, 16 Feb 2026 08:54:15 +0100 Subject: [PATCH 18/25] Refactor UserEntity to legacy_shared package --- .../datasource/account_remote_datasource.dart | 4 +- .../account_remote_datasource_impl.dart | 31 +- .../data/models/entities/user_entity.dart | 23 -- .../models/entities/user_entity.freezed.dart | 310 ------------------ .../models/get_app_users_response_model.dart | 2 +- .../get_logged_user_response_model.dart | 2 +- .../repositories/account_repository_impl.dart | 7 +- .../repositories/account_repository.dart | 4 +- .../domain/get_app_users_use_case.dart | 2 +- .../domain/get_app_users_use_case_impl.dart | 2 +- .../presentation/app_users_screen.dart | 2 +- .../state/app_users_view_model.dart | 15 +- .../state/app_users_view_state.dart | 2 +- .../state/linked_devices_view_model.dart | 13 +- .../state/linked_devices_view_state.dart | 2 +- .../domain/get_logged_user_use_case.dart | 5 - .../domain/get_logged_user_use_case_impl.dart | 13 - .../get_logged_user_use_case_provider.dart | 9 - .../state/personal_data_view_model.dart | 8 +- .../state/personal_data_view_state.dart | 3 +- .../src/providers/logged_user_provider.dart | 4 +- 21 files changed, 27 insertions(+), 436 deletions(-) delete mode 100644 modules/legacy/modules/account/lib/src/core/data/models/entities/user_entity.dart delete mode 100644 modules/legacy/modules/account/lib/src/core/data/models/entities/user_entity.freezed.dart delete mode 100644 modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case.dart delete mode 100644 modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case_impl.dart delete mode 100644 modules/legacy/modules/account/lib/src/features/personal_data/presentation/providers/get_logged_user_use_case_provider.dart diff --git a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart index c91a7b51..17ed7634 100644 --- a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart +++ b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart @@ -1,11 +1,9 @@ import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart'; import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; -import 'package:account/src/core/data/models/entities/user_entity.dart'; +import 'package:legacy_shared/legacy_shared.dart'; abstract class AccountRemoteDatasource { - Future getLoggedUser({required String token}); - Future> getLinkedDevices({required String userId}); Future deleteDevice({required String userId, required String deviceId}); diff --git a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart index 204b8dea..18596472 100644 --- a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart +++ b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart @@ -3,13 +3,12 @@ import 'dart:convert'; import 'package:account/src/core/data/datasource/account_remote_datasource.dart'; import 'package:account/src/core/data/models/get_app_users_response_model.dart'; import 'package:account/src/core/data/models/get_linked_devices_response_model.dart'; -import 'package:account/src/core/data/models/get_logged_user_response_model.dart'; import 'package:account/src/core/data/models/update_device_request_model.dart'; import 'package:account/src/core/data/models/update_user_request_model.dart'; import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart'; import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; -import 'package:account/src/core/data/models/entities/user_entity.dart'; +import 'package:legacy_shared/legacy_shared.dart'; import 'package:dio/dio.dart'; // import 'package:flutter/material.dart'; import 'package:sf_infrastructure/sf_infrastructure.dart'; @@ -50,33 +49,6 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource { } } - @override - Future getLoggedUser({required String token}) async { - try { - final response = await _repository.get>( - '/users/api/auth/me', - ); - final data = response.data!['item']; - if (data == null || data.isEmpty) { - throw Exception('Empty response from /auth/me'); - } - - final model = GetLoggedUserResponseModel.fromJson(data); - /*final model = GetLoggedUserResponseModel(item: - GetLoggedUserItemResponseModel( - id: '1111', - firstName: 'Juan', - email: 'juan@test.com', - phone: '111111111'));*/ - return model.toEntity(); - } on DioException catch (error) { - throw _mapDioError( - error, - defaultMessage: error.message ?? 'Error getting logged user', - ); - } - } - @override Future deleteDevice({required String userId, required String deviceId}) async { try { @@ -117,7 +89,6 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource { @override Future> getAppUsers({required String userId}) async { - throw UnimplementedError(); try { final response = await _repository.get>( '/$userId/devices', diff --git a/modules/legacy/modules/account/lib/src/core/data/models/entities/user_entity.dart b/modules/legacy/modules/account/lib/src/core/data/models/entities/user_entity.dart deleted file mode 100644 index ccea2ef5..00000000 --- a/modules/legacy/modules/account/lib/src/core/data/models/entities/user_entity.dart +++ /dev/null @@ -1,23 +0,0 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; - -part 'user_entity.freezed.dart'; - -@freezed -abstract class UserEntity with _$UserEntity { - const factory UserEntity({ - required String id, - required String delegationId, - required String email, - required String createdAt, - required String updatedAt, - required String status, - required String role, - required String lastLogin, - required String currentLogin, - required String language, - required String firstName, - required String lastName, - required String hasApiKey, - required String phone, - }) = _UserEntity; -} diff --git a/modules/legacy/modules/account/lib/src/core/data/models/entities/user_entity.freezed.dart b/modules/legacy/modules/account/lib/src/core/data/models/entities/user_entity.freezed.dart deleted file mode 100644 index 5b9e7aee..00000000 --- a/modules/legacy/modules/account/lib/src/core/data/models/entities/user_entity.freezed.dart +++ /dev/null @@ -1,310 +0,0 @@ -// 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 'user_entity.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; -/// @nodoc -mixin _$UserEntity { - - String get id; String get delegationId; String get email; String get createdAt; String get updatedAt; String get status; String get role; String get lastLogin; String get currentLogin; String get language; String get firstName; String get lastName; String get hasApiKey; String get phone; -/// Create a copy of UserEntity -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$UserEntityCopyWith get copyWith => _$UserEntityCopyWithImpl(this as UserEntity, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is UserEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone)); -} - - -@override -int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone); - -@override -String toString() { - return 'UserEntity(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)'; -} - - -} - -/// @nodoc -abstract mixin class $UserEntityCopyWith<$Res> { - factory $UserEntityCopyWith(UserEntity value, $Res Function(UserEntity) _then) = _$UserEntityCopyWithImpl; -@useResult -$Res call({ - String id, String delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone -}); - - - - -} -/// @nodoc -class _$UserEntityCopyWithImpl<$Res> - implements $UserEntityCopyWith<$Res> { - _$UserEntityCopyWithImpl(this._self, this._then); - - final UserEntity _self; - final $Res Function(UserEntity) _then; - -/// Create a copy of UserEntity -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? delegationId = null,Object? email = null,Object? createdAt = null,Object? updatedAt = null,Object? status = null,Object? role = null,Object? lastLogin = null,Object? currentLogin = null,Object? language = null,Object? firstName = null,Object? lastName = null,Object? hasApiKey = null,Object? phone = null,}) { - return _then(_self.copyWith( -id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable -as String,delegationId: null == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable -as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable -as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable -as String,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable -as String,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable -as String,role: null == role ? _self.role : role // ignore: cast_nullable_to_non_nullable -as String,lastLogin: null == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable -as String,currentLogin: null == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable -as String,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable -as String,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable -as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable -as String,hasApiKey: null == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable -as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable -as String, - )); -} - -} - - -/// Adds pattern-matching-related methods to [UserEntity]. -extension UserEntityPatterns on UserEntity { -/// 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( _UserEntity value)? $default,{required TResult orElse(),}){ -final _that = this; -switch (_that) { -case _UserEntity() 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( _UserEntity value) $default,){ -final _that = this; -switch (_that) { -case _UserEntity(): -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( _UserEntity value)? $default,){ -final _that = this; -switch (_that) { -case _UserEntity() 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 delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone)? $default,{required TResult orElse(),}) {final _that = this; -switch (_that) { -case _UserEntity() when $default != null: -return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);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 delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone) $default,) {final _that = this; -switch (_that) { -case _UserEntity(): -return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);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 delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone)? $default,) {final _that = this; -switch (_that) { -case _UserEntity() when $default != null: -return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _: - return null; - -} -} - -} - -/// @nodoc - - -class _UserEntity implements UserEntity { - const _UserEntity({required this.id, required this.delegationId, required this.email, required this.createdAt, required this.updatedAt, required this.status, required this.role, required this.lastLogin, required this.currentLogin, required this.language, required this.firstName, required this.lastName, required this.hasApiKey, required this.phone}); - - -@override final String id; -@override final String delegationId; -@override final String email; -@override final String createdAt; -@override final String updatedAt; -@override final String status; -@override final String role; -@override final String lastLogin; -@override final String currentLogin; -@override final String language; -@override final String firstName; -@override final String lastName; -@override final String hasApiKey; -@override final String phone; - -/// Create a copy of UserEntity -/// with the given fields replaced by the non-null parameter values. -@override @JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -_$UserEntityCopyWith<_UserEntity> get copyWith => __$UserEntityCopyWithImpl<_UserEntity>(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _UserEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone)); -} - - -@override -int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone); - -@override -String toString() { - return 'UserEntity(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)'; -} - - -} - -/// @nodoc -abstract mixin class _$UserEntityCopyWith<$Res> implements $UserEntityCopyWith<$Res> { - factory _$UserEntityCopyWith(_UserEntity value, $Res Function(_UserEntity) _then) = __$UserEntityCopyWithImpl; -@override @useResult -$Res call({ - String id, String delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone -}); - - - - -} -/// @nodoc -class __$UserEntityCopyWithImpl<$Res> - implements _$UserEntityCopyWith<$Res> { - __$UserEntityCopyWithImpl(this._self, this._then); - - final _UserEntity _self; - final $Res Function(_UserEntity) _then; - -/// Create a copy of UserEntity -/// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? delegationId = null,Object? email = null,Object? createdAt = null,Object? updatedAt = null,Object? status = null,Object? role = null,Object? lastLogin = null,Object? currentLogin = null,Object? language = null,Object? firstName = null,Object? lastName = null,Object? hasApiKey = null,Object? phone = null,}) { - return _then(_UserEntity( -id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable -as String,delegationId: null == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable -as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable -as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable -as String,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable -as String,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable -as String,role: null == role ? _self.role : role // ignore: cast_nullable_to_non_nullable -as String,lastLogin: null == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable -as String,currentLogin: null == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable -as String,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable -as String,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable -as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable -as String,hasApiKey: null == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable -as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable -as String, - )); -} - - -} - -// dart format on diff --git a/modules/legacy/modules/account/lib/src/core/data/models/get_app_users_response_model.dart b/modules/legacy/modules/account/lib/src/core/data/models/get_app_users_response_model.dart index dd5c5772..15f84333 100644 --- a/modules/legacy/modules/account/lib/src/core/data/models/get_app_users_response_model.dart +++ b/modules/legacy/modules/account/lib/src/core/data/models/get_app_users_response_model.dart @@ -1,4 +1,4 @@ -import 'package:account/src/core/data/models/entities/user_entity.dart'; +import 'package:legacy_shared/legacy_shared.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'get_app_users_response_model.freezed.dart'; diff --git a/modules/legacy/modules/account/lib/src/core/data/models/get_logged_user_response_model.dart b/modules/legacy/modules/account/lib/src/core/data/models/get_logged_user_response_model.dart index 7ba4f44a..5f2b81f5 100644 --- a/modules/legacy/modules/account/lib/src/core/data/models/get_logged_user_response_model.dart +++ b/modules/legacy/modules/account/lib/src/core/data/models/get_logged_user_response_model.dart @@ -1,4 +1,4 @@ -import 'package:account/src/core/data/models/entities/user_entity.dart'; +import 'package:legacy_shared/legacy_shared.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'get_logged_user_response_model.freezed.dart'; diff --git a/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart b/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart index 031b5742..d414e245 100644 --- a/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart +++ b/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart @@ -3,7 +3,7 @@ import 'package:account/src/core/domain/repositories/account_repository.dart'; import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart'; import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; -import 'package:account/src/core/data/models/entities/user_entity.dart'; +import 'package:legacy_shared/legacy_shared.dart'; class AccountRepositoryImpl implements AccountRepository { const AccountRepositoryImpl(this._remote); @@ -25,11 +25,6 @@ class AccountRepositoryImpl implements AccountRepository { return _remote.updateDevice(userId: userId, deviceId: deviceId, request: request); } - @override - Future getLoggedUser({required String token}) { - return _remote.getLoggedUser(token: token); - } - @override Future updateUser({required String userId, required UpdateUserRequestEntity request}) { return _remote.updateUser(userId: userId, request: request); diff --git a/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart b/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart index e6c4d87a..49b3d70e 100644 --- a/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart +++ b/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart @@ -1,7 +1,7 @@ import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart'; import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; -import 'package:account/src/core/data/models/entities/user_entity.dart'; +import 'package:legacy_shared/legacy_shared.dart'; abstract class AccountRepository { Future> getLinkedDevices({required String userId}); @@ -10,8 +10,6 @@ abstract class AccountRepository { Future updateDevice({required String userId, required String deviceId, required UpdateDeviceRequestEntity request}); - Future getLoggedUser({required String token}); - Future updateUser({required String userId, required UpdateUserRequestEntity request}); Future> getAppUsers({required String userId}); diff --git a/modules/legacy/modules/account/lib/src/features/app_users/domain/get_app_users_use_case.dart b/modules/legacy/modules/account/lib/src/features/app_users/domain/get_app_users_use_case.dart index 42d0896d..88bcc31e 100644 --- a/modules/legacy/modules/account/lib/src/features/app_users/domain/get_app_users_use_case.dart +++ b/modules/legacy/modules/account/lib/src/features/app_users/domain/get_app_users_use_case.dart @@ -1,4 +1,4 @@ -import 'package:account/src/core/data/models/entities/user_entity.dart'; +import 'package:legacy_shared/legacy_shared.dart'; abstract class GetAppUsersUseCase { Future> getAppUsers({required String userId}); diff --git a/modules/legacy/modules/account/lib/src/features/app_users/domain/get_app_users_use_case_impl.dart b/modules/legacy/modules/account/lib/src/features/app_users/domain/get_app_users_use_case_impl.dart index d446e24b..c1d3d277 100644 --- a/modules/legacy/modules/account/lib/src/features/app_users/domain/get_app_users_use_case_impl.dart +++ b/modules/legacy/modules/account/lib/src/features/app_users/domain/get_app_users_use_case_impl.dart @@ -1,4 +1,4 @@ -import 'package:account/src/core/data/models/entities/user_entity.dart'; +import 'package:legacy_shared/legacy_shared.dart'; import 'package:account/src/core/domain/repositories/account_repository.dart'; import 'package:account/src/features/app_users/domain/get_app_users_use_case.dart'; diff --git a/modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart b/modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart index 48bf1a18..41c1698b 100644 --- a/modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart @@ -1,8 +1,8 @@ -import 'package:account/src/core/data/models/entities/user_entity.dart'; import 'package:account/src/features/app_users/presentation/state/app_users_view_model.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:legacy_shared/legacy_shared.dart'; import 'package:navigation/navigation.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; diff --git a/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_model.dart b/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_model.dart index 990a985b..06b6eda5 100644 --- a/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_model.dart +++ b/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_model.dart @@ -1,11 +1,9 @@ -import 'package:account/src/core/data/models/entities/user_entity.dart'; +import 'package:legacy_shared/legacy_shared.dart'; import 'package:account/src/features/app_users/domain/delete_app_user_use_case.dart'; import 'package:account/src/features/app_users/domain/get_app_users_use_case.dart'; import 'package:account/src/features/app_users/presentation/providers/delete_app_user_use_case_provider.dart'; import 'package:account/src/features/app_users/presentation/providers/get_app_users_use_case_provider.dart'; import 'package:account/src/features/app_users/presentation/state/app_users_view_state.dart'; -import 'package:account/src/features/personal_data/domain/get_logged_user_use_case.dart'; -import 'package:account/src/features/personal_data/presentation/providers/get_logged_user_use_case_provider.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; // import 'package:sf_localizations/sf_localizations.dart'; @@ -15,20 +13,19 @@ NotifierProvider.autoDispose( ); class AppUsersViewModel extends Notifier { - late final GetLoggedUserUseCase _getLoggedUserUseCase; late final GetAppUsersUseCase _getAppUsersUseCase; late final DeleteAppUserUseCase _deleteAppUserUseCase; @override AppUsersViewState build() { - _getLoggedUserUseCase = ref.read(getLoggedUserUseCaseProvider); _getAppUsersUseCase = ref.read(getAppUsersUseCaseProvider); _deleteAppUserUseCase = ref.read(deleteAppUserUseCaseProvider); - _getLoggedUserUseCase.getLoggedUser(token: 'test').then((user){ - setUser(user); - return _getAppUsersUseCase.getAppUsers(userId: user.id); - }).then(setAppUsers); + ref.watch(loggedUserProvider.future) + .then((user){ + setUser(user); + return _getAppUsersUseCase.getAppUsers(userId: user.id); + }).then(setAppUsers); return const AppUsersViewState(); } diff --git a/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_state.dart b/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_state.dart index a6e74fff..af3c856e 100644 --- a/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_state.dart +++ b/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_state.dart @@ -1,4 +1,4 @@ -import 'package:account/src/core/data/models/entities/user_entity.dart'; +import 'package:legacy_shared/legacy_shared.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'app_users_view_state.freezed.dart'; diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_model.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_model.dart index 42fdaf8c..14432580 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_model.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_model.dart @@ -1,4 +1,3 @@ -import 'package:account/src/core/data/models/entities/user_entity.dart'; import 'package:account/src/features/linked_devices/domain/delete_device_use_case.dart'; import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart'; @@ -8,10 +7,9 @@ import 'package:account/src/features/linked_devices/presentation/providers/delet import 'package:account/src/features/linked_devices/presentation/providers/get_linked_devices_use_case_provider.dart'; import 'package:account/src/features/linked_devices/presentation/providers/update_device_use_case_provider.dart'; import 'package:account/src/features/linked_devices/presentation/state/linked_devices_view_state.dart'; -import 'package:account/src/features/personal_data/domain/get_logged_user_use_case.dart'; -import 'package:account/src/features/personal_data/presentation/providers/get_logged_user_use_case_provider.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:legacy_shared/legacy_shared.dart'; // import 'package:sf_localizations/sf_localizations.dart'; final linkedDevicesViewModelProvider = @@ -20,7 +18,6 @@ NotifierProvider.autoDispose( ); class LinkedDevicesViewModel extends Notifier { - late final GetLoggedUserUseCase _getLoggedUserUseCase; late final GetLinkedDevicesUseCase _getLinkedDevicesUseCase; late final UpdateDeviceUseCase _updateDeviceUseCase; late final DeleteDeviceUseCase _deleteDeviceUseCase; @@ -29,7 +26,6 @@ class LinkedDevicesViewModel extends Notifier { @override LinkedDevicesViewState build() { - _getLoggedUserUseCase = ref.read(getLoggedUserUseCaseProvider); _getLinkedDevicesUseCase = ref.read(getLinkedDevicesUseCaseProvider); _updateDeviceUseCase = ref.read(updateDeviceUseCaseProvider); _deleteDeviceUseCase = ref.read(deleteDeviceUseCaseProvider); @@ -37,12 +33,11 @@ class LinkedDevicesViewModel extends Notifier { deviceNameController = TextEditingController(); deviceNameController.addListener(_onDeviceNameChanged); - _getLoggedUserUseCase.getLoggedUser(token: 'test') - .then((UserEntity user){ + ref.watch(loggedUserProvider.future) + .then((user){ setUser(user); return _getLinkedDevicesUseCase.getLinkedDevices(userId: user.id); - }) - .then(setLinkedDevices); + }).then(setLinkedDevices); ref.onDispose(disposeControllers); diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_state.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_state.dart index e76f5a0c..26a091f8 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_state.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_state.dart @@ -1,6 +1,6 @@ -import 'package:account/src/core/data/models/entities/user_entity.dart'; import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:legacy_shared/legacy_shared.dart'; part 'linked_devices_view_state.freezed.dart'; diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case.dart b/modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case.dart deleted file mode 100644 index 155dbc19..00000000 --- a/modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case.dart +++ /dev/null @@ -1,5 +0,0 @@ -import 'package:account/src/core/data/models/entities/user_entity.dart'; - -abstract class GetLoggedUserUseCase { - Future getLoggedUser({required String token}); -} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case_impl.dart b/modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case_impl.dart deleted file mode 100644 index 72794bfe..00000000 --- a/modules/legacy/modules/account/lib/src/features/personal_data/domain/get_logged_user_use_case_impl.dart +++ /dev/null @@ -1,13 +0,0 @@ -import 'package:account/src/core/domain/repositories/account_repository.dart'; -import 'package:account/src/core/data/models/entities/user_entity.dart'; -import 'package:account/src/features/personal_data/domain/get_logged_user_use_case.dart'; - -class GetLoggedUserUseCaseImpl implements GetLoggedUserUseCase { - GetLoggedUserUseCaseImpl(this._repository); - - final AccountRepository _repository; - @override - Future getLoggedUser({required String token}) { - return _repository.getLoggedUser(token: token); - } -} diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/providers/get_logged_user_use_case_provider.dart b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/providers/get_logged_user_use_case_provider.dart deleted file mode 100644 index eb501024..00000000 --- a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/providers/get_logged_user_use_case_provider.dart +++ /dev/null @@ -1,9 +0,0 @@ -import 'package:account/src/core/providers/account_repository_provider.dart'; -import 'package:account/src/features/personal_data/domain/get_logged_user_use_case.dart'; -import 'package:account/src/features/personal_data/domain/get_logged_user_use_case_impl.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; - -final getLoggedUserUseCaseProvider = Provider.autoDispose((ref) { - final authRepository = ref.read(accountRepositoryProvider); - return GetLoggedUserUseCaseImpl(authRepository); -}); diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_model.dart b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_model.dart index 75fc5e30..3404a946 100644 --- a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_model.dart +++ b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_model.dart @@ -1,12 +1,10 @@ import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; -import 'package:account/src/core/data/models/entities/user_entity.dart'; -import 'package:account/src/features/personal_data/domain/get_logged_user_use_case.dart'; import 'package:account/src/features/personal_data/domain/update_user_use_case.dart'; -import 'package:account/src/features/personal_data/presentation/providers/get_logged_user_use_case_provider.dart'; import 'package:account/src/features/personal_data/presentation/providers/update_user_use_case_provider.dart'; import 'package:account/src/features/personal_data/presentation/state/personal_data_view_state.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:legacy_shared/legacy_shared.dart'; // import 'package:sf_localizations/sf_localizations.dart'; final personalDataViewModelProvider = @@ -15,7 +13,6 @@ NotifierProvider.autoDispose( ); class PersonalDataViewModel extends Notifier { - late final GetLoggedUserUseCase _getUserUseCase; late final UpdateUserUseCase _updateUserUseCase; late final TextEditingController nameController; @@ -25,7 +22,6 @@ class PersonalDataViewModel extends Notifier { @override PersonalDataViewState build() { - _getUserUseCase = ref.read(getLoggedUserUseCaseProvider); _updateUserUseCase = ref.read(updateUserUseCaseProvider); nameController = TextEditingController(); @@ -40,7 +36,7 @@ class PersonalDataViewModel extends Notifier { passwordController = TextEditingController(); passwordController.addListener(_onPasswordChanged); - _getUserUseCase.getLoggedUser(token: 'test') + ref.watch(loggedUserProvider.future) .then(setUser); ref.onDispose(disposeControllers); diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_state.dart b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_state.dart index 2e278ef8..49e1c174 100644 --- a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_state.dart +++ b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_state.dart @@ -1,5 +1,6 @@ -import 'package:account/src/core/data/models/entities/user_entity.dart'; + import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:legacy_shared/legacy_shared.dart'; part 'personal_data_view_state.freezed.dart'; diff --git a/modules/legacy/packages/legacy_shared/lib/src/providers/logged_user_provider.dart b/modules/legacy/packages/legacy_shared/lib/src/providers/logged_user_provider.dart index 9b8a5fee..dde1f9ca 100644 --- a/modules/legacy/packages/legacy_shared/lib/src/providers/logged_user_provider.dart +++ b/modules/legacy/packages/legacy_shared/lib/src/providers/logged_user_provider.dart @@ -5,7 +5,7 @@ import 'package:legacy_shared/src/data/models/entities/user_entity.dart'; import 'legacy_shared_repository_provider.dart'; -final loggedUserProvider = AsyncNotifierProvider.autoDispose( +final loggedUserProvider = AsyncNotifierProvider( LoggedUserNotifier.new, ); @@ -13,7 +13,7 @@ class LoggedUserNotifier extends AsyncNotifier { late final legacySharedRepository; @override - FutureOr build() { + Future build() { legacySharedRepository = ref.read(legacySharedRepositoryProvider); return legacySharedRepository.getLoggedUser(token: ''); } From f76a88a53c4ef9134bfaf19529034ee4edef4283 Mon Sep 17 00:00:00 2001 From: aitorarana Date: Mon, 16 Feb 2026 11:20:33 +0100 Subject: [PATCH 19/25] Fix translations and icons Added page layout to customer service screens --- .../lib/src/presentation/contact_screen.dart | 178 ++++++++--------- .../presentation/customer_service_screen.dart | 180 +++++++++--------- .../state/contact_view_model.dart | 22 ++- .../state/contact_view_state.dart | 2 +- .../state/contact_view_state.freezed.dart | 42 ++-- .../lib/src/widgets/layouts/page_layout.dart | 27 ++- packages/sf_localizations/assets/l10n/en.json | 5 +- packages/sf_localizations/assets/l10n/es.json | 11 +- .../lib/src/generated/i18n.dart | 2 + 9 files changed, 236 insertions(+), 233 deletions(-) diff --git a/modules/legacy/modules/customer_service/lib/src/presentation/contact_screen.dart b/modules/legacy/modules/customer_service/lib/src/presentation/contact_screen.dart index d5507856..ce9f2eac 100644 --- a/modules/legacy/modules/customer_service/lib/src/presentation/contact_screen.dart +++ b/modules/legacy/modules/customer_service/lib/src/presentation/contact_screen.dart @@ -2,26 +2,11 @@ import 'package:customer_service/src/presentation/state/contact_view_model.dart' import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:legacy_shared/legacy_shared.dart'; import 'package:navigation/navigation.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; -const Map country = { - 'SPAIN': 'España', - 'PORTUGAL': 'Portugal', - 'FRANCE': 'France', - 'ITALIA': 'Italia', - 'GERMANY': 'Deutschland', - 'OTHER': I18n.other, -}; - -const Map channel = { - 'ONLINE_SHOP': I18n.channelOnline, - 'AMAZON': I18n.channelAmazon, - 'STORE': I18n.channelStore, - 'OTHER': I18n.other, -}; - class ContactScreen extends ConsumerWidget { final NavigationContract navigationContract; @@ -34,87 +19,88 @@ class ContactScreen extends ConsumerWidget { final vm = ref.read(contactViewModelProvider.notifier); final viewState = ref.watch(contactViewModelProvider); - return Scaffold( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), - body: SafeArea( - child: Container( - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 38, vertical: 14), - big: EdgeInsets.symmetric(horizontal: 36, vertical: 12) - ), - child: SingleChildScrollView( - child: Column( - children: [ - Stack( - children: [ - SizedBox( - height: SizeUtils.getByScreen(small: 36, big: 36), - child: Align( - alignment: Alignment.centerLeft, - child: Icon(Icons.arrow_back, size: SizeUtils.getByScreen(small: 36, big: 34)) - ) - ), - Center(child: Text(context.translate(I18n.contactTitle), - style: TextStyle(fontSize: SizeUtils.getByScreen(small: 28, big: 27)))) - ], + final List country = [ + 'España', + 'Portugal', + 'France', + 'Italia', + 'Deutschland', + context.translate(I18n.other), + ]; + + final List channel = [ + context.translate(I18n.channelOnline), + context.translate(I18n.channelAmazon), + context.translate(I18n.channelStore), + context.translate(I18n.other), + ]; + + return PageLayout( + title: context.translate(I18n.contactTitle), + body: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 38), + big: EdgeInsets.symmetric(horizontal: 36) + ), + child: SingleChildScrollView(child: Column( + children: [ + CustomDropdown( + items: country.map(Text.new).toList(growable: false), + onChanged: (x){vm.setCountry(x);}, + hint: context.translate(I18n.selectCountry) + ), + SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), + CustomDropdown( + items: channel.map(Text.new).toList(growable: false), + onChanged: (x){vm.setChannel(x);}, + hint: context.translate(I18n.selectChannel) + ), + SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), + CustomTextField( + controller: vm.nameController, + hint: context.translate(I18n.enterName), + ), + SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), + CustomTextField( + controller: vm.emailController, + keyboardType: TextInputType.emailAddress, + hint: context.translate(I18n.enterEmail), + ), + SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), + CustomTextField( + controller: vm.subjectController, + hint: context.translate(I18n.enterSubject), + ), + SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), + CustomTextField( + controller: vm.bodyController, + keyboardType: TextInputType.multiline, + hint: context.translate(I18n.enterMessage), + lines: 8, + ), + if (viewState.errorMessage.isNotEmpty) ...[ + const SizedBox(height: 4), + Text( + viewState.errorMessage, + textAlign: TextAlign.center, + style: const TextStyle( + color: Color.fromRGBO(239, 17, 17, 1), + fontSize: 12, ), - SizedBox(height: SizeUtils.getByScreen(small: 40, big: 38)), - CustomDropdown( - items: country.values.map(Text.new).toList(growable: false), - values: country.keys.toList(), - onChanged: (x){vm.setCountry(x);}, - hint: 'Choose your country' - ), - SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), - CustomDropdown( - items: channel.values.map(Text.new).toList(growable: false), - values: channel.keys.toList(), - onChanged: (x){vm.setChannel(x);}, - hint: 'Purchase channel' - ), - SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), - CustomTextField( - controller: vm.nameController, - hint: 'Enter your name', - ), - SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), - CustomTextField( - controller: vm.emailController, - keyboardType: TextInputType.emailAddress, - hint: 'Enter your email', - ), - SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), - CustomTextField( - controller: vm.subjectController, - hint: 'Your message subject', - ), - SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), - CustomTextField( - controller: vm.bodyController, - keyboardType: TextInputType.multiline, - hint: 'Your message', - lines: 8, - ), - if (viewState.errorMessage.isNotEmpty) ...[ - const SizedBox(height: 4), - Text( - viewState.errorMessage, - textAlign: TextAlign.center, - style: const TextStyle( - color: Color.fromRGBO(239, 17, 17, 1), - fontSize: 12, - ), - ), - ], - SizedBox(height: SizeUtils.getByScreen(small: 28, big: 27)), - PrimaryButton( - onPressed: vm.sendEmail, - text: 'Send!', - color: theme.getColorFor(ThemeCode.buttonPrimary) - ) - ], - ) - ) + ), + ], + ], + )), + ), + footer: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 38, vertical: 14), + big: EdgeInsets.symmetric(horizontal: 36, vertical: 12) + ), + child: PrimaryButton( + onPressed: vm.sendEmail, + text: context.translate(I18n.sendEmail), + color: theme.getColorFor(ThemeCode.buttonPrimary) ) ), ); diff --git a/modules/legacy/modules/customer_service/lib/src/presentation/customer_service_screen.dart b/modules/legacy/modules/customer_service/lib/src/presentation/customer_service_screen.dart index 28f839ff..b984c077 100644 --- a/modules/legacy/modules/customer_service/lib/src/presentation/customer_service_screen.dart +++ b/modules/legacy/modules/customer_service/lib/src/presentation/customer_service_screen.dart @@ -2,6 +2,7 @@ import 'package:customer_service/src/presentation/contact_screen.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:legacy_shared/legacy_shared.dart'; import 'package:navigation/navigation.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; @@ -14,80 +15,66 @@ class CustomerServiceScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); + // final theme = ref.watch(themePortProvider); - return Scaffold( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), - body: SafeArea( - child: Container( - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 18, vertical: 14), - big: EdgeInsets.symmetric(horizontal: 16, vertical: 12) - ), - child: Column( - children: [ - Stack( - children: [ - SizedBox( - height: SizeUtils.getByScreen(small: 36, big: 36), - child: Align( - alignment: Alignment.centerLeft, - child: Icon(Icons.arrow_back, size: SizeUtils.getByScreen(small: 36, big: 34)) - ) - ), - Center(child: Text(context.translate(I18n.customerService), - style: TextStyle(fontSize: SizeUtils.getByScreen(small: 28, big: 27)))) - ], - ), - SizedBox(height: SizeUtils.getByScreen(small: 40, big: 38)), - AppSectionButton( - onPressed: () async { - final Uri url = Uri.parse('https://www.savefamilygps.com/'); - if (!await launchUrl(url)) { - throw Exception('Could not launch $url'); - } - }, - icon: Icons.sunny, - text: "Visit our Website" - ), - SizedBox(height: SizeUtils.getByScreen(small: 10, big: 9)), - AppSectionButton( - onPressed: () async { - final Uri url = Uri.parse('https://savefamilygpshelp.zendesk.com/hc/es'); - if (!await launchUrl(url)) { - throw Exception('Could not launch $url'); - } - }, - icon: Icons.handshake_outlined, - text: "Can we help you?" - ), - SizedBox(height: SizeUtils.getByScreen(small: 10, big: 9)), - AppSectionButton( + return PageLayout( + title: context.translate(I18n.customerService), + body: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 18), + big: EdgeInsets.symmetric(horizontal: 16) + ), + child: Column( + children: [ + SectionButton( + onPressed: () async { + final Uri url = Uri.parse('https://www.savefamilygps.com/'); + if (!await launchUrl(url)) { + throw Exception('Could not launch $url'); + } + }, + image: 'assets/images/ui/iso_sf.png', + text: context.translate(I18n.supportWebsite) + ), + SizedBox(height: SizeUtils.getByScreen(small: 10, big: 9)), + SectionButton( + onPressed: () async { + final Uri url = Uri.parse('https://savefamilygpshelp.zendesk.com/hc/es'); + if (!await launchUrl(url)) { + throw Exception('Could not launch $url'); + } + }, + icon: SFIcons.handshake, + text: context.translate(I18n.supportHelp) + ), + SizedBox(height: SizeUtils.getByScreen(small: 10, big: 9)), + SectionButton( onPressed: (){Navigator.push(context, - MaterialPageRoute( - builder: (_) => ContactScreen(navigationContract: navigationContract), - ));}, + MaterialPageRoute( + builder: (_) => ContactScreen(navigationContract: navigationContract), + ));}, icon: Icons.email_outlined, text: context.translate(I18n.contactTitle) - ), - ], - ) + ), + ], ) - ), + ) ); } } -class AppSectionButton extends ConsumerWidget { +class SectionButton extends ConsumerWidget { final GestureTapCallback onPressed; - final IconData icon; + final IconData? icon; + final String? image; final String text; - const AppSectionButton({ + const SectionButton({ required this.onPressed, - required this.icon, + this.icon, + this.image, required this.text, }); @@ -96,44 +83,49 @@ class AppSectionButton extends ConsumerWidget { 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), + onTap: onPressed, + child: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 16), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 12) + ), + 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: 12, big: 16)), + child: icon != null + ?Icon(icon, + size: SizeUtils.getByScreen(small: 44, big: 48), color: Color(0xFF588EA5), weight: 30, - ), + ) + : Image.asset(image!, + width: SizeUtils.getByScreen(small: 44, big: 48), + height: SizeUtils.getByScreen(small: 44, big: 48), ), - 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 - ) - ) - ), - ], - ), - ) + ), + 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/legacy/modules/customer_service/lib/src/presentation/state/contact_view_model.dart b/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_model.dart index 6f804672..199b06a0 100644 --- a/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_model.dart +++ b/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_model.dart @@ -88,27 +88,37 @@ class ContactViewModel extends Notifier { void _onBodyChanged() { final text = bodyController.text; - if (text == state.body) return; + if (text == state.message) return; - state = state.copyWith(body: text, errorMessage: ''); + state = state.copyWith(message: text, errorMessage: ''); } void sendEmail() async { - final receiver = 'aitorarana@savefamilygps.com'; + final receiver = 'info@savefamilygps.com'; - //final name = state.name; + final name = state.name; + final country = state.country; + final channel = state.channel; final sender = state.email; final subject = state.subject; - final body = state.body; + final message = state.message; if (sender.isEmpty) { state = state.copyWith(errorMessage: I18n.errorEmailRequired); return; } - if (_isValidEmail(sender)) { + if (!_isValidEmail(sender)) { state = state.copyWith(errorMessage: I18n.errorEmailInvalid); + return; } + final body = + 'country:$country\n' + 'Purchase channel:$channel\n' + 'name:$name\n' + 'email:$sender\n' + '$message'; + final Uri url = Uri.parse('mailto:$receiver?from=$sender&subject=$subject&body=$body'); if (!await launchUrl(url)) { throw Exception('Could not launch $url'); diff --git a/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_state.dart b/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_state.dart index 08133560..8584b4e2 100644 --- a/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_state.dart +++ b/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_state.dart @@ -10,7 +10,7 @@ abstract class ContactViewState with _$ContactViewState{ @Default('') String name, @Default('') String email, @Default('') String subject, - @Default('') String body, + @Default('') String message, @Default('') String errorMessage, @Default('') String emailError, }) = _ContactViewState; diff --git a/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_state.freezed.dart b/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_state.freezed.dart index 31f58ae1..74a56960 100644 --- a/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_state.freezed.dart +++ b/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_state.freezed.dart @@ -14,7 +14,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$ContactViewState { - String get country; String get channel; String get name; String get email; String get subject; String get body; String get errorMessage; String get emailError; + String get country; String get channel; String get name; String get email; String get subject; String get message; String get errorMessage; String get emailError; /// Create a copy of ContactViewState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -25,16 +25,16 @@ $ContactViewStateCopyWith get copyWith => _$ContactViewStateCo @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ContactViewState&&(identical(other.country, country) || other.country == country)&&(identical(other.channel, channel) || other.channel == channel)&&(identical(other.name, name) || other.name == name)&&(identical(other.email, email) || other.email == email)&&(identical(other.subject, subject) || other.subject == subject)&&(identical(other.body, body) || other.body == body)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.emailError, emailError) || other.emailError == emailError)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is ContactViewState&&(identical(other.country, country) || other.country == country)&&(identical(other.channel, channel) || other.channel == channel)&&(identical(other.name, name) || other.name == name)&&(identical(other.email, email) || other.email == email)&&(identical(other.subject, subject) || other.subject == subject)&&(identical(other.message, message) || other.message == message)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.emailError, emailError) || other.emailError == emailError)); } @override -int get hashCode => Object.hash(runtimeType,country,channel,name,email,subject,body,errorMessage,emailError); +int get hashCode => Object.hash(runtimeType,country,channel,name,email,subject,message,errorMessage,emailError); @override String toString() { - return 'ContactViewState(country: $country, channel: $channel, name: $name, email: $email, subject: $subject, body: $body, errorMessage: $errorMessage, emailError: $emailError)'; + return 'ContactViewState(country: $country, channel: $channel, name: $name, email: $email, subject: $subject, message: $message, errorMessage: $errorMessage, emailError: $emailError)'; } @@ -45,7 +45,7 @@ abstract mixin class $ContactViewStateCopyWith<$Res> { factory $ContactViewStateCopyWith(ContactViewState value, $Res Function(ContactViewState) _then) = _$ContactViewStateCopyWithImpl; @useResult $Res call({ - String country, String channel, String name, String email, String subject, String body, String errorMessage, String emailError + String country, String channel, String name, String email, String subject, String message, String errorMessage, String emailError }); @@ -62,14 +62,14 @@ class _$ContactViewStateCopyWithImpl<$Res> /// Create a copy of ContactViewState /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? country = null,Object? channel = null,Object? name = null,Object? email = null,Object? subject = null,Object? body = null,Object? errorMessage = null,Object? emailError = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? country = null,Object? channel = null,Object? name = null,Object? email = null,Object? subject = null,Object? message = null,Object? errorMessage = null,Object? emailError = null,}) { return _then(_self.copyWith( country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable as String,channel: null == channel ? _self.channel : channel // ignore: cast_nullable_to_non_nullable as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable as String,subject: null == subject ? _self.subject : subject // ignore: cast_nullable_to_non_nullable -as String,body: null == body ? _self.body : body // ignore: cast_nullable_to_non_nullable +as String,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable as String,emailError: null == emailError ? _self.emailError : emailError // ignore: cast_nullable_to_non_nullable as String, @@ -157,10 +157,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String country, String channel, String name, String email, String subject, String body, String errorMessage, String emailError)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String country, String channel, String name, String email, String subject, String message, String errorMessage, String emailError)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _ContactViewState() when $default != null: -return $default(_that.country,_that.channel,_that.name,_that.email,_that.subject,_that.body,_that.errorMessage,_that.emailError);case _: +return $default(_that.country,_that.channel,_that.name,_that.email,_that.subject,_that.message,_that.errorMessage,_that.emailError);case _: return orElse(); } @@ -178,10 +178,10 @@ return $default(_that.country,_that.channel,_that.name,_that.email,_that.subject /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String country, String channel, String name, String email, String subject, String body, String errorMessage, String emailError) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String country, String channel, String name, String email, String subject, String message, String errorMessage, String emailError) $default,) {final _that = this; switch (_that) { case _ContactViewState(): -return $default(_that.country,_that.channel,_that.name,_that.email,_that.subject,_that.body,_that.errorMessage,_that.emailError);case _: +return $default(_that.country,_that.channel,_that.name,_that.email,_that.subject,_that.message,_that.errorMessage,_that.emailError);case _: throw StateError('Unexpected subclass'); } @@ -198,10 +198,10 @@ return $default(_that.country,_that.channel,_that.name,_that.email,_that.subject /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String country, String channel, String name, String email, String subject, String body, String errorMessage, String emailError)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String country, String channel, String name, String email, String subject, String message, String errorMessage, String emailError)? $default,) {final _that = this; switch (_that) { case _ContactViewState() when $default != null: -return $default(_that.country,_that.channel,_that.name,_that.email,_that.subject,_that.body,_that.errorMessage,_that.emailError);case _: +return $default(_that.country,_that.channel,_that.name,_that.email,_that.subject,_that.message,_that.errorMessage,_that.emailError);case _: return null; } @@ -213,7 +213,7 @@ return $default(_that.country,_that.channel,_that.name,_that.email,_that.subject class _ContactViewState implements ContactViewState { - const _ContactViewState({this.country = '', this.channel = '', this.name = '', this.email = '', this.subject = '', this.body = '', this.errorMessage = '', this.emailError = ''}); + const _ContactViewState({this.country = '', this.channel = '', this.name = '', this.email = '', this.subject = '', this.message = '', this.errorMessage = '', this.emailError = ''}); @override@JsonKey() final String country; @@ -221,7 +221,7 @@ class _ContactViewState implements ContactViewState { @override@JsonKey() final String name; @override@JsonKey() final String email; @override@JsonKey() final String subject; -@override@JsonKey() final String body; +@override@JsonKey() final String message; @override@JsonKey() final String errorMessage; @override@JsonKey() final String emailError; @@ -235,16 +235,16 @@ _$ContactViewStateCopyWith<_ContactViewState> get copyWith => __$ContactViewStat @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _ContactViewState&&(identical(other.country, country) || other.country == country)&&(identical(other.channel, channel) || other.channel == channel)&&(identical(other.name, name) || other.name == name)&&(identical(other.email, email) || other.email == email)&&(identical(other.subject, subject) || other.subject == subject)&&(identical(other.body, body) || other.body == body)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.emailError, emailError) || other.emailError == emailError)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _ContactViewState&&(identical(other.country, country) || other.country == country)&&(identical(other.channel, channel) || other.channel == channel)&&(identical(other.name, name) || other.name == name)&&(identical(other.email, email) || other.email == email)&&(identical(other.subject, subject) || other.subject == subject)&&(identical(other.message, message) || other.message == message)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.emailError, emailError) || other.emailError == emailError)); } @override -int get hashCode => Object.hash(runtimeType,country,channel,name,email,subject,body,errorMessage,emailError); +int get hashCode => Object.hash(runtimeType,country,channel,name,email,subject,message,errorMessage,emailError); @override String toString() { - return 'ContactViewState(country: $country, channel: $channel, name: $name, email: $email, subject: $subject, body: $body, errorMessage: $errorMessage, emailError: $emailError)'; + return 'ContactViewState(country: $country, channel: $channel, name: $name, email: $email, subject: $subject, message: $message, errorMessage: $errorMessage, emailError: $emailError)'; } @@ -255,7 +255,7 @@ abstract mixin class _$ContactViewStateCopyWith<$Res> implements $ContactViewSta factory _$ContactViewStateCopyWith(_ContactViewState value, $Res Function(_ContactViewState) _then) = __$ContactViewStateCopyWithImpl; @override @useResult $Res call({ - String country, String channel, String name, String email, String subject, String body, String errorMessage, String emailError + String country, String channel, String name, String email, String subject, String message, String errorMessage, String emailError }); @@ -272,14 +272,14 @@ class __$ContactViewStateCopyWithImpl<$Res> /// Create a copy of ContactViewState /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? country = null,Object? channel = null,Object? name = null,Object? email = null,Object? subject = null,Object? body = null,Object? errorMessage = null,Object? emailError = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? country = null,Object? channel = null,Object? name = null,Object? email = null,Object? subject = null,Object? message = null,Object? errorMessage = null,Object? emailError = null,}) { return _then(_ContactViewState( country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable as String,channel: null == channel ? _self.channel : channel // ignore: cast_nullable_to_non_nullable as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable as String,subject: null == subject ? _self.subject : subject // ignore: cast_nullable_to_non_nullable -as String,body: null == body ? _self.body : body // ignore: cast_nullable_to_non_nullable +as String,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable as String,emailError: null == emailError ? _self.emailError : emailError // ignore: cast_nullable_to_non_nullable as String, diff --git a/modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart b/modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart index 860a1c8c..52564e18 100644 --- a/modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart +++ b/modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart @@ -23,18 +23,29 @@ class PageLayout extends StatelessWidget{ children: [ Container( padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), - big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) + small: EdgeInsets.fromLTRB(22, 20, 22, 0), + big: EdgeInsets.fromLTRB(21, 16, 21, 0), ), child: Stack( children: [ IconButton(onPressed: () {Navigator.pop(context);}, - icon: Icon(Icons.arrow_back)), - Center( - child: Text(title, - style: TextStyle( - fontSize: SizeUtils.getByScreen(small: 28, big: 27) - ), + icon: Icon(Icons.arrow_back, + color: Color(0xFF588EA5), + size: 32, + ), + padding: EdgeInsets.zero, + ), + SizedBox( + height: 50, + child: Center( + child: Text(title.toUpperCase(), + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 20, big: 19), + fontWeight: FontWeight.w500, + letterSpacing: 0, + color: Color(0xFF588EA5) + ), + ) ) ) ], diff --git a/packages/sf_localizations/assets/l10n/en.json b/packages/sf_localizations/assets/l10n/en.json index 95e7d7a4..90401663 100755 --- a/packages/sf_localizations/assets/l10n/en.json +++ b/packages/sf_localizations/assets/l10n/en.json @@ -144,6 +144,8 @@ "channelAmazon": "Amazon", "channelStore": "Physical store", "other": "Other", + "supportWebsite": "Visit our Website", + "supportHelp": "Can we help you?", "contactTitle": "Contact us", "selectCountry": "Choose your country", "selectChannel": "Purchase channel", @@ -151,8 +153,7 @@ "enterEmail": "Enter your email", "enterSubject": "Your message subject", "enterMessage": "Your message", - "sendEmail": "Send!" - "chat": "Chat", + "sendEmail": "Send!", "personalData": "Personal Data", "addNewSF": "Add a new SaveFamily", "linkedDevices": "Linked Devices", diff --git a/packages/sf_localizations/assets/l10n/es.json b/packages/sf_localizations/assets/l10n/es.json index 9b346111..33b571bb 100644 --- a/packages/sf_localizations/assets/l10n/es.json +++ b/packages/sf_localizations/assets/l10n/es.json @@ -140,19 +140,20 @@ "home": "Inicio", "location": "Mapa", "chat": "Chat", - "channelOnline": "Tienda online SF", + "channelOnline": "Tienda online de SF", "channelAmazon": "Amazon", "channelStore": "Tienda física", "other": "Otro", - "contactTitle": "Contacta con nosotros", + "supportWebsite": "Visita nuestro sitio web", + "supportHelp": "¿Podemos ayudarte?", + "contactTitle": "Contáctanos", "selectCountry": "Selecciona tu país", - "selectChannel": "Caal de compra", + "selectChannel": "Canal de compra", "enterName": "Introduce tu nombre", "enterEmail": "Introduce tu correo electrónico", "enterSubject": "Asunto del mensaje", "enterMessage": "Tu mensaje", - "sendEmail": "!Enviar!" - "chat": "Chat", + "sendEmail": "Enviar", "personalData": "Datos Personales", "addNewSF": "Añadir un nuevo SaveFamily", "linkedDevices": "Dispositivos vinculados", diff --git a/packages/sf_localizations/lib/src/generated/i18n.dart b/packages/sf_localizations/lib/src/generated/i18n.dart index 51cbff18..90815c64 100755 --- a/packages/sf_localizations/lib/src/generated/i18n.dart +++ b/packages/sf_localizations/lib/src/generated/i18n.dart @@ -174,6 +174,8 @@ class I18n { static const String channelAmazon = 'channelAmazon'; static const String channelStore = 'channelStore'; static const String other = 'other'; + static const String supportWebsite = 'supportWebsite'; + static const String supportHelp = 'supportHelp'; static const String contactTitle = 'contactTitle'; static const String selectCountry = 'selectCountry'; static const String selectChannel = 'selectChannel'; From 5f1e125cff3c70e23b8be0a0fa02e11d3a78f168 Mon Sep 17 00:00:00 2001 From: aitorarana Date: Tue, 17 Feb 2026 12:11:50 +0100 Subject: [PATCH 20/25] Added map data and device selection --- .../hub_remote_datasource_impl.dart | 50 +- .../latest_positions_response_model.dart | 96 ++- ...test_positions_response_model.freezed.dart | 678 +++++++++++++++++- .../latest_positions_response_model.g.dart | 80 ++- .../hub/domain/entities/address_entity.dart | 14 + .../entities/address_entity.freezed.dart | 283 ++++++++ .../hub/domain/entities/network_entity.dart | 12 + .../entities/network_entity.freezed.dart | 277 +++++++ .../hub/domain/entities/position_entity.dart | 44 +- .../entities/position_entity.freezed.dart | 352 +++++++++ .../hub/lib/src/features/hub/hub_builder.dart | 2 +- .../features/hub/presentation/hub_screen.dart | 209 ++++-- .../presentation/state/hub_view_model.dart | 48 +- .../presentation/state/hub_view_state.dart | 4 +- .../state/hub_view_state.freezed.dart | 78 +- packages/design_system/fonts/SFIcons.ttf | Bin 29300 -> 28912 bytes packages/design_system/fonts/config.json | 28 +- .../lib/src/dropdowns/dropdown.dart | 4 +- .../design_system/lib/src/icons/sf_icons.dart | 2 +- packages/sf_localizations/assets/l10n/en.json | 2 +- packages/sf_localizations/assets/l10n/es.json | 2 +- 21 files changed, 2073 insertions(+), 192 deletions(-) create mode 100644 modules/legacy/modules/hub/lib/src/features/hub/domain/entities/address_entity.dart create mode 100644 modules/legacy/modules/hub/lib/src/features/hub/domain/entities/address_entity.freezed.dart create mode 100644 modules/legacy/modules/hub/lib/src/features/hub/domain/entities/network_entity.dart create mode 100644 modules/legacy/modules/hub/lib/src/features/hub/domain/entities/network_entity.freezed.dart create mode 100644 modules/legacy/modules/hub/lib/src/features/hub/domain/entities/position_entity.freezed.dart diff --git a/modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart b/modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart index 78fb2279..6eca5a50 100644 --- a/modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart +++ b/modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart @@ -1,13 +1,11 @@ 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 { @@ -62,17 +60,53 @@ class HomeRemoteDatasourceImpl implements HomeRemoteDatasource { LatestPositionsItemResponseModel( latitude: 43.327116830678186, longitude: -3.083269100434551, - address: 'Aparcamiento', - positionDate: DateTime.now(), + address: LatestPositionsAddressResponseModel( + street: 'street', + city: 'city', + province: 'province', + state: 'state', + country: 'country', + ), + positionDate: DateTime.now().millisecondsSinceEpoch, frequentPlace: false, - frequentPlaceName: ''), + frequentPlaceName: '', + id: '1', + deviceIdentificator: deviceId, + hpe: 0, + ncell: 65, + type: 0, + createdAt: DateTime.now().millisecondsSinceEpoch, + positionDateOriginal: null, + message: '', + networks: [LatestPositionsNetworkResponseModel(SSID: 'SSID', BSSID: 'BSSID', signal: 'signal')], + ignore: false, + suspect: false + ), LatestPositionsItemResponseModel( latitude: 43.32729043118528, longitude: -3.08320596406992, - address: 'Izekoren etxea', - positionDate: DateTime.now(), + address: LatestPositionsAddressResponseModel( + street: 'street', + city: 'city', + province: 'province', + state: 'state', + country: 'country', + ), + positionDate: DateTime.now().millisecondsSinceEpoch, frequentPlace: true, - frequentPlaceName: 'La cafetería'), + frequentPlaceName: 'La cafetería', + id: '2', + deviceIdentificator: deviceId, + hpe: 0, + ncell: 65, + type: 0, + createdAt: DateTime.now().millisecondsSinceEpoch, + positionDateOriginal: null, + message: '', + networks: [], + ignore: false, + suspect: false + ), ]);*/ return model.toEntity(); } on DioException catch (error) { diff --git a/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.dart b/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.dart index e9aeaf19..b3fac765 100644 --- a/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.dart +++ b/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.dart @@ -1,4 +1,6 @@ import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:hub/src/features/hub/domain/entities/address_entity.dart'; +import 'package:hub/src/features/hub/domain/entities/network_entity.dart'; import 'package:hub/src/features/hub/domain/entities/position_entity.dart'; part 'latest_positions_response_model.freezed.dart'; @@ -18,27 +20,99 @@ abstract class LatestPositionsResponseModel with _$LatestPositionsResponseModel abstract class LatestPositionsItemResponseModel with _$LatestPositionsItemResponseModel { const factory LatestPositionsItemResponseModel({ + required String id, + required String deviceIdentificator, required double latitude, required double longitude, - required String? address, - required DateTime positionDate, + required int hpe, + int? ncell, + required int type, + int? steps, + LatestPositionsAddressResponseModel? address, + required int createdAt, + required int positionDate, + int? positionDateOriginal, + String? frequentPlaceName, + required String message, + required List networks, + required bool ignore, + required bool suspect, required bool frequentPlace, - required String frequentPlaceName, }) = _LatestPositionsItemResponseModel; factory LatestPositionsItemResponseModel.fromJson(Map json) => - _$LatestPositionsItemResponseModelFromJson(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, + return items.map((LatestPositionsItemResponseModel item) => PositionEntity( + id: item.id, + deviceIdentificator: item.deviceIdentificator, + latitude: item.latitude, + longitude: item.longitude, + hpe: item.hpe, + ncell: item.ncell, + type: item.type, + steps: item.steps, + address: item.address?.toEntity(), + createdAt: item.createdAt, + positionDate: item.positionDate, + positionDateOriginal: item.positionDateOriginal, + frequentPlaceName: item.frequentPlaceName, + message: item.message, + networks: item.networks.map((n)=>n.toEntity()).toList(), + ignore: item.ignore, + suspect: item.suspect, + frequentPlace: item.frequentPlace, )).toList(); } } + +@freezed +abstract class LatestPositionsAddressResponseModel with _$LatestPositionsAddressResponseModel { + const factory LatestPositionsAddressResponseModel({ + required String street, + required String city, + required String province, + required String state, + required String country, + }) = _LatestPositionsAddressResponseModel; + + factory LatestPositionsAddressResponseModel.fromJson(Map json) => + _$LatestPositionsAddressResponseModelFromJson(json); +} + +extension LatestPositionsAddressResponseModelMapper on LatestPositionsAddressResponseModel { + AddressEntity toEntity() { + return AddressEntity( + street: street, + city: city, + province: province, + state: state, + country: country, + ); + } +} + +@freezed +abstract class LatestPositionsNetworkResponseModel with _$LatestPositionsNetworkResponseModel { + const factory LatestPositionsNetworkResponseModel({ + required String SSID, + required String BSSID, + required String signal, + }) = _LatestPositionsNetworkResponseModel; + + factory LatestPositionsNetworkResponseModel.fromJson(Map json) => + _$LatestPositionsNetworkResponseModelFromJson(json); +} + +extension LatestPositionsNetworkResponseModelMapper on LatestPositionsNetworkResponseModel { + NetworkEntity toEntity() { + return NetworkEntity( + SSID: SSID, + BSSID: BSSID, + signal: signal, + ); + } +} \ No newline at end of file diff --git a/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.freezed.dart b/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.freezed.dart index 1f149eaa..675f05d5 100644 --- a/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.freezed.dart +++ b/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.freezed.dart @@ -284,7 +284,7 @@ as List, /// @nodoc mixin _$LatestPositionsItemResponseModel { - double get latitude; double get longitude; String? get address; DateTime get positionDate; bool get frequentPlace; String get frequentPlaceName; + String get id; String get deviceIdentificator; double get latitude; double get longitude; int get hpe; int? get ncell; int get type; int? get steps; LatestPositionsAddressResponseModel? get address; int get createdAt; int get positionDate; int? get positionDateOriginal; String? get frequentPlaceName; String get message; List get networks; bool get ignore; bool get suspect; bool get frequentPlace; /// Create a copy of LatestPositionsItemResponseModel /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -297,16 +297,16 @@ $LatestPositionsItemResponseModelCopyWith get @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)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is LatestPositionsItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.hpe, hpe) || other.hpe == hpe)&&(identical(other.ncell, ncell) || other.ncell == ncell)&&(identical(other.type, type) || other.type == type)&&(identical(other.steps, steps) || other.steps == steps)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.positionDate, positionDate) || other.positionDate == positionDate)&&(identical(other.positionDateOriginal, positionDateOriginal) || other.positionDateOriginal == positionDateOriginal)&&(identical(other.frequentPlaceName, frequentPlaceName) || other.frequentPlaceName == frequentPlaceName)&&(identical(other.message, message) || other.message == message)&&const DeepCollectionEquality().equals(other.networks, networks)&&(identical(other.ignore, ignore) || other.ignore == ignore)&&(identical(other.suspect, suspect) || other.suspect == suspect)&&(identical(other.frequentPlace, frequentPlace) || other.frequentPlace == frequentPlace)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,latitude,longitude,address,positionDate,frequentPlace,frequentPlaceName); +int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,latitude,longitude,hpe,ncell,type,steps,address,createdAt,positionDate,positionDateOriginal,frequentPlaceName,message,const DeepCollectionEquality().hash(networks),ignore,suspect,frequentPlace); @override String toString() { - return 'LatestPositionsItemResponseModel(latitude: $latitude, longitude: $longitude, address: $address, positionDate: $positionDate, frequentPlace: $frequentPlace, frequentPlaceName: $frequentPlaceName)'; + return 'LatestPositionsItemResponseModel(id: $id, deviceIdentificator: $deviceIdentificator, latitude: $latitude, longitude: $longitude, hpe: $hpe, ncell: $ncell, type: $type, steps: $steps, address: $address, createdAt: $createdAt, positionDate: $positionDate, positionDateOriginal: $positionDateOriginal, frequentPlaceName: $frequentPlaceName, message: $message, networks: $networks, ignore: $ignore, suspect: $suspect, frequentPlace: $frequentPlace)'; } @@ -317,11 +317,11 @@ 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 + String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, LatestPositionsAddressResponseModel? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List networks, bool ignore, bool suspect, bool frequentPlace }); - +$LatestPositionsAddressResponseModelCopyWith<$Res>? get address; } /// @nodoc @@ -334,18 +334,42 @@ class _$LatestPositionsItemResponseModelCopyWithImpl<$Res> /// 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,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? deviceIdentificator = null,Object? latitude = null,Object? longitude = null,Object? hpe = null,Object? ncell = freezed,Object? type = null,Object? steps = freezed,Object? address = freezed,Object? createdAt = null,Object? positionDate = null,Object? positionDateOriginal = freezed,Object? frequentPlaceName = freezed,Object? message = null,Object? networks = null,Object? ignore = null,Object? suspect = null,Object? frequentPlace = null,}) { return _then(_self.copyWith( -latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable +as String,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, +as double,hpe: null == hpe ? _self.hpe : hpe // ignore: cast_nullable_to_non_nullable +as int,ncell: freezed == ncell ? _self.ncell : ncell // ignore: cast_nullable_to_non_nullable +as int?,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as int,steps: freezed == steps ? _self.steps : steps // ignore: cast_nullable_to_non_nullable +as int?,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable +as LatestPositionsAddressResponseModel?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as int,positionDate: null == positionDate ? _self.positionDate : positionDate // ignore: cast_nullable_to_non_nullable +as int,positionDateOriginal: freezed == positionDateOriginal ? _self.positionDateOriginal : positionDateOriginal // ignore: cast_nullable_to_non_nullable +as int?,frequentPlaceName: freezed == frequentPlaceName ? _self.frequentPlaceName : frequentPlaceName // ignore: cast_nullable_to_non_nullable +as String?,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable +as String,networks: null == networks ? _self.networks : networks // ignore: cast_nullable_to_non_nullable +as List,ignore: null == ignore ? _self.ignore : ignore // ignore: cast_nullable_to_non_nullable +as bool,suspect: null == suspect ? _self.suspect : suspect // ignore: cast_nullable_to_non_nullable +as bool,frequentPlace: null == frequentPlace ? _self.frequentPlace : frequentPlace // ignore: cast_nullable_to_non_nullable +as bool, )); } +/// Create a copy of LatestPositionsItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$LatestPositionsAddressResponseModelCopyWith<$Res>? get address { + if (_self.address == null) { + return null; + } + return $LatestPositionsAddressResponseModelCopyWith<$Res>(_self.address!, (value) { + return _then(_self.copyWith(address: value)); + }); +} } @@ -427,10 +451,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( double latitude, double longitude, String? address, DateTime positionDate, bool frequentPlace, String frequentPlaceName)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, LatestPositionsAddressResponseModel? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List networks, bool ignore, bool suspect, bool frequentPlace)? $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 $default(_that.id,_that.deviceIdentificator,_that.latitude,_that.longitude,_that.hpe,_that.ncell,_that.type,_that.steps,_that.address,_that.createdAt,_that.positionDate,_that.positionDateOriginal,_that.frequentPlaceName,_that.message,_that.networks,_that.ignore,_that.suspect,_that.frequentPlace);case _: return orElse(); } @@ -448,10 +472,10 @@ return $default(_that.latitude,_that.longitude,_that.address,_that.positionDate, /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( double latitude, double longitude, String? address, DateTime positionDate, bool frequentPlace, String frequentPlaceName) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, LatestPositionsAddressResponseModel? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List networks, bool ignore, bool suspect, bool frequentPlace) $default,) {final _that = this; switch (_that) { case _LatestPositionsItemResponseModel(): -return $default(_that.latitude,_that.longitude,_that.address,_that.positionDate,_that.frequentPlace,_that.frequentPlaceName);case _: +return $default(_that.id,_that.deviceIdentificator,_that.latitude,_that.longitude,_that.hpe,_that.ncell,_that.type,_that.steps,_that.address,_that.createdAt,_that.positionDate,_that.positionDateOriginal,_that.frequentPlaceName,_that.message,_that.networks,_that.ignore,_that.suspect,_that.frequentPlace);case _: throw StateError('Unexpected subclass'); } @@ -468,10 +492,10 @@ return $default(_that.latitude,_that.longitude,_that.address,_that.positionDate, /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( double latitude, double longitude, String? address, DateTime positionDate, bool frequentPlace, String frequentPlaceName)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, LatestPositionsAddressResponseModel? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List networks, bool ignore, bool suspect, bool frequentPlace)? $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 $default(_that.id,_that.deviceIdentificator,_that.latitude,_that.longitude,_that.hpe,_that.ncell,_that.type,_that.steps,_that.address,_that.createdAt,_that.positionDate,_that.positionDateOriginal,_that.frequentPlaceName,_that.message,_that.networks,_that.ignore,_that.suspect,_that.frequentPlace);case _: return null; } @@ -483,15 +507,33 @@ return $default(_that.latitude,_that.longitude,_that.address,_that.positionDate, @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}); + const _LatestPositionsItemResponseModel({required this.id, required this.deviceIdentificator, required this.latitude, required this.longitude, required this.hpe, this.ncell, required this.type, this.steps, this.address, required this.createdAt, required this.positionDate, this.positionDateOriginal, this.frequentPlaceName, required this.message, required final List networks, required this.ignore, required this.suspect, required this.frequentPlace}): _networks = networks; factory _LatestPositionsItemResponseModel.fromJson(Map json) => _$LatestPositionsItemResponseModelFromJson(json); +@override final String id; +@override final String deviceIdentificator; @override final double latitude; @override final double longitude; -@override final String? address; -@override final DateTime positionDate; +@override final int hpe; +@override final int? ncell; +@override final int type; +@override final int? steps; +@override final LatestPositionsAddressResponseModel? address; +@override final int createdAt; +@override final int positionDate; +@override final int? positionDateOriginal; +@override final String? frequentPlaceName; +@override final String message; + final List _networks; +@override List get networks { + if (_networks is EqualUnmodifiableListView) return _networks; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_networks); +} + +@override final bool ignore; +@override final bool suspect; @override final bool frequentPlace; -@override final String frequentPlaceName; /// Create a copy of LatestPositionsItemResponseModel /// with the given fields replaced by the non-null parameter values. @@ -506,16 +548,16 @@ 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)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _LatestPositionsItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.hpe, hpe) || other.hpe == hpe)&&(identical(other.ncell, ncell) || other.ncell == ncell)&&(identical(other.type, type) || other.type == type)&&(identical(other.steps, steps) || other.steps == steps)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.positionDate, positionDate) || other.positionDate == positionDate)&&(identical(other.positionDateOriginal, positionDateOriginal) || other.positionDateOriginal == positionDateOriginal)&&(identical(other.frequentPlaceName, frequentPlaceName) || other.frequentPlaceName == frequentPlaceName)&&(identical(other.message, message) || other.message == message)&&const DeepCollectionEquality().equals(other._networks, _networks)&&(identical(other.ignore, ignore) || other.ignore == ignore)&&(identical(other.suspect, suspect) || other.suspect == suspect)&&(identical(other.frequentPlace, frequentPlace) || other.frequentPlace == frequentPlace)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,latitude,longitude,address,positionDate,frequentPlace,frequentPlaceName); +int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,latitude,longitude,hpe,ncell,type,steps,address,createdAt,positionDate,positionDateOriginal,frequentPlaceName,message,const DeepCollectionEquality().hash(_networks),ignore,suspect,frequentPlace); @override String toString() { - return 'LatestPositionsItemResponseModel(latitude: $latitude, longitude: $longitude, address: $address, positionDate: $positionDate, frequentPlace: $frequentPlace, frequentPlaceName: $frequentPlaceName)'; + return 'LatestPositionsItemResponseModel(id: $id, deviceIdentificator: $deviceIdentificator, latitude: $latitude, longitude: $longitude, hpe: $hpe, ncell: $ncell, type: $type, steps: $steps, address: $address, createdAt: $createdAt, positionDate: $positionDate, positionDateOriginal: $positionDateOriginal, frequentPlaceName: $frequentPlaceName, message: $message, networks: $networks, ignore: $ignore, suspect: $suspect, frequentPlace: $frequentPlace)'; } @@ -526,11 +568,11 @@ abstract mixin class _$LatestPositionsItemResponseModelCopyWith<$Res> implements 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 + String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, LatestPositionsAddressResponseModel? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List networks, bool ignore, bool suspect, bool frequentPlace }); - +@override $LatestPositionsAddressResponseModelCopyWith<$Res>? get address; } /// @nodoc @@ -543,14 +585,582 @@ class __$LatestPositionsItemResponseModelCopyWithImpl<$Res> /// 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,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? deviceIdentificator = null,Object? latitude = null,Object? longitude = null,Object? hpe = null,Object? ncell = freezed,Object? type = null,Object? steps = freezed,Object? address = freezed,Object? createdAt = null,Object? positionDate = null,Object? positionDateOriginal = freezed,Object? frequentPlaceName = freezed,Object? message = null,Object? networks = null,Object? ignore = null,Object? suspect = null,Object? frequentPlace = null,}) { return _then(_LatestPositionsItemResponseModel( -latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable +as String,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 double,hpe: null == hpe ? _self.hpe : hpe // ignore: cast_nullable_to_non_nullable +as int,ncell: freezed == ncell ? _self.ncell : ncell // ignore: cast_nullable_to_non_nullable +as int?,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as int,steps: freezed == steps ? _self.steps : steps // ignore: cast_nullable_to_non_nullable +as int?,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable +as LatestPositionsAddressResponseModel?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as int,positionDate: null == positionDate ? _self.positionDate : positionDate // ignore: cast_nullable_to_non_nullable +as int,positionDateOriginal: freezed == positionDateOriginal ? _self.positionDateOriginal : positionDateOriginal // ignore: cast_nullable_to_non_nullable +as int?,frequentPlaceName: freezed == frequentPlaceName ? _self.frequentPlaceName : frequentPlaceName // ignore: cast_nullable_to_non_nullable +as String?,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable +as String,networks: null == networks ? _self._networks : networks // ignore: cast_nullable_to_non_nullable +as List,ignore: null == ignore ? _self.ignore : ignore // ignore: cast_nullable_to_non_nullable +as bool,suspect: null == suspect ? _self.suspect : suspect // ignore: cast_nullable_to_non_nullable +as bool,frequentPlace: null == frequentPlace ? _self.frequentPlace : frequentPlace // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + +/// Create a copy of LatestPositionsItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$LatestPositionsAddressResponseModelCopyWith<$Res>? get address { + if (_self.address == null) { + return null; + } + + return $LatestPositionsAddressResponseModelCopyWith<$Res>(_self.address!, (value) { + return _then(_self.copyWith(address: value)); + }); +} +} + + +/// @nodoc +mixin _$LatestPositionsAddressResponseModel { + + String get street; String get city; String get province; String get state; String get country; +/// Create a copy of LatestPositionsAddressResponseModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$LatestPositionsAddressResponseModelCopyWith get copyWith => _$LatestPositionsAddressResponseModelCopyWithImpl(this as LatestPositionsAddressResponseModel, _$identity); + + /// Serializes this LatestPositionsAddressResponseModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is LatestPositionsAddressResponseModel&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,street,city,province,state,country); + +@override +String toString() { + return 'LatestPositionsAddressResponseModel(street: $street, city: $city, province: $province, state: $state, country: $country)'; +} + + +} + +/// @nodoc +abstract mixin class $LatestPositionsAddressResponseModelCopyWith<$Res> { + factory $LatestPositionsAddressResponseModelCopyWith(LatestPositionsAddressResponseModel value, $Res Function(LatestPositionsAddressResponseModel) _then) = _$LatestPositionsAddressResponseModelCopyWithImpl; +@useResult +$Res call({ + String street, String city, String province, String state, String country +}); + + + + +} +/// @nodoc +class _$LatestPositionsAddressResponseModelCopyWithImpl<$Res> + implements $LatestPositionsAddressResponseModelCopyWith<$Res> { + _$LatestPositionsAddressResponseModelCopyWithImpl(this._self, this._then); + + final LatestPositionsAddressResponseModel _self; + final $Res Function(LatestPositionsAddressResponseModel) _then; + +/// Create a copy of LatestPositionsAddressResponseModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? street = null,Object? city = null,Object? province = null,Object? state = null,Object? country = null,}) { + return _then(_self.copyWith( +street: null == street ? _self.street : street // ignore: cast_nullable_to_non_nullable +as String,city: null == city ? _self.city : city // ignore: cast_nullable_to_non_nullable +as String,province: null == province ? _self.province : province // ignore: cast_nullable_to_non_nullable +as String,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable +as String,country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [LatestPositionsAddressResponseModel]. +extension LatestPositionsAddressResponseModelPatterns on LatestPositionsAddressResponseModel { +/// 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( _LatestPositionsAddressResponseModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _LatestPositionsAddressResponseModel() 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( _LatestPositionsAddressResponseModel value) $default,){ +final _that = this; +switch (_that) { +case _LatestPositionsAddressResponseModel(): +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( _LatestPositionsAddressResponseModel value)? $default,){ +final _that = this; +switch (_that) { +case _LatestPositionsAddressResponseModel() 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 street, String city, String province, String state, String country)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _LatestPositionsAddressResponseModel() when $default != null: +return $default(_that.street,_that.city,_that.province,_that.state,_that.country);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 street, String city, String province, String state, String country) $default,) {final _that = this; +switch (_that) { +case _LatestPositionsAddressResponseModel(): +return $default(_that.street,_that.city,_that.province,_that.state,_that.country);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 street, String city, String province, String state, String country)? $default,) {final _that = this; +switch (_that) { +case _LatestPositionsAddressResponseModel() when $default != null: +return $default(_that.street,_that.city,_that.province,_that.state,_that.country);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _LatestPositionsAddressResponseModel implements LatestPositionsAddressResponseModel { + const _LatestPositionsAddressResponseModel({required this.street, required this.city, required this.province, required this.state, required this.country}); + factory _LatestPositionsAddressResponseModel.fromJson(Map json) => _$LatestPositionsAddressResponseModelFromJson(json); + +@override final String street; +@override final String city; +@override final String province; +@override final String state; +@override final String country; + +/// Create a copy of LatestPositionsAddressResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$LatestPositionsAddressResponseModelCopyWith<_LatestPositionsAddressResponseModel> get copyWith => __$LatestPositionsAddressResponseModelCopyWithImpl<_LatestPositionsAddressResponseModel>(this, _$identity); + +@override +Map toJson() { + return _$LatestPositionsAddressResponseModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _LatestPositionsAddressResponseModel&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,street,city,province,state,country); + +@override +String toString() { + return 'LatestPositionsAddressResponseModel(street: $street, city: $city, province: $province, state: $state, country: $country)'; +} + + +} + +/// @nodoc +abstract mixin class _$LatestPositionsAddressResponseModelCopyWith<$Res> implements $LatestPositionsAddressResponseModelCopyWith<$Res> { + factory _$LatestPositionsAddressResponseModelCopyWith(_LatestPositionsAddressResponseModel value, $Res Function(_LatestPositionsAddressResponseModel) _then) = __$LatestPositionsAddressResponseModelCopyWithImpl; +@override @useResult +$Res call({ + String street, String city, String province, String state, String country +}); + + + + +} +/// @nodoc +class __$LatestPositionsAddressResponseModelCopyWithImpl<$Res> + implements _$LatestPositionsAddressResponseModelCopyWith<$Res> { + __$LatestPositionsAddressResponseModelCopyWithImpl(this._self, this._then); + + final _LatestPositionsAddressResponseModel _self; + final $Res Function(_LatestPositionsAddressResponseModel) _then; + +/// Create a copy of LatestPositionsAddressResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? street = null,Object? city = null,Object? province = null,Object? state = null,Object? country = null,}) { + return _then(_LatestPositionsAddressResponseModel( +street: null == street ? _self.street : street // ignore: cast_nullable_to_non_nullable +as String,city: null == city ? _self.city : city // ignore: cast_nullable_to_non_nullable +as String,province: null == province ? _self.province : province // ignore: cast_nullable_to_non_nullable +as String,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable +as String,country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + + +/// @nodoc +mixin _$LatestPositionsNetworkResponseModel { + + String get SSID; String get BSSID; String get signal; +/// Create a copy of LatestPositionsNetworkResponseModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$LatestPositionsNetworkResponseModelCopyWith get copyWith => _$LatestPositionsNetworkResponseModelCopyWithImpl(this as LatestPositionsNetworkResponseModel, _$identity); + + /// Serializes this LatestPositionsNetworkResponseModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is LatestPositionsNetworkResponseModel&&(identical(other.SSID, SSID) || other.SSID == SSID)&&(identical(other.BSSID, BSSID) || other.BSSID == BSSID)&&(identical(other.signal, signal) || other.signal == signal)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,SSID,BSSID,signal); + +@override +String toString() { + return 'LatestPositionsNetworkResponseModel(SSID: $SSID, BSSID: $BSSID, signal: $signal)'; +} + + +} + +/// @nodoc +abstract mixin class $LatestPositionsNetworkResponseModelCopyWith<$Res> { + factory $LatestPositionsNetworkResponseModelCopyWith(LatestPositionsNetworkResponseModel value, $Res Function(LatestPositionsNetworkResponseModel) _then) = _$LatestPositionsNetworkResponseModelCopyWithImpl; +@useResult +$Res call({ + String SSID, String BSSID, String signal +}); + + + + +} +/// @nodoc +class _$LatestPositionsNetworkResponseModelCopyWithImpl<$Res> + implements $LatestPositionsNetworkResponseModelCopyWith<$Res> { + _$LatestPositionsNetworkResponseModelCopyWithImpl(this._self, this._then); + + final LatestPositionsNetworkResponseModel _self; + final $Res Function(LatestPositionsNetworkResponseModel) _then; + +/// Create a copy of LatestPositionsNetworkResponseModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? SSID = null,Object? BSSID = null,Object? signal = null,}) { + return _then(_self.copyWith( +SSID: null == SSID ? _self.SSID : SSID // ignore: cast_nullable_to_non_nullable +as String,BSSID: null == BSSID ? _self.BSSID : BSSID // ignore: cast_nullable_to_non_nullable +as String,signal: null == signal ? _self.signal : signal // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [LatestPositionsNetworkResponseModel]. +extension LatestPositionsNetworkResponseModelPatterns on LatestPositionsNetworkResponseModel { +/// 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( _LatestPositionsNetworkResponseModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _LatestPositionsNetworkResponseModel() 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( _LatestPositionsNetworkResponseModel value) $default,){ +final _that = this; +switch (_that) { +case _LatestPositionsNetworkResponseModel(): +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( _LatestPositionsNetworkResponseModel value)? $default,){ +final _that = this; +switch (_that) { +case _LatestPositionsNetworkResponseModel() 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 SSID, String BSSID, String signal)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _LatestPositionsNetworkResponseModel() when $default != null: +return $default(_that.SSID,_that.BSSID,_that.signal);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 SSID, String BSSID, String signal) $default,) {final _that = this; +switch (_that) { +case _LatestPositionsNetworkResponseModel(): +return $default(_that.SSID,_that.BSSID,_that.signal);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 SSID, String BSSID, String signal)? $default,) {final _that = this; +switch (_that) { +case _LatestPositionsNetworkResponseModel() when $default != null: +return $default(_that.SSID,_that.BSSID,_that.signal);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _LatestPositionsNetworkResponseModel implements LatestPositionsNetworkResponseModel { + const _LatestPositionsNetworkResponseModel({required this.SSID, required this.BSSID, required this.signal}); + factory _LatestPositionsNetworkResponseModel.fromJson(Map json) => _$LatestPositionsNetworkResponseModelFromJson(json); + +@override final String SSID; +@override final String BSSID; +@override final String signal; + +/// Create a copy of LatestPositionsNetworkResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$LatestPositionsNetworkResponseModelCopyWith<_LatestPositionsNetworkResponseModel> get copyWith => __$LatestPositionsNetworkResponseModelCopyWithImpl<_LatestPositionsNetworkResponseModel>(this, _$identity); + +@override +Map toJson() { + return _$LatestPositionsNetworkResponseModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _LatestPositionsNetworkResponseModel&&(identical(other.SSID, SSID) || other.SSID == SSID)&&(identical(other.BSSID, BSSID) || other.BSSID == BSSID)&&(identical(other.signal, signal) || other.signal == signal)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,SSID,BSSID,signal); + +@override +String toString() { + return 'LatestPositionsNetworkResponseModel(SSID: $SSID, BSSID: $BSSID, signal: $signal)'; +} + + +} + +/// @nodoc +abstract mixin class _$LatestPositionsNetworkResponseModelCopyWith<$Res> implements $LatestPositionsNetworkResponseModelCopyWith<$Res> { + factory _$LatestPositionsNetworkResponseModelCopyWith(_LatestPositionsNetworkResponseModel value, $Res Function(_LatestPositionsNetworkResponseModel) _then) = __$LatestPositionsNetworkResponseModelCopyWithImpl; +@override @useResult +$Res call({ + String SSID, String BSSID, String signal +}); + + + + +} +/// @nodoc +class __$LatestPositionsNetworkResponseModelCopyWithImpl<$Res> + implements _$LatestPositionsNetworkResponseModelCopyWith<$Res> { + __$LatestPositionsNetworkResponseModelCopyWithImpl(this._self, this._then); + + final _LatestPositionsNetworkResponseModel _self; + final $Res Function(_LatestPositionsNetworkResponseModel) _then; + +/// Create a copy of LatestPositionsNetworkResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? SSID = null,Object? BSSID = null,Object? signal = null,}) { + return _then(_LatestPositionsNetworkResponseModel( +SSID: null == SSID ? _self.SSID : SSID // ignore: cast_nullable_to_non_nullable +as String,BSSID: null == BSSID ? _self.BSSID : BSSID // ignore: cast_nullable_to_non_nullable +as String,signal: null == signal ? _self.signal : signal // ignore: cast_nullable_to_non_nullable as String, )); } diff --git a/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.g.dart b/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.g.dart index 6ac15cc9..9d44f2b0 100644 --- a/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.g.dart +++ b/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.g.dart @@ -25,21 +25,91 @@ Map _$LatestPositionsResponseModelToJson( _LatestPositionsItemResponseModel _$LatestPositionsItemResponseModelFromJson( Map json, ) => _LatestPositionsItemResponseModel( + id: json['id'] as String, + deviceIdentificator: json['deviceIdentificator'] as String, latitude: (json['latitude'] as num).toDouble(), longitude: (json['longitude'] as num).toDouble(), - address: json['address'] as String?, - positionDate: DateTime.parse(json['positionDate'] as String), + hpe: (json['hpe'] as num).toInt(), + ncell: (json['ncell'] as num?)?.toInt(), + type: (json['type'] as num).toInt(), + steps: (json['steps'] as num?)?.toInt(), + address: json['address'] == null + ? null + : LatestPositionsAddressResponseModel.fromJson( + json['address'] as Map, + ), + createdAt: (json['createdAt'] as num).toInt(), + positionDate: (json['positionDate'] as num).toInt(), + positionDateOriginal: (json['positionDateOriginal'] as num?)?.toInt(), + frequentPlaceName: json['frequentPlaceName'] as String?, + message: json['message'] as String, + networks: (json['networks'] as List) + .map( + (e) => LatestPositionsNetworkResponseModel.fromJson( + e as Map, + ), + ) + .toList(), + ignore: json['ignore'] as bool, + suspect: json['suspect'] as bool, frequentPlace: json['frequentPlace'] as bool, - frequentPlaceName: json['frequentPlaceName'] as String, ); Map _$LatestPositionsItemResponseModelToJson( _LatestPositionsItemResponseModel instance, ) => { + 'id': instance.id, + 'deviceIdentificator': instance.deviceIdentificator, 'latitude': instance.latitude, 'longitude': instance.longitude, + 'hpe': instance.hpe, + 'ncell': instance.ncell, + 'type': instance.type, + 'steps': instance.steps, 'address': instance.address, - 'positionDate': instance.positionDate.toIso8601String(), - 'frequentPlace': instance.frequentPlace, + 'createdAt': instance.createdAt, + 'positionDate': instance.positionDate, + 'positionDateOriginal': instance.positionDateOriginal, 'frequentPlaceName': instance.frequentPlaceName, + 'message': instance.message, + 'networks': instance.networks, + 'ignore': instance.ignore, + 'suspect': instance.suspect, + 'frequentPlace': instance.frequentPlace, +}; + +_LatestPositionsAddressResponseModel +_$LatestPositionsAddressResponseModelFromJson(Map json) => + _LatestPositionsAddressResponseModel( + street: json['street'] as String, + city: json['city'] as String, + province: json['province'] as String, + state: json['state'] as String, + country: json['country'] as String, + ); + +Map _$LatestPositionsAddressResponseModelToJson( + _LatestPositionsAddressResponseModel instance, +) => { + 'street': instance.street, + 'city': instance.city, + 'province': instance.province, + 'state': instance.state, + 'country': instance.country, +}; + +_LatestPositionsNetworkResponseModel +_$LatestPositionsNetworkResponseModelFromJson(Map json) => + _LatestPositionsNetworkResponseModel( + SSID: json['SSID'] as String, + BSSID: json['BSSID'] as String, + signal: json['signal'] as String, + ); + +Map _$LatestPositionsNetworkResponseModelToJson( + _LatestPositionsNetworkResponseModel instance, +) => { + 'SSID': instance.SSID, + 'BSSID': instance.BSSID, + 'signal': instance.signal, }; diff --git a/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/address_entity.dart b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/address_entity.dart new file mode 100644 index 00000000..ba61989a --- /dev/null +++ b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/address_entity.dart @@ -0,0 +1,14 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'address_entity.freezed.dart'; + +@freezed +abstract class AddressEntity with _$AddressEntity { + const factory AddressEntity({ + required String? street, + required String? city, + required String? province, + required String? state, + required String? country, + }) = _AddressEntity; +} diff --git a/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/address_entity.freezed.dart b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/address_entity.freezed.dart new file mode 100644 index 00000000..e2f3ec5e --- /dev/null +++ b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/address_entity.freezed.dart @@ -0,0 +1,283 @@ +// 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 'address_entity.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$AddressEntity { + + String? get street; String? get city; String? get province; String? get state; String? get country; +/// Create a copy of AddressEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$AddressEntityCopyWith get copyWith => _$AddressEntityCopyWithImpl(this as AddressEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is AddressEntity&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country)); +} + + +@override +int get hashCode => Object.hash(runtimeType,street,city,province,state,country); + +@override +String toString() { + return 'AddressEntity(street: $street, city: $city, province: $province, state: $state, country: $country)'; +} + + +} + +/// @nodoc +abstract mixin class $AddressEntityCopyWith<$Res> { + factory $AddressEntityCopyWith(AddressEntity value, $Res Function(AddressEntity) _then) = _$AddressEntityCopyWithImpl; +@useResult +$Res call({ + String? street, String? city, String? province, String? state, String? country +}); + + + + +} +/// @nodoc +class _$AddressEntityCopyWithImpl<$Res> + implements $AddressEntityCopyWith<$Res> { + _$AddressEntityCopyWithImpl(this._self, this._then); + + final AddressEntity _self; + final $Res Function(AddressEntity) _then; + +/// Create a copy of AddressEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? street = freezed,Object? city = freezed,Object? province = freezed,Object? state = freezed,Object? country = freezed,}) { + return _then(_self.copyWith( +street: freezed == street ? _self.street : street // ignore: cast_nullable_to_non_nullable +as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable +as String?,province: freezed == province ? _self.province : province // ignore: cast_nullable_to_non_nullable +as String?,state: freezed == state ? _self.state : state // ignore: cast_nullable_to_non_nullable +as String?,country: freezed == country ? _self.country : country // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + +} + + +/// Adds pattern-matching-related methods to [AddressEntity]. +extension AddressEntityPatterns on AddressEntity { +/// 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( _AddressEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _AddressEntity() 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( _AddressEntity value) $default,){ +final _that = this; +switch (_that) { +case _AddressEntity(): +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( _AddressEntity value)? $default,){ +final _that = this; +switch (_that) { +case _AddressEntity() 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? street, String? city, String? province, String? state, String? country)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _AddressEntity() when $default != null: +return $default(_that.street,_that.city,_that.province,_that.state,_that.country);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? street, String? city, String? province, String? state, String? country) $default,) {final _that = this; +switch (_that) { +case _AddressEntity(): +return $default(_that.street,_that.city,_that.province,_that.state,_that.country);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? street, String? city, String? province, String? state, String? country)? $default,) {final _that = this; +switch (_that) { +case _AddressEntity() when $default != null: +return $default(_that.street,_that.city,_that.province,_that.state,_that.country);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _AddressEntity implements AddressEntity { + const _AddressEntity({required this.street, required this.city, required this.province, required this.state, required this.country}); + + +@override final String? street; +@override final String? city; +@override final String? province; +@override final String? state; +@override final String? country; + +/// Create a copy of AddressEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$AddressEntityCopyWith<_AddressEntity> get copyWith => __$AddressEntityCopyWithImpl<_AddressEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _AddressEntity&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country)); +} + + +@override +int get hashCode => Object.hash(runtimeType,street,city,province,state,country); + +@override +String toString() { + return 'AddressEntity(street: $street, city: $city, province: $province, state: $state, country: $country)'; +} + + +} + +/// @nodoc +abstract mixin class _$AddressEntityCopyWith<$Res> implements $AddressEntityCopyWith<$Res> { + factory _$AddressEntityCopyWith(_AddressEntity value, $Res Function(_AddressEntity) _then) = __$AddressEntityCopyWithImpl; +@override @useResult +$Res call({ + String? street, String? city, String? province, String? state, String? country +}); + + + + +} +/// @nodoc +class __$AddressEntityCopyWithImpl<$Res> + implements _$AddressEntityCopyWith<$Res> { + __$AddressEntityCopyWithImpl(this._self, this._then); + + final _AddressEntity _self; + final $Res Function(_AddressEntity) _then; + +/// Create a copy of AddressEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? street = freezed,Object? city = freezed,Object? province = freezed,Object? state = freezed,Object? country = freezed,}) { + return _then(_AddressEntity( +street: freezed == street ? _self.street : street // ignore: cast_nullable_to_non_nullable +as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable +as String?,province: freezed == province ? _self.province : province // ignore: cast_nullable_to_non_nullable +as String?,state: freezed == state ? _self.state : state // ignore: cast_nullable_to_non_nullable +as String?,country: freezed == country ? _self.country : country // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/network_entity.dart b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/network_entity.dart new file mode 100644 index 00000000..0280d704 --- /dev/null +++ b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/network_entity.dart @@ -0,0 +1,12 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'network_entity.freezed.dart'; + +@freezed +abstract class NetworkEntity with _$NetworkEntity { + const factory NetworkEntity({ + required String SSID, + required String BSSID, + required String signal, + }) = _NetworkEntity; +} diff --git a/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/network_entity.freezed.dart b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/network_entity.freezed.dart new file mode 100644 index 00000000..eb795e0a --- /dev/null +++ b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/network_entity.freezed.dart @@ -0,0 +1,277 @@ +// 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 'network_entity.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$NetworkEntity { + + String get SSID; String get BSSID; String get signal; +/// Create a copy of NetworkEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$NetworkEntityCopyWith get copyWith => _$NetworkEntityCopyWithImpl(this as NetworkEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is NetworkEntity&&(identical(other.SSID, SSID) || other.SSID == SSID)&&(identical(other.BSSID, BSSID) || other.BSSID == BSSID)&&(identical(other.signal, signal) || other.signal == signal)); +} + + +@override +int get hashCode => Object.hash(runtimeType,SSID,BSSID,signal); + +@override +String toString() { + return 'NetworkEntity(SSID: $SSID, BSSID: $BSSID, signal: $signal)'; +} + + +} + +/// @nodoc +abstract mixin class $NetworkEntityCopyWith<$Res> { + factory $NetworkEntityCopyWith(NetworkEntity value, $Res Function(NetworkEntity) _then) = _$NetworkEntityCopyWithImpl; +@useResult +$Res call({ + String SSID, String BSSID, String signal +}); + + + + +} +/// @nodoc +class _$NetworkEntityCopyWithImpl<$Res> + implements $NetworkEntityCopyWith<$Res> { + _$NetworkEntityCopyWithImpl(this._self, this._then); + + final NetworkEntity _self; + final $Res Function(NetworkEntity) _then; + +/// Create a copy of NetworkEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? SSID = null,Object? BSSID = null,Object? signal = null,}) { + return _then(_self.copyWith( +SSID: null == SSID ? _self.SSID : SSID // ignore: cast_nullable_to_non_nullable +as String,BSSID: null == BSSID ? _self.BSSID : BSSID // ignore: cast_nullable_to_non_nullable +as String,signal: null == signal ? _self.signal : signal // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [NetworkEntity]. +extension NetworkEntityPatterns on NetworkEntity { +/// 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( _NetworkEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _NetworkEntity() 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( _NetworkEntity value) $default,){ +final _that = this; +switch (_that) { +case _NetworkEntity(): +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( _NetworkEntity value)? $default,){ +final _that = this; +switch (_that) { +case _NetworkEntity() 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 SSID, String BSSID, String signal)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _NetworkEntity() when $default != null: +return $default(_that.SSID,_that.BSSID,_that.signal);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 SSID, String BSSID, String signal) $default,) {final _that = this; +switch (_that) { +case _NetworkEntity(): +return $default(_that.SSID,_that.BSSID,_that.signal);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 SSID, String BSSID, String signal)? $default,) {final _that = this; +switch (_that) { +case _NetworkEntity() when $default != null: +return $default(_that.SSID,_that.BSSID,_that.signal);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _NetworkEntity implements NetworkEntity { + const _NetworkEntity({required this.SSID, required this.BSSID, required this.signal}); + + +@override final String SSID; +@override final String BSSID; +@override final String signal; + +/// Create a copy of NetworkEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$NetworkEntityCopyWith<_NetworkEntity> get copyWith => __$NetworkEntityCopyWithImpl<_NetworkEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _NetworkEntity&&(identical(other.SSID, SSID) || other.SSID == SSID)&&(identical(other.BSSID, BSSID) || other.BSSID == BSSID)&&(identical(other.signal, signal) || other.signal == signal)); +} + + +@override +int get hashCode => Object.hash(runtimeType,SSID,BSSID,signal); + +@override +String toString() { + return 'NetworkEntity(SSID: $SSID, BSSID: $BSSID, signal: $signal)'; +} + + +} + +/// @nodoc +abstract mixin class _$NetworkEntityCopyWith<$Res> implements $NetworkEntityCopyWith<$Res> { + factory _$NetworkEntityCopyWith(_NetworkEntity value, $Res Function(_NetworkEntity) _then) = __$NetworkEntityCopyWithImpl; +@override @useResult +$Res call({ + String SSID, String BSSID, String signal +}); + + + + +} +/// @nodoc +class __$NetworkEntityCopyWithImpl<$Res> + implements _$NetworkEntityCopyWith<$Res> { + __$NetworkEntityCopyWithImpl(this._self, this._then); + + final _NetworkEntity _self; + final $Res Function(_NetworkEntity) _then; + +/// Create a copy of NetworkEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? SSID = null,Object? BSSID = null,Object? signal = null,}) { + return _then(_NetworkEntity( +SSID: null == SSID ? _self.SSID : SSID // ignore: cast_nullable_to_non_nullable +as String,BSSID: null == BSSID ? _self.BSSID : BSSID // ignore: cast_nullable_to_non_nullable +as String,signal: null == signal ? _self.signal : signal // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/position_entity.dart b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/position_entity.dart index 00750377..ffdab2a2 100644 --- a/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/position_entity.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/position_entity.dart @@ -1,17 +1,29 @@ -class PositionEntity { - final double latitude; - final double longitude; - final String? address; - final bool frequentPlace; - final String frequentPlaceName; - final DateTime positionDate; +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:hub/src/features/hub/domain/entities/address_entity.dart'; +import 'package:hub/src/features/hub/domain/entities/network_entity.dart'; - 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 +part 'position_entity.freezed.dart'; + +@freezed +abstract class PositionEntity with _$PositionEntity { + const factory PositionEntity({ + required String id, + required String deviceIdentificator, + required double latitude, + required double longitude, + required int hpe, + int? ncell, + required int type, + int? steps, + AddressEntity? address, + required int createdAt, + required int positionDate, + int? positionDateOriginal, + String? frequentPlaceName, + required String message, + required List networks, + required bool ignore, + required bool suspect, + required bool frequentPlace, + }) = _PositionEntity; +} diff --git a/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/position_entity.freezed.dart b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/position_entity.freezed.dart new file mode 100644 index 00000000..098dc68d --- /dev/null +++ b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/position_entity.freezed.dart @@ -0,0 +1,352 @@ +// 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 'position_entity.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$PositionEntity { + + String get id; String get deviceIdentificator; double get latitude; double get longitude; int get hpe; int? get ncell; int get type; int? get steps; AddressEntity? get address; int get createdAt; int get positionDate; int? get positionDateOriginal; String? get frequentPlaceName; String get message; List get networks; bool get ignore; bool get suspect; bool get frequentPlace; +/// Create a copy of PositionEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$PositionEntityCopyWith get copyWith => _$PositionEntityCopyWithImpl(this as PositionEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is PositionEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.hpe, hpe) || other.hpe == hpe)&&(identical(other.ncell, ncell) || other.ncell == ncell)&&(identical(other.type, type) || other.type == type)&&(identical(other.steps, steps) || other.steps == steps)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.positionDate, positionDate) || other.positionDate == positionDate)&&(identical(other.positionDateOriginal, positionDateOriginal) || other.positionDateOriginal == positionDateOriginal)&&(identical(other.frequentPlaceName, frequentPlaceName) || other.frequentPlaceName == frequentPlaceName)&&(identical(other.message, message) || other.message == message)&&const DeepCollectionEquality().equals(other.networks, networks)&&(identical(other.ignore, ignore) || other.ignore == ignore)&&(identical(other.suspect, suspect) || other.suspect == suspect)&&(identical(other.frequentPlace, frequentPlace) || other.frequentPlace == frequentPlace)); +} + + +@override +int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,latitude,longitude,hpe,ncell,type,steps,address,createdAt,positionDate,positionDateOriginal,frequentPlaceName,message,const DeepCollectionEquality().hash(networks),ignore,suspect,frequentPlace); + +@override +String toString() { + return 'PositionEntity(id: $id, deviceIdentificator: $deviceIdentificator, latitude: $latitude, longitude: $longitude, hpe: $hpe, ncell: $ncell, type: $type, steps: $steps, address: $address, createdAt: $createdAt, positionDate: $positionDate, positionDateOriginal: $positionDateOriginal, frequentPlaceName: $frequentPlaceName, message: $message, networks: $networks, ignore: $ignore, suspect: $suspect, frequentPlace: $frequentPlace)'; +} + + +} + +/// @nodoc +abstract mixin class $PositionEntityCopyWith<$Res> { + factory $PositionEntityCopyWith(PositionEntity value, $Res Function(PositionEntity) _then) = _$PositionEntityCopyWithImpl; +@useResult +$Res call({ + String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, AddressEntity? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List networks, bool ignore, bool suspect, bool frequentPlace +}); + + +$AddressEntityCopyWith<$Res>? get address; + +} +/// @nodoc +class _$PositionEntityCopyWithImpl<$Res> + implements $PositionEntityCopyWith<$Res> { + _$PositionEntityCopyWithImpl(this._self, this._then); + + final PositionEntity _self; + final $Res Function(PositionEntity) _then; + +/// Create a copy of PositionEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? deviceIdentificator = null,Object? latitude = null,Object? longitude = null,Object? hpe = null,Object? ncell = freezed,Object? type = null,Object? steps = freezed,Object? address = freezed,Object? createdAt = null,Object? positionDate = null,Object? positionDateOriginal = freezed,Object? frequentPlaceName = freezed,Object? message = null,Object? networks = null,Object? ignore = null,Object? suspect = null,Object? frequentPlace = null,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable +as String,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,hpe: null == hpe ? _self.hpe : hpe // ignore: cast_nullable_to_non_nullable +as int,ncell: freezed == ncell ? _self.ncell : ncell // ignore: cast_nullable_to_non_nullable +as int?,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as int,steps: freezed == steps ? _self.steps : steps // ignore: cast_nullable_to_non_nullable +as int?,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable +as AddressEntity?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as int,positionDate: null == positionDate ? _self.positionDate : positionDate // ignore: cast_nullable_to_non_nullable +as int,positionDateOriginal: freezed == positionDateOriginal ? _self.positionDateOriginal : positionDateOriginal // ignore: cast_nullable_to_non_nullable +as int?,frequentPlaceName: freezed == frequentPlaceName ? _self.frequentPlaceName : frequentPlaceName // ignore: cast_nullable_to_non_nullable +as String?,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable +as String,networks: null == networks ? _self.networks : networks // ignore: cast_nullable_to_non_nullable +as List,ignore: null == ignore ? _self.ignore : ignore // ignore: cast_nullable_to_non_nullable +as bool,suspect: null == suspect ? _self.suspect : suspect // ignore: cast_nullable_to_non_nullable +as bool,frequentPlace: null == frequentPlace ? _self.frequentPlace : frequentPlace // ignore: cast_nullable_to_non_nullable +as bool, + )); +} +/// Create a copy of PositionEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$AddressEntityCopyWith<$Res>? get address { + if (_self.address == null) { + return null; + } + + return $AddressEntityCopyWith<$Res>(_self.address!, (value) { + return _then(_self.copyWith(address: value)); + }); +} +} + + +/// Adds pattern-matching-related methods to [PositionEntity]. +extension PositionEntityPatterns on PositionEntity { +/// 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( _PositionEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _PositionEntity() 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( _PositionEntity value) $default,){ +final _that = this; +switch (_that) { +case _PositionEntity(): +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( _PositionEntity value)? $default,){ +final _that = this; +switch (_that) { +case _PositionEntity() 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 deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, AddressEntity? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List networks, bool ignore, bool suspect, bool frequentPlace)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _PositionEntity() when $default != null: +return $default(_that.id,_that.deviceIdentificator,_that.latitude,_that.longitude,_that.hpe,_that.ncell,_that.type,_that.steps,_that.address,_that.createdAt,_that.positionDate,_that.positionDateOriginal,_that.frequentPlaceName,_that.message,_that.networks,_that.ignore,_that.suspect,_that.frequentPlace);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 deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, AddressEntity? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List networks, bool ignore, bool suspect, bool frequentPlace) $default,) {final _that = this; +switch (_that) { +case _PositionEntity(): +return $default(_that.id,_that.deviceIdentificator,_that.latitude,_that.longitude,_that.hpe,_that.ncell,_that.type,_that.steps,_that.address,_that.createdAt,_that.positionDate,_that.positionDateOriginal,_that.frequentPlaceName,_that.message,_that.networks,_that.ignore,_that.suspect,_that.frequentPlace);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 deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, AddressEntity? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List networks, bool ignore, bool suspect, bool frequentPlace)? $default,) {final _that = this; +switch (_that) { +case _PositionEntity() when $default != null: +return $default(_that.id,_that.deviceIdentificator,_that.latitude,_that.longitude,_that.hpe,_that.ncell,_that.type,_that.steps,_that.address,_that.createdAt,_that.positionDate,_that.positionDateOriginal,_that.frequentPlaceName,_that.message,_that.networks,_that.ignore,_that.suspect,_that.frequentPlace);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _PositionEntity implements PositionEntity { + const _PositionEntity({required this.id, required this.deviceIdentificator, required this.latitude, required this.longitude, required this.hpe, this.ncell, required this.type, this.steps, this.address, required this.createdAt, required this.positionDate, this.positionDateOriginal, this.frequentPlaceName, required this.message, required final List networks, required this.ignore, required this.suspect, required this.frequentPlace}): _networks = networks; + + +@override final String id; +@override final String deviceIdentificator; +@override final double latitude; +@override final double longitude; +@override final int hpe; +@override final int? ncell; +@override final int type; +@override final int? steps; +@override final AddressEntity? address; +@override final int createdAt; +@override final int positionDate; +@override final int? positionDateOriginal; +@override final String? frequentPlaceName; +@override final String message; + final List _networks; +@override List get networks { + if (_networks is EqualUnmodifiableListView) return _networks; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_networks); +} + +@override final bool ignore; +@override final bool suspect; +@override final bool frequentPlace; + +/// Create a copy of PositionEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$PositionEntityCopyWith<_PositionEntity> get copyWith => __$PositionEntityCopyWithImpl<_PositionEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _PositionEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.hpe, hpe) || other.hpe == hpe)&&(identical(other.ncell, ncell) || other.ncell == ncell)&&(identical(other.type, type) || other.type == type)&&(identical(other.steps, steps) || other.steps == steps)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.positionDate, positionDate) || other.positionDate == positionDate)&&(identical(other.positionDateOriginal, positionDateOriginal) || other.positionDateOriginal == positionDateOriginal)&&(identical(other.frequentPlaceName, frequentPlaceName) || other.frequentPlaceName == frequentPlaceName)&&(identical(other.message, message) || other.message == message)&&const DeepCollectionEquality().equals(other._networks, _networks)&&(identical(other.ignore, ignore) || other.ignore == ignore)&&(identical(other.suspect, suspect) || other.suspect == suspect)&&(identical(other.frequentPlace, frequentPlace) || other.frequentPlace == frequentPlace)); +} + + +@override +int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,latitude,longitude,hpe,ncell,type,steps,address,createdAt,positionDate,positionDateOriginal,frequentPlaceName,message,const DeepCollectionEquality().hash(_networks),ignore,suspect,frequentPlace); + +@override +String toString() { + return 'PositionEntity(id: $id, deviceIdentificator: $deviceIdentificator, latitude: $latitude, longitude: $longitude, hpe: $hpe, ncell: $ncell, type: $type, steps: $steps, address: $address, createdAt: $createdAt, positionDate: $positionDate, positionDateOriginal: $positionDateOriginal, frequentPlaceName: $frequentPlaceName, message: $message, networks: $networks, ignore: $ignore, suspect: $suspect, frequentPlace: $frequentPlace)'; +} + + +} + +/// @nodoc +abstract mixin class _$PositionEntityCopyWith<$Res> implements $PositionEntityCopyWith<$Res> { + factory _$PositionEntityCopyWith(_PositionEntity value, $Res Function(_PositionEntity) _then) = __$PositionEntityCopyWithImpl; +@override @useResult +$Res call({ + String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, AddressEntity? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List networks, bool ignore, bool suspect, bool frequentPlace +}); + + +@override $AddressEntityCopyWith<$Res>? get address; + +} +/// @nodoc +class __$PositionEntityCopyWithImpl<$Res> + implements _$PositionEntityCopyWith<$Res> { + __$PositionEntityCopyWithImpl(this._self, this._then); + + final _PositionEntity _self; + final $Res Function(_PositionEntity) _then; + +/// Create a copy of PositionEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? deviceIdentificator = null,Object? latitude = null,Object? longitude = null,Object? hpe = null,Object? ncell = freezed,Object? type = null,Object? steps = freezed,Object? address = freezed,Object? createdAt = null,Object? positionDate = null,Object? positionDateOriginal = freezed,Object? frequentPlaceName = freezed,Object? message = null,Object? networks = null,Object? ignore = null,Object? suspect = null,Object? frequentPlace = null,}) { + return _then(_PositionEntity( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable +as String,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,hpe: null == hpe ? _self.hpe : hpe // ignore: cast_nullable_to_non_nullable +as int,ncell: freezed == ncell ? _self.ncell : ncell // ignore: cast_nullable_to_non_nullable +as int?,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as int,steps: freezed == steps ? _self.steps : steps // ignore: cast_nullable_to_non_nullable +as int?,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable +as AddressEntity?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as int,positionDate: null == positionDate ? _self.positionDate : positionDate // ignore: cast_nullable_to_non_nullable +as int,positionDateOriginal: freezed == positionDateOriginal ? _self.positionDateOriginal : positionDateOriginal // ignore: cast_nullable_to_non_nullable +as int?,frequentPlaceName: freezed == frequentPlaceName ? _self.frequentPlaceName : frequentPlaceName // ignore: cast_nullable_to_non_nullable +as String?,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable +as String,networks: null == networks ? _self._networks : networks // ignore: cast_nullable_to_non_nullable +as List,ignore: null == ignore ? _self.ignore : ignore // ignore: cast_nullable_to_non_nullable +as bool,suspect: null == suspect ? _self.suspect : suspect // ignore: cast_nullable_to_non_nullable +as bool,frequentPlace: null == frequentPlace ? _self.frequentPlace : frequentPlace // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + +/// Create a copy of PositionEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$AddressEntityCopyWith<$Res>? get address { + if (_self.address == null) { + return null; + } + + return $AddressEntityCopyWith<$Res>(_self.address!, (value) { + return _then(_self.copyWith(address: value)); + }); +} +} + +// dart format on diff --git a/modules/legacy/modules/hub/lib/src/features/hub/hub_builder.dart b/modules/legacy/modules/hub/lib/src/features/hub/hub_builder.dart index 51504488..9f154583 100644 --- a/modules/legacy/modules/hub/lib/src/features/hub/hub_builder.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/hub_builder.dart @@ -12,7 +12,7 @@ class HubBuilder { return MaterialPage( key: state.pageKey, - child: HubScreen(navigationContract: navigationContract), + child: HubScreen(navigationContract: navigationContract, routerState: state), ); } } diff --git a/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart b/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart index f0b8db18..9efd7f0c 100644 --- a/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart @@ -1,4 +1,5 @@ import 'package:flutter_svg/svg.dart'; +import 'package:go_router/go_router.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'; @@ -11,8 +12,13 @@ import 'package:utils/utils.dart'; class HubScreen extends ConsumerWidget { final NavigationContract navigationContract; + final GoRouterState routerState; - const HubScreen({super.key, required this.navigationContract}); + const HubScreen({ + super.key, + required this.navigationContract, + required this.routerState + }); @override Widget build(BuildContext context, WidgetRef ref) { @@ -24,8 +30,8 @@ class HubScreen extends ConsumerWidget { return Scaffold( backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), body: SafeArea( - child: Container( - padding: EdgeInsets.symmetric(horizontal: 14), + child: Container( + padding: EdgeInsets.symmetric(horizontal: 14), child: Column( children: [ SizedBox(height: SizeUtils.getByScreen(small: 8, big: 4)), @@ -33,10 +39,28 @@ class HubScreen extends ConsumerWidget { 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)), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Image.asset('assets/images/ui/iso_sf.png', + height: SizeUtils.getByScreen(small: 18, big: 18)), + SizedBox(width: SizeUtils.getByScreen(small: 8, big: 4)), + SizedBox( + width: SizeUtils.getByScreen(small: 104, big: 100), + height: 32, + child: CustomDropdown( + items: viewState.devices.map((device)=> + Text(device.carrierName) + ).toList(), + values: viewState.devices, + value: viewState.selectedDevice, + onChanged: (device){viewModel.setSelectedDevice(device);}, + height: 32, + color: Colors.transparent, + padding: EdgeInsets.zero, + ), + ), + ] ) ), Center( @@ -51,29 +75,29 @@ class HubScreen extends ConsumerWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppSectionButton( - onPressed: (){navigationContract.pushTo(AppRoutes.customerService);}, - icon: SFIcons.customerService, - text: I18n.customerService), + onPressed: (){navigationContract.pushTo(AppRoutes.customerService);}, + icon: SFIcons.customerService, + text: I18n.customerService), SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), AppSectionButton( - onPressed: (){navigationContract.pushTo(AppRoutes.dashboardHome);}, - icon: SFIcons.payments, - text: I18n.sfPay), + onPressed: (){navigationContract.pushTo(AppRoutes.dashboardHome);}, + icon: SFIcons.payments, + text: I18n.sfPay), SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), AppSectionButton( - onPressed: (){navigationContract.pushTo(AppRoutes.dashboardFunctions);}, - icon: SFIcons.functions, - text: I18n.functions), + onPressed: (){navigationContract.pushTo(AppRoutes.dashboardFunctions);}, + icon: SFIcons.functions, + text: I18n.functions), SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), AppSectionButton( - onPressed: (){navigationContract.pushTo(AppRoutes.accountSettings);}, - icon: Icons.manage_accounts_outlined, - text: I18n.accountSettings), + onPressed: (){navigationContract.pushTo(AppRoutes.accountSettings);}, + 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), + onPressed: (){}, + icon: Icons.settings_outlined, + text: I18n.deviceSettings), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 22)), Text(context.translate(I18n.watchesOnMap), @@ -86,32 +110,7 @@ class HubScreen extends ConsumerWidget { 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()) - ], - ) + child: Minimap(), ), SizedBox(height: SizeUtils.getByScreen(small: 14, big: 13)), ], @@ -181,4 +180,118 @@ class AppSectionButton extends ConsumerWidget { ); } +} + +class Minimap extends ConsumerWidget { + + IconData batteryToIcon(int battery) { + if (battery < 15) return Icons.battery_0_bar; + if (battery < 30) return Icons.battery_1_bar; + if (battery < 45) return Icons.battery_2_bar; + if (battery < 60) return Icons.battery_3_bar; + if (battery < 75) return Icons.battery_4_bar; + if (battery < 90) return Icons.battery_5_bar; + return Icons.battery_6_bar; + } + + @override + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.watch(themePortProvider); + + final viewState = ref.watch(hubViewModelProvider); + final viewModel = ref.read(hubViewModelProvider.notifier); + + final battery = viewState.selectedPosition?.ncell ?? 0; + final IconData batteryIcon = batteryToIcon(battery); + + final positionDate = DateTime.fromMillisecondsSinceEpoch(viewState.selectedPosition?.positionDate ?? 0); + + return FlutterMap( + mapController: viewModel.mapController, + options: MapOptions( + initialCenter: LatLng(45.32833189648895, -3.0830872665435085), + initialZoom: 15, + keepAlive: true, + ), + children: [ + TileLayer( + urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', + userAgentPackageName: 'com.savefamily.sf_platform', + ), + MarkerLayer(markers: [if (viewState.selectedPosition != null) + Marker( + point: LatLng(viewState.selectedPosition!.latitude, viewState.selectedPosition!.longitude), + width: 200, + height: 145, + child: Align( + alignment: Alignment.topCenter, + child: SvgPicture.asset('assets/images/ui/location.svg', + height: 80) + ), + rotate: true, + ) + ]), + if (viewState.selectedPosition != null) + Align( + alignment: Alignment.bottomCenter, + child: Container( + height: SizeUtils.getByScreen(small: 60, big: 58), + width: SizeUtils.getByScreen(small: 300, big: 298), + margin: EdgeInsets.only(bottom: SizeUtils.getByScreen(small: 20, big: 16)), + decoration: BoxDecoration( + color: theme.getColorFor(ThemeCode.backgroundPrimary), + borderRadius: BorderRadius.all(Radius.circular(SizeUtils.getByScreen(small: 9, big: 8))) + ), + child: Row( + children: [ + Icon(SFIcons.location, + size: SizeUtils.getByScreen(small: 40, big: 38), + color: Color(0xFF588EA5), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + width: SizeUtils.getByScreen(small: 250, big: 248), + child: Text('${viewState.selectedPosition!.address?.street}, ' + '${viewState.selectedPosition!.address?.province}, ' + '${viewState.selectedPosition!.address?.country}', + overflow: TextOverflow.ellipsis, + ) + ), + Row( + children: [ + Text('${positionDate.month.toString().padLeft(2, '0')}-' + '${positionDate.day.toString().padLeft(2, '0')} ' + '${positionDate.hour.toString().padLeft(2, '0')}:' + '${positionDate.minute.toString().padLeft(2, '0')}:' + '${positionDate.second.toString().padLeft(2, '0')}', + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 12, big: 11) + ), + ), + if (viewState.selectedPosition!.networks.isNotEmpty) + Text(' | ${viewState.selectedPosition!.networks.first.signal}', + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 12, big: 11) + ), + ), + Icon(batteryIcon), + Text('${viewState.selectedPosition!.ncell ?? 0}%', + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 12, big: 11) + ), + ) + ], + ) + ], + ) + ], + ), + ), + ) + ], + ); + } } \ No newline at end of file diff --git a/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_model.dart b/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_model.dart index c87c507a..2473a0f7 100644 --- a/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_model.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_model.dart @@ -2,18 +2,14 @@ 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( @@ -36,11 +32,14 @@ class HubViewModel extends Notifier { _getDevicesUseCase.getDevices( userId: '' ).then((List res){ - state = state.copyWith(devices: res); + state = state.copyWith( + devices: res, + selectedDevice: res.first + ); return Future.wait(res.map((device) => - _getLatestPositionsUseCase.getLatestPositions( - deviceId: device.identificator - ) + _getLatestPositionsUseCase.getLatestPositions( + deviceId: device.identificator + ) )); }).then( (List> res) { @@ -55,31 +54,28 @@ class HubViewModel extends Notifier { void setPositions(List> positions) { final devicePositions = positions.map((List devicePositions)=>devicePositions[0]).toList(); + final selectedPosition = devicePositions.where((p)=> + p.deviceIdentificator == state.selectedDevice!.identificator).firstOrNull; state = state.copyWith( positions: devicePositions, + selectedPosition: selectedPosition, ); - 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); + if (selectedPosition != null) { + mapController.move(LatLng( + selectedPosition.latitude, + selectedPosition.longitude, + ), 15); + } } - GetDevicesRequestEntity _toDevicesRequest() { - final userId = ''; - if (userId == null) throw Exception('userId is required'); - - return GetDevicesRequestEntity(userId: userId); - } - - /*void _startLoadingForSignUp() { + void setSelectedDevice(DeviceEntity device) { + final selectedPosition = state.positions.where((p)=> + p.deviceIdentificator == device.identificator).firstOrNull; state = state.copyWith( - isLoading: true, - errorMessage: '', - twoFASecret: null, - showSecretCode: false, - showAccountCreated: false, + selectedDevice: device, + selectedPosition: selectedPosition, ); - }*/ + } void disposeControllers(){ mapController.dispose(); diff --git a/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart b/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart index a1c6dbde..d19035f7 100644 --- a/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart @@ -8,6 +8,8 @@ part 'hub_view_state.freezed.dart'; abstract class HubViewState with _$HubViewState { const factory HubViewState({ @Default([]) List devices, - @Default([]) List positions + DeviceEntity? selectedDevice, + @Default([]) List positions, + PositionEntity? selectedPosition }) = _HubViewState; } diff --git a/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.freezed.dart b/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.freezed.dart index 0388aa6b..92221d5c 100644 --- a/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.freezed.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.freezed.dart @@ -14,7 +14,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$HubViewState { - List get devices; List get positions; + List get devices; DeviceEntity? get selectedDevice; List get positions; PositionEntity? get selectedPosition; /// Create a copy of HubViewState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -25,16 +25,16 @@ $HubViewStateCopyWith get copyWith => _$HubViewStateCopyWithImpl Object.hash(runtimeType,const DeepCollectionEquality().hash(devices),const DeepCollectionEquality().hash(positions)); +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(devices),selectedDevice,const DeepCollectionEquality().hash(positions),selectedPosition); @override String toString() { - return 'HubViewState(devices: $devices, positions: $positions)'; + return 'HubViewState(devices: $devices, selectedDevice: $selectedDevice, positions: $positions, selectedPosition: $selectedPosition)'; } @@ -45,11 +45,11 @@ abstract mixin class $HubViewStateCopyWith<$Res> { factory $HubViewStateCopyWith(HubViewState value, $Res Function(HubViewState) _then) = _$HubViewStateCopyWithImpl; @useResult $Res call({ - List devices, List positions + List devices, DeviceEntity? selectedDevice, List positions, PositionEntity? selectedPosition }); - +$PositionEntityCopyWith<$Res>? get selectedPosition; } /// @nodoc @@ -62,14 +62,28 @@ class _$HubViewStateCopyWithImpl<$Res> /// 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,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? devices = null,Object? selectedDevice = freezed,Object? positions = null,Object? selectedPosition = freezed,}) { 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, +as List,selectedDevice: freezed == selectedDevice ? _self.selectedDevice : selectedDevice // ignore: cast_nullable_to_non_nullable +as DeviceEntity?,positions: null == positions ? _self.positions : positions // ignore: cast_nullable_to_non_nullable +as List,selectedPosition: freezed == selectedPosition ? _self.selectedPosition : selectedPosition // ignore: cast_nullable_to_non_nullable +as PositionEntity?, )); } +/// Create a copy of HubViewState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$PositionEntityCopyWith<$Res>? get selectedPosition { + if (_self.selectedPosition == null) { + return null; + } + return $PositionEntityCopyWith<$Res>(_self.selectedPosition!, (value) { + return _then(_self.copyWith(selectedPosition: value)); + }); +} } @@ -151,10 +165,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( List devices, List positions)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( List devices, DeviceEntity? selectedDevice, List positions, PositionEntity? selectedPosition)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _HubViewState() when $default != null: -return $default(_that.devices,_that.positions);case _: +return $default(_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition);case _: return orElse(); } @@ -172,10 +186,10 @@ return $default(_that.devices,_that.positions);case _: /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( List devices, List positions) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( List devices, DeviceEntity? selectedDevice, List positions, PositionEntity? selectedPosition) $default,) {final _that = this; switch (_that) { case _HubViewState(): -return $default(_that.devices,_that.positions);case _: +return $default(_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition);case _: throw StateError('Unexpected subclass'); } @@ -192,10 +206,10 @@ return $default(_that.devices,_that.positions);case _: /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( List devices, List positions)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( List devices, DeviceEntity? selectedDevice, List positions, PositionEntity? selectedPosition)? $default,) {final _that = this; switch (_that) { case _HubViewState() when $default != null: -return $default(_that.devices,_that.positions);case _: +return $default(_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition);case _: return null; } @@ -207,7 +221,7 @@ return $default(_that.devices,_that.positions);case _: class _HubViewState implements HubViewState { - const _HubViewState({final List devices = const [], final List positions = const []}): _devices = devices,_positions = positions; + const _HubViewState({final List devices = const [], this.selectedDevice, final List positions = const [], this.selectedPosition}): _devices = devices,_positions = positions; final List _devices; @@ -217,6 +231,7 @@ class _HubViewState implements HubViewState { return EqualUnmodifiableListView(_devices); } +@override final DeviceEntity? selectedDevice; final List _positions; @override@JsonKey() List get positions { if (_positions is EqualUnmodifiableListView) return _positions; @@ -224,6 +239,7 @@ class _HubViewState implements HubViewState { return EqualUnmodifiableListView(_positions); } +@override final PositionEntity? selectedPosition; /// Create a copy of HubViewState /// with the given fields replaced by the non-null parameter values. @@ -235,16 +251,16 @@ _$HubViewStateCopyWith<_HubViewState> get copyWith => __$HubViewStateCopyWithImp @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)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _HubViewState&&const DeepCollectionEquality().equals(other._devices, _devices)&&(identical(other.selectedDevice, selectedDevice) || other.selectedDevice == selectedDevice)&&const DeepCollectionEquality().equals(other._positions, _positions)&&(identical(other.selectedPosition, selectedPosition) || other.selectedPosition == selectedPosition)); } @override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_devices),const DeepCollectionEquality().hash(_positions)); +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_devices),selectedDevice,const DeepCollectionEquality().hash(_positions),selectedPosition); @override String toString() { - return 'HubViewState(devices: $devices, positions: $positions)'; + return 'HubViewState(devices: $devices, selectedDevice: $selectedDevice, positions: $positions, selectedPosition: $selectedPosition)'; } @@ -255,11 +271,11 @@ abstract mixin class _$HubViewStateCopyWith<$Res> implements $HubViewStateCopyWi factory _$HubViewStateCopyWith(_HubViewState value, $Res Function(_HubViewState) _then) = __$HubViewStateCopyWithImpl; @override @useResult $Res call({ - List devices, List positions + List devices, DeviceEntity? selectedDevice, List positions, PositionEntity? selectedPosition }); - +@override $PositionEntityCopyWith<$Res>? get selectedPosition; } /// @nodoc @@ -272,15 +288,29 @@ class __$HubViewStateCopyWithImpl<$Res> /// 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,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? devices = null,Object? selectedDevice = freezed,Object? positions = null,Object? selectedPosition = freezed,}) { 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, +as List,selectedDevice: freezed == selectedDevice ? _self.selectedDevice : selectedDevice // ignore: cast_nullable_to_non_nullable +as DeviceEntity?,positions: null == positions ? _self._positions : positions // ignore: cast_nullable_to_non_nullable +as List,selectedPosition: freezed == selectedPosition ? _self.selectedPosition : selectedPosition // ignore: cast_nullable_to_non_nullable +as PositionEntity?, )); } +/// Create a copy of HubViewState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$PositionEntityCopyWith<$Res>? get selectedPosition { + if (_self.selectedPosition == null) { + return null; + } + return $PositionEntityCopyWith<$Res>(_self.selectedPosition!, (value) { + return _then(_self.copyWith(selectedPosition: value)); + }); +} } // dart format on diff --git a/packages/design_system/fonts/SFIcons.ttf b/packages/design_system/fonts/SFIcons.ttf index ef3076f16e34e88849f8e40dddacc78198cfe69d..10d00529428ceb5b715e226686e17c525b21092e 100644 GIT binary patch delta 570 zcmXxfOGs2v9LMqB^<1Y$ZN{eYu^99=f{z^M_Q27iK%9K#BOf#3BqHjRR}mb|1R)sH z@wsZaGK5PPG5fo*+_eff#X!5Df`n5m7vm~n`rDuWhY#PgIE(Yo{!~tXD6el-MZcW^ zq6M%mPtUD9Q#0r9fdT^>BbL9;~+lNZ1&y2Eg>Y?^_Vr7@4}iMl71 z8O@`uYUkHeUe%kf`cMosIB+cfA<*;?uK1|vmVfQEu-MYgKPOfZcTg=&A0-c z{y&OY^YiqGv&`*K{7OxAQ=lnu=XR-S8DYmqSA|wCgw0;)C@$5^&6(k%Vo#B++C@2cZLyRT}f|SV1P>e*ADxx5X zM!d%0&J|(h=DHxVVL^-w5;qc~8!=IHWg{j?bcF{-6Sp#x?|hRvCnsl;+4#t9e&QY+ zbgz8)1_%{^bfvd{>|$ncEDA7$fb+AVp3ZLX)pgTMOOBYU2DfG=T;@vv_|4&=k?^(b zUI#F+IkVtPPI))@w8MDh2ciXy3h-HNF8OO!m)~_PcL~LZle^iEtylCNrE8hqvK2#=U%&T$|B7mMx|TrF%nlEotPr< z0iB_Yry-=ED91X?rDBwg7O&&|v38SCWh|6@wmQ+^c9ffvW27Wwe4JU Date: Tue, 17 Feb 2026 16:34:19 +0100 Subject: [PATCH 21/25] Added regcode qr dialog --- .../presentation/account_settings_screen.dart | 235 +++++++++++++----- packages/sf_localizations/assets/l10n/en.json | 8 +- packages/sf_localizations/assets/l10n/es.json | 14 +- .../lib/src/generated/i18n.dart | 6 + 4 files changed, 192 insertions(+), 71 deletions(-) diff --git a/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart b/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart index 6f2f73d0..6956c34c 100644 --- a/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart @@ -1,10 +1,12 @@ -// import 'package:account/src/features/linked_devices/presentation/app_users_screen.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:legacy_shared/legacy_shared.dart'; import 'package:navigation/navigation.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; +import 'package:flutter/services.dart'; +import 'package:qr_flutter/qr_flutter.dart'; class AccountSettingsScreen extends ConsumerWidget { final NavigationContract navigationContract; @@ -15,75 +17,77 @@ class AccountSettingsScreen extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final theme = ref.watch(themePortProvider); - return Scaffold( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), - body: SafeArea( + return PageLayout( + title: context.translate(I18n.accountSettings), + body: SingleChildScrollView(child: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) + ), child: Column( children: [ - Container( - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), - big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) - ), - child: Stack( - children: [ - IconButton(onPressed: () {Navigator.pop(context);}, - icon: Icon(Icons.arrow_back)), - Center( - child: Text(context.translate(I18n.accountSettings), - style: TextStyle( - fontSize: SizeUtils.getByScreen(small: 28, big: 27) - ), - ) - ) - ], - ), + AppSectionButton( + onPressed: (){navigationContract.pushTo(AppRoutes.personalData);}, + icon: SFIcons.account, + text: I18n.legacyPersonalData + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){}, + icon: Icons.lock, + text: I18n.legacyChangePassword + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){}, + icon: Icons.add_circle_outline, + text: I18n.legacyAddNewSF + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){navigationContract.pushTo(AppRoutes.linkedDevices);}, + icon: Icons.account_circle_outlined, + text: I18n.legacyLinkedDevices + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){navigationContract.pushTo(AppRoutes.appUsers);}, + icon: Icons.groups_outlined, + text: I18n.legacyAppUsers + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){}, + icon: SFIcons.privacy, + text: I18n.legacyPrivacyPolicy + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){ + showDialog(context: context, builder: (context)=>Dialog( + backgroundColor: Colors.transparent, + child: RegCodeDialog(regCode: 'regCode', deviceId: 'deviceId', name: 'name'), + )); + }, + icon: Icons.qr_code, + text: I18n.legacyRegCode + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppSectionButton( + onPressed: (){}, + icon: SFIcons.privacy, + text: I18n.legacyDeleteAccount ), - SizedBox(height: SizeUtils.getByScreen(small: 30, big: 28)), - SingleChildScrollView(child: Container( - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), - big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) - ), - child: Column( - children: [ - AppSectionButton( - onPressed: (){navigationContract.pushTo(AppRoutes.personalData);}, - icon: SFIcons.account, - text: I18n.legacyPersonalData - ), - SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), - AppSectionButton( - onPressed: (){}, - icon: Icons.add_circle_outline, - text: I18n.legacyAddNewSF - ), - SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), - AppSectionButton( - onPressed: (){navigationContract.pushTo(AppRoutes.linkedDevices);}, - icon: Icons.account_circle_outlined, - text: I18n.legacyLinkedDevices - ), - SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), - AppSectionButton( - onPressed: (){navigationContract.pushTo(AppRoutes.appUsers);}, - icon: Icons.groups_outlined, - text: I18n.legacyAppUsers - ), - SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), - AppSectionButton( - onPressed: (){}, - icon: SFIcons.privacy, - text: I18n.legacyPrivacyPolicy - ), - SizedBox(height: SizeUtils.getByScreen(small: 48, big: 47)), - PrimaryButton(text: context.translate(I18n.legacyLogOut), color: Color(0xFF588EA5)) - ], - ), - )), ], - ) - ), + ), + )), + footer: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(vertical: 12, horizontal: 30), + big: EdgeInsets.symmetric(vertical: 10, horizontal: 28) + ), + child: PrimaryButton(text: context.translate(I18n.legacyLogOut), color: Color(0xFF588EA5)), + ) ); } } @@ -143,4 +147,103 @@ class AppSectionButton extends ConsumerWidget { ) ); } +} + +class RegCodeDialog extends StatelessWidget { + + final String regCode; + final String deviceId; + final String name; + + const RegCodeDialog({ + super.key, + required this.regCode, + required this.deviceId, + required this.name, + }); + + @override + Widget build(BuildContext context) { + return Container( + height: SizeUtils.getByScreen(small: 330, big: 328), + color: Colors.transparent, + child: Stack( + children: [ + Align( + alignment: Alignment.bottomCenter, + child: Container( + height: SizeUtils.getByScreen(small: 300, big: 298), + width: SizeUtils.getByScreen(small: 350, big: 348), + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(vertical: 14, horizontal: 18), + big: EdgeInsets.symmetric(vertical: 12, horizontal: 16) + ), + color: Colors.white, + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Align( + alignment: Alignment.topRight, + child: IconButton( + onPressed: (){Navigator.pop(context);}, + icon: Icon(Icons.close), + padding: EdgeInsets.zero, + ), + ), + Text(name, style: TextStyle()), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text(context.translate(I18n.legacyDeviceIdLabel, + args: {'deviceId': deviceId})), + TextButton( + onPressed: (){Clipboard.setData(ClipboardData(text: deviceId));}, + child: Text(context.translate(I18n.legacyCopy)), + ) + ], + ), + QrImageView( + data: regCode, + version: QrVersions.auto, + size: SizeUtils.getByScreen(small: 100, big: 98), + padding: EdgeInsets.zero, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text(context.translate(I18n.legacyRegCodeLabel, + args: {'regCode': regCode})), + TextButton( + onPressed: (){Clipboard.setData(ClipboardData(text: regCode));}, + child: Text(context.translate(I18n.legacyCopy)) + ) + ], + ) + ], + ), + ), + ), + Align( + alignment: Alignment.topCenter, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Color(0xFF00A1C6), + ), + padding: SizeUtils.getByScreen( + small: EdgeInsets.all(12), + big: EdgeInsets.all(12) + ), + child: Icon( + SFIcons.watch, + size: SizeUtils.getByScreen(small: 68, big: 66), + color: Colors.white, + ), + ) + ), + ], + ), + ); + } + } \ No newline at end of file diff --git a/packages/sf_localizations/assets/l10n/en.json b/packages/sf_localizations/assets/l10n/en.json index 8754ad7a..2228d99c 100755 --- a/packages/sf_localizations/assets/l10n/en.json +++ b/packages/sf_localizations/assets/l10n/en.json @@ -155,10 +155,13 @@ "enterMessage": "Your message", "sendEmail": "Send!", "personalData": "Personal Data", + "changePassword": "Change password", "addNewSF": "Add a new SaveFamily", "linkedDevices": "Linked Devices", "appUsers": "App Users", "privacyPolicy": "User privacy policy", + "regCode": "Device registration code", + "deleteAccount": "Delete account", "logOut": "Log out", "loginEmail": "(Login email)", "userNameLabel": "User name", @@ -173,5 +176,8 @@ "cancel": "Cancel", "delete": "Delete", "userAccount": "Account: {email}", - "userRole": "Role: {role}" + "userRole": "Role: {role}", + "copy": "copy", + "deviceIdLabel": "ID: {deviceId}", + "regCodeLabel": "Registration code: {regCode}" } \ 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 7eda8c37..bf90f499 100644 --- a/packages/sf_localizations/assets/l10n/es.json +++ b/packages/sf_localizations/assets/l10n/es.json @@ -155,10 +155,13 @@ "enterMessage": "Tu mensaje", "sendEmail": "Enviar", "personalData": "Datos Personales", - "addNewSF": "Añadir un nuevo SaveFamily", + "changePassword": "Cambiar contraseña", + "addNewSF": "Agregar un nuevo SaveFamily", "linkedDevices": "Dispositivos vinculados", - "appUsers": "Usuarios de la App", - "privacyPolicy": "Política de privacidad", + "appUsers": "Usuarios de la aplicación", + "privacyPolicy": "Política de privacidad del usuario", + "regCode": "Código de registro del dispositivo", + "deleteAccount": "Eliminar cuenta", "logOut": "Cerrar sesión", "loginEmail": "(Correo electrónico)", "userNameLabel": "Nombre del usuario", @@ -173,5 +176,8 @@ "cancel": "Cancelar", "delete": "Eliminar", "userAccount": "Cuenta: {email}", - "userRole": "Rol: {role}" + "userRole": "Rol: {role}", + "copy": "copiar", + "deviceIdLabel": "ID: {deviceId}", + "regCodeLabel": "Código de registro: {regCode}" } \ 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 90815c64..b27bdf70 100755 --- a/packages/sf_localizations/lib/src/generated/i18n.dart +++ b/packages/sf_localizations/lib/src/generated/i18n.dart @@ -185,6 +185,7 @@ class I18n { static const String enterMessage = 'enterMessage'; static const String sendEmail = 'sendEmail'; static const String legacyPersonalData = 'personalData'; + static const String legacyChangePassword = 'changePassword'; static const String legacyAddNewSF = 'addNewSF'; static const String legacyLinkedDevices = 'linkedDevices'; static const String legacyAppUsers = 'appUsers'; @@ -205,4 +206,9 @@ class I18n { static const String legacyDelete = 'delete'; static const String legacyUserAccount = 'userAccount'; static const String legacyUserRole = 'userRole'; + static const String legacyCopy = 'copy'; + static const String legacyDeviceIdLabel = 'deviceIdLabel'; + static const String legacyRegCodeLabel = 'regCodeLabel'; + static const String legacyRegCode = 'regCode'; + static const String legacyDeleteAccount = 'deleteAccount'; } From 471aa1067ca4868673fa685cfe09810d63b6483e Mon Sep 17 00:00:00 2001 From: aitorarana Date: Wed, 18 Feb 2026 16:31:50 +0100 Subject: [PATCH 22/25] Added selected device provider, applied page_layout to account screens --- .../datasource/account_remote_datasource.dart | 2 +- .../account_remote_datasource_impl.dart | 58 +- .../get_linked_devices_response_model.dart | 78 +- ...linked_devices_response_model.freezed.dart | 671 +++- .../get_linked_devices_response_model.g.dart | 68 +- .../repositories/account_repository_impl.dart | 2 +- .../repositories/account_repository.dart | 2 +- .../presentation/account_settings_screen.dart | 4 +- .../presentation/app_users_screen.dart | 100 +- .../state/app_users_view_model.dart | 2 +- .../domain/entities/device_entity.dart | 12 - .../entities/device_entity.freezed.dart | 277 -- .../domain/get_linked_devices_use_case.dart | 2 +- .../get_linked_devices_use_case_impl.dart | 2 +- .../edit_linked_device_screen.dart | 159 +- .../presentation/linked_devices_screen.dart | 88 +- .../state/linked_devices_view_model.dart | 4 +- .../state/linked_devices_view_state.dart | 2 +- .../presentation/personal_data_screen.dart | 170 +- .../state/personal_data_view_model.dart | 3 +- modules/legacy/modules/account/pubspec.yaml | 116 + .../modules/customer_service/pubspec.yaml | 117 + .../datasource/hub_remote_datasource.dart | 4 +- .../hub_remote_datasource_impl.dart | 2 +- .../models/get_devices_response_model.dart | 82 +- .../get_devices_response_model.freezed.dart | 669 +++- .../models/get_devices_response_model.g.dart | 62 +- .../repositories/hub_repository_impl.dart | 3 +- .../domain/repositories/hub_repository.dart | 3 +- .../hub/domain/entities/device_entity.dart | 11 - .../hub/domain/get_devices_use_case.dart | 2 +- .../hub/domain/get_devices_use_case_impl.dart | 3 +- .../features/hub/presentation/hub_screen.dart | 3 +- .../presentation/state/hub_view_model.dart | 18 +- .../presentation/state/hub_view_state.dart | 3 +- .../state/hub_view_state.freezed.dart | 95 +- modules/legacy/modules/hub/pubspec.lock | 9 +- modules/legacy/modules/hub/pubspec.yaml | 4 +- .../legacy/modules/hub/pubspec_overrides.yaml | 3 + .../pubspec_overrides.yaml | 3 + .../data/models/entities/device_entity.dart | 123 + .../entities/device_entity.freezed.dart | 2922 +++++++++++++++++ .../providers/selected_device_provider.dart | 18 + .../lib/src/widgets/layouts/page_layout.dart | 36 +- packages/sf_localizations/assets/l10n/en.json | 1 - packages/sf_localizations/assets/l10n/es.json | 3 - .../lib/src/generated/i18n.dart | 4 - 47 files changed, 5252 insertions(+), 773 deletions(-) delete mode 100644 modules/legacy/modules/account/lib/src/features/linked_devices/domain/entities/device_entity.dart delete mode 100644 modules/legacy/modules/account/lib/src/features/linked_devices/domain/entities/device_entity.freezed.dart create mode 100644 modules/legacy/modules/account/pubspec.yaml create mode 100644 modules/legacy/modules/customer_service/pubspec.yaml delete mode 100644 modules/legacy/modules/hub/lib/src/features/hub/domain/entities/device_entity.dart create mode 100644 modules/legacy/packages/legacy_shared/lib/src/data/models/entities/device_entity.dart create mode 100644 modules/legacy/packages/legacy_shared/lib/src/data/models/entities/device_entity.freezed.dart create mode 100644 modules/legacy/packages/legacy_shared/lib/src/providers/selected_device_provider.dart diff --git a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart index 17ed7634..de5f7338 100644 --- a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart +++ b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart @@ -1,4 +1,4 @@ -import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:legacy_shared/src/data/models/entities/device_entity.dart'; import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart'; import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; import 'package:legacy_shared/legacy_shared.dart'; diff --git a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart index 18596472..8b953385 100644 --- a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart +++ b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart @@ -5,7 +5,7 @@ import 'package:account/src/core/data/models/get_app_users_response_model.dart'; import 'package:account/src/core/data/models/get_linked_devices_response_model.dart'; import 'package:account/src/core/data/models/update_device_request_model.dart'; import 'package:account/src/core/data/models/update_user_request_model.dart'; -import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:legacy_shared/src/data/models/entities/device_entity.dart'; import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart'; import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -21,7 +21,7 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource { @override Future> getLinkedDevices({required String userId}) async { try { - final response = await _repository.get>( + /*final response = await _repository.get>( '/$userId/devices', ); final data = response.data!['items']; @@ -29,17 +29,57 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource { throw Exception('Empty response from /:userId/devices'); } - final model = GetLinkedDevicesResponseModel.fromJson(data); - /*final model = GetLinkedDevicesResponseModel(items: [ + final model = GetLinkedDevicesResponseModel.fromJson(data);*/ + final model = GetLinkedDevicesResponseModel(items: [ GetLinkedDevicesItemResponseModel( identificator: '1111', - name: 'Carlos', - number: '111111111'), + carrierName: 'Carlos', + phone: '111111111', + id: '', + settings: GetLinkedDevicesSettingsResponseModel( + frequency: 0, + frequencyHeartRate: 0, + timezone: 0, + pedometer: false, + language: 'language', + alerts: [], + ), + protocol: '', + type: '', + connectionServer: '', + createdAt: 0, + flags: GetLinkedDevicesFlagsResponseModel( + isInOrOut: 'isInOrOut', + geofenceId: 'geofenceId', + isBatteryLow: false, + isDisconnect: false, + ) + ), GetLinkedDevicesItemResponseModel( identificator: '1112', - name: 'Ana', - number: '222222222'), - ]);*/ + carrierName: 'Ana', + phone: '222222222', + id: '', + settings: GetLinkedDevicesSettingsResponseModel( + frequency: 0, + frequencyHeartRate: 0, + timezone: 0, + pedometer: false, + language: 'language', + alerts: [], + ), + protocol: '', + type: '', + connectionServer: '', + createdAt: 0, + flags: GetLinkedDevicesFlagsResponseModel( + isInOrOut: 'isInOrOut', + geofenceId: 'geofenceId', + isBatteryLow: false, + isDisconnect: false, + ) + ), + ]); return model.toEntity(); } on DioException catch (error) { throw _mapDioError( diff --git a/modules/legacy/modules/account/lib/src/core/data/models/get_linked_devices_response_model.dart b/modules/legacy/modules/account/lib/src/core/data/models/get_linked_devices_response_model.dart index e844559d..b311ae23 100644 --- a/modules/legacy/modules/account/lib/src/core/data/models/get_linked_devices_response_model.dart +++ b/modules/legacy/modules/account/lib/src/core/data/models/get_linked_devices_response_model.dart @@ -1,4 +1,4 @@ -import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:legacy_shared/src/data/models/entities/device_entity.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'get_linked_devices_response_model.freezed.dart'; @@ -18,8 +18,15 @@ abstract class GetLinkedDevicesResponseModel with _$GetLinkedDevicesResponseMode abstract class GetLinkedDevicesItemResponseModel with _$GetLinkedDevicesItemResponseModel { const factory GetLinkedDevicesItemResponseModel({ required String identificator, - required String name, - required String number, + required String carrierName, + required String phone, + required String id, + required GetLinkedDevicesSettingsResponseModel settings, + required String protocol, + required String type, + required String connectionServer, + required int createdAt, + required GetLinkedDevicesFlagsResponseModel flags, }) = _GetLinkedDevicesItemResponseModel; @@ -30,9 +37,68 @@ abstract class GetLinkedDevicesItemResponseModel with _$GetLinkedDevicesItemResp extension GetDevicesResponseModelMapper on GetLinkedDevicesResponseModel { List toEntity() { return items.map((GetLinkedDevicesItemResponseModel item) => DeviceEntity( - identificator: item.identificator, - name: item.name, - number: item.number + identificator: item.identificator, + carrierName: item.carrierName, + phone: item.phone, + id: item.id, + settings: item.settings.toEntity(), + protocol: item.protocol, + type: item.type, + connectionServer: item.connectionServer, + createdAt: item.createdAt, + flags: item.flags.toEntity(), )).toList(); } +} + +@freezed +abstract class GetLinkedDevicesSettingsResponseModel with _$GetLinkedDevicesSettingsResponseModel { + const factory GetLinkedDevicesSettingsResponseModel({ + required int frequency, + required int frequencyHeartRate, + required int timezone, + required bool pedometer, + required String language, + required List alerts, + }) = _GetLinkedDevicesSettingsResponseModel; + + factory GetLinkedDevicesSettingsResponseModel.fromJson(Map json) => + _$GetLinkedDevicesSettingsResponseModelFromJson(json); +} + +extension GetLinkedDevicesSettingsResponseModelMapper on GetLinkedDevicesSettingsResponseModel { + DeviceSettingsEntity toEntity() { + return DeviceSettingsEntity( + frequency: frequency, + frequencyHeartRate: frequencyHeartRate, + timezone: timezone, + pedometer: pedometer, + language: language, + alerts: alerts, + ); + } +} + +@freezed +abstract class GetLinkedDevicesFlagsResponseModel with _$GetLinkedDevicesFlagsResponseModel { + const factory GetLinkedDevicesFlagsResponseModel({ + required String isInOrOut, + required String geofenceId, + required bool isBatteryLow, + required bool isDisconnect, + }) = _GetLinkedDevicesFlagsResponseModel; + + factory GetLinkedDevicesFlagsResponseModel.fromJson(Map json) => + _$GetLinkedDevicesFlagsResponseModelFromJson(json); +} + +extension GetLinkedDevicesFlagsResponseModelMapper on GetLinkedDevicesFlagsResponseModel { + DeviceFlagsEntity toEntity() { + return DeviceFlagsEntity( + isInOrOut: isInOrOut, + geofenceId: geofenceId, + isBatteryLow: isBatteryLow, + isDisconnect: isDisconnect, + ); + } } \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/core/data/models/get_linked_devices_response_model.freezed.dart b/modules/legacy/modules/account/lib/src/core/data/models/get_linked_devices_response_model.freezed.dart index ed127626..46fd8f5d 100644 --- a/modules/legacy/modules/account/lib/src/core/data/models/get_linked_devices_response_model.freezed.dart +++ b/modules/legacy/modules/account/lib/src/core/data/models/get_linked_devices_response_model.freezed.dart @@ -284,7 +284,7 @@ as List, /// @nodoc mixin _$GetLinkedDevicesItemResponseModel { - String get identificator; String get name; String get number; + String get identificator; String get carrierName; String get phone; String get id; GetLinkedDevicesSettingsResponseModel get settings; String get protocol; String get type; String get connectionServer; int get createdAt; GetLinkedDevicesFlagsResponseModel get flags; /// Create a copy of GetLinkedDevicesItemResponseModel /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -297,16 +297,16 @@ $GetLinkedDevicesItemResponseModelCopyWith ge @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is GetLinkedDevicesItemResponseModel&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.name, name) || other.name == name)&&(identical(other.number, number) || other.number == number)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is GetLinkedDevicesItemResponseModel&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.id, id) || other.id == id)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.protocol, protocol) || other.protocol == protocol)&&(identical(other.type, type) || other.type == type)&&(identical(other.connectionServer, connectionServer) || other.connectionServer == connectionServer)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.flags, flags) || other.flags == flags)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,identificator,name,number); +int get hashCode => Object.hash(runtimeType,identificator,carrierName,phone,id,settings,protocol,type,connectionServer,createdAt,flags); @override String toString() { - return 'GetLinkedDevicesItemResponseModel(identificator: $identificator, name: $name, number: $number)'; + return 'GetLinkedDevicesItemResponseModel(identificator: $identificator, carrierName: $carrierName, phone: $phone, id: $id, settings: $settings, protocol: $protocol, type: $type, connectionServer: $connectionServer, createdAt: $createdAt, flags: $flags)'; } @@ -317,11 +317,11 @@ abstract mixin class $GetLinkedDevicesItemResponseModelCopyWith<$Res> { factory $GetLinkedDevicesItemResponseModelCopyWith(GetLinkedDevicesItemResponseModel value, $Res Function(GetLinkedDevicesItemResponseModel) _then) = _$GetLinkedDevicesItemResponseModelCopyWithImpl; @useResult $Res call({ - String identificator, String name, String number + String identificator, String carrierName, String phone, String id, GetLinkedDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetLinkedDevicesFlagsResponseModel flags }); - +$GetLinkedDevicesSettingsResponseModelCopyWith<$Res> get settings;$GetLinkedDevicesFlagsResponseModelCopyWith<$Res> get flags; } /// @nodoc @@ -334,15 +334,40 @@ class _$GetLinkedDevicesItemResponseModelCopyWithImpl<$Res> /// Create a copy of GetLinkedDevicesItemResponseModel /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? identificator = null,Object? name = null,Object? number = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? identificator = null,Object? carrierName = null,Object? phone = null,Object? id = null,Object? settings = null,Object? protocol = null,Object? type = null,Object? connectionServer = null,Object? createdAt = null,Object? flags = null,}) { return _then(_self.copyWith( identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable -as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable -as String,number: null == number ? _self.number : number // ignore: cast_nullable_to_non_nullable -as String, +as String,carrierName: null == carrierName ? _self.carrierName : carrierName // ignore: cast_nullable_to_non_nullable +as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String,id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,settings: null == settings ? _self.settings : settings // ignore: cast_nullable_to_non_nullable +as GetLinkedDevicesSettingsResponseModel,protocol: null == protocol ? _self.protocol : protocol // ignore: cast_nullable_to_non_nullable +as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as String,connectionServer: null == connectionServer ? _self.connectionServer : connectionServer // ignore: cast_nullable_to_non_nullable +as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as int,flags: null == flags ? _self.flags : flags // ignore: cast_nullable_to_non_nullable +as GetLinkedDevicesFlagsResponseModel, )); } - +/// Create a copy of GetLinkedDevicesItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$GetLinkedDevicesSettingsResponseModelCopyWith<$Res> get settings { + + return $GetLinkedDevicesSettingsResponseModelCopyWith<$Res>(_self.settings, (value) { + return _then(_self.copyWith(settings: value)); + }); +}/// Create a copy of GetLinkedDevicesItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$GetLinkedDevicesFlagsResponseModelCopyWith<$Res> get flags { + + return $GetLinkedDevicesFlagsResponseModelCopyWith<$Res>(_self.flags, (value) { + return _then(_self.copyWith(flags: value)); + }); +} } @@ -424,10 +449,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String identificator, String name, String number)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String identificator, String carrierName, String phone, String id, GetLinkedDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetLinkedDevicesFlagsResponseModel flags)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _GetLinkedDevicesItemResponseModel() when $default != null: -return $default(_that.identificator,_that.name,_that.number);case _: +return $default(_that.identificator,_that.carrierName,_that.phone,_that.id,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.createdAt,_that.flags);case _: return orElse(); } @@ -445,10 +470,10 @@ return $default(_that.identificator,_that.name,_that.number);case _: /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String identificator, String name, String number) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String identificator, String carrierName, String phone, String id, GetLinkedDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetLinkedDevicesFlagsResponseModel flags) $default,) {final _that = this; switch (_that) { case _GetLinkedDevicesItemResponseModel(): -return $default(_that.identificator,_that.name,_that.number);case _: +return $default(_that.identificator,_that.carrierName,_that.phone,_that.id,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.createdAt,_that.flags);case _: throw StateError('Unexpected subclass'); } @@ -465,10 +490,10 @@ return $default(_that.identificator,_that.name,_that.number);case _: /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String identificator, String name, String number)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String identificator, String carrierName, String phone, String id, GetLinkedDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetLinkedDevicesFlagsResponseModel flags)? $default,) {final _that = this; switch (_that) { case _GetLinkedDevicesItemResponseModel() when $default != null: -return $default(_that.identificator,_that.name,_that.number);case _: +return $default(_that.identificator,_that.carrierName,_that.phone,_that.id,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.createdAt,_that.flags);case _: return null; } @@ -480,12 +505,19 @@ return $default(_that.identificator,_that.name,_that.number);case _: @JsonSerializable() class _GetLinkedDevicesItemResponseModel implements GetLinkedDevicesItemResponseModel { - const _GetLinkedDevicesItemResponseModel({required this.identificator, required this.name, required this.number}); + const _GetLinkedDevicesItemResponseModel({required this.identificator, required this.carrierName, required this.phone, required this.id, required this.settings, required this.protocol, required this.type, required this.connectionServer, required this.createdAt, required this.flags}); factory _GetLinkedDevicesItemResponseModel.fromJson(Map json) => _$GetLinkedDevicesItemResponseModelFromJson(json); @override final String identificator; -@override final String name; -@override final String number; +@override final String carrierName; +@override final String phone; +@override final String id; +@override final GetLinkedDevicesSettingsResponseModel settings; +@override final String protocol; +@override final String type; +@override final String connectionServer; +@override final int createdAt; +@override final GetLinkedDevicesFlagsResponseModel flags; /// Create a copy of GetLinkedDevicesItemResponseModel /// with the given fields replaced by the non-null parameter values. @@ -500,16 +532,16 @@ Map toJson() { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetLinkedDevicesItemResponseModel&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.name, name) || other.name == name)&&(identical(other.number, number) || other.number == number)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetLinkedDevicesItemResponseModel&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.id, id) || other.id == id)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.protocol, protocol) || other.protocol == protocol)&&(identical(other.type, type) || other.type == type)&&(identical(other.connectionServer, connectionServer) || other.connectionServer == connectionServer)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.flags, flags) || other.flags == flags)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,identificator,name,number); +int get hashCode => Object.hash(runtimeType,identificator,carrierName,phone,id,settings,protocol,type,connectionServer,createdAt,flags); @override String toString() { - return 'GetLinkedDevicesItemResponseModel(identificator: $identificator, name: $name, number: $number)'; + return 'GetLinkedDevicesItemResponseModel(identificator: $identificator, carrierName: $carrierName, phone: $phone, id: $id, settings: $settings, protocol: $protocol, type: $type, connectionServer: $connectionServer, createdAt: $createdAt, flags: $flags)'; } @@ -520,11 +552,11 @@ abstract mixin class _$GetLinkedDevicesItemResponseModelCopyWith<$Res> implement factory _$GetLinkedDevicesItemResponseModelCopyWith(_GetLinkedDevicesItemResponseModel value, $Res Function(_GetLinkedDevicesItemResponseModel) _then) = __$GetLinkedDevicesItemResponseModelCopyWithImpl; @override @useResult $Res call({ - String identificator, String name, String number + String identificator, String carrierName, String phone, String id, GetLinkedDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetLinkedDevicesFlagsResponseModel flags }); - +@override $GetLinkedDevicesSettingsResponseModelCopyWith<$Res> get settings;@override $GetLinkedDevicesFlagsResponseModelCopyWith<$Res> get flags; } /// @nodoc @@ -537,12 +569,593 @@ class __$GetLinkedDevicesItemResponseModelCopyWithImpl<$Res> /// Create a copy of GetLinkedDevicesItemResponseModel /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? identificator = null,Object? name = null,Object? number = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? identificator = null,Object? carrierName = null,Object? phone = null,Object? id = null,Object? settings = null,Object? protocol = null,Object? type = null,Object? connectionServer = null,Object? createdAt = null,Object? flags = null,}) { return _then(_GetLinkedDevicesItemResponseModel( identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable -as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable -as String,number: null == number ? _self.number : number // ignore: cast_nullable_to_non_nullable -as String, +as String,carrierName: null == carrierName ? _self.carrierName : carrierName // ignore: cast_nullable_to_non_nullable +as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String,id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,settings: null == settings ? _self.settings : settings // ignore: cast_nullable_to_non_nullable +as GetLinkedDevicesSettingsResponseModel,protocol: null == protocol ? _self.protocol : protocol // ignore: cast_nullable_to_non_nullable +as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as String,connectionServer: null == connectionServer ? _self.connectionServer : connectionServer // ignore: cast_nullable_to_non_nullable +as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as int,flags: null == flags ? _self.flags : flags // ignore: cast_nullable_to_non_nullable +as GetLinkedDevicesFlagsResponseModel, + )); +} + +/// Create a copy of GetLinkedDevicesItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$GetLinkedDevicesSettingsResponseModelCopyWith<$Res> get settings { + + return $GetLinkedDevicesSettingsResponseModelCopyWith<$Res>(_self.settings, (value) { + return _then(_self.copyWith(settings: value)); + }); +}/// Create a copy of GetLinkedDevicesItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$GetLinkedDevicesFlagsResponseModelCopyWith<$Res> get flags { + + return $GetLinkedDevicesFlagsResponseModelCopyWith<$Res>(_self.flags, (value) { + return _then(_self.copyWith(flags: value)); + }); +} +} + + +/// @nodoc +mixin _$GetLinkedDevicesSettingsResponseModel { + + int get frequency; int get frequencyHeartRate; int get timezone; bool get pedometer; String get language; List get alerts; +/// Create a copy of GetLinkedDevicesSettingsResponseModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$GetLinkedDevicesSettingsResponseModelCopyWith get copyWith => _$GetLinkedDevicesSettingsResponseModelCopyWithImpl(this as GetLinkedDevicesSettingsResponseModel, _$identity); + + /// Serializes this GetLinkedDevicesSettingsResponseModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is GetLinkedDevicesSettingsResponseModel&&(identical(other.frequency, frequency) || other.frequency == frequency)&&(identical(other.frequencyHeartRate, frequencyHeartRate) || other.frequencyHeartRate == frequencyHeartRate)&&(identical(other.timezone, timezone) || other.timezone == timezone)&&(identical(other.pedometer, pedometer) || other.pedometer == pedometer)&&(identical(other.language, language) || other.language == language)&&const DeepCollectionEquality().equals(other.alerts, alerts)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,frequency,frequencyHeartRate,timezone,pedometer,language,const DeepCollectionEquality().hash(alerts)); + +@override +String toString() { + return 'GetLinkedDevicesSettingsResponseModel(frequency: $frequency, frequencyHeartRate: $frequencyHeartRate, timezone: $timezone, pedometer: $pedometer, language: $language, alerts: $alerts)'; +} + + +} + +/// @nodoc +abstract mixin class $GetLinkedDevicesSettingsResponseModelCopyWith<$Res> { + factory $GetLinkedDevicesSettingsResponseModelCopyWith(GetLinkedDevicesSettingsResponseModel value, $Res Function(GetLinkedDevicesSettingsResponseModel) _then) = _$GetLinkedDevicesSettingsResponseModelCopyWithImpl; +@useResult +$Res call({ + int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts +}); + + + + +} +/// @nodoc +class _$GetLinkedDevicesSettingsResponseModelCopyWithImpl<$Res> + implements $GetLinkedDevicesSettingsResponseModelCopyWith<$Res> { + _$GetLinkedDevicesSettingsResponseModelCopyWithImpl(this._self, this._then); + + final GetLinkedDevicesSettingsResponseModel _self; + final $Res Function(GetLinkedDevicesSettingsResponseModel) _then; + +/// Create a copy of GetLinkedDevicesSettingsResponseModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? frequency = null,Object? frequencyHeartRate = null,Object? timezone = null,Object? pedometer = null,Object? language = null,Object? alerts = null,}) { + return _then(_self.copyWith( +frequency: null == frequency ? _self.frequency : frequency // ignore: cast_nullable_to_non_nullable +as int,frequencyHeartRate: null == frequencyHeartRate ? _self.frequencyHeartRate : frequencyHeartRate // ignore: cast_nullable_to_non_nullable +as int,timezone: null == timezone ? _self.timezone : timezone // ignore: cast_nullable_to_non_nullable +as int,pedometer: null == pedometer ? _self.pedometer : pedometer // ignore: cast_nullable_to_non_nullable +as bool,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String,alerts: null == alerts ? _self.alerts : alerts // ignore: cast_nullable_to_non_nullable +as List, + )); +} + +} + + +/// Adds pattern-matching-related methods to [GetLinkedDevicesSettingsResponseModel]. +extension GetLinkedDevicesSettingsResponseModelPatterns on GetLinkedDevicesSettingsResponseModel { +/// 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( _GetLinkedDevicesSettingsResponseModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _GetLinkedDevicesSettingsResponseModel() 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( _GetLinkedDevicesSettingsResponseModel value) $default,){ +final _that = this; +switch (_that) { +case _GetLinkedDevicesSettingsResponseModel(): +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( _GetLinkedDevicesSettingsResponseModel value)? $default,){ +final _that = this; +switch (_that) { +case _GetLinkedDevicesSettingsResponseModel() 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( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _GetLinkedDevicesSettingsResponseModel() when $default != null: +return $default(_that.frequency,_that.frequencyHeartRate,_that.timezone,_that.pedometer,_that.language,_that.alerts);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( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts) $default,) {final _that = this; +switch (_that) { +case _GetLinkedDevicesSettingsResponseModel(): +return $default(_that.frequency,_that.frequencyHeartRate,_that.timezone,_that.pedometer,_that.language,_that.alerts);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( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts)? $default,) {final _that = this; +switch (_that) { +case _GetLinkedDevicesSettingsResponseModel() when $default != null: +return $default(_that.frequency,_that.frequencyHeartRate,_that.timezone,_that.pedometer,_that.language,_that.alerts);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _GetLinkedDevicesSettingsResponseModel implements GetLinkedDevicesSettingsResponseModel { + const _GetLinkedDevicesSettingsResponseModel({required this.frequency, required this.frequencyHeartRate, required this.timezone, required this.pedometer, required this.language, required final List alerts}): _alerts = alerts; + factory _GetLinkedDevicesSettingsResponseModel.fromJson(Map json) => _$GetLinkedDevicesSettingsResponseModelFromJson(json); + +@override final int frequency; +@override final int frequencyHeartRate; +@override final int timezone; +@override final bool pedometer; +@override final String language; + final List _alerts; +@override List get alerts { + if (_alerts is EqualUnmodifiableListView) return _alerts; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_alerts); +} + + +/// Create a copy of GetLinkedDevicesSettingsResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$GetLinkedDevicesSettingsResponseModelCopyWith<_GetLinkedDevicesSettingsResponseModel> get copyWith => __$GetLinkedDevicesSettingsResponseModelCopyWithImpl<_GetLinkedDevicesSettingsResponseModel>(this, _$identity); + +@override +Map toJson() { + return _$GetLinkedDevicesSettingsResponseModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetLinkedDevicesSettingsResponseModel&&(identical(other.frequency, frequency) || other.frequency == frequency)&&(identical(other.frequencyHeartRate, frequencyHeartRate) || other.frequencyHeartRate == frequencyHeartRate)&&(identical(other.timezone, timezone) || other.timezone == timezone)&&(identical(other.pedometer, pedometer) || other.pedometer == pedometer)&&(identical(other.language, language) || other.language == language)&&const DeepCollectionEquality().equals(other._alerts, _alerts)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,frequency,frequencyHeartRate,timezone,pedometer,language,const DeepCollectionEquality().hash(_alerts)); + +@override +String toString() { + return 'GetLinkedDevicesSettingsResponseModel(frequency: $frequency, frequencyHeartRate: $frequencyHeartRate, timezone: $timezone, pedometer: $pedometer, language: $language, alerts: $alerts)'; +} + + +} + +/// @nodoc +abstract mixin class _$GetLinkedDevicesSettingsResponseModelCopyWith<$Res> implements $GetLinkedDevicesSettingsResponseModelCopyWith<$Res> { + factory _$GetLinkedDevicesSettingsResponseModelCopyWith(_GetLinkedDevicesSettingsResponseModel value, $Res Function(_GetLinkedDevicesSettingsResponseModel) _then) = __$GetLinkedDevicesSettingsResponseModelCopyWithImpl; +@override @useResult +$Res call({ + int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts +}); + + + + +} +/// @nodoc +class __$GetLinkedDevicesSettingsResponseModelCopyWithImpl<$Res> + implements _$GetLinkedDevicesSettingsResponseModelCopyWith<$Res> { + __$GetLinkedDevicesSettingsResponseModelCopyWithImpl(this._self, this._then); + + final _GetLinkedDevicesSettingsResponseModel _self; + final $Res Function(_GetLinkedDevicesSettingsResponseModel) _then; + +/// Create a copy of GetLinkedDevicesSettingsResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? frequency = null,Object? frequencyHeartRate = null,Object? timezone = null,Object? pedometer = null,Object? language = null,Object? alerts = null,}) { + return _then(_GetLinkedDevicesSettingsResponseModel( +frequency: null == frequency ? _self.frequency : frequency // ignore: cast_nullable_to_non_nullable +as int,frequencyHeartRate: null == frequencyHeartRate ? _self.frequencyHeartRate : frequencyHeartRate // ignore: cast_nullable_to_non_nullable +as int,timezone: null == timezone ? _self.timezone : timezone // ignore: cast_nullable_to_non_nullable +as int,pedometer: null == pedometer ? _self.pedometer : pedometer // ignore: cast_nullable_to_non_nullable +as bool,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String,alerts: null == alerts ? _self._alerts : alerts // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + + +/// @nodoc +mixin _$GetLinkedDevicesFlagsResponseModel { + + String get isInOrOut; String get geofenceId; bool get isBatteryLow; bool get isDisconnect; +/// Create a copy of GetLinkedDevicesFlagsResponseModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$GetLinkedDevicesFlagsResponseModelCopyWith get copyWith => _$GetLinkedDevicesFlagsResponseModelCopyWithImpl(this as GetLinkedDevicesFlagsResponseModel, _$identity); + + /// Serializes this GetLinkedDevicesFlagsResponseModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is GetLinkedDevicesFlagsResponseModel&&(identical(other.isInOrOut, isInOrOut) || other.isInOrOut == isInOrOut)&&(identical(other.geofenceId, geofenceId) || other.geofenceId == geofenceId)&&(identical(other.isBatteryLow, isBatteryLow) || other.isBatteryLow == isBatteryLow)&&(identical(other.isDisconnect, isDisconnect) || other.isDisconnect == isDisconnect)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,isInOrOut,geofenceId,isBatteryLow,isDisconnect); + +@override +String toString() { + return 'GetLinkedDevicesFlagsResponseModel(isInOrOut: $isInOrOut, geofenceId: $geofenceId, isBatteryLow: $isBatteryLow, isDisconnect: $isDisconnect)'; +} + + +} + +/// @nodoc +abstract mixin class $GetLinkedDevicesFlagsResponseModelCopyWith<$Res> { + factory $GetLinkedDevicesFlagsResponseModelCopyWith(GetLinkedDevicesFlagsResponseModel value, $Res Function(GetLinkedDevicesFlagsResponseModel) _then) = _$GetLinkedDevicesFlagsResponseModelCopyWithImpl; +@useResult +$Res call({ + String isInOrOut, String geofenceId, bool isBatteryLow, bool isDisconnect +}); + + + + +} +/// @nodoc +class _$GetLinkedDevicesFlagsResponseModelCopyWithImpl<$Res> + implements $GetLinkedDevicesFlagsResponseModelCopyWith<$Res> { + _$GetLinkedDevicesFlagsResponseModelCopyWithImpl(this._self, this._then); + + final GetLinkedDevicesFlagsResponseModel _self; + final $Res Function(GetLinkedDevicesFlagsResponseModel) _then; + +/// Create a copy of GetLinkedDevicesFlagsResponseModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? isInOrOut = null,Object? geofenceId = null,Object? isBatteryLow = null,Object? isDisconnect = null,}) { + return _then(_self.copyWith( +isInOrOut: null == isInOrOut ? _self.isInOrOut : isInOrOut // ignore: cast_nullable_to_non_nullable +as String,geofenceId: null == geofenceId ? _self.geofenceId : geofenceId // ignore: cast_nullable_to_non_nullable +as String,isBatteryLow: null == isBatteryLow ? _self.isBatteryLow : isBatteryLow // ignore: cast_nullable_to_non_nullable +as bool,isDisconnect: null == isDisconnect ? _self.isDisconnect : isDisconnect // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + +} + + +/// Adds pattern-matching-related methods to [GetLinkedDevicesFlagsResponseModel]. +extension GetLinkedDevicesFlagsResponseModelPatterns on GetLinkedDevicesFlagsResponseModel { +/// 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( _GetLinkedDevicesFlagsResponseModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _GetLinkedDevicesFlagsResponseModel() 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( _GetLinkedDevicesFlagsResponseModel value) $default,){ +final _that = this; +switch (_that) { +case _GetLinkedDevicesFlagsResponseModel(): +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( _GetLinkedDevicesFlagsResponseModel value)? $default,){ +final _that = this; +switch (_that) { +case _GetLinkedDevicesFlagsResponseModel() 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 isInOrOut, String geofenceId, bool isBatteryLow, bool isDisconnect)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _GetLinkedDevicesFlagsResponseModel() when $default != null: +return $default(_that.isInOrOut,_that.geofenceId,_that.isBatteryLow,_that.isDisconnect);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 isInOrOut, String geofenceId, bool isBatteryLow, bool isDisconnect) $default,) {final _that = this; +switch (_that) { +case _GetLinkedDevicesFlagsResponseModel(): +return $default(_that.isInOrOut,_that.geofenceId,_that.isBatteryLow,_that.isDisconnect);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 isInOrOut, String geofenceId, bool isBatteryLow, bool isDisconnect)? $default,) {final _that = this; +switch (_that) { +case _GetLinkedDevicesFlagsResponseModel() when $default != null: +return $default(_that.isInOrOut,_that.geofenceId,_that.isBatteryLow,_that.isDisconnect);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _GetLinkedDevicesFlagsResponseModel implements GetLinkedDevicesFlagsResponseModel { + const _GetLinkedDevicesFlagsResponseModel({required this.isInOrOut, required this.geofenceId, required this.isBatteryLow, required this.isDisconnect}); + factory _GetLinkedDevicesFlagsResponseModel.fromJson(Map json) => _$GetLinkedDevicesFlagsResponseModelFromJson(json); + +@override final String isInOrOut; +@override final String geofenceId; +@override final bool isBatteryLow; +@override final bool isDisconnect; + +/// Create a copy of GetLinkedDevicesFlagsResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$GetLinkedDevicesFlagsResponseModelCopyWith<_GetLinkedDevicesFlagsResponseModel> get copyWith => __$GetLinkedDevicesFlagsResponseModelCopyWithImpl<_GetLinkedDevicesFlagsResponseModel>(this, _$identity); + +@override +Map toJson() { + return _$GetLinkedDevicesFlagsResponseModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetLinkedDevicesFlagsResponseModel&&(identical(other.isInOrOut, isInOrOut) || other.isInOrOut == isInOrOut)&&(identical(other.geofenceId, geofenceId) || other.geofenceId == geofenceId)&&(identical(other.isBatteryLow, isBatteryLow) || other.isBatteryLow == isBatteryLow)&&(identical(other.isDisconnect, isDisconnect) || other.isDisconnect == isDisconnect)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,isInOrOut,geofenceId,isBatteryLow,isDisconnect); + +@override +String toString() { + return 'GetLinkedDevicesFlagsResponseModel(isInOrOut: $isInOrOut, geofenceId: $geofenceId, isBatteryLow: $isBatteryLow, isDisconnect: $isDisconnect)'; +} + + +} + +/// @nodoc +abstract mixin class _$GetLinkedDevicesFlagsResponseModelCopyWith<$Res> implements $GetLinkedDevicesFlagsResponseModelCopyWith<$Res> { + factory _$GetLinkedDevicesFlagsResponseModelCopyWith(_GetLinkedDevicesFlagsResponseModel value, $Res Function(_GetLinkedDevicesFlagsResponseModel) _then) = __$GetLinkedDevicesFlagsResponseModelCopyWithImpl; +@override @useResult +$Res call({ + String isInOrOut, String geofenceId, bool isBatteryLow, bool isDisconnect +}); + + + + +} +/// @nodoc +class __$GetLinkedDevicesFlagsResponseModelCopyWithImpl<$Res> + implements _$GetLinkedDevicesFlagsResponseModelCopyWith<$Res> { + __$GetLinkedDevicesFlagsResponseModelCopyWithImpl(this._self, this._then); + + final _GetLinkedDevicesFlagsResponseModel _self; + final $Res Function(_GetLinkedDevicesFlagsResponseModel) _then; + +/// Create a copy of GetLinkedDevicesFlagsResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? isInOrOut = null,Object? geofenceId = null,Object? isBatteryLow = null,Object? isDisconnect = null,}) { + return _then(_GetLinkedDevicesFlagsResponseModel( +isInOrOut: null == isInOrOut ? _self.isInOrOut : isInOrOut // ignore: cast_nullable_to_non_nullable +as String,geofenceId: null == geofenceId ? _self.geofenceId : geofenceId // ignore: cast_nullable_to_non_nullable +as String,isBatteryLow: null == isBatteryLow ? _self.isBatteryLow : isBatteryLow // ignore: cast_nullable_to_non_nullable +as bool,isDisconnect: null == isDisconnect ? _self.isDisconnect : isDisconnect // ignore: cast_nullable_to_non_nullable +as bool, )); } diff --git a/modules/legacy/modules/account/lib/src/core/data/models/get_linked_devices_response_model.g.dart b/modules/legacy/modules/account/lib/src/core/data/models/get_linked_devices_response_model.g.dart index 19d9d0bb..e50929b2 100644 --- a/modules/legacy/modules/account/lib/src/core/data/models/get_linked_devices_response_model.g.dart +++ b/modules/legacy/modules/account/lib/src/core/data/models/get_linked_devices_response_model.g.dart @@ -26,14 +26,74 @@ _GetLinkedDevicesItemResponseModel _$GetLinkedDevicesItemResponseModelFromJson( Map json, ) => _GetLinkedDevicesItemResponseModel( identificator: json['identificator'] as String, - name: json['name'] as String, - number: json['number'] as String, + carrierName: json['carrierName'] as String, + phone: json['phone'] as String, + id: json['id'] as String, + settings: GetLinkedDevicesSettingsResponseModel.fromJson( + json['settings'] as Map, + ), + protocol: json['protocol'] as String, + type: json['type'] as String, + connectionServer: json['connectionServer'] as String, + createdAt: (json['createdAt'] as num).toInt(), + flags: GetLinkedDevicesFlagsResponseModel.fromJson( + json['flags'] as Map, + ), ); Map _$GetLinkedDevicesItemResponseModelToJson( _GetLinkedDevicesItemResponseModel instance, ) => { 'identificator': instance.identificator, - 'name': instance.name, - 'number': instance.number, + 'carrierName': instance.carrierName, + 'phone': instance.phone, + 'id': instance.id, + 'settings': instance.settings, + 'protocol': instance.protocol, + 'type': instance.type, + 'connectionServer': instance.connectionServer, + 'createdAt': instance.createdAt, + 'flags': instance.flags, +}; + +_GetLinkedDevicesSettingsResponseModel +_$GetLinkedDevicesSettingsResponseModelFromJson(Map json) => + _GetLinkedDevicesSettingsResponseModel( + frequency: (json['frequency'] as num).toInt(), + frequencyHeartRate: (json['frequencyHeartRate'] as num).toInt(), + timezone: (json['timezone'] as num).toInt(), + pedometer: json['pedometer'] as bool, + language: json['language'] as String, + alerts: (json['alerts'] as List) + .map((e) => e as String) + .toList(), + ); + +Map _$GetLinkedDevicesSettingsResponseModelToJson( + _GetLinkedDevicesSettingsResponseModel instance, +) => { + 'frequency': instance.frequency, + 'frequencyHeartRate': instance.frequencyHeartRate, + 'timezone': instance.timezone, + 'pedometer': instance.pedometer, + 'language': instance.language, + 'alerts': instance.alerts, +}; + +_GetLinkedDevicesFlagsResponseModel +_$GetLinkedDevicesFlagsResponseModelFromJson(Map json) => + _GetLinkedDevicesFlagsResponseModel( + isInOrOut: json['isInOrOut'] as String, + geofenceId: json['geofenceId'] as String, + isBatteryLow: json['isBatteryLow'] as bool, + isDisconnect: json['isDisconnect'] as bool, + ); + +Map _$GetLinkedDevicesFlagsResponseModelToJson( + _GetLinkedDevicesFlagsResponseModel instance, +) => { + 'isInOrOut': instance.isInOrOut, + 'geofenceId': instance.geofenceId, + 'isBatteryLow': instance.isBatteryLow, + 'isDisconnect': instance.isDisconnect, }; diff --git a/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart b/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart index d414e245..ddac953a 100644 --- a/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart +++ b/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart @@ -1,6 +1,6 @@ import 'package:account/src/core/data/datasource/account_remote_datasource.dart'; import 'package:account/src/core/domain/repositories/account_repository.dart'; -import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:legacy_shared/src/data/models/entities/device_entity.dart'; import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart'; import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; import 'package:legacy_shared/legacy_shared.dart'; diff --git a/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart b/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart index 49b3d70e..21c55a91 100644 --- a/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart +++ b/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart @@ -1,4 +1,4 @@ -import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:legacy_shared/src/data/models/entities/device_entity.dart'; import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart'; import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; import 'package:legacy_shared/legacy_shared.dart'; diff --git a/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart b/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart index 6956c34c..ce898fcb 100644 --- a/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart @@ -17,6 +17,8 @@ class AccountSettingsScreen extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final theme = ref.watch(themePortProvider); + final selectedDevice = ref.watch(selectedDeviceProvider); + return PageLayout( title: context.translate(I18n.accountSettings), body: SingleChildScrollView(child: Container( @@ -66,7 +68,7 @@ class AccountSettingsScreen extends ConsumerWidget { onPressed: (){ showDialog(context: context, builder: (context)=>Dialog( backgroundColor: Colors.transparent, - child: RegCodeDialog(regCode: 'regCode', deviceId: 'deviceId', name: 'name'), + child: RegCodeDialog(regCode: selectedDevice?.id ?? '', deviceId: selectedDevice?.identificator ?? '', name: selectedDevice?.carrierName ?? ''), )); }, icon: Icons.qr_code, diff --git a/modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart b/modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart index 41c1698b..ccdd457c 100644 --- a/modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart @@ -19,83 +19,33 @@ class AppUsersScreen extends ConsumerWidget { final theme = ref.watch(themePortProvider); - return Scaffold( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), - body: SafeArea( - child: Column( - children: [ - Container( - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), - big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) - ), - child: Stack( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - IconButton(onPressed: () {Navigator.pop(context);}, - icon: Icon(Icons.arrow_back)), - if (!state.isEditing) ...[ - DecoratedBox( - decoration: BoxDecoration( - color: Color(0xFF588EA5), - shape: BoxShape.circle - ), - child: IconButton(onPressed: vm.toggleIsEditing, - icon: Icon(Icons.edit_outlined, - color: Colors.white, - size: SizeUtils.getByScreen(small: 30, big: 28), - ) - ), - ) - ] - ], - ), - Center( - child: Text(context.translate(I18n.legacyAppUsers), - style: TextStyle( - fontSize: SizeUtils.getByScreen(small: 28, big: 27) - ), - ) - ) - ], - ), + return PageLayout( + showEdit: true, + onEditChange: vm.toggleIsEditing, + title: context.translate(I18n.legacyAppUsers), + body: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) + ), + child: ListView.separated( + itemBuilder: (BuildContext context, int index)=>AppUserCard( + user: state.appUsers[index], + isEditing: state.isEditing, ), - SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)), - Expanded( child: Container( - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), - big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) - ), - child: ListView.separated( - itemBuilder: (BuildContext context, int index)=>AppUserCard( - user: state.appUsers[index], - isEditing: state.isEditing, - ), - separatorBuilder: (BuildContext context, int index)=>SizedBox( - height: SizeUtils.getByScreen(small: 18, big: 17) - ), - itemCount: state.appUsers.length - ), - )), - if (state.isEditing) ...[ - Container( - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 26, vertical: 14), - big: EdgeInsets.symmetric(horizontal: 24, vertical: 12) - ), - child: PrimaryButton( - onPressed: vm.toggleIsEditing, - text: context.translate(I18n.legacySave), - color: Color(0xFF588EA5), - height: SizeUtils.getByScreen(small: 44, big: 42), - ), - ), - ] - ], - ) + separatorBuilder: (BuildContext context, int index)=>SizedBox( + height: SizeUtils.getByScreen(small: 18, big: 17) + ), + itemCount: state.appUsers.length + ), ), + footer: state.isEditing ? + PrimaryButton( + onPressed: vm.toggleIsEditing, + text: context.translate(I18n.legacySave), + color: Color(0xFF588EA5), + height: SizeUtils.getByScreen(small: 44, big: 42), + ) : null ); } } diff --git a/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_model.dart b/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_model.dart index 06b6eda5..2296503c 100644 --- a/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_model.dart +++ b/modules/legacy/modules/account/lib/src/features/app_users/presentation/state/app_users_view_model.dart @@ -21,7 +21,7 @@ class AppUsersViewModel extends Notifier { _getAppUsersUseCase = ref.read(getAppUsersUseCaseProvider); _deleteAppUserUseCase = ref.read(deleteAppUserUseCaseProvider); - ref.watch(loggedUserProvider.future) + ref.read(loggedUserProvider.future) .then((user){ setUser(user); return _getAppUsersUseCase.getAppUsers(userId: user.id); diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/domain/entities/device_entity.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/entities/device_entity.dart deleted file mode 100644 index c34bd875..00000000 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/domain/entities/device_entity.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; - -part 'device_entity.freezed.dart'; - -@freezed -abstract class DeviceEntity with _$DeviceEntity { - const factory DeviceEntity({ - required String identificator, - required String name, - required String number, - }) = _DeviceEntity; -} diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/domain/entities/device_entity.freezed.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/entities/device_entity.freezed.dart deleted file mode 100644 index eed00822..00000000 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/domain/entities/device_entity.freezed.dart +++ /dev/null @@ -1,277 +0,0 @@ -// 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 'device_entity.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; -/// @nodoc -mixin _$DeviceEntity { - - String get identificator; String get name; String get number; -/// Create a copy of DeviceEntity -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$DeviceEntityCopyWith get copyWith => _$DeviceEntityCopyWithImpl(this as DeviceEntity, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceEntity&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.name, name) || other.name == name)&&(identical(other.number, number) || other.number == number)); -} - - -@override -int get hashCode => Object.hash(runtimeType,identificator,name,number); - -@override -String toString() { - return 'DeviceEntity(identificator: $identificator, name: $name, number: $number)'; -} - - -} - -/// @nodoc -abstract mixin class $DeviceEntityCopyWith<$Res> { - factory $DeviceEntityCopyWith(DeviceEntity value, $Res Function(DeviceEntity) _then) = _$DeviceEntityCopyWithImpl; -@useResult -$Res call({ - String identificator, String name, String number -}); - - - - -} -/// @nodoc -class _$DeviceEntityCopyWithImpl<$Res> - implements $DeviceEntityCopyWith<$Res> { - _$DeviceEntityCopyWithImpl(this._self, this._then); - - final DeviceEntity _self; - final $Res Function(DeviceEntity) _then; - -/// Create a copy of DeviceEntity -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? identificator = null,Object? name = null,Object? number = null,}) { - return _then(_self.copyWith( -identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable -as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable -as String,number: null == number ? _self.number : number // ignore: cast_nullable_to_non_nullable -as String, - )); -} - -} - - -/// Adds pattern-matching-related methods to [DeviceEntity]. -extension DeviceEntityPatterns on DeviceEntity { -/// 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( _DeviceEntity value)? $default,{required TResult orElse(),}){ -final _that = this; -switch (_that) { -case _DeviceEntity() 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( _DeviceEntity value) $default,){ -final _that = this; -switch (_that) { -case _DeviceEntity(): -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( _DeviceEntity value)? $default,){ -final _that = this; -switch (_that) { -case _DeviceEntity() 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 identificator, String name, String number)? $default,{required TResult orElse(),}) {final _that = this; -switch (_that) { -case _DeviceEntity() when $default != null: -return $default(_that.identificator,_that.name,_that.number);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 identificator, String name, String number) $default,) {final _that = this; -switch (_that) { -case _DeviceEntity(): -return $default(_that.identificator,_that.name,_that.number);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 identificator, String name, String number)? $default,) {final _that = this; -switch (_that) { -case _DeviceEntity() when $default != null: -return $default(_that.identificator,_that.name,_that.number);case _: - return null; - -} -} - -} - -/// @nodoc - - -class _DeviceEntity implements DeviceEntity { - const _DeviceEntity({required this.identificator, required this.name, required this.number}); - - -@override final String identificator; -@override final String name; -@override final String number; - -/// Create a copy of DeviceEntity -/// with the given fields replaced by the non-null parameter values. -@override @JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -_$DeviceEntityCopyWith<_DeviceEntity> get copyWith => __$DeviceEntityCopyWithImpl<_DeviceEntity>(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceEntity&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.name, name) || other.name == name)&&(identical(other.number, number) || other.number == number)); -} - - -@override -int get hashCode => Object.hash(runtimeType,identificator,name,number); - -@override -String toString() { - return 'DeviceEntity(identificator: $identificator, name: $name, number: $number)'; -} - - -} - -/// @nodoc -abstract mixin class _$DeviceEntityCopyWith<$Res> implements $DeviceEntityCopyWith<$Res> { - factory _$DeviceEntityCopyWith(_DeviceEntity value, $Res Function(_DeviceEntity) _then) = __$DeviceEntityCopyWithImpl; -@override @useResult -$Res call({ - String identificator, String name, String number -}); - - - - -} -/// @nodoc -class __$DeviceEntityCopyWithImpl<$Res> - implements _$DeviceEntityCopyWith<$Res> { - __$DeviceEntityCopyWithImpl(this._self, this._then); - - final _DeviceEntity _self; - final $Res Function(_DeviceEntity) _then; - -/// Create a copy of DeviceEntity -/// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? identificator = null,Object? name = null,Object? number = null,}) { - return _then(_DeviceEntity( -identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable -as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable -as String,number: null == number ? _self.number : number // ignore: cast_nullable_to_non_nullable -as String, - )); -} - - -} - -// dart format on diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/domain/get_linked_devices_use_case.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/get_linked_devices_use_case.dart index 67f1d8d5..777be86a 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/domain/get_linked_devices_use_case.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/get_linked_devices_use_case.dart @@ -1,4 +1,4 @@ -import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:legacy_shared/src/data/models/entities/device_entity.dart'; abstract class GetLinkedDevicesUseCase { Future> getLinkedDevices({required String userId}); diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/domain/get_linked_devices_use_case_impl.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/get_linked_devices_use_case_impl.dart index 5cabc76e..7b7b5bef 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/domain/get_linked_devices_use_case_impl.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/domain/get_linked_devices_use_case_impl.dart @@ -1,5 +1,5 @@ import 'package:account/src/core/domain/repositories/account_repository.dart'; -import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:legacy_shared/src/data/models/entities/device_entity.dart'; import 'package:account/src/features/linked_devices/domain/get_linked_devices_use_case.dart'; class GetLinkedDevicesUseCaseImpl implements GetLinkedDevicesUseCase { diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart index 2d68088b..3a29e975 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart @@ -1,9 +1,10 @@ -import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:legacy_shared/src/data/models/entities/device_entity.dart'; import 'package:account/src/features/linked_devices/presentation/state/linked_devices_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_svg/flutter_svg.dart'; +import 'package:legacy_shared/legacy_shared.dart'; // import 'package:navigation/navigation.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; @@ -21,86 +22,92 @@ class EditLinkedDeviceScreen extends ConsumerWidget { final theme = ref.watch(themePortProvider); - return Scaffold( + return /*PageLayout( + title: context.translate(I18n.legacyEditDeviceTitle), + showEdit: true, + onEditChange: vm.toggleIsEditing, + body: body + );*/ + Scaffold( backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), body: SafeArea( - child: Column( - children: [ - Container( - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), - big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) - ), - child: Stack( - children: [ - IconButton(onPressed: () {Navigator.pop(context);}, - icon: Icon(Icons.arrow_back)), - Center( - child: Text(context.translate(I18n.legacyEditDeviceTitle), - style: TextStyle( - fontSize: SizeUtils.getByScreen(small: 28, big: 27) - ), - ) - ) - ], - ), + child: Column( + children: [ + Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) ), - SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)), - Expanded(child: Container( - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 48, vertical: 10), - big: EdgeInsets.symmetric(horizontal: 47, vertical: 8) - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Stack( - children: [ - Center(child: SvgPicture.asset('assets/images/ui/profile.svg')), - Center(child: SizedBox( - width: 160, - height: 160, - child: Align(alignment: Alignment.bottomRight, - child: IconButton( - onPressed: (){}, - icon: Container( - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Color(0xFFCAC9C9) - ), - padding: EdgeInsets.all(8), - child: Icon( - Icons.edit_outlined, - color: Colors.white, - size: SizeUtils.getByScreen(small: 32, big: 30), - ), + child: Stack( + children: [ + IconButton(onPressed: () {Navigator.pop(context);}, + icon: Icon(Icons.arrow_back)), + Center( + child: Text(context.translate(I18n.legacyEditDeviceTitle), + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 28, big: 27) + ), + ) + ) + ], + ), + ), + SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)), + Expanded(child: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 48, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 47, vertical: 8) + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Stack( + children: [ + Center(child: SvgPicture.asset('assets/images/ui/profile.svg')), + Center(child: SizedBox( + width: 160, + height: 160, + child: Align(alignment: Alignment.bottomRight, + child: IconButton( + onPressed: (){}, + icon: Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Color(0xFFCAC9C9) ), - ) + padding: EdgeInsets.all(8), + child: Icon( + Icons.edit_outlined, + color: Colors.white, + size: SizeUtils.getByScreen(small: 32, big: 30), + ), + ), ) - )) - ], - ), - SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)), - CustomTextField( - controller: vm.deviceNameController, - hint: device.name, - label: context.translate(I18n.legacyName), - ) - ], - ), - PrimaryButton( - onPressed: (){vm.updateDevice(device);}, - text: context.translate(I18n.legacySave), - color: Color(0xFF588EA5) - ) - ], - )) - ), - ], - ) + ) + )) + ], + ), + SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)), + CustomTextField( + controller: vm.deviceNameController, + hint: device.carrierName, + label: context.translate(I18n.legacyName), + ) + ], + ), + PrimaryButton( + onPressed: (){vm.updateDevice(device);}, + text: context.translate(I18n.legacySave), + color: Color(0xFF588EA5) + ) + ], + )) + ), + ], + ) ), ); } diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart index 1694f4ef..c5eac3f4 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart @@ -1,9 +1,10 @@ -import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:legacy_shared/src/data/models/entities/device_entity.dart'; import 'package:account/src/features/linked_devices/presentation/edit_linked_device_screen.dart'; import 'package:account/src/features/linked_devices/presentation/state/linked_devices_view_model.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:legacy_shared/legacy_shared.dart'; import 'package:navigation/navigation.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; @@ -20,67 +21,26 @@ class LinkedDevicesScreen extends ConsumerWidget { final theme = ref.watch(themePortProvider); - return Scaffold( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), - body: SafeArea( - child: Column( - children: [ - Container( - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), - big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) - ), - child: Stack( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - IconButton(onPressed: () {Navigator.pop(context);}, - icon: Icon(Icons.arrow_back)), - DecoratedBox( - decoration: BoxDecoration( - color: Color(0xFF588EA5), - shape: BoxShape.circle - ), - child: IconButton(onPressed: vm.toggleIsEditing, - icon: Icon(Icons.edit_outlined, - color: Colors.white, - size: SizeUtils.getByScreen(small: 30, big: 28), - ) - ), - ) - ], - ), - Center( - child: Text(context.translate(I18n.legacyLinkedDevices), - style: TextStyle( - fontSize: SizeUtils.getByScreen(small: 28, big: 27) - ), - ) - ) - ], - ), - ), - SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)), - Expanded( child: Container( - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), - big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) - ), - child: ListView.separated( - itemBuilder: (BuildContext context, int index)=>LinkedDeviceCard( - device: state.linkedDevices[index], - isEditing: state.isEditing, - onDelete: ()=>vm.deleteDevice(state.linkedDevices[index]), - ), - separatorBuilder: (BuildContext context, int index)=>SizedBox( - height: SizeUtils.getByScreen(small: 18, big: 17) - ), - itemCount: state.linkedDevices.length - ), - )), - ], - ) + return PageLayout( + title: context.translate(I18n.legacyLinkedDevices), + showEdit: true, + onEditChange: vm.toggleIsEditing, + body: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) + ), + child: ListView.separated( + itemBuilder: (BuildContext context, int index)=>LinkedDeviceCard( + device: state.linkedDevices[index], + isEditing: state.isEditing, + onDelete: ()=>vm.deleteDevice(state.linkedDevices[index]), + ), + separatorBuilder: (BuildContext context, int index)=>SizedBox( + height: SizeUtils.getByScreen(small: 18, big: 17) + ), + itemCount: state.linkedDevices.length + ), ), ); } @@ -130,13 +90,13 @@ class LinkedDeviceCard extends ConsumerWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(device.name, + Text(device.carrierName, style: TextStyle( fontSize: SizeUtils.getByScreen(small: 18, big: 19), fontWeight: FontWeight.w500 ) ), - Text(device.number, + Text(device.phone ?? '', style: TextStyle( fontSize: SizeUtils.getByScreen(small: 14, big: 13), ) diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_model.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_model.dart index 14432580..58a85727 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_model.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_model.dart @@ -1,5 +1,5 @@ import 'package:account/src/features/linked_devices/domain/delete_device_use_case.dart'; -import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:legacy_shared/src/data/models/entities/device_entity.dart'; import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart'; import 'package:account/src/features/linked_devices/domain/get_linked_devices_use_case.dart'; import 'package:account/src/features/linked_devices/domain/update_device_use_case.dart'; @@ -33,7 +33,7 @@ class LinkedDevicesViewModel extends Notifier { deviceNameController = TextEditingController(); deviceNameController.addListener(_onDeviceNameChanged); - ref.watch(loggedUserProvider.future) + ref.read(loggedUserProvider.future) .then((user){ setUser(user); return _getLinkedDevicesUseCase.getLinkedDevices(userId: user.id); diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_state.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_state.dart index 26a091f8..373f3b01 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_state.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/state/linked_devices_view_state.dart @@ -1,4 +1,4 @@ -import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart'; +import 'package:legacy_shared/src/data/models/entities/device_entity.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:legacy_shared/legacy_shared.dart'; diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/personal_data_screen.dart b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/personal_data_screen.dart index 0e2858f9..92ac5845 100644 --- a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/personal_data_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/personal_data_screen.dart @@ -3,6 +3,7 @@ import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:legacy_shared/legacy_shared.dart'; import 'package:navigation/navigation.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; @@ -19,113 +20,74 @@ class PersonalDataScreen extends ConsumerWidget { final theme = ref.watch(themePortProvider); - return Scaffold( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), - body: SafeArea( - child: Column( - children: [ - Container( - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), - big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) - ), - child: Stack( - children: [ - IconButton(onPressed: () {Navigator.pop(context);}, - icon: Icon(Icons.arrow_back)), - Center( - child: Text(context.translate(I18n.legacyPersonalData), - style: TextStyle( - fontSize: SizeUtils.getByScreen(small: 28, big: 27) + return PageLayout( + title: context.translate(I18n.legacyPersonalData), + body: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 48, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 47, vertical: 8) + ), + child: SingleChildScrollView(child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Stack( + children: [ + Center(child: SvgPicture.asset('assets/images/ui/profile.svg')), + Center(child: SizedBox( + width: 160, + height: 160, + child: Align(alignment: Alignment.bottomRight, + child: IconButton( + onPressed: (){}, + icon: Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Color(0xFFCAC9C9) ), - ) + padding: EdgeInsets.all(8), + child: Icon( + Icons.edit_outlined, + color: Colors.white, + size: SizeUtils.getByScreen(small: 32, big: 30), + ), + ), ) - ], - ), - ), - SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)), - Expanded(child: Container( - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 48, vertical: 10), - big: EdgeInsets.symmetric(horizontal: 47, vertical: 8) - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded(child: SingleChildScrollView(child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Stack( - children: [ - Center(child: SvgPicture.asset('assets/images/ui/profile.svg')), - Center(child: SizedBox( - width: 160, - height: 160, - child: Align(alignment: Alignment.bottomRight, - child: IconButton( - onPressed: (){}, - icon: Container( - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Color(0xFFCAC9C9) - ), - padding: EdgeInsets.all(8), - child: Icon( - Icons.edit_outlined, - color: Colors.white, - size: SizeUtils.getByScreen(small: 32, big: 30), - ), - ), - ) - ) - )) - ], - ), - SizedBox(height: SizeUtils.getByScreen(small: 18, big: 16)), - Text(context.translate(I18n.legacyLoginEmail), - style: TextStyle(fontSize: SizeUtils.getByScreen(small: 14, big: 13)) - ), - Text(state.user?.email ?? '', - style: TextStyle(fontSize: SizeUtils.getByScreen(small: 18, big: 17)) - ), - SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)), - CustomTextField( - controller: vm.nameController, - hint: state.user?.firstName ?? '', - label: context.translate(I18n.legacyUserNameLabel), - ), - SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)), - CustomTextField( - controller: vm.phoneController, - hint: state.user?.phone ?? '', - label: context.translate(I18n.legacyUserPhoneLabel), - ), - SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)), - CustomTextField( - controller: vm.emailController, - hint: state.user?.email ?? '', - label: context.translate(I18n.legacyContactEmailLabel), - ), - SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)), - CustomTextField( - controller: vm.passwordController, - showPassword: state.showPassword, - hint: '********', - label: context.translate(I18n.passwordLabel), - ), - ], - ))), - SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)), - PrimaryButton( - onPressed: vm.updateUser, - text: context.translate(I18n.legacySubmit), - color: Color(0xFF588EA5) - ) - ], + ) )) - ), - ], - ) + ], + ), + SizedBox(height: SizeUtils.getByScreen(small: 18, big: 16)), + Text(context.translate(I18n.emailLabel), + style: TextStyle(fontSize: SizeUtils.getByScreen(small: 14, big: 13)) + ), + Text(state.user?.email ?? '', + style: TextStyle(fontSize: SizeUtils.getByScreen(small: 18, big: 17)) + ), + SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)), + CustomTextField( + controller: vm.nameController, + hint: state.user?.firstName ?? '', + label: context.translate(I18n.firstNameLabel), + ), + SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)), + CustomTextField( + controller: vm.phoneController, + hint: state.user?.phone ?? '', + label: context.translate(I18n.phoneLabel), + ), + SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)), + CustomTextField( + controller: vm.emailController, + hint: state.user?.email ?? '', + label: context.translate(I18n.emailLabel), + ), + ], + )) + ), + footer: PrimaryButton( + onPressed: vm.updateUser, + text: context.translate(I18n.legacySubmit), + color: Color(0xFF588EA5) ), ); } diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_model.dart b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_model.dart index 3404a946..febcec7c 100644 --- a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_model.dart +++ b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/state/personal_data_view_model.dart @@ -36,7 +36,7 @@ class PersonalDataViewModel extends Notifier { passwordController = TextEditingController(); passwordController.addListener(_onPasswordChanged); - ref.watch(loggedUserProvider.future) + ref.read(loggedUserProvider.future) .then(setUser); ref.onDispose(disposeControllers); @@ -117,6 +117,7 @@ class PersonalDataViewModel extends Notifier { final request = _toRequest(); _updateUserUseCase.updateUser(userId: state.user!.id, request: request); + ref.invalidate(loggedUserProvider); return true; } catch (e) { diff --git a/modules/legacy/modules/account/pubspec.yaml b/modules/legacy/modules/account/pubspec.yaml new file mode 100644 index 00000000..c68930d9 --- /dev/null +++ b/modules/legacy/modules/account/pubspec.yaml @@ -0,0 +1,116 @@ +name: account +description: "A new Flutter project." + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# +# This version is used _only_ for the Runner app, which is used if you just do +# a `flutter run`. It has no impact on any other native host app that you embed +# your Flutter project into. +version: 1.0.0+1 + +environment: + sdk: ^3.9.2 + +dependencies: + flutter: + sdk: flutter + #modules dependencies go here + + #packages dependencies go here + design_system: + path: ../../../../packages/design_system + navigation: + path: ../../../../packages/navigation + sf_localizations: + path: ../../../../packages/sf_localizations + sf_infrastructure: + path: ../../../../packages/sf_infrastructure + utils: + path: ../../../../packages/utils + fonts: + path: ../../../../packages/fonts + legacy_shared: + path: ../../packages/legacy_shared + #dependencies go here + flutter_svg: ^2.2.1 + get_it: ^9.0.5 + go_router: ^17.0.0 + flutter_riverpod: ^3.0.3 + freezed_annotation: ^3.1.0 + freezed: ^3.2.3 + dio: ^5.9.0 + json_annotation: ^4.9.0 + json_serializable: ^6.11.2 + uuid: ^4.5.2 + qr_flutter: ^4.1.0 + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.8 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^5.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +flutter: + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add Flutter specific assets to your application, add an assets section, + # like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/to/resolution-aware-images + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/to/asset-from-package + + # To add Flutter specific custom fonts to your application, add a fonts + # section here, in this "flutter" section. Each entry in this list should + # have a "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/to/font-from-package + + + # This section identifies your Flutter project as a module meant for + # embedding in a native host app. These identifiers should _not_ ordinarily + # be changed after generation - they are used to ensure that the tooling can + # maintain consistency when adding or modifying assets and plugins. + # They also do not have any bearing on your native host application's + # identifiers, which may be completely independent or the same as these. + module: + androidX: true + androidPackage: com.example.account + iosBundleIdentifier: com.example.account diff --git a/modules/legacy/modules/customer_service/pubspec.yaml b/modules/legacy/modules/customer_service/pubspec.yaml new file mode 100644 index 00000000..d5e1e055 --- /dev/null +++ b/modules/legacy/modules/customer_service/pubspec.yaml @@ -0,0 +1,117 @@ +name: customer_service +description: "A new Flutter project." + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# +# This version is used _only_ for the Runner app, which is used if you just do +# a `flutter run`. It has no impact on any other native host app that you embed +# your Flutter project into. +version: 1.0.0+1 + +environment: + sdk: ^3.9.2 + +dependencies: + flutter: + sdk: flutter + #modules dependencies go here + + #packages dependencies go here + design_system: + path: ../../../../packages/design_system + navigation: + path: ../../../../packages/navigation + sf_localizations: + path: ../../../../packages/sf_localizations + sf_infrastructure: + path: ../../../../packages/sf_infrastructure + utils: + path: ../../../../packages/utils + fonts: + path: ../../../../packages/fonts + legacy_shared: + path: ../../packages/legacy_shared + #dependencies go here + flutter_svg: ^2.2.1 + get_it: ^9.0.5 + go_router: ^17.0.0 + flutter_riverpod: ^3.0.3 + freezed_annotation: ^3.1.0 + freezed: ^3.2.3 + dio: ^5.9.0 + json_annotation: ^4.9.0 + json_serializable: ^6.11.2 + url_launcher: ^6.3.2 + qr_flutter: ^4.1.0 + + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.8 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^5.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +flutter: + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add Flutter specific assets to your application, add an assets section, + # like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/to/resolution-aware-images + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/to/asset-from-package + + # To add Flutter specific custom fonts to your application, add a fonts + # section here, in this "flutter" section. Each entry in this list should + # have a "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/to/font-from-package + + + # This section identifies your Flutter project as a module meant for + # embedding in a native host app. These identifiers should _not_ ordinarily + # be changed after generation - they are used to ensure that the tooling can + # maintain consistency when adding or modifying assets and plugins. + # They also do not have any bearing on your native host application's + # identifiers, which may be completely independent or the same as these. + module: + androidX: true + androidPackage: com.example.customer_service + iosBundleIdentifier: com.example.customerService diff --git a/modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource.dart b/modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource.dart index 54336801..2f14ce30 100644 --- a/modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource.dart +++ b/modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource.dart @@ -1,7 +1,5 @@ - -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:legacy_shared/legacy_shared.dart'; abstract class HomeRemoteDatasource { Future> getDevices({required String userId}); diff --git a/modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart b/modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart index 6eca5a50..ac9c073a 100644 --- a/modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart +++ b/modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart @@ -4,8 +4,8 @@ import 'package:dio/dio.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:legacy_shared/legacy_shared.dart'; import 'package:sf_infrastructure/sf_infrastructure.dart'; class HomeRemoteDatasourceImpl implements HomeRemoteDatasource { diff --git a/modules/legacy/modules/hub/lib/src/core/data/models/get_devices_response_model.dart b/modules/legacy/modules/hub/lib/src/core/data/models/get_devices_response_model.dart index e64f3bf5..523daef1 100644 --- a/modules/legacy/modules/hub/lib/src/core/data/models/get_devices_response_model.dart +++ b/modules/legacy/modules/hub/lib/src/core/data/models/get_devices_response_model.dart @@ -1,5 +1,5 @@ +import 'package:legacy_shared/src/data/models/entities/device_entity.dart'; 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'; @@ -15,13 +15,20 @@ abstract class GetDevicesResponseModel with _$GetDevicesResponseModel { } @freezed -abstract class GetDevicesItemResponseModel - with _$GetDevicesItemResponseModel { +abstract class GetDevicesItemResponseModel with _$GetDevicesItemResponseModel { const factory GetDevicesItemResponseModel({ - required String id, required String identificator, required String carrierName, - }) = _GetDevicesItemResponseModel; + required String phone, + required String id, + required GetDevicesSettingsResponseModel settings, + required String protocol, + required String type, + required String connectionServer, + required int createdAt, + required GetDevicesFlagsResponseModel flags, + }) = + _GetDevicesItemResponseModel; factory GetDevicesItemResponseModel.fromJson(Map json) => _$GetDevicesItemResponseModelFromJson(json); @@ -30,9 +37,68 @@ abstract class GetDevicesItemResponseModel extension GetDevicesResponseModelMapper on GetDevicesResponseModel { List toEntity() { return items.map((GetDevicesItemResponseModel item) => DeviceEntity( - id: item.id, - identificator: item.identificator, - carrierName: item.carrierName, + identificator: item.identificator, + carrierName: item.carrierName, + phone: item.phone, + id: item.id, + settings: item.settings.toEntity(), + protocol: item.protocol, + type: item.type, + connectionServer: item.connectionServer, + createdAt: item.createdAt, + flags: item.flags.toEntity(), )).toList(); } } + +@freezed +abstract class GetDevicesSettingsResponseModel with _$GetDevicesSettingsResponseModel { + const factory GetDevicesSettingsResponseModel({ + required int frequency, + required int frequencyHeartRate, + required int timezone, + required bool pedometer, + required String language, + required List alerts, + }) = _GetDevicesSettingsResponseModel; + + factory GetDevicesSettingsResponseModel.fromJson(Map json) => + _$GetDevicesSettingsResponseModelFromJson(json); +} + +extension GetDevicesSettingsResponseModelMapper on GetDevicesSettingsResponseModel { + DeviceSettingsEntity toEntity() { + return DeviceSettingsEntity( + frequency: frequency, + frequencyHeartRate: frequencyHeartRate, + timezone: timezone, + pedometer: pedometer, + language: language, + alerts: alerts, + ); + } +} + +@freezed +abstract class GetDevicesFlagsResponseModel with _$GetDevicesFlagsResponseModel { + const factory GetDevicesFlagsResponseModel({ + required String isInOrOut, + required String geofenceId, + required bool isBatteryLow, + required bool isDisconnect, + }) = _GetDevicesFlagsResponseModel; + + factory GetDevicesFlagsResponseModel.fromJson(Map json) => + _$GetDevicesFlagsResponseModelFromJson(json); +} + +extension GetDevicesFlagsResponseModelMapper on GetDevicesFlagsResponseModel { + DeviceFlagsEntity toEntity() { + return DeviceFlagsEntity( + isInOrOut: isInOrOut, + geofenceId: geofenceId, + isBatteryLow: isBatteryLow, + isDisconnect: isDisconnect, + ); + } +} \ No newline at end of file diff --git a/modules/legacy/modules/hub/lib/src/core/data/models/get_devices_response_model.freezed.dart b/modules/legacy/modules/hub/lib/src/core/data/models/get_devices_response_model.freezed.dart index 1ad17056..2473d450 100644 --- a/modules/legacy/modules/hub/lib/src/core/data/models/get_devices_response_model.freezed.dart +++ b/modules/legacy/modules/hub/lib/src/core/data/models/get_devices_response_model.freezed.dart @@ -284,7 +284,7 @@ as List, /// @nodoc mixin _$GetDevicesItemResponseModel { - String get id; String get identificator; String get carrierName; + String get identificator; String get carrierName; String get phone; String get id; GetDevicesSettingsResponseModel get settings; String get protocol; String get type; String get connectionServer; int get createdAt; GetDevicesFlagsResponseModel get flags; /// Create a copy of GetDevicesItemResponseModel /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -297,16 +297,16 @@ $GetDevicesItemResponseModelCopyWith get copyWith = @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)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is GetDevicesItemResponseModel&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.id, id) || other.id == id)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.protocol, protocol) || other.protocol == protocol)&&(identical(other.type, type) || other.type == type)&&(identical(other.connectionServer, connectionServer) || other.connectionServer == connectionServer)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.flags, flags) || other.flags == flags)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,id,identificator,carrierName); +int get hashCode => Object.hash(runtimeType,identificator,carrierName,phone,id,settings,protocol,type,connectionServer,createdAt,flags); @override String toString() { - return 'GetDevicesItemResponseModel(id: $id, identificator: $identificator, carrierName: $carrierName)'; + return 'GetDevicesItemResponseModel(identificator: $identificator, carrierName: $carrierName, phone: $phone, id: $id, settings: $settings, protocol: $protocol, type: $type, connectionServer: $connectionServer, createdAt: $createdAt, flags: $flags)'; } @@ -317,11 +317,11 @@ abstract mixin class $GetDevicesItemResponseModelCopyWith<$Res> { factory $GetDevicesItemResponseModelCopyWith(GetDevicesItemResponseModel value, $Res Function(GetDevicesItemResponseModel) _then) = _$GetDevicesItemResponseModelCopyWithImpl; @useResult $Res call({ - String id, String identificator, String carrierName + String identificator, String carrierName, String phone, String id, GetDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetDevicesFlagsResponseModel flags }); - +$GetDevicesSettingsResponseModelCopyWith<$Res> get settings;$GetDevicesFlagsResponseModelCopyWith<$Res> get flags; } /// @nodoc @@ -334,15 +334,40 @@ class _$GetDevicesItemResponseModelCopyWithImpl<$Res> /// 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,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? identificator = null,Object? carrierName = null,Object? phone = null,Object? id = null,Object? settings = null,Object? protocol = null,Object? type = null,Object? connectionServer = null,Object? createdAt = null,Object? flags = 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 +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, +as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String,id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,settings: null == settings ? _self.settings : settings // ignore: cast_nullable_to_non_nullable +as GetDevicesSettingsResponseModel,protocol: null == protocol ? _self.protocol : protocol // ignore: cast_nullable_to_non_nullable +as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as String,connectionServer: null == connectionServer ? _self.connectionServer : connectionServer // ignore: cast_nullable_to_non_nullable +as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as int,flags: null == flags ? _self.flags : flags // ignore: cast_nullable_to_non_nullable +as GetDevicesFlagsResponseModel, )); } - +/// Create a copy of GetDevicesItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$GetDevicesSettingsResponseModelCopyWith<$Res> get settings { + + return $GetDevicesSettingsResponseModelCopyWith<$Res>(_self.settings, (value) { + return _then(_self.copyWith(settings: value)); + }); +}/// Create a copy of GetDevicesItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$GetDevicesFlagsResponseModelCopyWith<$Res> get flags { + + return $GetDevicesFlagsResponseModelCopyWith<$Res>(_self.flags, (value) { + return _then(_self.copyWith(flags: value)); + }); +} } @@ -424,10 +449,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String identificator, String carrierName)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String identificator, String carrierName, String phone, String id, GetDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetDevicesFlagsResponseModel flags)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _GetDevicesItemResponseModel() when $default != null: -return $default(_that.id,_that.identificator,_that.carrierName);case _: +return $default(_that.identificator,_that.carrierName,_that.phone,_that.id,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.createdAt,_that.flags);case _: return orElse(); } @@ -445,10 +470,10 @@ return $default(_that.id,_that.identificator,_that.carrierName);case _: /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String id, String identificator, String carrierName) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String identificator, String carrierName, String phone, String id, GetDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetDevicesFlagsResponseModel flags) $default,) {final _that = this; switch (_that) { case _GetDevicesItemResponseModel(): -return $default(_that.id,_that.identificator,_that.carrierName);case _: +return $default(_that.identificator,_that.carrierName,_that.phone,_that.id,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.createdAt,_that.flags);case _: throw StateError('Unexpected subclass'); } @@ -465,10 +490,10 @@ return $default(_that.id,_that.identificator,_that.carrierName);case _: /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String identificator, String carrierName)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String identificator, String carrierName, String phone, String id, GetDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetDevicesFlagsResponseModel flags)? $default,) {final _that = this; switch (_that) { case _GetDevicesItemResponseModel() when $default != null: -return $default(_that.id,_that.identificator,_that.carrierName);case _: +return $default(_that.identificator,_that.carrierName,_that.phone,_that.id,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.createdAt,_that.flags);case _: return null; } @@ -480,12 +505,19 @@ return $default(_that.id,_that.identificator,_that.carrierName);case _: @JsonSerializable() class _GetDevicesItemResponseModel implements GetDevicesItemResponseModel { - const _GetDevicesItemResponseModel({required this.id, required this.identificator, required this.carrierName}); + const _GetDevicesItemResponseModel({required this.identificator, required this.carrierName, required this.phone, required this.id, required this.settings, required this.protocol, required this.type, required this.connectionServer, required this.createdAt, required this.flags}); factory _GetDevicesItemResponseModel.fromJson(Map json) => _$GetDevicesItemResponseModelFromJson(json); -@override final String id; @override final String identificator; @override final String carrierName; +@override final String phone; +@override final String id; +@override final GetDevicesSettingsResponseModel settings; +@override final String protocol; +@override final String type; +@override final String connectionServer; +@override final int createdAt; +@override final GetDevicesFlagsResponseModel flags; /// Create a copy of GetDevicesItemResponseModel /// with the given fields replaced by the non-null parameter values. @@ -500,16 +532,16 @@ 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)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetDevicesItemResponseModel&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.id, id) || other.id == id)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.protocol, protocol) || other.protocol == protocol)&&(identical(other.type, type) || other.type == type)&&(identical(other.connectionServer, connectionServer) || other.connectionServer == connectionServer)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.flags, flags) || other.flags == flags)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,id,identificator,carrierName); +int get hashCode => Object.hash(runtimeType,identificator,carrierName,phone,id,settings,protocol,type,connectionServer,createdAt,flags); @override String toString() { - return 'GetDevicesItemResponseModel(id: $id, identificator: $identificator, carrierName: $carrierName)'; + return 'GetDevicesItemResponseModel(identificator: $identificator, carrierName: $carrierName, phone: $phone, id: $id, settings: $settings, protocol: $protocol, type: $type, connectionServer: $connectionServer, createdAt: $createdAt, flags: $flags)'; } @@ -520,11 +552,11 @@ abstract mixin class _$GetDevicesItemResponseModelCopyWith<$Res> implements $Get factory _$GetDevicesItemResponseModelCopyWith(_GetDevicesItemResponseModel value, $Res Function(_GetDevicesItemResponseModel) _then) = __$GetDevicesItemResponseModelCopyWithImpl; @override @useResult $Res call({ - String id, String identificator, String carrierName + String identificator, String carrierName, String phone, String id, GetDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetDevicesFlagsResponseModel flags }); - +@override $GetDevicesSettingsResponseModelCopyWith<$Res> get settings;@override $GetDevicesFlagsResponseModelCopyWith<$Res> get flags; } /// @nodoc @@ -537,12 +569,593 @@ class __$GetDevicesItemResponseModelCopyWithImpl<$Res> /// 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,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? identificator = null,Object? carrierName = null,Object? phone = null,Object? id = null,Object? settings = null,Object? protocol = null,Object? type = null,Object? connectionServer = null,Object? createdAt = null,Object? flags = 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 +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, +as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String,id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,settings: null == settings ? _self.settings : settings // ignore: cast_nullable_to_non_nullable +as GetDevicesSettingsResponseModel,protocol: null == protocol ? _self.protocol : protocol // ignore: cast_nullable_to_non_nullable +as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as String,connectionServer: null == connectionServer ? _self.connectionServer : connectionServer // ignore: cast_nullable_to_non_nullable +as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as int,flags: null == flags ? _self.flags : flags // ignore: cast_nullable_to_non_nullable +as GetDevicesFlagsResponseModel, + )); +} + +/// Create a copy of GetDevicesItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$GetDevicesSettingsResponseModelCopyWith<$Res> get settings { + + return $GetDevicesSettingsResponseModelCopyWith<$Res>(_self.settings, (value) { + return _then(_self.copyWith(settings: value)); + }); +}/// Create a copy of GetDevicesItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$GetDevicesFlagsResponseModelCopyWith<$Res> get flags { + + return $GetDevicesFlagsResponseModelCopyWith<$Res>(_self.flags, (value) { + return _then(_self.copyWith(flags: value)); + }); +} +} + + +/// @nodoc +mixin _$GetDevicesSettingsResponseModel { + + int get frequency; int get frequencyHeartRate; int get timezone; bool get pedometer; String get language; List get alerts; +/// Create a copy of GetDevicesSettingsResponseModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$GetDevicesSettingsResponseModelCopyWith get copyWith => _$GetDevicesSettingsResponseModelCopyWithImpl(this as GetDevicesSettingsResponseModel, _$identity); + + /// Serializes this GetDevicesSettingsResponseModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is GetDevicesSettingsResponseModel&&(identical(other.frequency, frequency) || other.frequency == frequency)&&(identical(other.frequencyHeartRate, frequencyHeartRate) || other.frequencyHeartRate == frequencyHeartRate)&&(identical(other.timezone, timezone) || other.timezone == timezone)&&(identical(other.pedometer, pedometer) || other.pedometer == pedometer)&&(identical(other.language, language) || other.language == language)&&const DeepCollectionEquality().equals(other.alerts, alerts)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,frequency,frequencyHeartRate,timezone,pedometer,language,const DeepCollectionEquality().hash(alerts)); + +@override +String toString() { + return 'GetDevicesSettingsResponseModel(frequency: $frequency, frequencyHeartRate: $frequencyHeartRate, timezone: $timezone, pedometer: $pedometer, language: $language, alerts: $alerts)'; +} + + +} + +/// @nodoc +abstract mixin class $GetDevicesSettingsResponseModelCopyWith<$Res> { + factory $GetDevicesSettingsResponseModelCopyWith(GetDevicesSettingsResponseModel value, $Res Function(GetDevicesSettingsResponseModel) _then) = _$GetDevicesSettingsResponseModelCopyWithImpl; +@useResult +$Res call({ + int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts +}); + + + + +} +/// @nodoc +class _$GetDevicesSettingsResponseModelCopyWithImpl<$Res> + implements $GetDevicesSettingsResponseModelCopyWith<$Res> { + _$GetDevicesSettingsResponseModelCopyWithImpl(this._self, this._then); + + final GetDevicesSettingsResponseModel _self; + final $Res Function(GetDevicesSettingsResponseModel) _then; + +/// Create a copy of GetDevicesSettingsResponseModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? frequency = null,Object? frequencyHeartRate = null,Object? timezone = null,Object? pedometer = null,Object? language = null,Object? alerts = null,}) { + return _then(_self.copyWith( +frequency: null == frequency ? _self.frequency : frequency // ignore: cast_nullable_to_non_nullable +as int,frequencyHeartRate: null == frequencyHeartRate ? _self.frequencyHeartRate : frequencyHeartRate // ignore: cast_nullable_to_non_nullable +as int,timezone: null == timezone ? _self.timezone : timezone // ignore: cast_nullable_to_non_nullable +as int,pedometer: null == pedometer ? _self.pedometer : pedometer // ignore: cast_nullable_to_non_nullable +as bool,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String,alerts: null == alerts ? _self.alerts : alerts // ignore: cast_nullable_to_non_nullable +as List, + )); +} + +} + + +/// Adds pattern-matching-related methods to [GetDevicesSettingsResponseModel]. +extension GetDevicesSettingsResponseModelPatterns on GetDevicesSettingsResponseModel { +/// 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( _GetDevicesSettingsResponseModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _GetDevicesSettingsResponseModel() 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( _GetDevicesSettingsResponseModel value) $default,){ +final _that = this; +switch (_that) { +case _GetDevicesSettingsResponseModel(): +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( _GetDevicesSettingsResponseModel value)? $default,){ +final _that = this; +switch (_that) { +case _GetDevicesSettingsResponseModel() 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( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _GetDevicesSettingsResponseModel() when $default != null: +return $default(_that.frequency,_that.frequencyHeartRate,_that.timezone,_that.pedometer,_that.language,_that.alerts);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( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts) $default,) {final _that = this; +switch (_that) { +case _GetDevicesSettingsResponseModel(): +return $default(_that.frequency,_that.frequencyHeartRate,_that.timezone,_that.pedometer,_that.language,_that.alerts);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( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts)? $default,) {final _that = this; +switch (_that) { +case _GetDevicesSettingsResponseModel() when $default != null: +return $default(_that.frequency,_that.frequencyHeartRate,_that.timezone,_that.pedometer,_that.language,_that.alerts);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _GetDevicesSettingsResponseModel implements GetDevicesSettingsResponseModel { + const _GetDevicesSettingsResponseModel({required this.frequency, required this.frequencyHeartRate, required this.timezone, required this.pedometer, required this.language, required final List alerts}): _alerts = alerts; + factory _GetDevicesSettingsResponseModel.fromJson(Map json) => _$GetDevicesSettingsResponseModelFromJson(json); + +@override final int frequency; +@override final int frequencyHeartRate; +@override final int timezone; +@override final bool pedometer; +@override final String language; + final List _alerts; +@override List get alerts { + if (_alerts is EqualUnmodifiableListView) return _alerts; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_alerts); +} + + +/// Create a copy of GetDevicesSettingsResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$GetDevicesSettingsResponseModelCopyWith<_GetDevicesSettingsResponseModel> get copyWith => __$GetDevicesSettingsResponseModelCopyWithImpl<_GetDevicesSettingsResponseModel>(this, _$identity); + +@override +Map toJson() { + return _$GetDevicesSettingsResponseModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetDevicesSettingsResponseModel&&(identical(other.frequency, frequency) || other.frequency == frequency)&&(identical(other.frequencyHeartRate, frequencyHeartRate) || other.frequencyHeartRate == frequencyHeartRate)&&(identical(other.timezone, timezone) || other.timezone == timezone)&&(identical(other.pedometer, pedometer) || other.pedometer == pedometer)&&(identical(other.language, language) || other.language == language)&&const DeepCollectionEquality().equals(other._alerts, _alerts)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,frequency,frequencyHeartRate,timezone,pedometer,language,const DeepCollectionEquality().hash(_alerts)); + +@override +String toString() { + return 'GetDevicesSettingsResponseModel(frequency: $frequency, frequencyHeartRate: $frequencyHeartRate, timezone: $timezone, pedometer: $pedometer, language: $language, alerts: $alerts)'; +} + + +} + +/// @nodoc +abstract mixin class _$GetDevicesSettingsResponseModelCopyWith<$Res> implements $GetDevicesSettingsResponseModelCopyWith<$Res> { + factory _$GetDevicesSettingsResponseModelCopyWith(_GetDevicesSettingsResponseModel value, $Res Function(_GetDevicesSettingsResponseModel) _then) = __$GetDevicesSettingsResponseModelCopyWithImpl; +@override @useResult +$Res call({ + int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts +}); + + + + +} +/// @nodoc +class __$GetDevicesSettingsResponseModelCopyWithImpl<$Res> + implements _$GetDevicesSettingsResponseModelCopyWith<$Res> { + __$GetDevicesSettingsResponseModelCopyWithImpl(this._self, this._then); + + final _GetDevicesSettingsResponseModel _self; + final $Res Function(_GetDevicesSettingsResponseModel) _then; + +/// Create a copy of GetDevicesSettingsResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? frequency = null,Object? frequencyHeartRate = null,Object? timezone = null,Object? pedometer = null,Object? language = null,Object? alerts = null,}) { + return _then(_GetDevicesSettingsResponseModel( +frequency: null == frequency ? _self.frequency : frequency // ignore: cast_nullable_to_non_nullable +as int,frequencyHeartRate: null == frequencyHeartRate ? _self.frequencyHeartRate : frequencyHeartRate // ignore: cast_nullable_to_non_nullable +as int,timezone: null == timezone ? _self.timezone : timezone // ignore: cast_nullable_to_non_nullable +as int,pedometer: null == pedometer ? _self.pedometer : pedometer // ignore: cast_nullable_to_non_nullable +as bool,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String,alerts: null == alerts ? _self._alerts : alerts // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + + +/// @nodoc +mixin _$GetDevicesFlagsResponseModel { + + String get isInOrOut; String get geofenceId; bool get isBatteryLow; bool get isDisconnect; +/// Create a copy of GetDevicesFlagsResponseModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$GetDevicesFlagsResponseModelCopyWith get copyWith => _$GetDevicesFlagsResponseModelCopyWithImpl(this as GetDevicesFlagsResponseModel, _$identity); + + /// Serializes this GetDevicesFlagsResponseModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is GetDevicesFlagsResponseModel&&(identical(other.isInOrOut, isInOrOut) || other.isInOrOut == isInOrOut)&&(identical(other.geofenceId, geofenceId) || other.geofenceId == geofenceId)&&(identical(other.isBatteryLow, isBatteryLow) || other.isBatteryLow == isBatteryLow)&&(identical(other.isDisconnect, isDisconnect) || other.isDisconnect == isDisconnect)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,isInOrOut,geofenceId,isBatteryLow,isDisconnect); + +@override +String toString() { + return 'GetDevicesFlagsResponseModel(isInOrOut: $isInOrOut, geofenceId: $geofenceId, isBatteryLow: $isBatteryLow, isDisconnect: $isDisconnect)'; +} + + +} + +/// @nodoc +abstract mixin class $GetDevicesFlagsResponseModelCopyWith<$Res> { + factory $GetDevicesFlagsResponseModelCopyWith(GetDevicesFlagsResponseModel value, $Res Function(GetDevicesFlagsResponseModel) _then) = _$GetDevicesFlagsResponseModelCopyWithImpl; +@useResult +$Res call({ + String isInOrOut, String geofenceId, bool isBatteryLow, bool isDisconnect +}); + + + + +} +/// @nodoc +class _$GetDevicesFlagsResponseModelCopyWithImpl<$Res> + implements $GetDevicesFlagsResponseModelCopyWith<$Res> { + _$GetDevicesFlagsResponseModelCopyWithImpl(this._self, this._then); + + final GetDevicesFlagsResponseModel _self; + final $Res Function(GetDevicesFlagsResponseModel) _then; + +/// Create a copy of GetDevicesFlagsResponseModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? isInOrOut = null,Object? geofenceId = null,Object? isBatteryLow = null,Object? isDisconnect = null,}) { + return _then(_self.copyWith( +isInOrOut: null == isInOrOut ? _self.isInOrOut : isInOrOut // ignore: cast_nullable_to_non_nullable +as String,geofenceId: null == geofenceId ? _self.geofenceId : geofenceId // ignore: cast_nullable_to_non_nullable +as String,isBatteryLow: null == isBatteryLow ? _self.isBatteryLow : isBatteryLow // ignore: cast_nullable_to_non_nullable +as bool,isDisconnect: null == isDisconnect ? _self.isDisconnect : isDisconnect // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + +} + + +/// Adds pattern-matching-related methods to [GetDevicesFlagsResponseModel]. +extension GetDevicesFlagsResponseModelPatterns on GetDevicesFlagsResponseModel { +/// 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( _GetDevicesFlagsResponseModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _GetDevicesFlagsResponseModel() 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( _GetDevicesFlagsResponseModel value) $default,){ +final _that = this; +switch (_that) { +case _GetDevicesFlagsResponseModel(): +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( _GetDevicesFlagsResponseModel value)? $default,){ +final _that = this; +switch (_that) { +case _GetDevicesFlagsResponseModel() 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 isInOrOut, String geofenceId, bool isBatteryLow, bool isDisconnect)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _GetDevicesFlagsResponseModel() when $default != null: +return $default(_that.isInOrOut,_that.geofenceId,_that.isBatteryLow,_that.isDisconnect);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 isInOrOut, String geofenceId, bool isBatteryLow, bool isDisconnect) $default,) {final _that = this; +switch (_that) { +case _GetDevicesFlagsResponseModel(): +return $default(_that.isInOrOut,_that.geofenceId,_that.isBatteryLow,_that.isDisconnect);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 isInOrOut, String geofenceId, bool isBatteryLow, bool isDisconnect)? $default,) {final _that = this; +switch (_that) { +case _GetDevicesFlagsResponseModel() when $default != null: +return $default(_that.isInOrOut,_that.geofenceId,_that.isBatteryLow,_that.isDisconnect);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _GetDevicesFlagsResponseModel implements GetDevicesFlagsResponseModel { + const _GetDevicesFlagsResponseModel({required this.isInOrOut, required this.geofenceId, required this.isBatteryLow, required this.isDisconnect}); + factory _GetDevicesFlagsResponseModel.fromJson(Map json) => _$GetDevicesFlagsResponseModelFromJson(json); + +@override final String isInOrOut; +@override final String geofenceId; +@override final bool isBatteryLow; +@override final bool isDisconnect; + +/// Create a copy of GetDevicesFlagsResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$GetDevicesFlagsResponseModelCopyWith<_GetDevicesFlagsResponseModel> get copyWith => __$GetDevicesFlagsResponseModelCopyWithImpl<_GetDevicesFlagsResponseModel>(this, _$identity); + +@override +Map toJson() { + return _$GetDevicesFlagsResponseModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetDevicesFlagsResponseModel&&(identical(other.isInOrOut, isInOrOut) || other.isInOrOut == isInOrOut)&&(identical(other.geofenceId, geofenceId) || other.geofenceId == geofenceId)&&(identical(other.isBatteryLow, isBatteryLow) || other.isBatteryLow == isBatteryLow)&&(identical(other.isDisconnect, isDisconnect) || other.isDisconnect == isDisconnect)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,isInOrOut,geofenceId,isBatteryLow,isDisconnect); + +@override +String toString() { + return 'GetDevicesFlagsResponseModel(isInOrOut: $isInOrOut, geofenceId: $geofenceId, isBatteryLow: $isBatteryLow, isDisconnect: $isDisconnect)'; +} + + +} + +/// @nodoc +abstract mixin class _$GetDevicesFlagsResponseModelCopyWith<$Res> implements $GetDevicesFlagsResponseModelCopyWith<$Res> { + factory _$GetDevicesFlagsResponseModelCopyWith(_GetDevicesFlagsResponseModel value, $Res Function(_GetDevicesFlagsResponseModel) _then) = __$GetDevicesFlagsResponseModelCopyWithImpl; +@override @useResult +$Res call({ + String isInOrOut, String geofenceId, bool isBatteryLow, bool isDisconnect +}); + + + + +} +/// @nodoc +class __$GetDevicesFlagsResponseModelCopyWithImpl<$Res> + implements _$GetDevicesFlagsResponseModelCopyWith<$Res> { + __$GetDevicesFlagsResponseModelCopyWithImpl(this._self, this._then); + + final _GetDevicesFlagsResponseModel _self; + final $Res Function(_GetDevicesFlagsResponseModel) _then; + +/// Create a copy of GetDevicesFlagsResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? isInOrOut = null,Object? geofenceId = null,Object? isBatteryLow = null,Object? isDisconnect = null,}) { + return _then(_GetDevicesFlagsResponseModel( +isInOrOut: null == isInOrOut ? _self.isInOrOut : isInOrOut // ignore: cast_nullable_to_non_nullable +as String,geofenceId: null == geofenceId ? _self.geofenceId : geofenceId // ignore: cast_nullable_to_non_nullable +as String,isBatteryLow: null == isBatteryLow ? _self.isBatteryLow : isBatteryLow // ignore: cast_nullable_to_non_nullable +as bool,isDisconnect: null == isDisconnect ? _self.isDisconnect : isDisconnect // ignore: cast_nullable_to_non_nullable +as bool, )); } diff --git a/modules/legacy/modules/hub/lib/src/core/data/models/get_devices_response_model.g.dart b/modules/legacy/modules/hub/lib/src/core/data/models/get_devices_response_model.g.dart index e6927c90..258ecfad 100644 --- a/modules/legacy/modules/hub/lib/src/core/data/models/get_devices_response_model.g.dart +++ b/modules/legacy/modules/hub/lib/src/core/data/models/get_devices_response_model.g.dart @@ -23,15 +23,73 @@ Map _$GetDevicesResponseModelToJson( _GetDevicesItemResponseModel _$GetDevicesItemResponseModelFromJson( Map json, ) => _GetDevicesItemResponseModel( - id: json['id'] as String, identificator: json['identificator'] as String, carrierName: json['carrierName'] as String, + phone: json['phone'] as String, + id: json['id'] as String, + settings: GetDevicesSettingsResponseModel.fromJson( + json['settings'] as Map, + ), + protocol: json['protocol'] as String, + type: json['type'] as String, + connectionServer: json['connectionServer'] as String, + createdAt: (json['createdAt'] as num).toInt(), + flags: GetDevicesFlagsResponseModel.fromJson( + json['flags'] as Map, + ), ); Map _$GetDevicesItemResponseModelToJson( _GetDevicesItemResponseModel instance, ) => { - 'id': instance.id, 'identificator': instance.identificator, 'carrierName': instance.carrierName, + 'phone': instance.phone, + 'id': instance.id, + 'settings': instance.settings, + 'protocol': instance.protocol, + 'type': instance.type, + 'connectionServer': instance.connectionServer, + 'createdAt': instance.createdAt, + 'flags': instance.flags, +}; + +_GetDevicesSettingsResponseModel _$GetDevicesSettingsResponseModelFromJson( + Map json, +) => _GetDevicesSettingsResponseModel( + frequency: (json['frequency'] as num).toInt(), + frequencyHeartRate: (json['frequencyHeartRate'] as num).toInt(), + timezone: (json['timezone'] as num).toInt(), + pedometer: json['pedometer'] as bool, + language: json['language'] as String, + alerts: (json['alerts'] as List).map((e) => e as String).toList(), +); + +Map _$GetDevicesSettingsResponseModelToJson( + _GetDevicesSettingsResponseModel instance, +) => { + 'frequency': instance.frequency, + 'frequencyHeartRate': instance.frequencyHeartRate, + 'timezone': instance.timezone, + 'pedometer': instance.pedometer, + 'language': instance.language, + 'alerts': instance.alerts, +}; + +_GetDevicesFlagsResponseModel _$GetDevicesFlagsResponseModelFromJson( + Map json, +) => _GetDevicesFlagsResponseModel( + isInOrOut: json['isInOrOut'] as String, + geofenceId: json['geofenceId'] as String, + isBatteryLow: json['isBatteryLow'] as bool, + isDisconnect: json['isDisconnect'] as bool, +); + +Map _$GetDevicesFlagsResponseModelToJson( + _GetDevicesFlagsResponseModel instance, +) => { + 'isInOrOut': instance.isInOrOut, + 'geofenceId': instance.geofenceId, + 'isBatteryLow': instance.isBatteryLow, + 'isDisconnect': instance.isDisconnect, }; diff --git a/modules/legacy/modules/hub/lib/src/core/data/repositories/hub_repository_impl.dart b/modules/legacy/modules/hub/lib/src/core/data/repositories/hub_repository_impl.dart index 90e10058..4dbb96d2 100644 --- a/modules/legacy/modules/hub/lib/src/core/data/repositories/hub_repository_impl.dart +++ b/modules/legacy/modules/hub/lib/src/core/data/repositories/hub_repository_impl.dart @@ -1,8 +1,7 @@ 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'; +import 'package:legacy_shared/legacy_shared.dart'; class HomeRepositoryImpl implements HomeRepository { const HomeRepositoryImpl(this._remote); diff --git a/modules/legacy/modules/hub/lib/src/core/domain/repositories/hub_repository.dart b/modules/legacy/modules/hub/lib/src/core/domain/repositories/hub_repository.dart index ad163bef..f0eff890 100644 --- a/modules/legacy/modules/hub/lib/src/core/domain/repositories/hub_repository.dart +++ b/modules/legacy/modules/hub/lib/src/core/domain/repositories/hub_repository.dart @@ -1,6 +1,5 @@ -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:legacy_shared/legacy_shared.dart'; abstract class HomeRepository { Future> getDevices({required String userId}); diff --git a/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/device_entity.dart b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/device_entity.dart deleted file mode 100644 index 23334861..00000000 --- a/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/device_entity.dart +++ /dev/null @@ -1,11 +0,0 @@ -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/legacy/modules/hub/lib/src/features/hub/domain/get_devices_use_case.dart b/modules/legacy/modules/hub/lib/src/features/hub/domain/get_devices_use_case.dart index 2647cb60..aa5d3efd 100644 --- a/modules/legacy/modules/hub/lib/src/features/hub/domain/get_devices_use_case.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/domain/get_devices_use_case.dart @@ -1,4 +1,4 @@ -import 'package:hub/src/features/hub/domain/entities/device_entity.dart'; +import 'package:legacy_shared/legacy_shared.dart'; abstract class GetDevicesUseCase { Future> getDevices({required String userId}); diff --git a/modules/legacy/modules/hub/lib/src/features/hub/domain/get_devices_use_case_impl.dart b/modules/legacy/modules/hub/lib/src/features/hub/domain/get_devices_use_case_impl.dart index a5e8c62c..e7877039 100644 --- a/modules/legacy/modules/hub/lib/src/features/hub/domain/get_devices_use_case_impl.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/domain/get_devices_use_case_impl.dart @@ -1,7 +1,6 @@ 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'; +import 'package:legacy_shared/legacy_shared.dart'; class GetDevicesUseCaseImpl implements GetDevicesUseCase { GetDevicesUseCaseImpl(this._repository); diff --git a/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart b/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart index 9efd7f0c..238b13e4 100644 --- a/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart @@ -6,6 +6,7 @@ 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:legacy_shared/legacy_shared.dart'; import 'package:navigation/navigation.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; @@ -49,7 +50,7 @@ class HubScreen extends ConsumerWidget { width: SizeUtils.getByScreen(small: 104, big: 100), height: 32, child: CustomDropdown( - items: viewState.devices.map((device)=> + items: viewState.devices.map((DeviceEntity device)=> Text(device.carrierName) ).toList(), values: viewState.devices, diff --git a/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_model.dart b/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_model.dart index 2473a0f7..e25e8be4 100644 --- a/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_model.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_model.dart @@ -1,13 +1,13 @@ 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/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:legacy_shared/legacy_shared.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:latlong2/latlong.dart'; @@ -20,6 +20,8 @@ class HubViewModel extends Notifier { late final GetDevicesUseCase _getDevicesUseCase; late final GetLatestPositionsUseCase _getLatestPositionsUseCase; + late final SelectedDeviceNotifier selectedDeviceNotifier; + late final MapController mapController; @override @@ -27,11 +29,17 @@ class HubViewModel extends Notifier { _getDevicesUseCase = ref.read(getDevicesUseCaseProvider); _getLatestPositionsUseCase = ref.read(getLatestPositionsUseCaseProvider); + selectedDeviceNotifier = ref.read(selectedDeviceProvider.notifier); + mapController = MapControllerImpl(); - _getDevicesUseCase.getDevices( - userId: '' - ).then((List res){ + ref.read(loggedUserProvider.future) + .then((loggedUser) { + state = state.copyWith(loggedUser: loggedUser); + return _getDevicesUseCase.getDevices( + userId: loggedUser.id + ); + }).then((List res){ state = state.copyWith( devices: res, selectedDevice: res.first @@ -75,6 +83,8 @@ class HubViewModel extends Notifier { selectedDevice: device, selectedPosition: selectedPosition, ); + + selectedDeviceNotifier.setSelectedDevice(device); } void disposeControllers(){ diff --git a/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart b/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart index d19035f7..02abd604 100644 --- a/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart @@ -1,12 +1,13 @@ -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:legacy_shared/legacy_shared.dart'; part 'hub_view_state.freezed.dart'; @freezed abstract class HubViewState with _$HubViewState { const factory HubViewState({ + UserEntity? loggedUser, @Default([]) List devices, DeviceEntity? selectedDevice, @Default([]) List positions, diff --git a/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.freezed.dart b/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.freezed.dart index 92221d5c..578f4431 100644 --- a/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.freezed.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.freezed.dart @@ -14,7 +14,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$HubViewState { - List get devices; DeviceEntity? get selectedDevice; List get positions; PositionEntity? get selectedPosition; + UserEntity? get loggedUser; List get devices; DeviceEntity? get selectedDevice; List get positions; PositionEntity? get selectedPosition; /// Create a copy of HubViewState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -25,16 +25,16 @@ $HubViewStateCopyWith get copyWith => _$HubViewStateCopyWithImpl Object.hash(runtimeType,const DeepCollectionEquality().hash(devices),selectedDevice,const DeepCollectionEquality().hash(positions),selectedPosition); +int get hashCode => Object.hash(runtimeType,loggedUser,const DeepCollectionEquality().hash(devices),selectedDevice,const DeepCollectionEquality().hash(positions),selectedPosition); @override String toString() { - return 'HubViewState(devices: $devices, selectedDevice: $selectedDevice, positions: $positions, selectedPosition: $selectedPosition)'; + return 'HubViewState(loggedUser: $loggedUser, devices: $devices, selectedDevice: $selectedDevice, positions: $positions, selectedPosition: $selectedPosition)'; } @@ -45,11 +45,11 @@ abstract mixin class $HubViewStateCopyWith<$Res> { factory $HubViewStateCopyWith(HubViewState value, $Res Function(HubViewState) _then) = _$HubViewStateCopyWithImpl; @useResult $Res call({ - List devices, DeviceEntity? selectedDevice, List positions, PositionEntity? selectedPosition + UserEntity? loggedUser, List devices, DeviceEntity? selectedDevice, List positions, PositionEntity? selectedPosition }); -$PositionEntityCopyWith<$Res>? get selectedPosition; +$UserEntityCopyWith<$Res>? get loggedUser;$DeviceEntityCopyWith<$Res>? get selectedDevice;$PositionEntityCopyWith<$Res>? get selectedPosition; } /// @nodoc @@ -62,9 +62,10 @@ class _$HubViewStateCopyWithImpl<$Res> /// 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? selectedDevice = freezed,Object? positions = null,Object? selectedPosition = freezed,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? loggedUser = freezed,Object? devices = null,Object? selectedDevice = freezed,Object? positions = null,Object? selectedPosition = freezed,}) { return _then(_self.copyWith( -devices: null == devices ? _self.devices : devices // ignore: cast_nullable_to_non_nullable +loggedUser: freezed == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable +as UserEntity?,devices: null == devices ? _self.devices : devices // ignore: cast_nullable_to_non_nullable as List,selectedDevice: freezed == selectedDevice ? _self.selectedDevice : selectedDevice // ignore: cast_nullable_to_non_nullable as DeviceEntity?,positions: null == positions ? _self.positions : positions // ignore: cast_nullable_to_non_nullable as List,selectedPosition: freezed == selectedPosition ? _self.selectedPosition : selectedPosition // ignore: cast_nullable_to_non_nullable @@ -75,6 +76,30 @@ as PositionEntity?, /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') +$UserEntityCopyWith<$Res>? get loggedUser { + if (_self.loggedUser == null) { + return null; + } + + return $UserEntityCopyWith<$Res>(_self.loggedUser!, (value) { + return _then(_self.copyWith(loggedUser: value)); + }); +}/// Create a copy of HubViewState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceEntityCopyWith<$Res>? get selectedDevice { + if (_self.selectedDevice == null) { + return null; + } + + return $DeviceEntityCopyWith<$Res>(_self.selectedDevice!, (value) { + return _then(_self.copyWith(selectedDevice: value)); + }); +}/// Create a copy of HubViewState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') $PositionEntityCopyWith<$Res>? get selectedPosition { if (_self.selectedPosition == null) { return null; @@ -165,10 +190,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( List devices, DeviceEntity? selectedDevice, List positions, PositionEntity? selectedPosition)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( UserEntity? loggedUser, List devices, DeviceEntity? selectedDevice, List positions, PositionEntity? selectedPosition)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _HubViewState() when $default != null: -return $default(_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition);case _: +return $default(_that.loggedUser,_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition);case _: return orElse(); } @@ -186,10 +211,10 @@ return $default(_that.devices,_that.selectedDevice,_that.positions,_that.selecte /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( List devices, DeviceEntity? selectedDevice, List positions, PositionEntity? selectedPosition) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( UserEntity? loggedUser, List devices, DeviceEntity? selectedDevice, List positions, PositionEntity? selectedPosition) $default,) {final _that = this; switch (_that) { case _HubViewState(): -return $default(_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition);case _: +return $default(_that.loggedUser,_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition);case _: throw StateError('Unexpected subclass'); } @@ -206,10 +231,10 @@ return $default(_that.devices,_that.selectedDevice,_that.positions,_that.selecte /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( List devices, DeviceEntity? selectedDevice, List positions, PositionEntity? selectedPosition)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( UserEntity? loggedUser, List devices, DeviceEntity? selectedDevice, List positions, PositionEntity? selectedPosition)? $default,) {final _that = this; switch (_that) { case _HubViewState() when $default != null: -return $default(_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition);case _: +return $default(_that.loggedUser,_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition);case _: return null; } @@ -221,9 +246,10 @@ return $default(_that.devices,_that.selectedDevice,_that.positions,_that.selecte class _HubViewState implements HubViewState { - const _HubViewState({final List devices = const [], this.selectedDevice, final List positions = const [], this.selectedPosition}): _devices = devices,_positions = positions; + const _HubViewState({this.loggedUser, final List devices = const [], this.selectedDevice, final List positions = const [], this.selectedPosition}): _devices = devices,_positions = positions; +@override final UserEntity? loggedUser; final List _devices; @override@JsonKey() List get devices { if (_devices is EqualUnmodifiableListView) return _devices; @@ -251,16 +277,16 @@ _$HubViewStateCopyWith<_HubViewState> get copyWith => __$HubViewStateCopyWithImp @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _HubViewState&&const DeepCollectionEquality().equals(other._devices, _devices)&&(identical(other.selectedDevice, selectedDevice) || other.selectedDevice == selectedDevice)&&const DeepCollectionEquality().equals(other._positions, _positions)&&(identical(other.selectedPosition, selectedPosition) || other.selectedPosition == selectedPosition)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _HubViewState&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&const DeepCollectionEquality().equals(other._devices, _devices)&&(identical(other.selectedDevice, selectedDevice) || other.selectedDevice == selectedDevice)&&const DeepCollectionEquality().equals(other._positions, _positions)&&(identical(other.selectedPosition, selectedPosition) || other.selectedPosition == selectedPosition)); } @override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_devices),selectedDevice,const DeepCollectionEquality().hash(_positions),selectedPosition); +int get hashCode => Object.hash(runtimeType,loggedUser,const DeepCollectionEquality().hash(_devices),selectedDevice,const DeepCollectionEquality().hash(_positions),selectedPosition); @override String toString() { - return 'HubViewState(devices: $devices, selectedDevice: $selectedDevice, positions: $positions, selectedPosition: $selectedPosition)'; + return 'HubViewState(loggedUser: $loggedUser, devices: $devices, selectedDevice: $selectedDevice, positions: $positions, selectedPosition: $selectedPosition)'; } @@ -271,11 +297,11 @@ abstract mixin class _$HubViewStateCopyWith<$Res> implements $HubViewStateCopyWi factory _$HubViewStateCopyWith(_HubViewState value, $Res Function(_HubViewState) _then) = __$HubViewStateCopyWithImpl; @override @useResult $Res call({ - List devices, DeviceEntity? selectedDevice, List positions, PositionEntity? selectedPosition + UserEntity? loggedUser, List devices, DeviceEntity? selectedDevice, List positions, PositionEntity? selectedPosition }); -@override $PositionEntityCopyWith<$Res>? get selectedPosition; +@override $UserEntityCopyWith<$Res>? get loggedUser;@override $DeviceEntityCopyWith<$Res>? get selectedDevice;@override $PositionEntityCopyWith<$Res>? get selectedPosition; } /// @nodoc @@ -288,9 +314,10 @@ class __$HubViewStateCopyWithImpl<$Res> /// 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? selectedDevice = freezed,Object? positions = null,Object? selectedPosition = freezed,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? loggedUser = freezed,Object? devices = null,Object? selectedDevice = freezed,Object? positions = null,Object? selectedPosition = freezed,}) { return _then(_HubViewState( -devices: null == devices ? _self._devices : devices // ignore: cast_nullable_to_non_nullable +loggedUser: freezed == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable +as UserEntity?,devices: null == devices ? _self._devices : devices // ignore: cast_nullable_to_non_nullable as List,selectedDevice: freezed == selectedDevice ? _self.selectedDevice : selectedDevice // ignore: cast_nullable_to_non_nullable as DeviceEntity?,positions: null == positions ? _self._positions : positions // ignore: cast_nullable_to_non_nullable as List,selectedPosition: freezed == selectedPosition ? _self.selectedPosition : selectedPosition // ignore: cast_nullable_to_non_nullable @@ -302,6 +329,30 @@ as PositionEntity?, /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') +$UserEntityCopyWith<$Res>? get loggedUser { + if (_self.loggedUser == null) { + return null; + } + + return $UserEntityCopyWith<$Res>(_self.loggedUser!, (value) { + return _then(_self.copyWith(loggedUser: value)); + }); +}/// Create a copy of HubViewState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceEntityCopyWith<$Res>? get selectedDevice { + if (_self.selectedDevice == null) { + return null; + } + + return $DeviceEntityCopyWith<$Res>(_self.selectedDevice!, (value) { + return _then(_self.copyWith(selectedDevice: value)); + }); +}/// Create a copy of HubViewState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') $PositionEntityCopyWith<$Res>? get selectedPosition { if (_self.selectedPosition == null) { return null; diff --git a/modules/legacy/modules/hub/pubspec.lock b/modules/legacy/modules/hub/pubspec.lock index 636f3de1..16307937 100644 --- a/modules/legacy/modules/hub/pubspec.lock +++ b/modules/legacy/modules/hub/pubspec.lock @@ -422,7 +422,7 @@ packages: source: sdk version: "0.0.0" fonts: - dependency: "direct main" + dependency: "direct overridden" description: path: "../../../../packages/fonts" relative: true @@ -595,6 +595,13 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.2" + legacy_shared: + dependency: "direct main" + description: + path: "../../packages/legacy_shared" + relative: true + source: path + version: "0.0.1" lints: dependency: transitive description: diff --git a/modules/legacy/modules/hub/pubspec.yaml b/modules/legacy/modules/hub/pubspec.yaml index aa7ceb59..b1c41d9d 100644 --- a/modules/legacy/modules/hub/pubspec.yaml +++ b/modules/legacy/modules/hub/pubspec.yaml @@ -45,8 +45,8 @@ dependencies: path: ../../../../packages/sf_infrastructure utils: path: ../../../../packages/utils - fonts: - path: ../../../../packages/fonts + legacy_shared: + path: ../../packages/legacy_shared #dependencies go here flutter_svg: ^2.2.1 get_it: ^9.0.5 diff --git a/modules/legacy/modules/hub/pubspec_overrides.yaml b/modules/legacy/modules/hub/pubspec_overrides.yaml index cf91bc8a..04ccd0da 100644 --- a/modules/legacy/modules/hub/pubspec_overrides.yaml +++ b/modules/legacy/modules/hub/pubspec_overrides.yaml @@ -1,3 +1,4 @@ +# melos_managed_dependency_overrides: legacy_shared # melos_managed_dependency_overrides: design_system,fonts,navigation,sf_infrastructure,sf_localizations,utils,auth,dashboard_shell,home,notifications,sf_shared,profile dependency_overrides: auth: @@ -10,6 +11,8 @@ dependency_overrides: path: ..\\..\\..\\..\\packages\\fonts home: path: ..\\..\\..\\home + legacy_shared: + path: ..\\..\\packages\\legacy_shared navigation: path: ..\\..\\..\\..\\packages\\navigation notifications: diff --git a/modules/legacy/modules/legacy_dashboard_shell/pubspec_overrides.yaml b/modules/legacy/modules/legacy_dashboard_shell/pubspec_overrides.yaml index fef6dac5..62159a3e 100644 --- a/modules/legacy/modules/legacy_dashboard_shell/pubspec_overrides.yaml +++ b/modules/legacy/modules/legacy_dashboard_shell/pubspec_overrides.yaml @@ -1,3 +1,4 @@ +# melos_managed_dependency_overrides: legacy_shared # melos_managed_dependency_overrides: auth,design_system,fonts,home,navigation,notifications,sf_infrastructure,sf_localizations,sf_shared,utils,dashboard_shell,hub,profile dependency_overrides: auth: @@ -12,6 +13,8 @@ dependency_overrides: path: ..\\..\\..\\home hub: path: ..\\hub + legacy_shared: + path: ..\\..\\packages\\legacy_shared navigation: path: ..\\..\\..\\..\\packages\\navigation notifications: diff --git a/modules/legacy/packages/legacy_shared/lib/src/data/models/entities/device_entity.dart b/modules/legacy/packages/legacy_shared/lib/src/data/models/entities/device_entity.dart new file mode 100644 index 00000000..d7dddaa1 --- /dev/null +++ b/modules/legacy/packages/legacy_shared/lib/src/data/models/entities/device_entity.dart @@ -0,0 +1,123 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'device_entity.freezed.dart'; + +@freezed +abstract class DeviceEntity with _$DeviceEntity { + const factory DeviceEntity({ + required String id, + required String identificator, + int? battery, + String? userId, + String? companyId, + String? delegationId, + String? groupId, + required DeviceFlagsEntity flags, + List? tags, + int? lastConnection, + String? carrierGenre, + int? carrierBirthday, + int? carrierWeight, + int? carrierStepLength, + required String carrierName, + String? comment, + String? phone, + String? simId, + String? simStatus, + DevicePaymentOptionsEntity? paymentOptions, + required DeviceSettingsEntity settings, + required String protocol, + required String type, + required String connectionServer, + DeviceCapabilitiesEntity? capabilities, + required int createdAt, + int? updatedAt, + }) = _DeviceEntity; +} + +@freezed +abstract class DeviceFlagsEntity with _$DeviceFlagsEntity{ + const factory DeviceFlagsEntity({ + required String isInOrOut, + String? geofenceId, + required bool isBatteryLow, + required bool isDisconnect, + }) = _DeviceFlagsEntity; +} + +@freezed +abstract class DevicePaymentOptionsEntity with _$DevicePaymentOptionsEntity{ + const factory DevicePaymentOptionsEntity({ + int? nextPayDate, + required bool usePayment, + required String typeSubscription, + required bool hasSubscription, + required bool hasToPay, + }) = _DevicePaymentOptionsEntity; +} + +@freezed +abstract class DeviceSettingsEntity with _$DeviceSettingsEntity{ + const factory DeviceSettingsEntity({ + required int frequency, + required int frequencyHeartRate, + required int timezone, + required bool pedometer, + required String language, + required List alerts, + }) = _DeviceSettingsEntity; +} + +@freezed +abstract class DeviceCapabilitiesEntity with _$DeviceCapabilitiesEntity{ + const factory DeviceCapabilitiesEntity({ + required bool heartbeats, + required bool bloodPressure, + required DeviceCapabilitiesAlertEntity alerts, + required bool podometer, + required DeviceCapabilitiesContactsEntity contacts, + required DeviceCapabilitiesCommandsEntity commands, + required DeviceCapabilitiesSettingsEntity settings, + }) = _DeviceCapabilitiesEntity; +} + +@freezed +abstract class DeviceCapabilitiesAlertEntity with _$DeviceCapabilitiesAlertEntity{ + const factory DeviceCapabilitiesAlertEntity({ + required bool enabled, + required List types, + }) = _DeviceCapabilitiesAlertEntity; +} + +@freezed +abstract class DeviceCapabilitiesContactsEntity with _$DeviceCapabilitiesContactsEntity{ + const factory DeviceCapabilitiesContactsEntity({ + required bool enabled, + required List types, + }) = _DeviceCapabilitiesContactsEntity; +} + +@freezed +abstract class DeviceCapabilitiesContactTypeEntity with _$DeviceCapabilitiesContactTypeEntity{ + const factory DeviceCapabilitiesContactTypeEntity({ + required String type, + required int amount, + }) = _DeviceCapabilitiesContactTypeEntity; +} + +@freezed +abstract class DeviceCapabilitiesCommandsEntity with _$DeviceCapabilitiesCommandsEntity{ + const factory DeviceCapabilitiesCommandsEntity({ + required bool enabled, + required List types, + }) = _DeviceCapabilitiesCommandsEntity; +} + +@freezed +abstract class DeviceCapabilitiesSettingsEntity with _$DeviceCapabilitiesSettingsEntity{ + const factory DeviceCapabilitiesSettingsEntity({ + required bool locationFrequency, + required bool timezone, + required bool language, + }) = _DeviceCapabilitiesSettingsEntity; +} \ No newline at end of file diff --git a/modules/legacy/packages/legacy_shared/lib/src/data/models/entities/device_entity.freezed.dart b/modules/legacy/packages/legacy_shared/lib/src/data/models/entities/device_entity.freezed.dart new file mode 100644 index 00000000..44d8b405 --- /dev/null +++ b/modules/legacy/packages/legacy_shared/lib/src/data/models/entities/device_entity.freezed.dart @@ -0,0 +1,2922 @@ +// 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 'device_entity.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$DeviceEntity { + + String get id; String get identificator; int? get battery; String? get userId; String? get companyId; String? get delegationId; String? get groupId; DeviceFlagsEntity get flags; List? get tags; int? get lastConnection; String? get carrierGenre; int? get carrierBirthday; int? get carrierWeight; int? get carrierStepLength; String get carrierName; String? get comment; String? get phone; String? get simId; String? get simStatus; DevicePaymentOptionsEntity? get paymentOptions; DeviceSettingsEntity get settings; String get protocol; String get type; String get connectionServer; DeviceCapabilitiesEntity? get capabilities; int get createdAt; int? get updatedAt; +/// Create a copy of DeviceEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceEntityCopyWith get copyWith => _$DeviceEntityCopyWithImpl(this as DeviceEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.battery, battery) || other.battery == battery)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.companyId, companyId) || other.companyId == companyId)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&(identical(other.flags, flags) || other.flags == flags)&&const DeepCollectionEquality().equals(other.tags, tags)&&(identical(other.lastConnection, lastConnection) || other.lastConnection == lastConnection)&&(identical(other.carrierGenre, carrierGenre) || other.carrierGenre == carrierGenre)&&(identical(other.carrierBirthday, carrierBirthday) || other.carrierBirthday == carrierBirthday)&&(identical(other.carrierWeight, carrierWeight) || other.carrierWeight == carrierWeight)&&(identical(other.carrierStepLength, carrierStepLength) || other.carrierStepLength == carrierStepLength)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName)&&(identical(other.comment, comment) || other.comment == comment)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.simId, simId) || other.simId == simId)&&(identical(other.simStatus, simStatus) || other.simStatus == simStatus)&&(identical(other.paymentOptions, paymentOptions) || other.paymentOptions == paymentOptions)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.protocol, protocol) || other.protocol == protocol)&&(identical(other.type, type) || other.type == type)&&(identical(other.connectionServer, connectionServer) || other.connectionServer == connectionServer)&&(identical(other.capabilities, capabilities) || other.capabilities == capabilities)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); +} + + +@override +int get hashCode => Object.hashAll([runtimeType,id,identificator,battery,userId,companyId,delegationId,groupId,flags,const DeepCollectionEquality().hash(tags),lastConnection,carrierGenre,carrierBirthday,carrierWeight,carrierStepLength,carrierName,comment,phone,simId,simStatus,paymentOptions,settings,protocol,type,connectionServer,capabilities,createdAt,updatedAt]); + +@override +String toString() { + return 'DeviceEntity(id: $id, identificator: $identificator, battery: $battery, userId: $userId, companyId: $companyId, delegationId: $delegationId, groupId: $groupId, flags: $flags, tags: $tags, lastConnection: $lastConnection, carrierGenre: $carrierGenre, carrierBirthday: $carrierBirthday, carrierWeight: $carrierWeight, carrierStepLength: $carrierStepLength, carrierName: $carrierName, comment: $comment, phone: $phone, simId: $simId, simStatus: $simStatus, paymentOptions: $paymentOptions, settings: $settings, protocol: $protocol, type: $type, connectionServer: $connectionServer, capabilities: $capabilities, createdAt: $createdAt, updatedAt: $updatedAt)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceEntityCopyWith<$Res> { + factory $DeviceEntityCopyWith(DeviceEntity value, $Res Function(DeviceEntity) _then) = _$DeviceEntityCopyWithImpl; +@useResult +$Res call({ + String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, DeviceFlagsEntity flags, List? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, int? carrierWeight, int? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, DevicePaymentOptionsEntity? paymentOptions, DeviceSettingsEntity settings, String protocol, String type, String connectionServer, DeviceCapabilitiesEntity? capabilities, int createdAt, int? updatedAt +}); + + +$DeviceFlagsEntityCopyWith<$Res> get flags;$DevicePaymentOptionsEntityCopyWith<$Res>? get paymentOptions;$DeviceSettingsEntityCopyWith<$Res> get settings;$DeviceCapabilitiesEntityCopyWith<$Res>? get capabilities; + +} +/// @nodoc +class _$DeviceEntityCopyWithImpl<$Res> + implements $DeviceEntityCopyWith<$Res> { + _$DeviceEntityCopyWithImpl(this._self, this._then); + + final DeviceEntity _self; + final $Res Function(DeviceEntity) _then; + +/// Create a copy of DeviceEntity +/// 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? battery = freezed,Object? userId = freezed,Object? companyId = freezed,Object? delegationId = freezed,Object? groupId = freezed,Object? flags = null,Object? tags = freezed,Object? lastConnection = freezed,Object? carrierGenre = freezed,Object? carrierBirthday = freezed,Object? carrierWeight = freezed,Object? carrierStepLength = freezed,Object? carrierName = null,Object? comment = freezed,Object? phone = freezed,Object? simId = freezed,Object? simStatus = freezed,Object? paymentOptions = freezed,Object? settings = null,Object? protocol = null,Object? type = null,Object? connectionServer = null,Object? capabilities = freezed,Object? createdAt = null,Object? updatedAt = freezed,}) { + 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,battery: freezed == battery ? _self.battery : battery // ignore: cast_nullable_to_non_nullable +as int?,userId: freezed == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable +as String?,companyId: freezed == companyId ? _self.companyId : companyId // ignore: cast_nullable_to_non_nullable +as String?,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable +as String?,groupId: freezed == groupId ? _self.groupId : groupId // ignore: cast_nullable_to_non_nullable +as String?,flags: null == flags ? _self.flags : flags // ignore: cast_nullable_to_non_nullable +as DeviceFlagsEntity,tags: freezed == tags ? _self.tags : tags // ignore: cast_nullable_to_non_nullable +as List?,lastConnection: freezed == lastConnection ? _self.lastConnection : lastConnection // ignore: cast_nullable_to_non_nullable +as int?,carrierGenre: freezed == carrierGenre ? _self.carrierGenre : carrierGenre // ignore: cast_nullable_to_non_nullable +as String?,carrierBirthday: freezed == carrierBirthday ? _self.carrierBirthday : carrierBirthday // ignore: cast_nullable_to_non_nullable +as int?,carrierWeight: freezed == carrierWeight ? _self.carrierWeight : carrierWeight // ignore: cast_nullable_to_non_nullable +as int?,carrierStepLength: freezed == carrierStepLength ? _self.carrierStepLength : carrierStepLength // ignore: cast_nullable_to_non_nullable +as int?,carrierName: null == carrierName ? _self.carrierName : carrierName // ignore: cast_nullable_to_non_nullable +as String,comment: freezed == comment ? _self.comment : comment // ignore: cast_nullable_to_non_nullable +as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String?,simId: freezed == simId ? _self.simId : simId // ignore: cast_nullable_to_non_nullable +as String?,simStatus: freezed == simStatus ? _self.simStatus : simStatus // ignore: cast_nullable_to_non_nullable +as String?,paymentOptions: freezed == paymentOptions ? _self.paymentOptions : paymentOptions // ignore: cast_nullable_to_non_nullable +as DevicePaymentOptionsEntity?,settings: null == settings ? _self.settings : settings // ignore: cast_nullable_to_non_nullable +as DeviceSettingsEntity,protocol: null == protocol ? _self.protocol : protocol // ignore: cast_nullable_to_non_nullable +as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as String,connectionServer: null == connectionServer ? _self.connectionServer : connectionServer // ignore: cast_nullable_to_non_nullable +as String,capabilities: freezed == capabilities ? _self.capabilities : capabilities // ignore: cast_nullable_to_non_nullable +as DeviceCapabilitiesEntity?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as int,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as int?, + )); +} +/// Create a copy of DeviceEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceFlagsEntityCopyWith<$Res> get flags { + + return $DeviceFlagsEntityCopyWith<$Res>(_self.flags, (value) { + return _then(_self.copyWith(flags: value)); + }); +}/// Create a copy of DeviceEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DevicePaymentOptionsEntityCopyWith<$Res>? get paymentOptions { + if (_self.paymentOptions == null) { + return null; + } + + return $DevicePaymentOptionsEntityCopyWith<$Res>(_self.paymentOptions!, (value) { + return _then(_self.copyWith(paymentOptions: value)); + }); +}/// Create a copy of DeviceEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceSettingsEntityCopyWith<$Res> get settings { + + return $DeviceSettingsEntityCopyWith<$Res>(_self.settings, (value) { + return _then(_self.copyWith(settings: value)); + }); +}/// Create a copy of DeviceEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilitiesEntityCopyWith<$Res>? get capabilities { + if (_self.capabilities == null) { + return null; + } + + return $DeviceCapabilitiesEntityCopyWith<$Res>(_self.capabilities!, (value) { + return _then(_self.copyWith(capabilities: value)); + }); +} +} + + +/// Adds pattern-matching-related methods to [DeviceEntity]. +extension DeviceEntityPatterns on DeviceEntity { +/// 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( _DeviceEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceEntity() 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( _DeviceEntity value) $default,){ +final _that = this; +switch (_that) { +case _DeviceEntity(): +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( _DeviceEntity value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceEntity() 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, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, DeviceFlagsEntity flags, List? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, int? carrierWeight, int? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, DevicePaymentOptionsEntity? paymentOptions, DeviceSettingsEntity settings, String protocol, String type, String connectionServer, DeviceCapabilitiesEntity? capabilities, int createdAt, int? updatedAt)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceEntity() when $default != null: +return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.simStatus,_that.paymentOptions,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.capabilities,_that.createdAt,_that.updatedAt);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, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, DeviceFlagsEntity flags, List? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, int? carrierWeight, int? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, DevicePaymentOptionsEntity? paymentOptions, DeviceSettingsEntity settings, String protocol, String type, String connectionServer, DeviceCapabilitiesEntity? capabilities, int createdAt, int? updatedAt) $default,) {final _that = this; +switch (_that) { +case _DeviceEntity(): +return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.simStatus,_that.paymentOptions,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.capabilities,_that.createdAt,_that.updatedAt);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, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, DeviceFlagsEntity flags, List? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, int? carrierWeight, int? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, DevicePaymentOptionsEntity? paymentOptions, DeviceSettingsEntity settings, String protocol, String type, String connectionServer, DeviceCapabilitiesEntity? capabilities, int createdAt, int? updatedAt)? $default,) {final _that = this; +switch (_that) { +case _DeviceEntity() when $default != null: +return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.simStatus,_that.paymentOptions,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.capabilities,_that.createdAt,_that.updatedAt);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DeviceEntity implements DeviceEntity { + const _DeviceEntity({required this.id, required this.identificator, this.battery, this.userId, this.companyId, this.delegationId, this.groupId, required this.flags, final List? tags, this.lastConnection, this.carrierGenre, this.carrierBirthday, this.carrierWeight, this.carrierStepLength, required this.carrierName, this.comment, this.phone, this.simId, this.simStatus, this.paymentOptions, required this.settings, required this.protocol, required this.type, required this.connectionServer, this.capabilities, required this.createdAt, this.updatedAt}): _tags = tags; + + +@override final String id; +@override final String identificator; +@override final int? battery; +@override final String? userId; +@override final String? companyId; +@override final String? delegationId; +@override final String? groupId; +@override final DeviceFlagsEntity flags; + final List? _tags; +@override List? get tags { + final value = _tags; + if (value == null) return null; + if (_tags is EqualUnmodifiableListView) return _tags; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); +} + +@override final int? lastConnection; +@override final String? carrierGenre; +@override final int? carrierBirthday; +@override final int? carrierWeight; +@override final int? carrierStepLength; +@override final String carrierName; +@override final String? comment; +@override final String? phone; +@override final String? simId; +@override final String? simStatus; +@override final DevicePaymentOptionsEntity? paymentOptions; +@override final DeviceSettingsEntity settings; +@override final String protocol; +@override final String type; +@override final String connectionServer; +@override final DeviceCapabilitiesEntity? capabilities; +@override final int createdAt; +@override final int? updatedAt; + +/// Create a copy of DeviceEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceEntityCopyWith<_DeviceEntity> get copyWith => __$DeviceEntityCopyWithImpl<_DeviceEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.battery, battery) || other.battery == battery)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.companyId, companyId) || other.companyId == companyId)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&(identical(other.flags, flags) || other.flags == flags)&&const DeepCollectionEquality().equals(other._tags, _tags)&&(identical(other.lastConnection, lastConnection) || other.lastConnection == lastConnection)&&(identical(other.carrierGenre, carrierGenre) || other.carrierGenre == carrierGenre)&&(identical(other.carrierBirthday, carrierBirthday) || other.carrierBirthday == carrierBirthday)&&(identical(other.carrierWeight, carrierWeight) || other.carrierWeight == carrierWeight)&&(identical(other.carrierStepLength, carrierStepLength) || other.carrierStepLength == carrierStepLength)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName)&&(identical(other.comment, comment) || other.comment == comment)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.simId, simId) || other.simId == simId)&&(identical(other.simStatus, simStatus) || other.simStatus == simStatus)&&(identical(other.paymentOptions, paymentOptions) || other.paymentOptions == paymentOptions)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.protocol, protocol) || other.protocol == protocol)&&(identical(other.type, type) || other.type == type)&&(identical(other.connectionServer, connectionServer) || other.connectionServer == connectionServer)&&(identical(other.capabilities, capabilities) || other.capabilities == capabilities)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); +} + + +@override +int get hashCode => Object.hashAll([runtimeType,id,identificator,battery,userId,companyId,delegationId,groupId,flags,const DeepCollectionEquality().hash(_tags),lastConnection,carrierGenre,carrierBirthday,carrierWeight,carrierStepLength,carrierName,comment,phone,simId,simStatus,paymentOptions,settings,protocol,type,connectionServer,capabilities,createdAt,updatedAt]); + +@override +String toString() { + return 'DeviceEntity(id: $id, identificator: $identificator, battery: $battery, userId: $userId, companyId: $companyId, delegationId: $delegationId, groupId: $groupId, flags: $flags, tags: $tags, lastConnection: $lastConnection, carrierGenre: $carrierGenre, carrierBirthday: $carrierBirthday, carrierWeight: $carrierWeight, carrierStepLength: $carrierStepLength, carrierName: $carrierName, comment: $comment, phone: $phone, simId: $simId, simStatus: $simStatus, paymentOptions: $paymentOptions, settings: $settings, protocol: $protocol, type: $type, connectionServer: $connectionServer, capabilities: $capabilities, createdAt: $createdAt, updatedAt: $updatedAt)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceEntityCopyWith<$Res> implements $DeviceEntityCopyWith<$Res> { + factory _$DeviceEntityCopyWith(_DeviceEntity value, $Res Function(_DeviceEntity) _then) = __$DeviceEntityCopyWithImpl; +@override @useResult +$Res call({ + String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, DeviceFlagsEntity flags, List? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, int? carrierWeight, int? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, DevicePaymentOptionsEntity? paymentOptions, DeviceSettingsEntity settings, String protocol, String type, String connectionServer, DeviceCapabilitiesEntity? capabilities, int createdAt, int? updatedAt +}); + + +@override $DeviceFlagsEntityCopyWith<$Res> get flags;@override $DevicePaymentOptionsEntityCopyWith<$Res>? get paymentOptions;@override $DeviceSettingsEntityCopyWith<$Res> get settings;@override $DeviceCapabilitiesEntityCopyWith<$Res>? get capabilities; + +} +/// @nodoc +class __$DeviceEntityCopyWithImpl<$Res> + implements _$DeviceEntityCopyWith<$Res> { + __$DeviceEntityCopyWithImpl(this._self, this._then); + + final _DeviceEntity _self; + final $Res Function(_DeviceEntity) _then; + +/// Create a copy of DeviceEntity +/// 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? battery = freezed,Object? userId = freezed,Object? companyId = freezed,Object? delegationId = freezed,Object? groupId = freezed,Object? flags = null,Object? tags = freezed,Object? lastConnection = freezed,Object? carrierGenre = freezed,Object? carrierBirthday = freezed,Object? carrierWeight = freezed,Object? carrierStepLength = freezed,Object? carrierName = null,Object? comment = freezed,Object? phone = freezed,Object? simId = freezed,Object? simStatus = freezed,Object? paymentOptions = freezed,Object? settings = null,Object? protocol = null,Object? type = null,Object? connectionServer = null,Object? capabilities = freezed,Object? createdAt = null,Object? updatedAt = freezed,}) { + return _then(_DeviceEntity( +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,battery: freezed == battery ? _self.battery : battery // ignore: cast_nullable_to_non_nullable +as int?,userId: freezed == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable +as String?,companyId: freezed == companyId ? _self.companyId : companyId // ignore: cast_nullable_to_non_nullable +as String?,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable +as String?,groupId: freezed == groupId ? _self.groupId : groupId // ignore: cast_nullable_to_non_nullable +as String?,flags: null == flags ? _self.flags : flags // ignore: cast_nullable_to_non_nullable +as DeviceFlagsEntity,tags: freezed == tags ? _self._tags : tags // ignore: cast_nullable_to_non_nullable +as List?,lastConnection: freezed == lastConnection ? _self.lastConnection : lastConnection // ignore: cast_nullable_to_non_nullable +as int?,carrierGenre: freezed == carrierGenre ? _self.carrierGenre : carrierGenre // ignore: cast_nullable_to_non_nullable +as String?,carrierBirthday: freezed == carrierBirthday ? _self.carrierBirthday : carrierBirthday // ignore: cast_nullable_to_non_nullable +as int?,carrierWeight: freezed == carrierWeight ? _self.carrierWeight : carrierWeight // ignore: cast_nullable_to_non_nullable +as int?,carrierStepLength: freezed == carrierStepLength ? _self.carrierStepLength : carrierStepLength // ignore: cast_nullable_to_non_nullable +as int?,carrierName: null == carrierName ? _self.carrierName : carrierName // ignore: cast_nullable_to_non_nullable +as String,comment: freezed == comment ? _self.comment : comment // ignore: cast_nullable_to_non_nullable +as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable +as String?,simId: freezed == simId ? _self.simId : simId // ignore: cast_nullable_to_non_nullable +as String?,simStatus: freezed == simStatus ? _self.simStatus : simStatus // ignore: cast_nullable_to_non_nullable +as String?,paymentOptions: freezed == paymentOptions ? _self.paymentOptions : paymentOptions // ignore: cast_nullable_to_non_nullable +as DevicePaymentOptionsEntity?,settings: null == settings ? _self.settings : settings // ignore: cast_nullable_to_non_nullable +as DeviceSettingsEntity,protocol: null == protocol ? _self.protocol : protocol // ignore: cast_nullable_to_non_nullable +as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as String,connectionServer: null == connectionServer ? _self.connectionServer : connectionServer // ignore: cast_nullable_to_non_nullable +as String,capabilities: freezed == capabilities ? _self.capabilities : capabilities // ignore: cast_nullable_to_non_nullable +as DeviceCapabilitiesEntity?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as int,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as int?, + )); +} + +/// Create a copy of DeviceEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceFlagsEntityCopyWith<$Res> get flags { + + return $DeviceFlagsEntityCopyWith<$Res>(_self.flags, (value) { + return _then(_self.copyWith(flags: value)); + }); +}/// Create a copy of DeviceEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DevicePaymentOptionsEntityCopyWith<$Res>? get paymentOptions { + if (_self.paymentOptions == null) { + return null; + } + + return $DevicePaymentOptionsEntityCopyWith<$Res>(_self.paymentOptions!, (value) { + return _then(_self.copyWith(paymentOptions: value)); + }); +}/// Create a copy of DeviceEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceSettingsEntityCopyWith<$Res> get settings { + + return $DeviceSettingsEntityCopyWith<$Res>(_self.settings, (value) { + return _then(_self.copyWith(settings: value)); + }); +}/// Create a copy of DeviceEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilitiesEntityCopyWith<$Res>? get capabilities { + if (_self.capabilities == null) { + return null; + } + + return $DeviceCapabilitiesEntityCopyWith<$Res>(_self.capabilities!, (value) { + return _then(_self.copyWith(capabilities: value)); + }); +} +} + +/// @nodoc +mixin _$DeviceFlagsEntity { + + String get isInOrOut; String? get geofenceId; bool get isBatteryLow; bool get isDisconnect; +/// Create a copy of DeviceFlagsEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceFlagsEntityCopyWith get copyWith => _$DeviceFlagsEntityCopyWithImpl(this as DeviceFlagsEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceFlagsEntity&&(identical(other.isInOrOut, isInOrOut) || other.isInOrOut == isInOrOut)&&(identical(other.geofenceId, geofenceId) || other.geofenceId == geofenceId)&&(identical(other.isBatteryLow, isBatteryLow) || other.isBatteryLow == isBatteryLow)&&(identical(other.isDisconnect, isDisconnect) || other.isDisconnect == isDisconnect)); +} + + +@override +int get hashCode => Object.hash(runtimeType,isInOrOut,geofenceId,isBatteryLow,isDisconnect); + +@override +String toString() { + return 'DeviceFlagsEntity(isInOrOut: $isInOrOut, geofenceId: $geofenceId, isBatteryLow: $isBatteryLow, isDisconnect: $isDisconnect)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceFlagsEntityCopyWith<$Res> { + factory $DeviceFlagsEntityCopyWith(DeviceFlagsEntity value, $Res Function(DeviceFlagsEntity) _then) = _$DeviceFlagsEntityCopyWithImpl; +@useResult +$Res call({ + String isInOrOut, String? geofenceId, bool isBatteryLow, bool isDisconnect +}); + + + + +} +/// @nodoc +class _$DeviceFlagsEntityCopyWithImpl<$Res> + implements $DeviceFlagsEntityCopyWith<$Res> { + _$DeviceFlagsEntityCopyWithImpl(this._self, this._then); + + final DeviceFlagsEntity _self; + final $Res Function(DeviceFlagsEntity) _then; + +/// Create a copy of DeviceFlagsEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? isInOrOut = null,Object? geofenceId = freezed,Object? isBatteryLow = null,Object? isDisconnect = null,}) { + return _then(_self.copyWith( +isInOrOut: null == isInOrOut ? _self.isInOrOut : isInOrOut // ignore: cast_nullable_to_non_nullable +as String,geofenceId: freezed == geofenceId ? _self.geofenceId : geofenceId // ignore: cast_nullable_to_non_nullable +as String?,isBatteryLow: null == isBatteryLow ? _self.isBatteryLow : isBatteryLow // ignore: cast_nullable_to_non_nullable +as bool,isDisconnect: null == isDisconnect ? _self.isDisconnect : isDisconnect // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceFlagsEntity]. +extension DeviceFlagsEntityPatterns on DeviceFlagsEntity { +/// 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( _DeviceFlagsEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceFlagsEntity() 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( _DeviceFlagsEntity value) $default,){ +final _that = this; +switch (_that) { +case _DeviceFlagsEntity(): +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( _DeviceFlagsEntity value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceFlagsEntity() 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 isInOrOut, String? geofenceId, bool isBatteryLow, bool isDisconnect)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceFlagsEntity() when $default != null: +return $default(_that.isInOrOut,_that.geofenceId,_that.isBatteryLow,_that.isDisconnect);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 isInOrOut, String? geofenceId, bool isBatteryLow, bool isDisconnect) $default,) {final _that = this; +switch (_that) { +case _DeviceFlagsEntity(): +return $default(_that.isInOrOut,_that.geofenceId,_that.isBatteryLow,_that.isDisconnect);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 isInOrOut, String? geofenceId, bool isBatteryLow, bool isDisconnect)? $default,) {final _that = this; +switch (_that) { +case _DeviceFlagsEntity() when $default != null: +return $default(_that.isInOrOut,_that.geofenceId,_that.isBatteryLow,_that.isDisconnect);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DeviceFlagsEntity implements DeviceFlagsEntity { + const _DeviceFlagsEntity({required this.isInOrOut, this.geofenceId, required this.isBatteryLow, required this.isDisconnect}); + + +@override final String isInOrOut; +@override final String? geofenceId; +@override final bool isBatteryLow; +@override final bool isDisconnect; + +/// Create a copy of DeviceFlagsEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceFlagsEntityCopyWith<_DeviceFlagsEntity> get copyWith => __$DeviceFlagsEntityCopyWithImpl<_DeviceFlagsEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceFlagsEntity&&(identical(other.isInOrOut, isInOrOut) || other.isInOrOut == isInOrOut)&&(identical(other.geofenceId, geofenceId) || other.geofenceId == geofenceId)&&(identical(other.isBatteryLow, isBatteryLow) || other.isBatteryLow == isBatteryLow)&&(identical(other.isDisconnect, isDisconnect) || other.isDisconnect == isDisconnect)); +} + + +@override +int get hashCode => Object.hash(runtimeType,isInOrOut,geofenceId,isBatteryLow,isDisconnect); + +@override +String toString() { + return 'DeviceFlagsEntity(isInOrOut: $isInOrOut, geofenceId: $geofenceId, isBatteryLow: $isBatteryLow, isDisconnect: $isDisconnect)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceFlagsEntityCopyWith<$Res> implements $DeviceFlagsEntityCopyWith<$Res> { + factory _$DeviceFlagsEntityCopyWith(_DeviceFlagsEntity value, $Res Function(_DeviceFlagsEntity) _then) = __$DeviceFlagsEntityCopyWithImpl; +@override @useResult +$Res call({ + String isInOrOut, String? geofenceId, bool isBatteryLow, bool isDisconnect +}); + + + + +} +/// @nodoc +class __$DeviceFlagsEntityCopyWithImpl<$Res> + implements _$DeviceFlagsEntityCopyWith<$Res> { + __$DeviceFlagsEntityCopyWithImpl(this._self, this._then); + + final _DeviceFlagsEntity _self; + final $Res Function(_DeviceFlagsEntity) _then; + +/// Create a copy of DeviceFlagsEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? isInOrOut = null,Object? geofenceId = freezed,Object? isBatteryLow = null,Object? isDisconnect = null,}) { + return _then(_DeviceFlagsEntity( +isInOrOut: null == isInOrOut ? _self.isInOrOut : isInOrOut // ignore: cast_nullable_to_non_nullable +as String,geofenceId: freezed == geofenceId ? _self.geofenceId : geofenceId // ignore: cast_nullable_to_non_nullable +as String?,isBatteryLow: null == isBatteryLow ? _self.isBatteryLow : isBatteryLow // ignore: cast_nullable_to_non_nullable +as bool,isDisconnect: null == isDisconnect ? _self.isDisconnect : isDisconnect // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + + +} + +/// @nodoc +mixin _$DevicePaymentOptionsEntity { + + int? get nextPayDate; bool get usePayment; String get typeSubscription; bool get hasSubscription; bool get hasToPay; +/// Create a copy of DevicePaymentOptionsEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DevicePaymentOptionsEntityCopyWith get copyWith => _$DevicePaymentOptionsEntityCopyWithImpl(this as DevicePaymentOptionsEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DevicePaymentOptionsEntity&&(identical(other.nextPayDate, nextPayDate) || other.nextPayDate == nextPayDate)&&(identical(other.usePayment, usePayment) || other.usePayment == usePayment)&&(identical(other.typeSubscription, typeSubscription) || other.typeSubscription == typeSubscription)&&(identical(other.hasSubscription, hasSubscription) || other.hasSubscription == hasSubscription)&&(identical(other.hasToPay, hasToPay) || other.hasToPay == hasToPay)); +} + + +@override +int get hashCode => Object.hash(runtimeType,nextPayDate,usePayment,typeSubscription,hasSubscription,hasToPay); + +@override +String toString() { + return 'DevicePaymentOptionsEntity(nextPayDate: $nextPayDate, usePayment: $usePayment, typeSubscription: $typeSubscription, hasSubscription: $hasSubscription, hasToPay: $hasToPay)'; +} + + +} + +/// @nodoc +abstract mixin class $DevicePaymentOptionsEntityCopyWith<$Res> { + factory $DevicePaymentOptionsEntityCopyWith(DevicePaymentOptionsEntity value, $Res Function(DevicePaymentOptionsEntity) _then) = _$DevicePaymentOptionsEntityCopyWithImpl; +@useResult +$Res call({ + int? nextPayDate, bool usePayment, String typeSubscription, bool hasSubscription, bool hasToPay +}); + + + + +} +/// @nodoc +class _$DevicePaymentOptionsEntityCopyWithImpl<$Res> + implements $DevicePaymentOptionsEntityCopyWith<$Res> { + _$DevicePaymentOptionsEntityCopyWithImpl(this._self, this._then); + + final DevicePaymentOptionsEntity _self; + final $Res Function(DevicePaymentOptionsEntity) _then; + +/// Create a copy of DevicePaymentOptionsEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? nextPayDate = freezed,Object? usePayment = null,Object? typeSubscription = null,Object? hasSubscription = null,Object? hasToPay = null,}) { + return _then(_self.copyWith( +nextPayDate: freezed == nextPayDate ? _self.nextPayDate : nextPayDate // ignore: cast_nullable_to_non_nullable +as int?,usePayment: null == usePayment ? _self.usePayment : usePayment // ignore: cast_nullable_to_non_nullable +as bool,typeSubscription: null == typeSubscription ? _self.typeSubscription : typeSubscription // ignore: cast_nullable_to_non_nullable +as String,hasSubscription: null == hasSubscription ? _self.hasSubscription : hasSubscription // ignore: cast_nullable_to_non_nullable +as bool,hasToPay: null == hasToPay ? _self.hasToPay : hasToPay // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DevicePaymentOptionsEntity]. +extension DevicePaymentOptionsEntityPatterns on DevicePaymentOptionsEntity { +/// 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( _DevicePaymentOptionsEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DevicePaymentOptionsEntity() 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( _DevicePaymentOptionsEntity value) $default,){ +final _that = this; +switch (_that) { +case _DevicePaymentOptionsEntity(): +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( _DevicePaymentOptionsEntity value)? $default,){ +final _that = this; +switch (_that) { +case _DevicePaymentOptionsEntity() 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( int? nextPayDate, bool usePayment, String typeSubscription, bool hasSubscription, bool hasToPay)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DevicePaymentOptionsEntity() when $default != null: +return $default(_that.nextPayDate,_that.usePayment,_that.typeSubscription,_that.hasSubscription,_that.hasToPay);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( int? nextPayDate, bool usePayment, String typeSubscription, bool hasSubscription, bool hasToPay) $default,) {final _that = this; +switch (_that) { +case _DevicePaymentOptionsEntity(): +return $default(_that.nextPayDate,_that.usePayment,_that.typeSubscription,_that.hasSubscription,_that.hasToPay);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( int? nextPayDate, bool usePayment, String typeSubscription, bool hasSubscription, bool hasToPay)? $default,) {final _that = this; +switch (_that) { +case _DevicePaymentOptionsEntity() when $default != null: +return $default(_that.nextPayDate,_that.usePayment,_that.typeSubscription,_that.hasSubscription,_that.hasToPay);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DevicePaymentOptionsEntity implements DevicePaymentOptionsEntity { + const _DevicePaymentOptionsEntity({this.nextPayDate, required this.usePayment, required this.typeSubscription, required this.hasSubscription, required this.hasToPay}); + + +@override final int? nextPayDate; +@override final bool usePayment; +@override final String typeSubscription; +@override final bool hasSubscription; +@override final bool hasToPay; + +/// Create a copy of DevicePaymentOptionsEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DevicePaymentOptionsEntityCopyWith<_DevicePaymentOptionsEntity> get copyWith => __$DevicePaymentOptionsEntityCopyWithImpl<_DevicePaymentOptionsEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DevicePaymentOptionsEntity&&(identical(other.nextPayDate, nextPayDate) || other.nextPayDate == nextPayDate)&&(identical(other.usePayment, usePayment) || other.usePayment == usePayment)&&(identical(other.typeSubscription, typeSubscription) || other.typeSubscription == typeSubscription)&&(identical(other.hasSubscription, hasSubscription) || other.hasSubscription == hasSubscription)&&(identical(other.hasToPay, hasToPay) || other.hasToPay == hasToPay)); +} + + +@override +int get hashCode => Object.hash(runtimeType,nextPayDate,usePayment,typeSubscription,hasSubscription,hasToPay); + +@override +String toString() { + return 'DevicePaymentOptionsEntity(nextPayDate: $nextPayDate, usePayment: $usePayment, typeSubscription: $typeSubscription, hasSubscription: $hasSubscription, hasToPay: $hasToPay)'; +} + + +} + +/// @nodoc +abstract mixin class _$DevicePaymentOptionsEntityCopyWith<$Res> implements $DevicePaymentOptionsEntityCopyWith<$Res> { + factory _$DevicePaymentOptionsEntityCopyWith(_DevicePaymentOptionsEntity value, $Res Function(_DevicePaymentOptionsEntity) _then) = __$DevicePaymentOptionsEntityCopyWithImpl; +@override @useResult +$Res call({ + int? nextPayDate, bool usePayment, String typeSubscription, bool hasSubscription, bool hasToPay +}); + + + + +} +/// @nodoc +class __$DevicePaymentOptionsEntityCopyWithImpl<$Res> + implements _$DevicePaymentOptionsEntityCopyWith<$Res> { + __$DevicePaymentOptionsEntityCopyWithImpl(this._self, this._then); + + final _DevicePaymentOptionsEntity _self; + final $Res Function(_DevicePaymentOptionsEntity) _then; + +/// Create a copy of DevicePaymentOptionsEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? nextPayDate = freezed,Object? usePayment = null,Object? typeSubscription = null,Object? hasSubscription = null,Object? hasToPay = null,}) { + return _then(_DevicePaymentOptionsEntity( +nextPayDate: freezed == nextPayDate ? _self.nextPayDate : nextPayDate // ignore: cast_nullable_to_non_nullable +as int?,usePayment: null == usePayment ? _self.usePayment : usePayment // ignore: cast_nullable_to_non_nullable +as bool,typeSubscription: null == typeSubscription ? _self.typeSubscription : typeSubscription // ignore: cast_nullable_to_non_nullable +as String,hasSubscription: null == hasSubscription ? _self.hasSubscription : hasSubscription // ignore: cast_nullable_to_non_nullable +as bool,hasToPay: null == hasToPay ? _self.hasToPay : hasToPay // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + + +} + +/// @nodoc +mixin _$DeviceSettingsEntity { + + int get frequency; int get frequencyHeartRate; int get timezone; bool get pedometer; String get language; List get alerts; +/// Create a copy of DeviceSettingsEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceSettingsEntityCopyWith get copyWith => _$DeviceSettingsEntityCopyWithImpl(this as DeviceSettingsEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceSettingsEntity&&(identical(other.frequency, frequency) || other.frequency == frequency)&&(identical(other.frequencyHeartRate, frequencyHeartRate) || other.frequencyHeartRate == frequencyHeartRate)&&(identical(other.timezone, timezone) || other.timezone == timezone)&&(identical(other.pedometer, pedometer) || other.pedometer == pedometer)&&(identical(other.language, language) || other.language == language)&&const DeepCollectionEquality().equals(other.alerts, alerts)); +} + + +@override +int get hashCode => Object.hash(runtimeType,frequency,frequencyHeartRate,timezone,pedometer,language,const DeepCollectionEquality().hash(alerts)); + +@override +String toString() { + return 'DeviceSettingsEntity(frequency: $frequency, frequencyHeartRate: $frequencyHeartRate, timezone: $timezone, pedometer: $pedometer, language: $language, alerts: $alerts)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceSettingsEntityCopyWith<$Res> { + factory $DeviceSettingsEntityCopyWith(DeviceSettingsEntity value, $Res Function(DeviceSettingsEntity) _then) = _$DeviceSettingsEntityCopyWithImpl; +@useResult +$Res call({ + int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts +}); + + + + +} +/// @nodoc +class _$DeviceSettingsEntityCopyWithImpl<$Res> + implements $DeviceSettingsEntityCopyWith<$Res> { + _$DeviceSettingsEntityCopyWithImpl(this._self, this._then); + + final DeviceSettingsEntity _self; + final $Res Function(DeviceSettingsEntity) _then; + +/// Create a copy of DeviceSettingsEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? frequency = null,Object? frequencyHeartRate = null,Object? timezone = null,Object? pedometer = null,Object? language = null,Object? alerts = null,}) { + return _then(_self.copyWith( +frequency: null == frequency ? _self.frequency : frequency // ignore: cast_nullable_to_non_nullable +as int,frequencyHeartRate: null == frequencyHeartRate ? _self.frequencyHeartRate : frequencyHeartRate // ignore: cast_nullable_to_non_nullable +as int,timezone: null == timezone ? _self.timezone : timezone // ignore: cast_nullable_to_non_nullable +as int,pedometer: null == pedometer ? _self.pedometer : pedometer // ignore: cast_nullable_to_non_nullable +as bool,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String,alerts: null == alerts ? _self.alerts : alerts // ignore: cast_nullable_to_non_nullable +as List, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceSettingsEntity]. +extension DeviceSettingsEntityPatterns on DeviceSettingsEntity { +/// 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( _DeviceSettingsEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceSettingsEntity() 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( _DeviceSettingsEntity value) $default,){ +final _that = this; +switch (_that) { +case _DeviceSettingsEntity(): +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( _DeviceSettingsEntity value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceSettingsEntity() 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( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceSettingsEntity() when $default != null: +return $default(_that.frequency,_that.frequencyHeartRate,_that.timezone,_that.pedometer,_that.language,_that.alerts);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( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts) $default,) {final _that = this; +switch (_that) { +case _DeviceSettingsEntity(): +return $default(_that.frequency,_that.frequencyHeartRate,_that.timezone,_that.pedometer,_that.language,_that.alerts);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( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts)? $default,) {final _that = this; +switch (_that) { +case _DeviceSettingsEntity() when $default != null: +return $default(_that.frequency,_that.frequencyHeartRate,_that.timezone,_that.pedometer,_that.language,_that.alerts);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DeviceSettingsEntity implements DeviceSettingsEntity { + const _DeviceSettingsEntity({required this.frequency, required this.frequencyHeartRate, required this.timezone, required this.pedometer, required this.language, required final List alerts}): _alerts = alerts; + + +@override final int frequency; +@override final int frequencyHeartRate; +@override final int timezone; +@override final bool pedometer; +@override final String language; + final List _alerts; +@override List get alerts { + if (_alerts is EqualUnmodifiableListView) return _alerts; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_alerts); +} + + +/// Create a copy of DeviceSettingsEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceSettingsEntityCopyWith<_DeviceSettingsEntity> get copyWith => __$DeviceSettingsEntityCopyWithImpl<_DeviceSettingsEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceSettingsEntity&&(identical(other.frequency, frequency) || other.frequency == frequency)&&(identical(other.frequencyHeartRate, frequencyHeartRate) || other.frequencyHeartRate == frequencyHeartRate)&&(identical(other.timezone, timezone) || other.timezone == timezone)&&(identical(other.pedometer, pedometer) || other.pedometer == pedometer)&&(identical(other.language, language) || other.language == language)&&const DeepCollectionEquality().equals(other._alerts, _alerts)); +} + + +@override +int get hashCode => Object.hash(runtimeType,frequency,frequencyHeartRate,timezone,pedometer,language,const DeepCollectionEquality().hash(_alerts)); + +@override +String toString() { + return 'DeviceSettingsEntity(frequency: $frequency, frequencyHeartRate: $frequencyHeartRate, timezone: $timezone, pedometer: $pedometer, language: $language, alerts: $alerts)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceSettingsEntityCopyWith<$Res> implements $DeviceSettingsEntityCopyWith<$Res> { + factory _$DeviceSettingsEntityCopyWith(_DeviceSettingsEntity value, $Res Function(_DeviceSettingsEntity) _then) = __$DeviceSettingsEntityCopyWithImpl; +@override @useResult +$Res call({ + int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts +}); + + + + +} +/// @nodoc +class __$DeviceSettingsEntityCopyWithImpl<$Res> + implements _$DeviceSettingsEntityCopyWith<$Res> { + __$DeviceSettingsEntityCopyWithImpl(this._self, this._then); + + final _DeviceSettingsEntity _self; + final $Res Function(_DeviceSettingsEntity) _then; + +/// Create a copy of DeviceSettingsEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? frequency = null,Object? frequencyHeartRate = null,Object? timezone = null,Object? pedometer = null,Object? language = null,Object? alerts = null,}) { + return _then(_DeviceSettingsEntity( +frequency: null == frequency ? _self.frequency : frequency // ignore: cast_nullable_to_non_nullable +as int,frequencyHeartRate: null == frequencyHeartRate ? _self.frequencyHeartRate : frequencyHeartRate // ignore: cast_nullable_to_non_nullable +as int,timezone: null == timezone ? _self.timezone : timezone // ignore: cast_nullable_to_non_nullable +as int,pedometer: null == pedometer ? _self.pedometer : pedometer // ignore: cast_nullable_to_non_nullable +as bool,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String,alerts: null == alerts ? _self._alerts : alerts // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + +/// @nodoc +mixin _$DeviceCapabilitiesEntity { + + bool get heartbeats; bool get bloodPressure; DeviceCapabilitiesAlertEntity get alerts; bool get podometer; DeviceCapabilitiesContactsEntity get contacts; DeviceCapabilitiesCommandsEntity get commands; DeviceCapabilitiesSettingsEntity get settings; +/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilitiesEntityCopyWith get copyWith => _$DeviceCapabilitiesEntityCopyWithImpl(this as DeviceCapabilitiesEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilitiesEntity&&(identical(other.heartbeats, heartbeats) || other.heartbeats == heartbeats)&&(identical(other.bloodPressure, bloodPressure) || other.bloodPressure == bloodPressure)&&(identical(other.alerts, alerts) || other.alerts == alerts)&&(identical(other.podometer, podometer) || other.podometer == podometer)&&(identical(other.contacts, contacts) || other.contacts == contacts)&&(identical(other.commands, commands) || other.commands == commands)&&(identical(other.settings, settings) || other.settings == settings)); +} + + +@override +int get hashCode => Object.hash(runtimeType,heartbeats,bloodPressure,alerts,podometer,contacts,commands,settings); + +@override +String toString() { + return 'DeviceCapabilitiesEntity(heartbeats: $heartbeats, bloodPressure: $bloodPressure, alerts: $alerts, podometer: $podometer, contacts: $contacts, commands: $commands, settings: $settings)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilitiesEntityCopyWith<$Res> { + factory $DeviceCapabilitiesEntityCopyWith(DeviceCapabilitiesEntity value, $Res Function(DeviceCapabilitiesEntity) _then) = _$DeviceCapabilitiesEntityCopyWithImpl; +@useResult +$Res call({ + bool heartbeats, bool bloodPressure, DeviceCapabilitiesAlertEntity alerts, bool podometer, DeviceCapabilitiesContactsEntity contacts, DeviceCapabilitiesCommandsEntity commands, DeviceCapabilitiesSettingsEntity settings +}); + + +$DeviceCapabilitiesAlertEntityCopyWith<$Res> get alerts;$DeviceCapabilitiesContactsEntityCopyWith<$Res> get contacts;$DeviceCapabilitiesCommandsEntityCopyWith<$Res> get commands;$DeviceCapabilitiesSettingsEntityCopyWith<$Res> get settings; + +} +/// @nodoc +class _$DeviceCapabilitiesEntityCopyWithImpl<$Res> + implements $DeviceCapabilitiesEntityCopyWith<$Res> { + _$DeviceCapabilitiesEntityCopyWithImpl(this._self, this._then); + + final DeviceCapabilitiesEntity _self; + final $Res Function(DeviceCapabilitiesEntity) _then; + +/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? heartbeats = null,Object? bloodPressure = null,Object? alerts = null,Object? podometer = null,Object? contacts = null,Object? commands = null,Object? settings = null,}) { + return _then(_self.copyWith( +heartbeats: null == heartbeats ? _self.heartbeats : heartbeats // ignore: cast_nullable_to_non_nullable +as bool,bloodPressure: null == bloodPressure ? _self.bloodPressure : bloodPressure // ignore: cast_nullable_to_non_nullable +as bool,alerts: null == alerts ? _self.alerts : alerts // ignore: cast_nullable_to_non_nullable +as DeviceCapabilitiesAlertEntity,podometer: null == podometer ? _self.podometer : podometer // ignore: cast_nullable_to_non_nullable +as bool,contacts: null == contacts ? _self.contacts : contacts // ignore: cast_nullable_to_non_nullable +as DeviceCapabilitiesContactsEntity,commands: null == commands ? _self.commands : commands // ignore: cast_nullable_to_non_nullable +as DeviceCapabilitiesCommandsEntity,settings: null == settings ? _self.settings : settings // ignore: cast_nullable_to_non_nullable +as DeviceCapabilitiesSettingsEntity, + )); +} +/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilitiesAlertEntityCopyWith<$Res> get alerts { + + return $DeviceCapabilitiesAlertEntityCopyWith<$Res>(_self.alerts, (value) { + return _then(_self.copyWith(alerts: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilitiesContactsEntityCopyWith<$Res> get contacts { + + return $DeviceCapabilitiesContactsEntityCopyWith<$Res>(_self.contacts, (value) { + return _then(_self.copyWith(contacts: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilitiesCommandsEntityCopyWith<$Res> get commands { + + return $DeviceCapabilitiesCommandsEntityCopyWith<$Res>(_self.commands, (value) { + return _then(_self.copyWith(commands: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilitiesSettingsEntityCopyWith<$Res> get settings { + + return $DeviceCapabilitiesSettingsEntityCopyWith<$Res>(_self.settings, (value) { + return _then(_self.copyWith(settings: value)); + }); +} +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilitiesEntity]. +extension DeviceCapabilitiesEntityPatterns on DeviceCapabilitiesEntity { +/// 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( _DeviceCapabilitiesEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesEntity() 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( _DeviceCapabilitiesEntity value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesEntity(): +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( _DeviceCapabilitiesEntity value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesEntity() 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( bool heartbeats, bool bloodPressure, DeviceCapabilitiesAlertEntity alerts, bool podometer, DeviceCapabilitiesContactsEntity contacts, DeviceCapabilitiesCommandsEntity commands, DeviceCapabilitiesSettingsEntity settings)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesEntity() when $default != null: +return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podometer,_that.contacts,_that.commands,_that.settings);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( bool heartbeats, bool bloodPressure, DeviceCapabilitiesAlertEntity alerts, bool podometer, DeviceCapabilitiesContactsEntity contacts, DeviceCapabilitiesCommandsEntity commands, DeviceCapabilitiesSettingsEntity settings) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesEntity(): +return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podometer,_that.contacts,_that.commands,_that.settings);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( bool heartbeats, bool bloodPressure, DeviceCapabilitiesAlertEntity alerts, bool podometer, DeviceCapabilitiesContactsEntity contacts, DeviceCapabilitiesCommandsEntity commands, DeviceCapabilitiesSettingsEntity settings)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesEntity() when $default != null: +return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podometer,_that.contacts,_that.commands,_that.settings);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DeviceCapabilitiesEntity implements DeviceCapabilitiesEntity { + const _DeviceCapabilitiesEntity({required this.heartbeats, required this.bloodPressure, required this.alerts, required this.podometer, required this.contacts, required this.commands, required this.settings}); + + +@override final bool heartbeats; +@override final bool bloodPressure; +@override final DeviceCapabilitiesAlertEntity alerts; +@override final bool podometer; +@override final DeviceCapabilitiesContactsEntity contacts; +@override final DeviceCapabilitiesCommandsEntity commands; +@override final DeviceCapabilitiesSettingsEntity settings; + +/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilitiesEntityCopyWith<_DeviceCapabilitiesEntity> get copyWith => __$DeviceCapabilitiesEntityCopyWithImpl<_DeviceCapabilitiesEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilitiesEntity&&(identical(other.heartbeats, heartbeats) || other.heartbeats == heartbeats)&&(identical(other.bloodPressure, bloodPressure) || other.bloodPressure == bloodPressure)&&(identical(other.alerts, alerts) || other.alerts == alerts)&&(identical(other.podometer, podometer) || other.podometer == podometer)&&(identical(other.contacts, contacts) || other.contacts == contacts)&&(identical(other.commands, commands) || other.commands == commands)&&(identical(other.settings, settings) || other.settings == settings)); +} + + +@override +int get hashCode => Object.hash(runtimeType,heartbeats,bloodPressure,alerts,podometer,contacts,commands,settings); + +@override +String toString() { + return 'DeviceCapabilitiesEntity(heartbeats: $heartbeats, bloodPressure: $bloodPressure, alerts: $alerts, podometer: $podometer, contacts: $contacts, commands: $commands, settings: $settings)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilitiesEntityCopyWith<$Res> implements $DeviceCapabilitiesEntityCopyWith<$Res> { + factory _$DeviceCapabilitiesEntityCopyWith(_DeviceCapabilitiesEntity value, $Res Function(_DeviceCapabilitiesEntity) _then) = __$DeviceCapabilitiesEntityCopyWithImpl; +@override @useResult +$Res call({ + bool heartbeats, bool bloodPressure, DeviceCapabilitiesAlertEntity alerts, bool podometer, DeviceCapabilitiesContactsEntity contacts, DeviceCapabilitiesCommandsEntity commands, DeviceCapabilitiesSettingsEntity settings +}); + + +@override $DeviceCapabilitiesAlertEntityCopyWith<$Res> get alerts;@override $DeviceCapabilitiesContactsEntityCopyWith<$Res> get contacts;@override $DeviceCapabilitiesCommandsEntityCopyWith<$Res> get commands;@override $DeviceCapabilitiesSettingsEntityCopyWith<$Res> get settings; + +} +/// @nodoc +class __$DeviceCapabilitiesEntityCopyWithImpl<$Res> + implements _$DeviceCapabilitiesEntityCopyWith<$Res> { + __$DeviceCapabilitiesEntityCopyWithImpl(this._self, this._then); + + final _DeviceCapabilitiesEntity _self; + final $Res Function(_DeviceCapabilitiesEntity) _then; + +/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? heartbeats = null,Object? bloodPressure = null,Object? alerts = null,Object? podometer = null,Object? contacts = null,Object? commands = null,Object? settings = null,}) { + return _then(_DeviceCapabilitiesEntity( +heartbeats: null == heartbeats ? _self.heartbeats : heartbeats // ignore: cast_nullable_to_non_nullable +as bool,bloodPressure: null == bloodPressure ? _self.bloodPressure : bloodPressure // ignore: cast_nullable_to_non_nullable +as bool,alerts: null == alerts ? _self.alerts : alerts // ignore: cast_nullable_to_non_nullable +as DeviceCapabilitiesAlertEntity,podometer: null == podometer ? _self.podometer : podometer // ignore: cast_nullable_to_non_nullable +as bool,contacts: null == contacts ? _self.contacts : contacts // ignore: cast_nullable_to_non_nullable +as DeviceCapabilitiesContactsEntity,commands: null == commands ? _self.commands : commands // ignore: cast_nullable_to_non_nullable +as DeviceCapabilitiesCommandsEntity,settings: null == settings ? _self.settings : settings // ignore: cast_nullable_to_non_nullable +as DeviceCapabilitiesSettingsEntity, + )); +} + +/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilitiesAlertEntityCopyWith<$Res> get alerts { + + return $DeviceCapabilitiesAlertEntityCopyWith<$Res>(_self.alerts, (value) { + return _then(_self.copyWith(alerts: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilitiesContactsEntityCopyWith<$Res> get contacts { + + return $DeviceCapabilitiesContactsEntityCopyWith<$Res>(_self.contacts, (value) { + return _then(_self.copyWith(contacts: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilitiesCommandsEntityCopyWith<$Res> get commands { + + return $DeviceCapabilitiesCommandsEntityCopyWith<$Res>(_self.commands, (value) { + return _then(_self.copyWith(commands: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilitiesSettingsEntityCopyWith<$Res> get settings { + + return $DeviceCapabilitiesSettingsEntityCopyWith<$Res>(_self.settings, (value) { + return _then(_self.copyWith(settings: value)); + }); +} +} + +/// @nodoc +mixin _$DeviceCapabilitiesAlertEntity { + + bool get enabled; List get types; +/// Create a copy of DeviceCapabilitiesAlertEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilitiesAlertEntityCopyWith get copyWith => _$DeviceCapabilitiesAlertEntityCopyWithImpl(this as DeviceCapabilitiesAlertEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilitiesAlertEntity&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other.types, types)); +} + + +@override +int get hashCode => Object.hash(runtimeType,enabled,const DeepCollectionEquality().hash(types)); + +@override +String toString() { + return 'DeviceCapabilitiesAlertEntity(enabled: $enabled, types: $types)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilitiesAlertEntityCopyWith<$Res> { + factory $DeviceCapabilitiesAlertEntityCopyWith(DeviceCapabilitiesAlertEntity value, $Res Function(DeviceCapabilitiesAlertEntity) _then) = _$DeviceCapabilitiesAlertEntityCopyWithImpl; +@useResult +$Res call({ + bool enabled, List types +}); + + + + +} +/// @nodoc +class _$DeviceCapabilitiesAlertEntityCopyWithImpl<$Res> + implements $DeviceCapabilitiesAlertEntityCopyWith<$Res> { + _$DeviceCapabilitiesAlertEntityCopyWithImpl(this._self, this._then); + + final DeviceCapabilitiesAlertEntity _self; + final $Res Function(DeviceCapabilitiesAlertEntity) _then; + +/// Create a copy of DeviceCapabilitiesAlertEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? enabled = null,Object? types = null,}) { + return _then(_self.copyWith( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,types: null == types ? _self.types : types // ignore: cast_nullable_to_non_nullable +as List, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilitiesAlertEntity]. +extension DeviceCapabilitiesAlertEntityPatterns on DeviceCapabilitiesAlertEntity { +/// 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( _DeviceCapabilitiesAlertEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesAlertEntity() 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( _DeviceCapabilitiesAlertEntity value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesAlertEntity(): +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( _DeviceCapabilitiesAlertEntity value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesAlertEntity() 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( bool enabled, List types)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesAlertEntity() when $default != null: +return $default(_that.enabled,_that.types);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( bool enabled, List types) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesAlertEntity(): +return $default(_that.enabled,_that.types);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( bool enabled, List types)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesAlertEntity() when $default != null: +return $default(_that.enabled,_that.types);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DeviceCapabilitiesAlertEntity implements DeviceCapabilitiesAlertEntity { + const _DeviceCapabilitiesAlertEntity({required this.enabled, required final List types}): _types = types; + + +@override final bool enabled; + final List _types; +@override List get types { + if (_types is EqualUnmodifiableListView) return _types; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_types); +} + + +/// Create a copy of DeviceCapabilitiesAlertEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilitiesAlertEntityCopyWith<_DeviceCapabilitiesAlertEntity> get copyWith => __$DeviceCapabilitiesAlertEntityCopyWithImpl<_DeviceCapabilitiesAlertEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilitiesAlertEntity&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other._types, _types)); +} + + +@override +int get hashCode => Object.hash(runtimeType,enabled,const DeepCollectionEquality().hash(_types)); + +@override +String toString() { + return 'DeviceCapabilitiesAlertEntity(enabled: $enabled, types: $types)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilitiesAlertEntityCopyWith<$Res> implements $DeviceCapabilitiesAlertEntityCopyWith<$Res> { + factory _$DeviceCapabilitiesAlertEntityCopyWith(_DeviceCapabilitiesAlertEntity value, $Res Function(_DeviceCapabilitiesAlertEntity) _then) = __$DeviceCapabilitiesAlertEntityCopyWithImpl; +@override @useResult +$Res call({ + bool enabled, List types +}); + + + + +} +/// @nodoc +class __$DeviceCapabilitiesAlertEntityCopyWithImpl<$Res> + implements _$DeviceCapabilitiesAlertEntityCopyWith<$Res> { + __$DeviceCapabilitiesAlertEntityCopyWithImpl(this._self, this._then); + + final _DeviceCapabilitiesAlertEntity _self; + final $Res Function(_DeviceCapabilitiesAlertEntity) _then; + +/// Create a copy of DeviceCapabilitiesAlertEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? enabled = null,Object? types = null,}) { + return _then(_DeviceCapabilitiesAlertEntity( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,types: null == types ? _self._types : types // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + +/// @nodoc +mixin _$DeviceCapabilitiesContactsEntity { + + bool get enabled; List get types; +/// Create a copy of DeviceCapabilitiesContactsEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilitiesContactsEntityCopyWith get copyWith => _$DeviceCapabilitiesContactsEntityCopyWithImpl(this as DeviceCapabilitiesContactsEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilitiesContactsEntity&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other.types, types)); +} + + +@override +int get hashCode => Object.hash(runtimeType,enabled,const DeepCollectionEquality().hash(types)); + +@override +String toString() { + return 'DeviceCapabilitiesContactsEntity(enabled: $enabled, types: $types)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilitiesContactsEntityCopyWith<$Res> { + factory $DeviceCapabilitiesContactsEntityCopyWith(DeviceCapabilitiesContactsEntity value, $Res Function(DeviceCapabilitiesContactsEntity) _then) = _$DeviceCapabilitiesContactsEntityCopyWithImpl; +@useResult +$Res call({ + bool enabled, List types +}); + + + + +} +/// @nodoc +class _$DeviceCapabilitiesContactsEntityCopyWithImpl<$Res> + implements $DeviceCapabilitiesContactsEntityCopyWith<$Res> { + _$DeviceCapabilitiesContactsEntityCopyWithImpl(this._self, this._then); + + final DeviceCapabilitiesContactsEntity _self; + final $Res Function(DeviceCapabilitiesContactsEntity) _then; + +/// Create a copy of DeviceCapabilitiesContactsEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? enabled = null,Object? types = null,}) { + return _then(_self.copyWith( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,types: null == types ? _self.types : types // ignore: cast_nullable_to_non_nullable +as List, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilitiesContactsEntity]. +extension DeviceCapabilitiesContactsEntityPatterns on DeviceCapabilitiesContactsEntity { +/// 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( _DeviceCapabilitiesContactsEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesContactsEntity() 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( _DeviceCapabilitiesContactsEntity value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesContactsEntity(): +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( _DeviceCapabilitiesContactsEntity value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesContactsEntity() 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( bool enabled, List types)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesContactsEntity() when $default != null: +return $default(_that.enabled,_that.types);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( bool enabled, List types) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesContactsEntity(): +return $default(_that.enabled,_that.types);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( bool enabled, List types)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesContactsEntity() when $default != null: +return $default(_that.enabled,_that.types);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DeviceCapabilitiesContactsEntity implements DeviceCapabilitiesContactsEntity { + const _DeviceCapabilitiesContactsEntity({required this.enabled, required final List types}): _types = types; + + +@override final bool enabled; + final List _types; +@override List get types { + if (_types is EqualUnmodifiableListView) return _types; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_types); +} + + +/// Create a copy of DeviceCapabilitiesContactsEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilitiesContactsEntityCopyWith<_DeviceCapabilitiesContactsEntity> get copyWith => __$DeviceCapabilitiesContactsEntityCopyWithImpl<_DeviceCapabilitiesContactsEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilitiesContactsEntity&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other._types, _types)); +} + + +@override +int get hashCode => Object.hash(runtimeType,enabled,const DeepCollectionEquality().hash(_types)); + +@override +String toString() { + return 'DeviceCapabilitiesContactsEntity(enabled: $enabled, types: $types)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilitiesContactsEntityCopyWith<$Res> implements $DeviceCapabilitiesContactsEntityCopyWith<$Res> { + factory _$DeviceCapabilitiesContactsEntityCopyWith(_DeviceCapabilitiesContactsEntity value, $Res Function(_DeviceCapabilitiesContactsEntity) _then) = __$DeviceCapabilitiesContactsEntityCopyWithImpl; +@override @useResult +$Res call({ + bool enabled, List types +}); + + + + +} +/// @nodoc +class __$DeviceCapabilitiesContactsEntityCopyWithImpl<$Res> + implements _$DeviceCapabilitiesContactsEntityCopyWith<$Res> { + __$DeviceCapabilitiesContactsEntityCopyWithImpl(this._self, this._then); + + final _DeviceCapabilitiesContactsEntity _self; + final $Res Function(_DeviceCapabilitiesContactsEntity) _then; + +/// Create a copy of DeviceCapabilitiesContactsEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? enabled = null,Object? types = null,}) { + return _then(_DeviceCapabilitiesContactsEntity( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,types: null == types ? _self._types : types // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + +/// @nodoc +mixin _$DeviceCapabilitiesContactTypeEntity { + + String get type; int get amount; +/// Create a copy of DeviceCapabilitiesContactTypeEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilitiesContactTypeEntityCopyWith get copyWith => _$DeviceCapabilitiesContactTypeEntityCopyWithImpl(this as DeviceCapabilitiesContactTypeEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilitiesContactTypeEntity&&(identical(other.type, type) || other.type == type)&&(identical(other.amount, amount) || other.amount == amount)); +} + + +@override +int get hashCode => Object.hash(runtimeType,type,amount); + +@override +String toString() { + return 'DeviceCapabilitiesContactTypeEntity(type: $type, amount: $amount)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilitiesContactTypeEntityCopyWith<$Res> { + factory $DeviceCapabilitiesContactTypeEntityCopyWith(DeviceCapabilitiesContactTypeEntity value, $Res Function(DeviceCapabilitiesContactTypeEntity) _then) = _$DeviceCapabilitiesContactTypeEntityCopyWithImpl; +@useResult +$Res call({ + String type, int amount +}); + + + + +} +/// @nodoc +class _$DeviceCapabilitiesContactTypeEntityCopyWithImpl<$Res> + implements $DeviceCapabilitiesContactTypeEntityCopyWith<$Res> { + _$DeviceCapabilitiesContactTypeEntityCopyWithImpl(this._self, this._then); + + final DeviceCapabilitiesContactTypeEntity _self; + final $Res Function(DeviceCapabilitiesContactTypeEntity) _then; + +/// Create a copy of DeviceCapabilitiesContactTypeEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? type = null,Object? amount = null,}) { + return _then(_self.copyWith( +type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as String,amount: null == amount ? _self.amount : amount // ignore: cast_nullable_to_non_nullable +as int, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilitiesContactTypeEntity]. +extension DeviceCapabilitiesContactTypeEntityPatterns on DeviceCapabilitiesContactTypeEntity { +/// 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( _DeviceCapabilitiesContactTypeEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesContactTypeEntity() 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( _DeviceCapabilitiesContactTypeEntity value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesContactTypeEntity(): +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( _DeviceCapabilitiesContactTypeEntity value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesContactTypeEntity() 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 type, int amount)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesContactTypeEntity() when $default != null: +return $default(_that.type,_that.amount);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 type, int amount) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesContactTypeEntity(): +return $default(_that.type,_that.amount);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 type, int amount)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesContactTypeEntity() when $default != null: +return $default(_that.type,_that.amount);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DeviceCapabilitiesContactTypeEntity implements DeviceCapabilitiesContactTypeEntity { + const _DeviceCapabilitiesContactTypeEntity({required this.type, required this.amount}); + + +@override final String type; +@override final int amount; + +/// Create a copy of DeviceCapabilitiesContactTypeEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilitiesContactTypeEntityCopyWith<_DeviceCapabilitiesContactTypeEntity> get copyWith => __$DeviceCapabilitiesContactTypeEntityCopyWithImpl<_DeviceCapabilitiesContactTypeEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilitiesContactTypeEntity&&(identical(other.type, type) || other.type == type)&&(identical(other.amount, amount) || other.amount == amount)); +} + + +@override +int get hashCode => Object.hash(runtimeType,type,amount); + +@override +String toString() { + return 'DeviceCapabilitiesContactTypeEntity(type: $type, amount: $amount)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilitiesContactTypeEntityCopyWith<$Res> implements $DeviceCapabilitiesContactTypeEntityCopyWith<$Res> { + factory _$DeviceCapabilitiesContactTypeEntityCopyWith(_DeviceCapabilitiesContactTypeEntity value, $Res Function(_DeviceCapabilitiesContactTypeEntity) _then) = __$DeviceCapabilitiesContactTypeEntityCopyWithImpl; +@override @useResult +$Res call({ + String type, int amount +}); + + + + +} +/// @nodoc +class __$DeviceCapabilitiesContactTypeEntityCopyWithImpl<$Res> + implements _$DeviceCapabilitiesContactTypeEntityCopyWith<$Res> { + __$DeviceCapabilitiesContactTypeEntityCopyWithImpl(this._self, this._then); + + final _DeviceCapabilitiesContactTypeEntity _self; + final $Res Function(_DeviceCapabilitiesContactTypeEntity) _then; + +/// Create a copy of DeviceCapabilitiesContactTypeEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? type = null,Object? amount = null,}) { + return _then(_DeviceCapabilitiesContactTypeEntity( +type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as String,amount: null == amount ? _self.amount : amount // ignore: cast_nullable_to_non_nullable +as int, + )); +} + + +} + +/// @nodoc +mixin _$DeviceCapabilitiesCommandsEntity { + + bool get enabled; List get types; +/// Create a copy of DeviceCapabilitiesCommandsEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilitiesCommandsEntityCopyWith get copyWith => _$DeviceCapabilitiesCommandsEntityCopyWithImpl(this as DeviceCapabilitiesCommandsEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilitiesCommandsEntity&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other.types, types)); +} + + +@override +int get hashCode => Object.hash(runtimeType,enabled,const DeepCollectionEquality().hash(types)); + +@override +String toString() { + return 'DeviceCapabilitiesCommandsEntity(enabled: $enabled, types: $types)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilitiesCommandsEntityCopyWith<$Res> { + factory $DeviceCapabilitiesCommandsEntityCopyWith(DeviceCapabilitiesCommandsEntity value, $Res Function(DeviceCapabilitiesCommandsEntity) _then) = _$DeviceCapabilitiesCommandsEntityCopyWithImpl; +@useResult +$Res call({ + bool enabled, List types +}); + + + + +} +/// @nodoc +class _$DeviceCapabilitiesCommandsEntityCopyWithImpl<$Res> + implements $DeviceCapabilitiesCommandsEntityCopyWith<$Res> { + _$DeviceCapabilitiesCommandsEntityCopyWithImpl(this._self, this._then); + + final DeviceCapabilitiesCommandsEntity _self; + final $Res Function(DeviceCapabilitiesCommandsEntity) _then; + +/// Create a copy of DeviceCapabilitiesCommandsEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? enabled = null,Object? types = null,}) { + return _then(_self.copyWith( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,types: null == types ? _self.types : types // ignore: cast_nullable_to_non_nullable +as List, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilitiesCommandsEntity]. +extension DeviceCapabilitiesCommandsEntityPatterns on DeviceCapabilitiesCommandsEntity { +/// 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( _DeviceCapabilitiesCommandsEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesCommandsEntity() 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( _DeviceCapabilitiesCommandsEntity value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesCommandsEntity(): +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( _DeviceCapabilitiesCommandsEntity value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesCommandsEntity() 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( bool enabled, List types)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesCommandsEntity() when $default != null: +return $default(_that.enabled,_that.types);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( bool enabled, List types) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesCommandsEntity(): +return $default(_that.enabled,_that.types);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( bool enabled, List types)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesCommandsEntity() when $default != null: +return $default(_that.enabled,_that.types);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DeviceCapabilitiesCommandsEntity implements DeviceCapabilitiesCommandsEntity { + const _DeviceCapabilitiesCommandsEntity({required this.enabled, required final List types}): _types = types; + + +@override final bool enabled; + final List _types; +@override List get types { + if (_types is EqualUnmodifiableListView) return _types; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_types); +} + + +/// Create a copy of DeviceCapabilitiesCommandsEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilitiesCommandsEntityCopyWith<_DeviceCapabilitiesCommandsEntity> get copyWith => __$DeviceCapabilitiesCommandsEntityCopyWithImpl<_DeviceCapabilitiesCommandsEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilitiesCommandsEntity&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other._types, _types)); +} + + +@override +int get hashCode => Object.hash(runtimeType,enabled,const DeepCollectionEquality().hash(_types)); + +@override +String toString() { + return 'DeviceCapabilitiesCommandsEntity(enabled: $enabled, types: $types)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilitiesCommandsEntityCopyWith<$Res> implements $DeviceCapabilitiesCommandsEntityCopyWith<$Res> { + factory _$DeviceCapabilitiesCommandsEntityCopyWith(_DeviceCapabilitiesCommandsEntity value, $Res Function(_DeviceCapabilitiesCommandsEntity) _then) = __$DeviceCapabilitiesCommandsEntityCopyWithImpl; +@override @useResult +$Res call({ + bool enabled, List types +}); + + + + +} +/// @nodoc +class __$DeviceCapabilitiesCommandsEntityCopyWithImpl<$Res> + implements _$DeviceCapabilitiesCommandsEntityCopyWith<$Res> { + __$DeviceCapabilitiesCommandsEntityCopyWithImpl(this._self, this._then); + + final _DeviceCapabilitiesCommandsEntity _self; + final $Res Function(_DeviceCapabilitiesCommandsEntity) _then; + +/// Create a copy of DeviceCapabilitiesCommandsEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? enabled = null,Object? types = null,}) { + return _then(_DeviceCapabilitiesCommandsEntity( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,types: null == types ? _self._types : types // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + +/// @nodoc +mixin _$DeviceCapabilitiesSettingsEntity { + + bool get locationFrequency; bool get timezone; bool get language; +/// Create a copy of DeviceCapabilitiesSettingsEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilitiesSettingsEntityCopyWith get copyWith => _$DeviceCapabilitiesSettingsEntityCopyWithImpl(this as DeviceCapabilitiesSettingsEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilitiesSettingsEntity&&(identical(other.locationFrequency, locationFrequency) || other.locationFrequency == locationFrequency)&&(identical(other.timezone, timezone) || other.timezone == timezone)&&(identical(other.language, language) || other.language == language)); +} + + +@override +int get hashCode => Object.hash(runtimeType,locationFrequency,timezone,language); + +@override +String toString() { + return 'DeviceCapabilitiesSettingsEntity(locationFrequency: $locationFrequency, timezone: $timezone, language: $language)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilitiesSettingsEntityCopyWith<$Res> { + factory $DeviceCapabilitiesSettingsEntityCopyWith(DeviceCapabilitiesSettingsEntity value, $Res Function(DeviceCapabilitiesSettingsEntity) _then) = _$DeviceCapabilitiesSettingsEntityCopyWithImpl; +@useResult +$Res call({ + bool locationFrequency, bool timezone, bool language +}); + + + + +} +/// @nodoc +class _$DeviceCapabilitiesSettingsEntityCopyWithImpl<$Res> + implements $DeviceCapabilitiesSettingsEntityCopyWith<$Res> { + _$DeviceCapabilitiesSettingsEntityCopyWithImpl(this._self, this._then); + + final DeviceCapabilitiesSettingsEntity _self; + final $Res Function(DeviceCapabilitiesSettingsEntity) _then; + +/// Create a copy of DeviceCapabilitiesSettingsEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? locationFrequency = null,Object? timezone = null,Object? language = null,}) { + return _then(_self.copyWith( +locationFrequency: null == locationFrequency ? _self.locationFrequency : locationFrequency // ignore: cast_nullable_to_non_nullable +as bool,timezone: null == timezone ? _self.timezone : timezone // ignore: cast_nullable_to_non_nullable +as bool,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilitiesSettingsEntity]. +extension DeviceCapabilitiesSettingsEntityPatterns on DeviceCapabilitiesSettingsEntity { +/// 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( _DeviceCapabilitiesSettingsEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesSettingsEntity() 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( _DeviceCapabilitiesSettingsEntity value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesSettingsEntity(): +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( _DeviceCapabilitiesSettingsEntity value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesSettingsEntity() 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( bool locationFrequency, bool timezone, bool language)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesSettingsEntity() when $default != null: +return $default(_that.locationFrequency,_that.timezone,_that.language);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( bool locationFrequency, bool timezone, bool language) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesSettingsEntity(): +return $default(_that.locationFrequency,_that.timezone,_that.language);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( bool locationFrequency, bool timezone, bool language)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesSettingsEntity() when $default != null: +return $default(_that.locationFrequency,_that.timezone,_that.language);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DeviceCapabilitiesSettingsEntity implements DeviceCapabilitiesSettingsEntity { + const _DeviceCapabilitiesSettingsEntity({required this.locationFrequency, required this.timezone, required this.language}); + + +@override final bool locationFrequency; +@override final bool timezone; +@override final bool language; + +/// Create a copy of DeviceCapabilitiesSettingsEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilitiesSettingsEntityCopyWith<_DeviceCapabilitiesSettingsEntity> get copyWith => __$DeviceCapabilitiesSettingsEntityCopyWithImpl<_DeviceCapabilitiesSettingsEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilitiesSettingsEntity&&(identical(other.locationFrequency, locationFrequency) || other.locationFrequency == locationFrequency)&&(identical(other.timezone, timezone) || other.timezone == timezone)&&(identical(other.language, language) || other.language == language)); +} + + +@override +int get hashCode => Object.hash(runtimeType,locationFrequency,timezone,language); + +@override +String toString() { + return 'DeviceCapabilitiesSettingsEntity(locationFrequency: $locationFrequency, timezone: $timezone, language: $language)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilitiesSettingsEntityCopyWith<$Res> implements $DeviceCapabilitiesSettingsEntityCopyWith<$Res> { + factory _$DeviceCapabilitiesSettingsEntityCopyWith(_DeviceCapabilitiesSettingsEntity value, $Res Function(_DeviceCapabilitiesSettingsEntity) _then) = __$DeviceCapabilitiesSettingsEntityCopyWithImpl; +@override @useResult +$Res call({ + bool locationFrequency, bool timezone, bool language +}); + + + + +} +/// @nodoc +class __$DeviceCapabilitiesSettingsEntityCopyWithImpl<$Res> + implements _$DeviceCapabilitiesSettingsEntityCopyWith<$Res> { + __$DeviceCapabilitiesSettingsEntityCopyWithImpl(this._self, this._then); + + final _DeviceCapabilitiesSettingsEntity _self; + final $Res Function(_DeviceCapabilitiesSettingsEntity) _then; + +/// Create a copy of DeviceCapabilitiesSettingsEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? locationFrequency = null,Object? timezone = null,Object? language = null,}) { + return _then(_DeviceCapabilitiesSettingsEntity( +locationFrequency: null == locationFrequency ? _self.locationFrequency : locationFrequency // ignore: cast_nullable_to_non_nullable +as bool,timezone: null == timezone ? _self.timezone : timezone // ignore: cast_nullable_to_non_nullable +as bool,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/packages/legacy_shared/lib/src/providers/selected_device_provider.dart b/modules/legacy/packages/legacy_shared/lib/src/providers/selected_device_provider.dart new file mode 100644 index 00000000..860393cd --- /dev/null +++ b/modules/legacy/packages/legacy_shared/lib/src/providers/selected_device_provider.dart @@ -0,0 +1,18 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:legacy_shared/src/data/models/entities/device_entity.dart'; + +final selectedDeviceProvider = NotifierProvider( + SelectedDeviceNotifier.new, +); + +class SelectedDeviceNotifier extends Notifier { + + @override + DeviceEntity? build() { + return null; + } + + void setSelectedDevice(DeviceEntity device) { + state = device; + } +} diff --git a/modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart b/modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart index 52564e18..08732649 100644 --- a/modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart +++ b/modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart @@ -6,12 +6,16 @@ class PageLayout extends StatelessWidget{ final String title; final Widget body; final Widget? footer; + final bool showEdit; + final VoidCallback? onEditChange; const PageLayout({ super.key, required this.title, required this.body, - this.footer + this.footer, + this.showEdit = false, + this.onEditChange }); @override @@ -28,12 +32,30 @@ class PageLayout extends StatelessWidget{ ), child: Stack( children: [ - IconButton(onPressed: () {Navigator.pop(context);}, - icon: Icon(Icons.arrow_back, - color: Color(0xFF588EA5), - size: 32, - ), - padding: EdgeInsets.zero, + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + IconButton(onPressed: () {Navigator.pop(context);}, + icon: Icon(Icons.arrow_back, + color: Color(0xFF588EA5), + size: 32, + ), + padding: EdgeInsets.zero, + ), + if (showEdit) + DecoratedBox( + decoration: BoxDecoration( + color: Color(0xFF588EA5), + shape: BoxShape.circle + ), + child: IconButton(onPressed: onEditChange, + icon: Icon(Icons.edit_outlined, + color: Colors.white, + size: SizeUtils.getByScreen(small: 30, big: 28), + ) + ), + ) + ], ), SizedBox( height: 50, diff --git a/packages/sf_localizations/assets/l10n/en.json b/packages/sf_localizations/assets/l10n/en.json index 2228d99c..81cd554c 100755 --- a/packages/sf_localizations/assets/l10n/en.json +++ b/packages/sf_localizations/assets/l10n/en.json @@ -167,7 +167,6 @@ "userNameLabel": "User name", "userPhoneLabel": "User phone number", "contactEmailLabel": "Contact email", - "passwordLabel": "Password (6 to 12 digits)", "submit": "Submit", "save": "Save", "editDeviceTitle": "Edit Device", diff --git a/packages/sf_localizations/assets/l10n/es.json b/packages/sf_localizations/assets/l10n/es.json index bf90f499..1a142310 100644 --- a/packages/sf_localizations/assets/l10n/es.json +++ b/packages/sf_localizations/assets/l10n/es.json @@ -164,9 +164,6 @@ "deleteAccount": "Eliminar cuenta", "logOut": "Cerrar sesión", "loginEmail": "(Correo electrónico)", - "userNameLabel": "Nombre del usuario", - "userPhoneLabel": "Número de teléfono del usuario", - "contactEmailLabel": "Correo de contacto", "passwordLabel": "Contraseña (de 6 a 12 caracteres)", "submit": "Enviar", "save": "Guardar", diff --git a/packages/sf_localizations/lib/src/generated/i18n.dart b/packages/sf_localizations/lib/src/generated/i18n.dart index b27bdf70..d0631f95 100755 --- a/packages/sf_localizations/lib/src/generated/i18n.dart +++ b/packages/sf_localizations/lib/src/generated/i18n.dart @@ -191,10 +191,6 @@ class I18n { static const String legacyAppUsers = 'appUsers'; static const String legacyPrivacyPolicy = 'privacyPolicy'; static const String legacyLogOut = 'logOut'; - static const String legacyLoginEmail = 'loginEmail'; - static const String legacyUserNameLabel = 'userNameLabel'; - static const String legacyUserPhoneLabel = 'userPhoneLabel'; - static const String legacyContactEmailLabel = 'contactEmailLabel'; static const String passwordLabel = 'passwordLabel'; static const String legacySubmit = 'submit'; static const String legacySave = 'save'; From 8445af3f5a9c4892d8af7d7edc99b0ae8f55e7b8 Mon Sep 17 00:00:00 2001 From: aitorarana Date: Mon, 23 Feb 2026 09:46:41 +0100 Subject: [PATCH 23/25] Change password --- .../mobile_app/lib/navigation/app_router.dart | 5 + .../datasource/account_remote_datasource.dart | 3 + .../account_remote_datasource_impl.dart | 23 +- .../models/change_password_request_model.dart | 21 ++ ...change_password_request_model.freezed.dart | 277 ++++++++++++++++ .../change_password_request_model.g.dart | 15 + .../repositories/account_repository_impl.dart | 6 + .../repositories/account_repository.dart | 11 +- .../presentation/account_settings_screen.dart | 18 +- .../change_password_builder.dart | 18 + .../domain/change_password_use_case.dart | 8 + .../domain/change_password_use_case_impl.dart | 14 + .../change_password_request_entity.dart | 10 + .../change_password_request_entity_impl.dart | 1 + .../presentation/change_password_screen.dart | 75 +++++ .../change_password_use_case_provider.dart | 9 + .../state/change_password_view_model.dart | 143 ++++++++ .../state/change_password_view_state.dart | 16 + .../change_password_view_state.freezed.dart | 310 ++++++++++++++++++ modules/legacy/modules/account/pubspec.yaml | 1 + packages/navigation/lib/app_routes.dart | 1 + 21 files changed, 976 insertions(+), 9 deletions(-) create mode 100644 modules/legacy/modules/account/lib/src/core/data/models/change_password_request_model.dart create mode 100644 modules/legacy/modules/account/lib/src/core/data/models/change_password_request_model.freezed.dart create mode 100644 modules/legacy/modules/account/lib/src/core/data/models/change_password_request_model.g.dart create mode 100644 modules/legacy/modules/account/lib/src/features/change_password/change_password_builder.dart create mode 100644 modules/legacy/modules/account/lib/src/features/change_password/domain/change_password_use_case.dart create mode 100644 modules/legacy/modules/account/lib/src/features/change_password/domain/change_password_use_case_impl.dart create mode 100644 modules/legacy/modules/account/lib/src/features/change_password/domain/models/entities/change_password_request_entity.dart create mode 100644 modules/legacy/modules/account/lib/src/features/change_password/domain/models/entities/change_password_request_entity_impl.dart create mode 100644 modules/legacy/modules/account/lib/src/features/change_password/presentation/change_password_screen.dart create mode 100644 modules/legacy/modules/account/lib/src/features/change_password/presentation/providers/change_password_use_case_provider.dart create mode 100644 modules/legacy/modules/account/lib/src/features/change_password/presentation/state/change_password_view_model.dart create mode 100644 modules/legacy/modules/account/lib/src/features/change_password/presentation/state/change_password_view_state.dart create mode 100644 modules/legacy/modules/account/lib/src/features/change_password/presentation/state/change_password_view_state.freezed.dart diff --git a/apps/mobile_app/lib/navigation/app_router.dart b/apps/mobile_app/lib/navigation/app_router.dart index 663748a9..2d370280 100644 --- a/apps/mobile_app/lib/navigation/app_router.dart +++ b/apps/mobile_app/lib/navigation/app_router.dart @@ -79,6 +79,11 @@ void configureAppRouter() { name: 'personal_data', pageBuilder: PersonalDataBuilder().buildPage, ), + GoRoute( + path: AppRoutes.changePassword, + name: 'change_password', + pageBuilder: ChangePasswordBuilder().buildPage, + ), GoRoute( path: AppRoutes.linkedDevices, name: 'linked_devices', diff --git a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart index de5f7338..2110d5d4 100644 --- a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart +++ b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource.dart @@ -1,3 +1,4 @@ +import 'package:account/src/features/change_password/domain/models/entities/change_password_request_entity.dart'; import 'package:legacy_shared/src/data/models/entities/device_entity.dart'; import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart'; import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; @@ -15,4 +16,6 @@ abstract class AccountRemoteDatasource { Future> getAppUsers({required String userId}); Future deleteAppUser({required String userId}); + + Future changePassword({required String userId, required ChangePasswordRequestEntity request}); } diff --git a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart index 8b953385..0f0af606 100644 --- a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart +++ b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart @@ -1,10 +1,12 @@ import 'dart:convert'; import 'package:account/src/core/data/datasource/account_remote_datasource.dart'; +import 'package:account/src/core/data/models/change_password_request_model.dart'; import 'package:account/src/core/data/models/get_app_users_response_model.dart'; import 'package:account/src/core/data/models/get_linked_devices_response_model.dart'; import 'package:account/src/core/data/models/update_device_request_model.dart'; import 'package:account/src/core/data/models/update_user_request_model.dart'; +import 'package:account/src/features/change_password/domain/models/entities/change_password_request_entity.dart'; import 'package:legacy_shared/src/data/models/entities/device_entity.dart'; import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart'; import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; @@ -21,7 +23,7 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource { @override Future> getLinkedDevices({required String userId}) async { try { - /*final response = await _repository.get>( + final response = await _repository.get>( '/$userId/devices', ); final data = response.data!['items']; @@ -29,8 +31,8 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource { throw Exception('Empty response from /:userId/devices'); } - final model = GetLinkedDevicesResponseModel.fromJson(data);*/ - final model = GetLinkedDevicesResponseModel(items: [ + final model = GetLinkedDevicesResponseModel.fromJson(data); + /*final model = GetLinkedDevicesResponseModel(items: [ GetLinkedDevicesItemResponseModel( identificator: '1111', carrierName: 'Carlos', @@ -79,7 +81,7 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource { isDisconnect: false, ) ), - ]); + ]);*/ return model.toEntity(); } on DioException catch (error) { throw _mapDioError( @@ -191,6 +193,19 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource { throw _mapDioError(error, defaultMessage: 'Error to delete device'); } } + + @override + Future changePassword({required String userId, required ChangePasswordRequestEntity request}) async { + try { + final body = request.toModel().toJson(); + await _repository.put( + '/auth/change-password', + body: body, + ); + } on DioException catch (error) { + throw _mapDioError(error, defaultMessage: 'Error to change password'); + } + } } Exception _mapDioError(DioException error, {required String defaultMessage}) { diff --git a/modules/legacy/modules/account/lib/src/core/data/models/change_password_request_model.dart b/modules/legacy/modules/account/lib/src/core/data/models/change_password_request_model.dart new file mode 100644 index 00000000..e5dba888 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/data/models/change_password_request_model.dart @@ -0,0 +1,21 @@ +import 'package:account/src/features/change_password/domain/models/entities/change_password_request_entity.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'change_password_request_model.freezed.dart'; +part 'change_password_request_model.g.dart'; + +@freezed +abstract class ChangePasswordRequestModel with _$ChangePasswordRequestModel { + const factory ChangePasswordRequestModel({ + required String password, + }) = _ChangePasswordRequestModel; + + factory ChangePasswordRequestModel.fromJson(Map json) => + _$ChangePasswordRequestModelFromJson(json); +} + +extension ChangePasswordRequestModelMapper on ChangePasswordRequestEntity { + ChangePasswordRequestModel toModel() => ChangePasswordRequestModel( + password: password, + ); +} diff --git a/modules/legacy/modules/account/lib/src/core/data/models/change_password_request_model.freezed.dart b/modules/legacy/modules/account/lib/src/core/data/models/change_password_request_model.freezed.dart new file mode 100644 index 00000000..1b1d9903 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/data/models/change_password_request_model.freezed.dart @@ -0,0 +1,277 @@ +// 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 'change_password_request_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$ChangePasswordRequestModel { + + String get password; +/// Create a copy of ChangePasswordRequestModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ChangePasswordRequestModelCopyWith get copyWith => _$ChangePasswordRequestModelCopyWithImpl(this as ChangePasswordRequestModel, _$identity); + + /// Serializes this ChangePasswordRequestModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ChangePasswordRequestModel&&(identical(other.password, password) || other.password == password)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,password); + +@override +String toString() { + return 'ChangePasswordRequestModel(password: $password)'; +} + + +} + +/// @nodoc +abstract mixin class $ChangePasswordRequestModelCopyWith<$Res> { + factory $ChangePasswordRequestModelCopyWith(ChangePasswordRequestModel value, $Res Function(ChangePasswordRequestModel) _then) = _$ChangePasswordRequestModelCopyWithImpl; +@useResult +$Res call({ + String password +}); + + + + +} +/// @nodoc +class _$ChangePasswordRequestModelCopyWithImpl<$Res> + implements $ChangePasswordRequestModelCopyWith<$Res> { + _$ChangePasswordRequestModelCopyWithImpl(this._self, this._then); + + final ChangePasswordRequestModel _self; + final $Res Function(ChangePasswordRequestModel) _then; + +/// Create a copy of ChangePasswordRequestModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? password = null,}) { + return _then(_self.copyWith( +password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [ChangePasswordRequestModel]. +extension ChangePasswordRequestModelPatterns on ChangePasswordRequestModel { +/// 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( _ChangePasswordRequestModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _ChangePasswordRequestModel() 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( _ChangePasswordRequestModel value) $default,){ +final _that = this; +switch (_that) { +case _ChangePasswordRequestModel(): +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( _ChangePasswordRequestModel value)? $default,){ +final _that = this; +switch (_that) { +case _ChangePasswordRequestModel() 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 password)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _ChangePasswordRequestModel() when $default != null: +return $default(_that.password);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 password) $default,) {final _that = this; +switch (_that) { +case _ChangePasswordRequestModel(): +return $default(_that.password);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 password)? $default,) {final _that = this; +switch (_that) { +case _ChangePasswordRequestModel() when $default != null: +return $default(_that.password);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _ChangePasswordRequestModel implements ChangePasswordRequestModel { + const _ChangePasswordRequestModel({required this.password}); + factory _ChangePasswordRequestModel.fromJson(Map json) => _$ChangePasswordRequestModelFromJson(json); + +@override final String password; + +/// Create a copy of ChangePasswordRequestModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$ChangePasswordRequestModelCopyWith<_ChangePasswordRequestModel> get copyWith => __$ChangePasswordRequestModelCopyWithImpl<_ChangePasswordRequestModel>(this, _$identity); + +@override +Map toJson() { + return _$ChangePasswordRequestModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _ChangePasswordRequestModel&&(identical(other.password, password) || other.password == password)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,password); + +@override +String toString() { + return 'ChangePasswordRequestModel(password: $password)'; +} + + +} + +/// @nodoc +abstract mixin class _$ChangePasswordRequestModelCopyWith<$Res> implements $ChangePasswordRequestModelCopyWith<$Res> { + factory _$ChangePasswordRequestModelCopyWith(_ChangePasswordRequestModel value, $Res Function(_ChangePasswordRequestModel) _then) = __$ChangePasswordRequestModelCopyWithImpl; +@override @useResult +$Res call({ + String password +}); + + + + +} +/// @nodoc +class __$ChangePasswordRequestModelCopyWithImpl<$Res> + implements _$ChangePasswordRequestModelCopyWith<$Res> { + __$ChangePasswordRequestModelCopyWithImpl(this._self, this._then); + + final _ChangePasswordRequestModel _self; + final $Res Function(_ChangePasswordRequestModel) _then; + +/// Create a copy of ChangePasswordRequestModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? password = null,}) { + return _then(_ChangePasswordRequestModel( +password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/account/lib/src/core/data/models/change_password_request_model.g.dart b/modules/legacy/modules/account/lib/src/core/data/models/change_password_request_model.g.dart new file mode 100644 index 00000000..17a6e2b5 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/core/data/models/change_password_request_model.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'change_password_request_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_ChangePasswordRequestModel _$ChangePasswordRequestModelFromJson( + Map json, +) => _ChangePasswordRequestModel(password: json['password'] as String); + +Map _$ChangePasswordRequestModelToJson( + _ChangePasswordRequestModel instance, +) => {'password': instance.password}; diff --git a/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart b/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart index ddac953a..9b8bd025 100644 --- a/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart +++ b/modules/legacy/modules/account/lib/src/core/data/repositories/account_repository_impl.dart @@ -1,5 +1,6 @@ import 'package:account/src/core/data/datasource/account_remote_datasource.dart'; import 'package:account/src/core/domain/repositories/account_repository.dart'; +import 'package:account/src/features/change_password/domain/models/entities/change_password_request_entity.dart'; import 'package:legacy_shared/src/data/models/entities/device_entity.dart'; import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart'; import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; @@ -39,4 +40,9 @@ class AccountRepositoryImpl implements AccountRepository { Future deleteAppUser({required String userId}) { return _remote.deleteAppUser(userId: userId); } + + @override + Future changePassword({required String userId, required ChangePasswordRequestEntity request}) { + return _remote.changePassword(userId: userId, request: request); + } } diff --git a/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart b/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart index 21c55a91..99ac924d 100644 --- a/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart +++ b/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart @@ -1,3 +1,4 @@ +import 'package:account/src/features/change_password/domain/models/entities/change_password_request_entity.dart'; import 'package:legacy_shared/src/data/models/entities/device_entity.dart'; import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart'; import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart'; @@ -8,11 +9,19 @@ abstract class AccountRepository { Future deleteDevice({required String userId, required String deviceId}); - Future updateDevice({required String userId, required String deviceId, required UpdateDeviceRequestEntity request}); + Future updateDevice({ + required String userId, + required String deviceId, + required UpdateDeviceRequestEntity request + }); Future updateUser({required String userId, required UpdateUserRequestEntity request}); Future> getAppUsers({required String userId}); Future deleteAppUser({required String userId}); + + Future changePassword({required String userId, + required ChangePasswordRequestEntity request + }); } diff --git a/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart b/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart index ce898fcb..e25483fb 100644 --- a/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart @@ -4,6 +4,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; import 'package:navigation/navigation.dart'; import 'package:sf_localizations/sf_localizations.dart'; +import 'package:url_launcher/url_launcher.dart'; import 'package:utils/utils.dart'; import 'package:flutter/services.dart'; import 'package:qr_flutter/qr_flutter.dart'; @@ -35,7 +36,7 @@ class AccountSettingsScreen extends ConsumerWidget { ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( - onPressed: (){}, + onPressed: (){navigationContract.pushTo(AppRoutes.changePassword);}, icon: Icons.lock, text: I18n.legacyChangePassword ), @@ -59,7 +60,12 @@ class AccountSettingsScreen extends ConsumerWidget { ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( - onPressed: (){}, + onPressed: () async { + final Uri url = Uri.parse('https://savefamilygps.com/pages/politica-de-privacidad-reloj-gps-infantil-localizador-savefamily'); + if (!await launchUrl(url)) { + throw Exception('Could not launch $url'); + } + }, icon: SFIcons.privacy, text: I18n.legacyPrivacyPolicy ), @@ -68,7 +74,11 @@ class AccountSettingsScreen extends ConsumerWidget { onPressed: (){ showDialog(context: context, builder: (context)=>Dialog( backgroundColor: Colors.transparent, - child: RegCodeDialog(regCode: selectedDevice?.id ?? '', deviceId: selectedDevice?.identificator ?? '', name: selectedDevice?.carrierName ?? ''), + child: RegCodeDialog( + regCode: selectedDevice?.id ?? '', + deviceId: selectedDevice?.identificator ?? '', + name: selectedDevice?.carrierName ?? '' + ), )); }, icon: Icons.qr_code, @@ -77,7 +87,7 @@ class AccountSettingsScreen extends ConsumerWidget { SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){}, - icon: SFIcons.privacy, + icon: Icons.no_accounts, text: I18n.legacyDeleteAccount ), ], diff --git a/modules/legacy/modules/account/lib/src/features/change_password/change_password_builder.dart b/modules/legacy/modules/account/lib/src/features/change_password/change_password_builder.dart new file mode 100644 index 00000000..3d12437a --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/change_password/change_password_builder.dart @@ -0,0 +1,18 @@ +import 'package:account/src/features/change_password/presentation/change_password_screen.dart'; +import 'package:flutter/material.dart'; +import 'package:get_it/get_it.dart'; +import 'package:go_router/go_router.dart'; +import 'package:navigation/navigation.dart'; + +class ChangePasswordBuilder { + const ChangePasswordBuilder(); + + Page buildPage(BuildContext context, GoRouterState state) { + final NavigationContract navigationContract = GetIt.I(); + + return MaterialPage( + key: state.pageKey, + child: ChangePasswordScreen(navigationContract: navigationContract), + ); + } +} diff --git a/modules/legacy/modules/account/lib/src/features/change_password/domain/change_password_use_case.dart b/modules/legacy/modules/account/lib/src/features/change_password/domain/change_password_use_case.dart new file mode 100644 index 00000000..1c11fc8a --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/change_password/domain/change_password_use_case.dart @@ -0,0 +1,8 @@ +import 'package:account/src/features/change_password/domain/models/entities/change_password_request_entity.dart'; + +abstract class ChangePasswordUseCase { + Future changePassword({ + required String userId, + required ChangePasswordRequestEntity request, + }); +} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/change_password/domain/change_password_use_case_impl.dart b/modules/legacy/modules/account/lib/src/features/change_password/domain/change_password_use_case_impl.dart new file mode 100644 index 00000000..b1573dcf --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/change_password/domain/change_password_use_case_impl.dart @@ -0,0 +1,14 @@ +import 'package:account/src/core/domain/repositories/account_repository.dart'; +import 'package:account/src/features/change_password/domain/models/entities/change_password_request_entity.dart'; +import 'package:account/src/features/change_password/domain/change_password_use_case.dart'; + +class ChangePasswordUseCaseImpl implements ChangePasswordUseCase { + ChangePasswordUseCaseImpl(this._repository); + + final AccountRepository _repository; + + @override + Future changePassword({required String userId, required ChangePasswordRequestEntity request}) { + return _repository.changePassword(userId: userId, request: request); + } +} diff --git a/modules/legacy/modules/account/lib/src/features/change_password/domain/models/entities/change_password_request_entity.dart b/modules/legacy/modules/account/lib/src/features/change_password/domain/models/entities/change_password_request_entity.dart new file mode 100644 index 00000000..147d9b71 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/change_password/domain/models/entities/change_password_request_entity.dart @@ -0,0 +1,10 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'change_password_request_entity.freezed.dart'; + +@freezed +abstract class ChangePasswordRequestEntity with _$ChangePasswordRequestEntity { + const factory ChangePasswordRequestEntity({ + required String password, + }) = _ChangePasswordRequestEntity; +} diff --git a/modules/legacy/modules/account/lib/src/features/change_password/domain/models/entities/change_password_request_entity_impl.dart b/modules/legacy/modules/account/lib/src/features/change_password/domain/models/entities/change_password_request_entity_impl.dart new file mode 100644 index 00000000..f03d6b18 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/change_password/domain/models/entities/change_password_request_entity_impl.dart @@ -0,0 +1 @@ +part of 'change_password_request_entity.dart'; \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/change_password/presentation/change_password_screen.dart b/modules/legacy/modules/account/lib/src/features/change_password/presentation/change_password_screen.dart new file mode 100644 index 00000000..c0f8f2a6 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/change_password/presentation/change_password_screen.dart @@ -0,0 +1,75 @@ +import 'package:account/src/features/change_password/presentation/state/change_password_view_model.dart'; +import 'package:design_system/design_system.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:legacy_shared/legacy_shared.dart'; +import 'package:navigation/navigation.dart'; +import 'package:sf_localizations/sf_localizations.dart'; +import 'package:utils/utils.dart'; + +class ChangePasswordScreen extends ConsumerWidget { + final NavigationContract navigationContract; + + const ChangePasswordScreen({super.key, required this.navigationContract}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final vm = ref.read(changePasswordViewModelProvider.notifier); + final state = ref.watch(changePasswordViewModelProvider); + + final theme = ref.watch(themePortProvider); + + return PageLayout( + title: context.translate(I18n.legacyChangePassword), + body: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 28, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 27, vertical: 8) + ), + child: SingleChildScrollView(child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + CustomTextField( + controller: vm.currentPasswordController, + hint: '********', + label: context.translate(I18n.password), + ), + SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)), + CustomTextField( + controller: vm.newPasswordController, + hint: '********', + label: context.translate(I18n.newPassword), + ), + SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)), + CustomTextField( + controller: vm.repeatPasswordController, + hint: '********', + label: context.translate(I18n.repeatPassword), + ), + if (state.errorMessage.isNotEmpty) ...[ + const SizedBox(height: 8), + Text( + state.errorMessage, + textAlign: TextAlign.center, + style: const TextStyle( + color: Color.fromRGBO(239, 17, 17, 1), + fontSize: 12, + ), + ), + ], + ], + )) + ), + footer: PrimaryButton( + onPressed: () async { + final bool res = await vm.changePassword(); + if (res){ + Navigator.pop(context); + } + }, + text: context.translate('OK'), + color: Color(0xFF588EA5) + ), + ); + } +} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/change_password/presentation/providers/change_password_use_case_provider.dart b/modules/legacy/modules/account/lib/src/features/change_password/presentation/providers/change_password_use_case_provider.dart new file mode 100644 index 00000000..56735503 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/change_password/presentation/providers/change_password_use_case_provider.dart @@ -0,0 +1,9 @@ +import 'package:account/src/core/providers/account_repository_provider.dart'; +import 'package:account/src/features/change_password/domain/change_password_use_case.dart'; +import 'package:account/src/features/change_password/domain/change_password_use_case_impl.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +final changePasswordUseCaseProvider = Provider.autoDispose((ref) { + final accountRepository = ref.read(accountRepositoryProvider); + return ChangePasswordUseCaseImpl(accountRepository); +}); diff --git a/modules/legacy/modules/account/lib/src/features/change_password/presentation/state/change_password_view_model.dart b/modules/legacy/modules/account/lib/src/features/change_password/presentation/state/change_password_view_model.dart new file mode 100644 index 00000000..ca7de53c --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/change_password/presentation/state/change_password_view_model.dart @@ -0,0 +1,143 @@ +import 'package:account/src/features/change_password/domain/change_password_use_case.dart'; +import 'package:account/src/features/change_password/domain/models/entities/change_password_request_entity.dart'; +import 'package:account/src/features/change_password/presentation/providers/change_password_use_case_provider.dart'; +import 'package:account/src/features/change_password/presentation/state/change_password_view_state.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:legacy_shared/legacy_shared.dart'; + +// import 'package:sf_localizations/sf_localizations.dart'; + +final changePasswordViewModelProvider = +NotifierProvider.autoDispose( + ChangePasswordViewModel.new, +); + +class ChangePasswordViewModel extends Notifier { + late final ChangePasswordUseCase _changePasswordUseCase; + + late final TextEditingController currentPasswordController; + late final TextEditingController newPasswordController; + late final TextEditingController repeatPasswordController; + late final TextEditingController passwordController; + + @override + ChangePasswordViewState build() { + _changePasswordUseCase = ref.read(changePasswordUseCaseProvider); + + currentPasswordController = TextEditingController(); + currentPasswordController.addListener(_onCurrentPasswordChanged); + + newPasswordController = TextEditingController(); + newPasswordController.addListener(_onNewPasswordChanged); + + repeatPasswordController = TextEditingController(); + repeatPasswordController.addListener(_onRepeatPasswordController); + + ref.read(loggedUserProvider.future) + .then(setUser); + + ref.onDispose(disposeControllers); + + return const ChangePasswordViewState(); + } + + void setUser(UserEntity user) { + state = state.copyWith(loggedUser: user); + } + + void _onCurrentPasswordChanged() { + final value = currentPasswordController.text; + + if (value == state.currentPassword) return; + + state = state.copyWith( + currentPassword: value, + ); + } + + void _onNewPasswordChanged() { + final value = newPasswordController.text; + + if (value == state.newPassword) return; + + state = state.copyWith( + newPassword: value, + ); + } + + void _onRepeatPasswordController() { + final value = repeatPasswordController.text; + + if (value == state.repeatPassword) return; + + state = state.copyWith( + repeatPassword: value, + ); + } + + bool _validateForm() { + if (state.currentPassword.trim().isEmpty){ + state = state.copyWith(errorMessage: 'errorMessageCurrentPasswordIsEmpty'); + return false; + } + if (state.newPassword.trim().isEmpty){ + state = state.copyWith(errorMessage: 'errorMessageNewPasswordIsEmpty'); + return false; + } + if (state.repeatPassword.trim().isEmpty){ + state = state.copyWith(errorMessage: 'errorMessageRepeatPasswordIsEmpty'); + return false; + } + if (state.newPassword.trim() != state.repeatPassword.trim()){ + state = state.copyWith(errorMessage: 'errorMessagePasswordsDontMatch'); + return false; + } + return true; + } + + ChangePasswordRequestEntity _toRequest() { + + return ChangePasswordRequestEntity( + password: state.newPassword.trim(), + ); + } + + Future changePassword() async { + if (state.isLoading) return false; + if (!_validateForm()) return false; + + try { + final request = _toRequest(); + + await _changePasswordUseCase.changePassword(userId: state.loggedUser!.id, request: request); + ref.invalidate(loggedUserProvider); + + return true; + } catch (e) { + if (!ref.mounted) return false; + _finishWithError(message: e.toString()); + return false; + } + + } + + void _finishWithError({required String message}) { + state = state.copyWith( + isLoading: false, + errorMessage: message, + ); + } + + void disposeControllers() { + currentPasswordController.removeListener(_onCurrentPasswordChanged); + currentPasswordController.dispose(); + + newPasswordController.removeListener(_onNewPasswordChanged); + newPasswordController.dispose(); + + repeatPasswordController.removeListener(_onRepeatPasswordController); + repeatPasswordController.dispose(); + + } +} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/change_password/presentation/state/change_password_view_state.dart b/modules/legacy/modules/account/lib/src/features/change_password/presentation/state/change_password_view_state.dart new file mode 100644 index 00000000..5c2c19af --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/change_password/presentation/state/change_password_view_state.dart @@ -0,0 +1,16 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:legacy_shared/legacy_shared.dart'; + +part 'change_password_view_state.freezed.dart'; + +@freezed +abstract class ChangePasswordViewState with _$ChangePasswordViewState { + const factory ChangePasswordViewState({ + UserEntity? loggedUser, + @Default(false) bool isLoading, + @Default('') String currentPassword, + @Default('') String newPassword, + @Default('') String repeatPassword, + @Default('') String errorMessage + }) = _ChangePasswordViewState; +} diff --git a/modules/legacy/modules/account/lib/src/features/change_password/presentation/state/change_password_view_state.freezed.dart b/modules/legacy/modules/account/lib/src/features/change_password/presentation/state/change_password_view_state.freezed.dart new file mode 100644 index 00000000..5056cbe8 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/change_password/presentation/state/change_password_view_state.freezed.dart @@ -0,0 +1,310 @@ +// 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 'change_password_view_state.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$ChangePasswordViewState { + + UserEntity? get loggedUser; bool get isLoading; String get currentPassword; String get newPassword; String get repeatPassword; String get errorMessage; +/// Create a copy of ChangePasswordViewState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ChangePasswordViewStateCopyWith get copyWith => _$ChangePasswordViewStateCopyWithImpl(this as ChangePasswordViewState, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ChangePasswordViewState&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.currentPassword, currentPassword) || other.currentPassword == currentPassword)&&(identical(other.newPassword, newPassword) || other.newPassword == newPassword)&&(identical(other.repeatPassword, repeatPassword) || other.repeatPassword == repeatPassword)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); +} + + +@override +int get hashCode => Object.hash(runtimeType,loggedUser,isLoading,currentPassword,newPassword,repeatPassword,errorMessage); + +@override +String toString() { + return 'ChangePasswordViewState(loggedUser: $loggedUser, isLoading: $isLoading, currentPassword: $currentPassword, newPassword: $newPassword, repeatPassword: $repeatPassword, errorMessage: $errorMessage)'; +} + + +} + +/// @nodoc +abstract mixin class $ChangePasswordViewStateCopyWith<$Res> { + factory $ChangePasswordViewStateCopyWith(ChangePasswordViewState value, $Res Function(ChangePasswordViewState) _then) = _$ChangePasswordViewStateCopyWithImpl; +@useResult +$Res call({ + UserEntity? loggedUser, bool isLoading, String currentPassword, String newPassword, String repeatPassword, String errorMessage +}); + + +$UserEntityCopyWith<$Res>? get loggedUser; + +} +/// @nodoc +class _$ChangePasswordViewStateCopyWithImpl<$Res> + implements $ChangePasswordViewStateCopyWith<$Res> { + _$ChangePasswordViewStateCopyWithImpl(this._self, this._then); + + final ChangePasswordViewState _self; + final $Res Function(ChangePasswordViewState) _then; + +/// Create a copy of ChangePasswordViewState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? loggedUser = freezed,Object? isLoading = null,Object? currentPassword = null,Object? newPassword = null,Object? repeatPassword = null,Object? errorMessage = null,}) { + return _then(_self.copyWith( +loggedUser: freezed == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable +as UserEntity?,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable +as bool,currentPassword: null == currentPassword ? _self.currentPassword : currentPassword // ignore: cast_nullable_to_non_nullable +as String,newPassword: null == newPassword ? _self.newPassword : newPassword // ignore: cast_nullable_to_non_nullable +as String,repeatPassword: null == repeatPassword ? _self.repeatPassword : repeatPassword // ignore: cast_nullable_to_non_nullable +as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable +as String, + )); +} +/// Create a copy of ChangePasswordViewState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$UserEntityCopyWith<$Res>? get loggedUser { + if (_self.loggedUser == null) { + return null; + } + + return $UserEntityCopyWith<$Res>(_self.loggedUser!, (value) { + return _then(_self.copyWith(loggedUser: value)); + }); +} +} + + +/// Adds pattern-matching-related methods to [ChangePasswordViewState]. +extension ChangePasswordViewStatePatterns on ChangePasswordViewState { +/// 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( _ChangePasswordViewState value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _ChangePasswordViewState() 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( _ChangePasswordViewState value) $default,){ +final _that = this; +switch (_that) { +case _ChangePasswordViewState(): +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( _ChangePasswordViewState value)? $default,){ +final _that = this; +switch (_that) { +case _ChangePasswordViewState() 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( UserEntity? loggedUser, bool isLoading, String currentPassword, String newPassword, String repeatPassword, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _ChangePasswordViewState() when $default != null: +return $default(_that.loggedUser,_that.isLoading,_that.currentPassword,_that.newPassword,_that.repeatPassword,_that.errorMessage);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( UserEntity? loggedUser, bool isLoading, String currentPassword, String newPassword, String repeatPassword, String errorMessage) $default,) {final _that = this; +switch (_that) { +case _ChangePasswordViewState(): +return $default(_that.loggedUser,_that.isLoading,_that.currentPassword,_that.newPassword,_that.repeatPassword,_that.errorMessage);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( UserEntity? loggedUser, bool isLoading, String currentPassword, String newPassword, String repeatPassword, String errorMessage)? $default,) {final _that = this; +switch (_that) { +case _ChangePasswordViewState() when $default != null: +return $default(_that.loggedUser,_that.isLoading,_that.currentPassword,_that.newPassword,_that.repeatPassword,_that.errorMessage);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _ChangePasswordViewState implements ChangePasswordViewState { + const _ChangePasswordViewState({this.loggedUser, this.isLoading = false, this.currentPassword = '', this.newPassword = '', this.repeatPassword = '', this.errorMessage = ''}); + + +@override final UserEntity? loggedUser; +@override@JsonKey() final bool isLoading; +@override@JsonKey() final String currentPassword; +@override@JsonKey() final String newPassword; +@override@JsonKey() final String repeatPassword; +@override@JsonKey() final String errorMessage; + +/// Create a copy of ChangePasswordViewState +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$ChangePasswordViewStateCopyWith<_ChangePasswordViewState> get copyWith => __$ChangePasswordViewStateCopyWithImpl<_ChangePasswordViewState>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _ChangePasswordViewState&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.currentPassword, currentPassword) || other.currentPassword == currentPassword)&&(identical(other.newPassword, newPassword) || other.newPassword == newPassword)&&(identical(other.repeatPassword, repeatPassword) || other.repeatPassword == repeatPassword)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); +} + + +@override +int get hashCode => Object.hash(runtimeType,loggedUser,isLoading,currentPassword,newPassword,repeatPassword,errorMessage); + +@override +String toString() { + return 'ChangePasswordViewState(loggedUser: $loggedUser, isLoading: $isLoading, currentPassword: $currentPassword, newPassword: $newPassword, repeatPassword: $repeatPassword, errorMessage: $errorMessage)'; +} + + +} + +/// @nodoc +abstract mixin class _$ChangePasswordViewStateCopyWith<$Res> implements $ChangePasswordViewStateCopyWith<$Res> { + factory _$ChangePasswordViewStateCopyWith(_ChangePasswordViewState value, $Res Function(_ChangePasswordViewState) _then) = __$ChangePasswordViewStateCopyWithImpl; +@override @useResult +$Res call({ + UserEntity? loggedUser, bool isLoading, String currentPassword, String newPassword, String repeatPassword, String errorMessage +}); + + +@override $UserEntityCopyWith<$Res>? get loggedUser; + +} +/// @nodoc +class __$ChangePasswordViewStateCopyWithImpl<$Res> + implements _$ChangePasswordViewStateCopyWith<$Res> { + __$ChangePasswordViewStateCopyWithImpl(this._self, this._then); + + final _ChangePasswordViewState _self; + final $Res Function(_ChangePasswordViewState) _then; + +/// Create a copy of ChangePasswordViewState +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? loggedUser = freezed,Object? isLoading = null,Object? currentPassword = null,Object? newPassword = null,Object? repeatPassword = null,Object? errorMessage = null,}) { + return _then(_ChangePasswordViewState( +loggedUser: freezed == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable +as UserEntity?,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable +as bool,currentPassword: null == currentPassword ? _self.currentPassword : currentPassword // ignore: cast_nullable_to_non_nullable +as String,newPassword: null == newPassword ? _self.newPassword : newPassword // ignore: cast_nullable_to_non_nullable +as String,repeatPassword: null == repeatPassword ? _self.repeatPassword : repeatPassword // ignore: cast_nullable_to_non_nullable +as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +/// Create a copy of ChangePasswordViewState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$UserEntityCopyWith<$Res>? get loggedUser { + if (_self.loggedUser == null) { + return null; + } + + return $UserEntityCopyWith<$Res>(_self.loggedUser!, (value) { + return _then(_self.copyWith(loggedUser: value)); + }); +} +} + +// dart format on diff --git a/modules/legacy/modules/account/pubspec.yaml b/modules/legacy/modules/account/pubspec.yaml index c68930d9..2e206c71 100644 --- a/modules/legacy/modules/account/pubspec.yaml +++ b/modules/legacy/modules/account/pubspec.yaml @@ -52,6 +52,7 @@ dependencies: json_serializable: ^6.11.2 uuid: ^4.5.2 qr_flutter: ^4.1.0 + url_launcher: ^6.3.2 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. diff --git a/packages/navigation/lib/app_routes.dart b/packages/navigation/lib/app_routes.dart index f4dee74c..205178f4 100644 --- a/packages/navigation/lib/app_routes.dart +++ b/packages/navigation/lib/app_routes.dart @@ -21,6 +21,7 @@ class AppRoutes { static const accountSettings = '$legacy/account_settings'; static const personalData = '$accountSettings/personal_data'; + static const changePassword = '$accountSettings/change_password'; static const linkedDevices = '$accountSettings/linked_devices'; static const appUsers = '$accountSettings/app_users'; From 5a68dfb3df870703ec83b26603c4b50569c61a7c Mon Sep 17 00:00:00 2001 From: aitorarana Date: Thu, 26 Feb 2026 17:01:19 +0100 Subject: [PATCH 24/25] Delete account --- .../mobile_app/lib/navigation/app_router.dart | 5 + .../account_remote_datasource_impl.dart | 8 +- .../repositories/account_repository.dart | 8 +- .../presentation/account_settings_screen.dart | 2 +- .../delete_account_builder.dart | 18 + .../domain/delete_account_use_case.dart | 6 + .../domain/delete_account_use_case_impl.dart | 13 + .../presentation/delete_account_screen.dart | 256 ++++++++++++++ .../delete_account_use_case_provider.dart | 9 + .../state/delete_account_view_model.dart | 128 +++++++ .../state/delete_account_view_state.dart | 18 + .../delete_account_view_state.freezed.dart | 328 ++++++++++++++++++ .../legacy_shared_remote_datasource_impl.dart | 8 +- .../src/providers/logged_user_provider.dart | 7 +- packages/navigation/lib/app_routes.dart | 1 + packages/sf_localizations/assets/l10n/es.json | 10 +- .../lib/src/generated/i18n.dart | 8 + 17 files changed, 818 insertions(+), 15 deletions(-) create mode 100644 modules/legacy/modules/account/lib/src/features/delete_account/delete_account_builder.dart create mode 100644 modules/legacy/modules/account/lib/src/features/delete_account/domain/delete_account_use_case.dart create mode 100644 modules/legacy/modules/account/lib/src/features/delete_account/domain/delete_account_use_case_impl.dart create mode 100644 modules/legacy/modules/account/lib/src/features/delete_account/presentation/delete_account_screen.dart create mode 100644 modules/legacy/modules/account/lib/src/features/delete_account/presentation/providers/delete_account_use_case_provider.dart create mode 100644 modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_model.dart create mode 100644 modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_state.dart create mode 100644 modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_state.freezed.dart diff --git a/apps/mobile_app/lib/navigation/app_router.dart b/apps/mobile_app/lib/navigation/app_router.dart index 2d370280..da96b616 100644 --- a/apps/mobile_app/lib/navigation/app_router.dart +++ b/apps/mobile_app/lib/navigation/app_router.dart @@ -94,6 +94,11 @@ void configureAppRouter() { name: 'app_users', pageBuilder: AppUsersBuilder().buildPage, ), + GoRoute( + path: AppRoutes.deleteAccount, + name: 'delete_account', + pageBuilder: DeleteAccountBuilder().buildPage, + ), GoRoute( path: AppRoutes.customerService, diff --git a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart index 0f0af606..78c92f7e 100644 --- a/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart +++ b/modules/legacy/modules/account/lib/src/core/data/datasource/account_remote_datasource_impl.dart @@ -23,7 +23,7 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource { @override Future> getLinkedDevices({required String userId}) async { try { - final response = await _repository.get>( + /*final response = await _repository.get>( '/$userId/devices', ); final data = response.data!['items']; @@ -31,8 +31,8 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource { throw Exception('Empty response from /:userId/devices'); } - final model = GetLinkedDevicesResponseModel.fromJson(data); - /*final model = GetLinkedDevicesResponseModel(items: [ + final model = GetLinkedDevicesResponseModel.fromJson(data);*/ + final model = GetLinkedDevicesResponseModel(items: [ GetLinkedDevicesItemResponseModel( identificator: '1111', carrierName: 'Carlos', @@ -81,7 +81,7 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource { isDisconnect: false, ) ), - ]);*/ + ]); return model.toEntity(); } on DioException catch (error) { throw _mapDioError( diff --git a/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart b/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart index 99ac924d..bfbf31e9 100644 --- a/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart +++ b/modules/legacy/modules/account/lib/src/core/domain/repositories/account_repository.dart @@ -15,13 +15,17 @@ abstract class AccountRepository { required UpdateDeviceRequestEntity request }); - Future updateUser({required String userId, required UpdateUserRequestEntity request}); + Future updateUser({ + required String userId, + required UpdateUserRequestEntity request + }); Future> getAppUsers({required String userId}); Future deleteAppUser({required String userId}); - Future changePassword({required String userId, + Future changePassword({ + required String userId, required ChangePasswordRequestEntity request }); } diff --git a/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart b/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart index e25483fb..56f074d8 100644 --- a/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart @@ -86,7 +86,7 @@ class AccountSettingsScreen extends ConsumerWidget { ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( - onPressed: (){}, + onPressed: (){navigationContract.pushTo(AppRoutes.deleteAccount);}, icon: Icons.no_accounts, text: I18n.legacyDeleteAccount ), diff --git a/modules/legacy/modules/account/lib/src/features/delete_account/delete_account_builder.dart b/modules/legacy/modules/account/lib/src/features/delete_account/delete_account_builder.dart new file mode 100644 index 00000000..7f5e95e8 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/delete_account/delete_account_builder.dart @@ -0,0 +1,18 @@ +import 'package:account/src/features/delete_account/presentation/delete_account_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 DeleteAccountBuilder { + const DeleteAccountBuilder(); + + Page buildPage(BuildContext context, GoRouterState state) { + final NavigationContract navigationContract = GetIt.I(); + + return MaterialPage( + key: state.pageKey, + child: DeleteAccountScreen(navigationContract: navigationContract), + ); + } +} diff --git a/modules/legacy/modules/account/lib/src/features/delete_account/domain/delete_account_use_case.dart b/modules/legacy/modules/account/lib/src/features/delete_account/domain/delete_account_use_case.dart new file mode 100644 index 00000000..41dbe568 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/delete_account/domain/delete_account_use_case.dart @@ -0,0 +1,6 @@ + +abstract class DeleteAccountUseCase { + Future deleteAccount({ + required String userId, + }); +} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/delete_account/domain/delete_account_use_case_impl.dart b/modules/legacy/modules/account/lib/src/features/delete_account/domain/delete_account_use_case_impl.dart new file mode 100644 index 00000000..299cd6b8 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/delete_account/domain/delete_account_use_case_impl.dart @@ -0,0 +1,13 @@ +import 'package:account/src/core/domain/repositories/account_repository.dart'; +import 'package:account/src/features/delete_account/domain/delete_account_use_case.dart'; + +class DeleteAccountUseCaseImpl implements DeleteAccountUseCase { + DeleteAccountUseCaseImpl(this._repository); + + final AccountRepository _repository; + + @override + Future deleteAccount({required String userId}) { + return _repository.deleteAppUser(userId: userId); + } +} diff --git a/modules/legacy/modules/account/lib/src/features/delete_account/presentation/delete_account_screen.dart b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/delete_account_screen.dart new file mode 100644 index 00000000..48ea4a75 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/delete_account_screen.dart @@ -0,0 +1,256 @@ +import 'package:account/src/features/delete_account/presentation/state/delete_account_view_model.dart'; +import 'package:design_system/design_system.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:legacy_shared/legacy_shared.dart'; +import 'package:navigation/navigation.dart'; +import 'package:sf_localizations/sf_localizations.dart'; +import 'package:utils/utils.dart'; + +class DeleteAccountScreen extends ConsumerWidget { + final NavigationContract navigationContract; + + const DeleteAccountScreen({super.key, required this.navigationContract}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.watch(themePortProvider); + + final state = ref.watch(deleteAccountViewModelProvider); + final viewModel = ref.read(deleteAccountViewModelProvider.notifier); + + return PageLayout( + title: context.translate(I18n.legacyDeleteAccount), + body: SingleChildScrollView(child: Container( + margin: EdgeInsets.symmetric(horizontal: 10), + child: Column( + children: [ + Container( + color: theme.getColorFor(ThemeCode.backgroundSecondary), + width: double.infinity, + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(vertical: 20), + big: EdgeInsets.symmetric(vertical: 19), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + decoration: BoxDecoration( + color: Color(0xFF00A1C6), + borderRadius: BorderRadius.circular(12) + ), + padding: SizeUtils.getByScreen( + small: EdgeInsets.all(7), + big: EdgeInsets.all(6), + ), + child: Icon(Icons.power_settings_new_outlined, + size: SizeUtils.getByScreen(small: 48, big: 46), + color: Colors.white, + ), + ), + Text(context.translate(I18n.legacyDeleteAccount), + style: TextStyle(fontSize: SizeUtils.getByScreen(small: 20, big: 19)), + ) + ], + ), + ), + SizedBox(height: SizeUtils.getByScreen(small: 8, big: 6)), + Text(context.translate(I18n.legacyDeleteAccountBody1), + textAlign: TextAlign.start, + ), + SizedBox(height: SizeUtils.getByScreen(small: 38, big: 36)), + Text(context.translate(I18n.legacyDeleteAccountBody2), + textAlign: TextAlign.start, + style: TextStyle( + fontSize: 12, + color: theme.getColorFor(ThemeCode.textPrimary) + ), + ), + ], + ) + )), + footer: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 14, vertical: 10), + big: EdgeInsets.symmetric(horizontal: 12, vertical: 8), + ), + child: PrimaryButton( + onPressed: (){ + if (state.loggedUser != null) { + showDialog(context: context, builder: (context) => + Dialog( + backgroundColor: Colors.transparent, + child: ConfirmDialog(navigationContract: navigationContract), + ) + ); + } + }, + text: context.translate(I18n.legacyRequestCancelButton), + color: Color(0xFF588EA5) + ), + ), + ); + } +} + +class ConfirmDialog extends ConsumerWidget{ + + final NavigationContract navigationContract; + + const ConfirmDialog({ + super.key, + required this.navigationContract, + }); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final state = ref.watch(deleteAccountViewModelProvider); + final viewModel = ref.read(deleteAccountViewModelProvider.notifier); + + final steps = [ + Container( + height: 210, + width: 500, + color: Colors.white, + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 11), + big: EdgeInsets.symmetric(horizontal: 20, vertical: 10), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(context.translate(I18n.legacyVerifyAccount), + style: TextStyle( + fontWeight: FontWeight.w500 + ), + ), + SizedBox(height: SizeUtils.getByScreen(small: 18, big: 16)), + Text('${context.translate(I18n.email)}: ${state.loggedUser!.email}'), + SizedBox(height: SizeUtils.getByScreen(small: 8, big: 6)), + Row( + children: [ + Text('${context.translate(I18n.password)}: '), + SizedBox(width: SizeUtils.getByScreen(small: 12, big: 10)), + Expanded(child: TextField( + controller: viewModel.passwordController, + style: TextStyle(fontSize: 12), + decoration: InputDecoration(hintText: context.translate(I18n.password)), + obscureText: true, + enableSuggestions: false, + autocorrect: true, + )) + ], + ), + if (state.errorMessage.isNotEmpty) + Text( + state.errorMessage, + textAlign: TextAlign.center, + style: TextStyle( + color: Theme.of(context).colorScheme.error, + fontSize: 13, + ), + ), + SizedBox(height: SizeUtils.getByScreen(small: 12, big: 10)), + Row( + children: [ + Expanded(child: SecondaryButton( + onPressed: (){Navigator.pop(context);}, + text: context.translate(I18n.legacyCancel), + color: Color(0xFF588EA5), + height: 40, + radius: 20, + )), + SizedBox(width: SizeUtils.getByScreen(small: 12, big: 10)), + Expanded(child: PrimaryButton( + onPressed: viewModel.nextStep, + text: context.translate(I18n.accept), + color: Color(0xFF588EA5), + height: 40, + radius: 20, + )), + ], + ) + ], + ), + ), + Container( + height: 400, + width: 500, + color: Colors.white, + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 11), + big: EdgeInsets.symmetric(horizontal: 20, vertical: 10), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SizedBox(height: SizeUtils.getByScreen(small: 14, big: 12)), + Text(context.translate(I18n.legacyRequestCancelTitle), + style: TextStyle( + fontWeight: FontWeight.w500 + ), + ), + SizedBox(height: SizeUtils.getByScreen(small: 14, big: 12)), + Expanded(child: SingleChildScrollView(child: Column( + children: [ + Text(context.translate(I18n.legacyRequestCancelBody), + style: TextStyle(height: 1.5), + ), + SizedBox(height: SizeUtils.getByScreen(small: 12, big: 10)), + ...List.generate(state.devices.length, (int index) => + CheckboxListTile( + contentPadding: EdgeInsets.zero, + title: Text(context.translate(I18n.legacyDeleteDeviceData, + args: {'name': state.devices[index].carrierName} + ), + style: TextStyle(height: 0), + ), + controlAffinity: ListTileControlAffinity.leading, + value: false, + onChanged: (_){ + viewModel.updateDeleteDevice(index); + } + ) + ), + ] + ))), + SizedBox(height: SizeUtils.getByScreen(small: 12, big: 10)), + Row( + children: [ + Expanded(child: SecondaryButton( + onPressed: (){ + viewModel.resetConfirmStep(); + Navigator.pop(context); + }, + text: context.translate(I18n.legacyCancel), + color: Color(0xFF588EA5), + height: 50, + radius: 25, + )), + SizedBox(width: SizeUtils.getByScreen(small: 12, big: 10)), + Expanded(child: PrimaryButton( + onPressed: () async { + viewModel.deleteAccount(); + if (!context.mounted) return; + + navigationContract.goTo(AppRoutes.login); + }, + text: context.translate(I18n.legacyConfirm), + color: Color(0xFF588EA5), + height: 50, + radius: 25, + )), + ], + ) + ], + ), + ) + ]; + + return steps[state.confirmStep]; + } + +} diff --git a/modules/legacy/modules/account/lib/src/features/delete_account/presentation/providers/delete_account_use_case_provider.dart b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/providers/delete_account_use_case_provider.dart new file mode 100644 index 00000000..75628c2e --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/providers/delete_account_use_case_provider.dart @@ -0,0 +1,9 @@ +import 'package:account/src/core/providers/account_repository_provider.dart'; +import 'package:account/src/features/delete_account/domain/delete_account_use_case.dart'; +import 'package:account/src/features/delete_account/domain/delete_account_use_case_impl.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +final deleteAccountUseCaseProvider = Provider.autoDispose((ref) { + final accountRepository = ref.read(accountRepositoryProvider); + return DeleteAccountUseCaseImpl(accountRepository); +}); diff --git a/modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_model.dart b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_model.dart new file mode 100644 index 00000000..ab0700f9 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_model.dart @@ -0,0 +1,128 @@ +import 'package:account/src/features/delete_account/domain/delete_account_use_case.dart'; +import 'package:account/src/features/delete_account/presentation/providers/delete_account_use_case_provider.dart'; +import 'package:account/src/features/delete_account/presentation/state/delete_account_view_state.dart'; +import 'package:account/src/features/linked_devices/domain/get_linked_devices_use_case.dart'; +import 'package:account/src/features/linked_devices/presentation/providers/get_linked_devices_use_case_provider.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:legacy_shared/legacy_shared.dart'; + +// import 'package:sf_localizations/sf_localizations.dart'; + +final deleteAccountViewModelProvider = +NotifierProvider.autoDispose( + DeleteAccountViewModel.new, +); + +class DeleteAccountViewModel extends Notifier { + late final DeleteAccountUseCase _deleteAccountUseCase; + late final GetLinkedDevicesUseCase _getLinkedDevicesUseCase; + late final TextEditingController passwordController; + + @override + DeleteAccountViewState build() { + _deleteAccountUseCase = ref.read(deleteAccountUseCaseProvider); + _getLinkedDevicesUseCase = ref.read(getLinkedDevicesUseCaseProvider); + + passwordController = TextEditingController(); + passwordController.addListener(_onPasswordChanged); + + ref.read(loggedUserProvider.future) + .then((user){ + setUser(user); + return _getLinkedDevicesUseCase.getLinkedDevices(userId: user.id); + }).then(setDevices); + + ref.onDispose(disposeListeners); + + return const DeleteAccountViewState(); + } + + void setUser(UserEntity user) { + state = state.copyWith(loggedUser: user); + } + + void setDevices(List devices) { + state = state.copyWith( + devices: devices, + deleteDevices: List.generate(devices.length, (_)=>false), + ); + } + + void updateDeleteDevice(int index) { + List deleteDevices = state.deleteDevices; + deleteDevices[index] = !deleteDevices[index]; + + state = state.copyWith( + deleteDevices: deleteDevices, + ); + } + + void _onPasswordChanged() { + final value = passwordController.text; + if (value == state.password) return; + + state = state.copyWith( + password: value, + errorMessage: '' + ); + } + + bool _validateForm() { + if (state.password.trim().isEmpty) { + state = state.copyWith(errorMessage: 'errorMessagePasswordIsEmpty'); + return false; + } + /*if (state.password.trim() != state.loggedUser.password.trim()) { + state = state.copyWith(errorMessage: 'errorMessagePasswordsDontMatch'); + return false; + }*/ + return true; + } + + void nextStep() { + final step = state.confirmStep; + + if (step == 0 && !_validateForm()) return; + + state = state.copyWith(confirmStep: step + 1); + } + + void resetConfirmStep() { + state = state.copyWith(confirmStep: 0); + } + + Future deleteAccount() async { + if (state.isLoading) return false; + + try { + state = state.copyWith(isLoading: true); + + await _deleteAccountUseCase.deleteAccount(userId: state.loggedUser!.id); + if (!ref.mounted) return false; + + ref.invalidate(loggedUserProvider); + + state = state.copyWith(isLoading: false, isDeleted: true); + return true; + } catch (e) { + state = state.copyWith(isLoading: false); + if (!ref.mounted) return false; + _finishWithError(message: e.toString()); + return false; + } + + } + + void _finishWithError({required String message}) { + state = state.copyWith( + isLoading: false, + errorMessage: message, + ); + } + + void disposeListeners() { + passwordController.removeListener(_onPasswordChanged); + passwordController.dispose(); + } +} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_state.dart b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_state.dart new file mode 100644 index 00000000..1b7e9ecb --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_state.dart @@ -0,0 +1,18 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:legacy_shared/legacy_shared.dart'; + +part 'delete_account_view_state.freezed.dart'; + +@freezed +abstract class DeleteAccountViewState with _$DeleteAccountViewState { + const factory DeleteAccountViewState({ + UserEntity? loggedUser, + @Default('') String password, + @Default(false) bool isLoading, + @Default(false) bool isDeleted, + @Default(0) int confirmStep, + @Default([]) List devices, + @Default([]) List deleteDevices, + @Default('') String errorMessage, + }) = _DeleteAccountViewState; +} diff --git a/modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_state.freezed.dart b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_state.freezed.dart new file mode 100644 index 00000000..c0c64d1b --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_state.freezed.dart @@ -0,0 +1,328 @@ +// 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 'delete_account_view_state.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$DeleteAccountViewState { + + UserEntity? get loggedUser; String get password; bool get isLoading; bool get isDeleted; int get confirmStep; List get devices; List get deleteDevices; String get errorMessage; +/// Create a copy of DeleteAccountViewState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeleteAccountViewStateCopyWith get copyWith => _$DeleteAccountViewStateCopyWithImpl(this as DeleteAccountViewState, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeleteAccountViewState&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&(identical(other.password, password) || other.password == password)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isDeleted, isDeleted) || other.isDeleted == isDeleted)&&(identical(other.confirmStep, confirmStep) || other.confirmStep == confirmStep)&&const DeepCollectionEquality().equals(other.devices, devices)&&const DeepCollectionEquality().equals(other.deleteDevices, deleteDevices)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); +} + + +@override +int get hashCode => Object.hash(runtimeType,loggedUser,password,isLoading,isDeleted,confirmStep,const DeepCollectionEquality().hash(devices),const DeepCollectionEquality().hash(deleteDevices),errorMessage); + +@override +String toString() { + return 'DeleteAccountViewState(loggedUser: $loggedUser, password: $password, isLoading: $isLoading, isDeleted: $isDeleted, confirmStep: $confirmStep, devices: $devices, deleteDevices: $deleteDevices, errorMessage: $errorMessage)'; +} + + +} + +/// @nodoc +abstract mixin class $DeleteAccountViewStateCopyWith<$Res> { + factory $DeleteAccountViewStateCopyWith(DeleteAccountViewState value, $Res Function(DeleteAccountViewState) _then) = _$DeleteAccountViewStateCopyWithImpl; +@useResult +$Res call({ + UserEntity? loggedUser, String password, bool isLoading, bool isDeleted, int confirmStep, List devices, List deleteDevices, String errorMessage +}); + + +$UserEntityCopyWith<$Res>? get loggedUser; + +} +/// @nodoc +class _$DeleteAccountViewStateCopyWithImpl<$Res> + implements $DeleteAccountViewStateCopyWith<$Res> { + _$DeleteAccountViewStateCopyWithImpl(this._self, this._then); + + final DeleteAccountViewState _self; + final $Res Function(DeleteAccountViewState) _then; + +/// Create a copy of DeleteAccountViewState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? loggedUser = freezed,Object? password = null,Object? isLoading = null,Object? isDeleted = null,Object? confirmStep = null,Object? devices = null,Object? deleteDevices = null,Object? errorMessage = null,}) { + return _then(_self.copyWith( +loggedUser: freezed == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable +as UserEntity?,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable +as String,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable +as bool,isDeleted: null == isDeleted ? _self.isDeleted : isDeleted // ignore: cast_nullable_to_non_nullable +as bool,confirmStep: null == confirmStep ? _self.confirmStep : confirmStep // ignore: cast_nullable_to_non_nullable +as int,devices: null == devices ? _self.devices : devices // ignore: cast_nullable_to_non_nullable +as List,deleteDevices: null == deleteDevices ? _self.deleteDevices : deleteDevices // ignore: cast_nullable_to_non_nullable +as List,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable +as String, + )); +} +/// Create a copy of DeleteAccountViewState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$UserEntityCopyWith<$Res>? get loggedUser { + if (_self.loggedUser == null) { + return null; + } + + return $UserEntityCopyWith<$Res>(_self.loggedUser!, (value) { + return _then(_self.copyWith(loggedUser: value)); + }); +} +} + + +/// Adds pattern-matching-related methods to [DeleteAccountViewState]. +extension DeleteAccountViewStatePatterns on DeleteAccountViewState { +/// 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( _DeleteAccountViewState value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeleteAccountViewState() 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( _DeleteAccountViewState value) $default,){ +final _that = this; +switch (_that) { +case _DeleteAccountViewState(): +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( _DeleteAccountViewState value)? $default,){ +final _that = this; +switch (_that) { +case _DeleteAccountViewState() 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( UserEntity? loggedUser, String password, bool isLoading, bool isDeleted, int confirmStep, List devices, List deleteDevices, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeleteAccountViewState() when $default != null: +return $default(_that.loggedUser,_that.password,_that.isLoading,_that.isDeleted,_that.confirmStep,_that.devices,_that.deleteDevices,_that.errorMessage);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( UserEntity? loggedUser, String password, bool isLoading, bool isDeleted, int confirmStep, List devices, List deleteDevices, String errorMessage) $default,) {final _that = this; +switch (_that) { +case _DeleteAccountViewState(): +return $default(_that.loggedUser,_that.password,_that.isLoading,_that.isDeleted,_that.confirmStep,_that.devices,_that.deleteDevices,_that.errorMessage);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( UserEntity? loggedUser, String password, bool isLoading, bool isDeleted, int confirmStep, List devices, List deleteDevices, String errorMessage)? $default,) {final _that = this; +switch (_that) { +case _DeleteAccountViewState() when $default != null: +return $default(_that.loggedUser,_that.password,_that.isLoading,_that.isDeleted,_that.confirmStep,_that.devices,_that.deleteDevices,_that.errorMessage);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DeleteAccountViewState implements DeleteAccountViewState { + const _DeleteAccountViewState({this.loggedUser, this.password = '', this.isLoading = false, this.isDeleted = false, this.confirmStep = 0, final List devices = const [], final List deleteDevices = const [], this.errorMessage = ''}): _devices = devices,_deleteDevices = deleteDevices; + + +@override final UserEntity? loggedUser; +@override@JsonKey() final String password; +@override@JsonKey() final bool isLoading; +@override@JsonKey() final bool isDeleted; +@override@JsonKey() final int confirmStep; + final List _devices; +@override@JsonKey() List get devices { + if (_devices is EqualUnmodifiableListView) return _devices; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_devices); +} + + final List _deleteDevices; +@override@JsonKey() List get deleteDevices { + if (_deleteDevices is EqualUnmodifiableListView) return _deleteDevices; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_deleteDevices); +} + +@override@JsonKey() final String errorMessage; + +/// Create a copy of DeleteAccountViewState +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeleteAccountViewStateCopyWith<_DeleteAccountViewState> get copyWith => __$DeleteAccountViewStateCopyWithImpl<_DeleteAccountViewState>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeleteAccountViewState&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&(identical(other.password, password) || other.password == password)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isDeleted, isDeleted) || other.isDeleted == isDeleted)&&(identical(other.confirmStep, confirmStep) || other.confirmStep == confirmStep)&&const DeepCollectionEquality().equals(other._devices, _devices)&&const DeepCollectionEquality().equals(other._deleteDevices, _deleteDevices)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); +} + + +@override +int get hashCode => Object.hash(runtimeType,loggedUser,password,isLoading,isDeleted,confirmStep,const DeepCollectionEquality().hash(_devices),const DeepCollectionEquality().hash(_deleteDevices),errorMessage); + +@override +String toString() { + return 'DeleteAccountViewState(loggedUser: $loggedUser, password: $password, isLoading: $isLoading, isDeleted: $isDeleted, confirmStep: $confirmStep, devices: $devices, deleteDevices: $deleteDevices, errorMessage: $errorMessage)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeleteAccountViewStateCopyWith<$Res> implements $DeleteAccountViewStateCopyWith<$Res> { + factory _$DeleteAccountViewStateCopyWith(_DeleteAccountViewState value, $Res Function(_DeleteAccountViewState) _then) = __$DeleteAccountViewStateCopyWithImpl; +@override @useResult +$Res call({ + UserEntity? loggedUser, String password, bool isLoading, bool isDeleted, int confirmStep, List devices, List deleteDevices, String errorMessage +}); + + +@override $UserEntityCopyWith<$Res>? get loggedUser; + +} +/// @nodoc +class __$DeleteAccountViewStateCopyWithImpl<$Res> + implements _$DeleteAccountViewStateCopyWith<$Res> { + __$DeleteAccountViewStateCopyWithImpl(this._self, this._then); + + final _DeleteAccountViewState _self; + final $Res Function(_DeleteAccountViewState) _then; + +/// Create a copy of DeleteAccountViewState +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? loggedUser = freezed,Object? password = null,Object? isLoading = null,Object? isDeleted = null,Object? confirmStep = null,Object? devices = null,Object? deleteDevices = null,Object? errorMessage = null,}) { + return _then(_DeleteAccountViewState( +loggedUser: freezed == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable +as UserEntity?,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable +as String,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable +as bool,isDeleted: null == isDeleted ? _self.isDeleted : isDeleted // ignore: cast_nullable_to_non_nullable +as bool,confirmStep: null == confirmStep ? _self.confirmStep : confirmStep // ignore: cast_nullable_to_non_nullable +as int,devices: null == devices ? _self._devices : devices // ignore: cast_nullable_to_non_nullable +as List,deleteDevices: null == deleteDevices ? _self._deleteDevices : deleteDevices // ignore: cast_nullable_to_non_nullable +as List,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +/// Create a copy of DeleteAccountViewState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$UserEntityCopyWith<$Res>? get loggedUser { + if (_self.loggedUser == null) { + return null; + } + + return $UserEntityCopyWith<$Res>(_self.loggedUser!, (value) { + return _then(_self.copyWith(loggedUser: value)); + }); +} +} + +// dart format on diff --git a/modules/legacy/packages/legacy_shared/lib/src/data/datasource/legacy_shared_remote_datasource_impl.dart b/modules/legacy/packages/legacy_shared/lib/src/data/datasource/legacy_shared_remote_datasource_impl.dart index 30a09326..112dcc87 100644 --- a/modules/legacy/packages/legacy_shared/lib/src/data/datasource/legacy_shared_remote_datasource_impl.dart +++ b/modules/legacy/packages/legacy_shared/lib/src/data/datasource/legacy_shared_remote_datasource_impl.dart @@ -14,7 +14,7 @@ class LegacySharedRemoteDatasourceImpl implements LegacySharedRemoteDatasource { @override Future getLoggedUser({required String token}) async { try { - final response = await _repository.get>( + /*final response = await _repository.get>( '/users/api/auth/me', ); final data = response.data!['item']; @@ -22,13 +22,13 @@ class LegacySharedRemoteDatasourceImpl implements LegacySharedRemoteDatasource { throw Exception('Empty response from /auth/me'); } - final model = GetLoggedUserResponseModel.fromJson(data); - /*final model = GetLoggedUserResponseModel(item: + final model = GetLoggedUserResponseModel.fromJson(data);*/ + final model = GetLoggedUserResponseModel(item: GetLoggedUserItemResponseModel( id: '1111', firstName: 'Juan', email: 'juan@test.com', - phone: '111111111'));*/ + phone: '111111111')); return model.toEntity(); } on DioException catch (error) { throw _mapDioError( diff --git a/modules/legacy/packages/legacy_shared/lib/src/providers/logged_user_provider.dart b/modules/legacy/packages/legacy_shared/lib/src/providers/logged_user_provider.dart index dde1f9ca..b39aa974 100644 --- a/modules/legacy/packages/legacy_shared/lib/src/providers/logged_user_provider.dart +++ b/modules/legacy/packages/legacy_shared/lib/src/providers/logged_user_provider.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/src/data/models/entities/user_entity.dart'; +import 'package:legacy_shared/src/data/repositories/legacy_shared_repository.dart'; import 'legacy_shared_repository_provider.dart'; @@ -10,11 +11,11 @@ final loggedUserProvider = AsyncNotifierProvider ); class LoggedUserNotifier extends AsyncNotifier { - late final legacySharedRepository; + late final LegacySharedRepository _legacySharedRepository; @override Future build() { - legacySharedRepository = ref.read(legacySharedRepositoryProvider); - return legacySharedRepository.getLoggedUser(token: ''); + _legacySharedRepository = ref.read(legacySharedRepositoryProvider); + return _legacySharedRepository.getLoggedUser(token: ''); } } diff --git a/packages/navigation/lib/app_routes.dart b/packages/navigation/lib/app_routes.dart index 205178f4..e33ad6e5 100644 --- a/packages/navigation/lib/app_routes.dart +++ b/packages/navigation/lib/app_routes.dart @@ -24,6 +24,7 @@ class AppRoutes { static const changePassword = '$accountSettings/change_password'; static const linkedDevices = '$accountSettings/linked_devices'; static const appUsers = '$accountSettings/app_users'; + static const deleteAccount = '$accountSettings/delete_account'; static const legacyDashboard = '$legacy/dashboard'; diff --git a/packages/sf_localizations/assets/l10n/es.json b/packages/sf_localizations/assets/l10n/es.json index 1a142310..b6d9d71f 100644 --- a/packages/sf_localizations/assets/l10n/es.json +++ b/packages/sf_localizations/assets/l10n/es.json @@ -176,5 +176,13 @@ "userRole": "Rol: {role}", "copy": "copiar", "deviceIdLabel": "ID: {deviceId}", - "regCodeLabel": "Código de registro: {regCode}" + "regCodeLabel": "Código de registro: {regCode}", + "deleteAccountBody1": "Cancelar una cuenta es una operación irreversible. Confirma que todos los servicios relacionados con la cuenta se hayan gestionado correctamente.\n\nDespués de cancelar tu cuenta, ya no podrás usar esta cuenta ni recuperar ningún contenido o información que hayas agregado o vinculado (incluso si usas la misma cuenta para registrarse y volver a usar), incluídos, entre otros:\n1. No podrás iniciar sesión y usar esta cuenta.\n2. La información personal y la información histórica de tu cuenta no se recuperarán.\n3. No se pueden recuperar todos los registros de servicios de terceros que utiliza a través de la vinculación de cuenta o la vinculación de cuenta. Ya no podrás iniciar sesión y utilizar los servicios mencionados anteriormente. El amor, las monedas de oro, los puntos de terceros, los pedidos, los boletos y otros cupones que hayas recibido se considerarán abandonados y no se utilizarán.\n\nTen en cuenta que cancelar tu cuenta no significa que el comportamiento de la cuenta y las responsabilidades relacionadas antes de la cancelación de esta cuenta estén exentas o reducidas.", + "deleteAccountBody2": "Hacer clic en \"Solicitar la cancelación de mi cuenta\" significa que has leído y estás de acuerdo con la descripción anterior.", + "requestCancelButton": "Solicitar la cancelación de mi cuenta", + "verifyAccount": "Verificación de la cuenta,", + "requestCancelTitle": "Solicitud de cancelación de la cuenta", + "requestCancelBody": "1. La cancelación de la cuenta no es la recuperación operacional, asegúrate de que antes de operar la cuenta ya no se utiliza.\n2. Enviado correctamente una cancelación de la cuenta de la aplicación, la plataforma se eliminará toda la información relacionada con tu cuenta dentro de 1 hora.", + "deleteDeviceData": "Borrar toda la información relacionada con el dispositivo de {name}", + "confirm": "Confirmar" } \ 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 d0631f95..70203512 100755 --- a/packages/sf_localizations/lib/src/generated/i18n.dart +++ b/packages/sf_localizations/lib/src/generated/i18n.dart @@ -207,4 +207,12 @@ class I18n { static const String legacyRegCodeLabel = 'regCodeLabel'; static const String legacyRegCode = 'regCode'; static const String legacyDeleteAccount = 'deleteAccount'; + static const String legacyDeleteAccountBody1 = 'deleteAccountBody1'; + static const String legacyDeleteAccountBody2 = 'deleteAccountBody2'; + static const String legacyRequestCancelButton = 'requestCancelButton'; + static const String legacyVerifyAccount = 'verifyAccount'; + static const String legacyRequestCancelTitle = 'requestCancelTitle'; + static const String legacyRequestCancelBody = 'requestCancelBody'; + static const String legacyDeleteDeviceData = 'deleteDeviceData'; + static const String legacyConfirm = 'confirm'; } From 014ef1ad2615fe2981f18ed28adcde17edda4f1e Mon Sep 17 00:00:00 2001 From: aitorarana Date: Wed, 4 Mar 2026 18:00:55 +0100 Subject: [PATCH 25/25] Added translations, fixed icons, created menu buttons, refactor screens --- .idea/modules.xml | 1 + .../presentation/account_settings_screen.dart | 33 +- .../presentation/app_users_screen.dart | 27 +- .../presentation/change_password_screen.dart | 7 +- .../presentation/delete_account_screen.dart | 176 +------- .../state/delete_account_view_model.dart | 20 +- .../state/delete_account_view_state.dart | 2 +- .../delete_account_view_state.freezed.dart | 52 +-- .../presentation/widgets/confirm_dialog.dart | 229 ++++++++++ .../edit_linked_device_screen.dart | 13 +- .../presentation/linked_devices_screen.dart | 21 +- .../presentation/personal_data_screen.dart | 9 +- .../entities/send_email_request_entity.dart | 15 - .../send_email_request_entity.freezed.dart | 286 ------------ .../customer_service_repository.dart | 0 .../lib/src/domain/send_email_use_case.dart | 5 - .../src/domain/send_email_use_case_impl.dart | 13 - .../lib/src/presentation/contact_screen.dart | 261 ++++++++--- .../presentation/customer_service_screen.dart | 127 ++---- .../send_email_use_case_provider.dart | 9 - .../state/contact_view_model.dart | 4 - .../customer_service_repository_provider.dart | 8 - .../functions_remote_datasource_impl.dart | 12 +- .../presentation/contacts_screen.dart | 20 +- .../presentation/edit_contact_screen.dart | 8 +- .../features/functions/functions_screen.dart | 279 +++++------- .../functions/widgets/call_watch_dialog.dart | 5 +- .../presentation/locate_device_screen.dart | 105 +---- .../widgets/locate_device_dialog.dart | 95 ++++ .../domain/entities/picture_entity.dart | 6 +- .../entities/picture_entity.freezed.dart | 54 ++- .../domain/get_pictures_use_case_impl.dart | 10 +- .../presentation/remote_camera_screen.dart | 163 ++++--- .../remote_connection_screen.dart | 151 ++----- .../state/remote_connection_view_model.dart | 52 ++- .../state/remote_connection_view_state.dart | 3 +- .../remote_connection_view_state.freezed.dart | 45 +- .../widgets/show_picture_dialog.dart | 105 +++++ .../presentation/widgets/spy_call_dialog.dart | 156 +++++++ .../hub_remote_datasource_impl.dart | 56 ++- .../features/hub/presentation/hub_screen.dart | 421 ++++++++++-------- modules/legacy/modules/hub/pubspec.lock | 7 + modules/legacy/modules/hub/pubspec.yaml | 2 + .../legacy/modules/hub/pubspec_overrides.yaml | 3 + .../lib/src/components/menu_button.dart | 64 +++ .../lib/src/components/section_button.dart | 55 +++ .../lib/src/widgets/layouts/page_layout.dart | 17 +- packages/design_system/lib/design_system.dart | 2 +- .../lib/src/theme/theme_port.dart | 1 + .../lib/src/theme/theme_sf_adapter.dart | 1 + packages/sf_localizations/assets/l10n/en.json | 31 +- packages/sf_localizations/assets/l10n/es.json | 23 +- .../lib/src/generated/i18n.dart | 81 ++-- 53 files changed, 1845 insertions(+), 1506 deletions(-) create mode 100644 modules/legacy/modules/account/lib/src/features/delete_account/presentation/widgets/confirm_dialog.dart delete mode 100644 modules/legacy/modules/customer_service/lib/src/domain/entities/send_email_request_entity.dart delete mode 100644 modules/legacy/modules/customer_service/lib/src/domain/entities/send_email_request_entity.freezed.dart delete mode 100644 modules/legacy/modules/customer_service/lib/src/domain/repositories/customer_service_repository.dart delete mode 100644 modules/legacy/modules/customer_service/lib/src/domain/send_email_use_case.dart delete mode 100644 modules/legacy/modules/customer_service/lib/src/domain/send_email_use_case_impl.dart delete mode 100644 modules/legacy/modules/customer_service/lib/src/presentation/providers/send_email_use_case_provider.dart delete mode 100644 modules/legacy/modules/customer_service/lib/src/providers/customer_service_repository_provider.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/locate_device/presentation/widgets/locate_device_dialog.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/widgets/show_picture_dialog.dart create mode 100644 modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/widgets/spy_call_dialog.dart create mode 100644 modules/legacy/packages/legacy_shared/lib/src/components/menu_button.dart create mode 100644 modules/legacy/packages/legacy_shared/lib/src/components/section_button.dart diff --git a/.idea/modules.xml b/.idea/modules.xml index 54a5b847..09ca2fec 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -17,6 +17,7 @@ + diff --git a/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart b/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart index 56f074d8..7f83e2c8 100644 --- a/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart @@ -20,7 +20,8 @@ class AccountSettingsScreen extends ConsumerWidget { final selectedDevice = ref.watch(selectedDeviceProvider); - return PageLayout( + return LegacyPageLayout( +theme: theme, title: context.translate(I18n.accountSettings), body: SingleChildScrollView(child: Container( padding: SizeUtils.getByScreen( @@ -32,31 +33,31 @@ class AccountSettingsScreen extends ConsumerWidget { AppSectionButton( onPressed: (){navigationContract.pushTo(AppRoutes.personalData);}, icon: SFIcons.account, - text: I18n.legacyPersonalData + text: I18n.personalData ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){navigationContract.pushTo(AppRoutes.changePassword);}, icon: Icons.lock, - text: I18n.legacyChangePassword + text: I18n.changePassword ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){}, icon: Icons.add_circle_outline, - text: I18n.legacyAddNewSF + text: I18n.addNewSF ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){navigationContract.pushTo(AppRoutes.linkedDevices);}, icon: Icons.account_circle_outlined, - text: I18n.legacyLinkedDevices + text: I18n.linkedDevices ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){navigationContract.pushTo(AppRoutes.appUsers);}, icon: Icons.groups_outlined, - text: I18n.legacyAppUsers + text: I18n.appUsers ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( @@ -67,7 +68,7 @@ class AccountSettingsScreen extends ConsumerWidget { } }, icon: SFIcons.privacy, - text: I18n.legacyPrivacyPolicy + text: I18n.privacyPolicy ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( @@ -82,13 +83,13 @@ class AccountSettingsScreen extends ConsumerWidget { )); }, icon: Icons.qr_code, - text: I18n.legacyRegCode + text: I18n.regCode ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), AppSectionButton( onPressed: (){navigationContract.pushTo(AppRoutes.deleteAccount);}, icon: Icons.no_accounts, - text: I18n.legacyDeleteAccount + text: I18n.deleteAccount ), ], ), @@ -98,7 +99,7 @@ class AccountSettingsScreen extends ConsumerWidget { small: EdgeInsets.symmetric(vertical: 12, horizontal: 30), big: EdgeInsets.symmetric(vertical: 10, horizontal: 28) ), - child: PrimaryButton(text: context.translate(I18n.legacyLogOut), color: Color(0xFF588EA5)), + child: PrimaryButton(text: context.translate(I18n.logOut), color: theme.getColorFor(ThemeCode.legacyPrimary)), ) ); } @@ -118,7 +119,7 @@ class AppSectionButton extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); + final theme = ref.watch(themePortProvider); return GestureDetector( onTap: onPressed, @@ -141,7 +142,7 @@ class AppSectionButton extends ConsumerWidget { padding: EdgeInsets.all(SizeUtils.getByScreen(small: 4, big: 12)), child: Icon(icon, size: SizeUtils.getByScreen(small: 40, big: 44), - color: Color(0xFF588EA5), + color: theme.getColorFor(ThemeCode.legacyPrimary), weight: 30, ), ), @@ -206,11 +207,11 @@ class RegCodeDialog extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text(context.translate(I18n.legacyDeviceIdLabel, + Text(context.translate(I18n.deviceIdLabel, args: {'deviceId': deviceId})), TextButton( onPressed: (){Clipboard.setData(ClipboardData(text: deviceId));}, - child: Text(context.translate(I18n.legacyCopy)), + child: Text(context.translate(I18n.copy)), ) ], ), @@ -223,11 +224,11 @@ class RegCodeDialog extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text(context.translate(I18n.legacyRegCodeLabel, + Text(context.translate(I18n.regCodeLabel, args: {'regCode': regCode})), TextButton( onPressed: (){Clipboard.setData(ClipboardData(text: regCode));}, - child: Text(context.translate(I18n.legacyCopy)) + child: Text(context.translate(I18n.copy)) ) ], ) diff --git a/modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart b/modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart index ccdd457c..256a96ca 100644 --- a/modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart @@ -19,10 +19,11 @@ class AppUsersScreen extends ConsumerWidget { final theme = ref.watch(themePortProvider); - return PageLayout( + return LegacyPageLayout( +theme: theme, showEdit: true, onEditChange: vm.toggleIsEditing, - title: context.translate(I18n.legacyAppUsers), + title: context.translate(I18n.appUsers), body: Container( padding: SizeUtils.getByScreen( small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), @@ -42,8 +43,8 @@ class AppUsersScreen extends ConsumerWidget { footer: state.isEditing ? PrimaryButton( onPressed: vm.toggleIsEditing, - text: context.translate(I18n.legacySave), - color: Color(0xFF588EA5), + text: context.translate(I18n.save), + color: theme.getColorFor(ThemeCode.legacyPrimary), height: SizeUtils.getByScreen(small: 44, big: 42), ) : null ); @@ -62,7 +63,7 @@ class AppUserCard extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); + final theme = ref.watch(themePortProvider); return Container( padding: SizeUtils.getByScreen( @@ -83,7 +84,7 @@ class AppUserCard extends ConsumerWidget { padding: EdgeInsets.all(SizeUtils.getByScreen(small: 4, big: 12)), child: Icon(SFIcons.account, size: SizeUtils.getByScreen(small: 40, big: 44), - color: Color(0xFF588EA5), + color: theme.getColorFor(ThemeCode.legacyPrimary), weight: 30, ), ), @@ -98,12 +99,12 @@ class AppUserCard extends ConsumerWidget { fontWeight: FontWeight.w500 ) ), - Text(context.translate(I18n.legacyUserAccount, args: {'email': user.email}), + Text(context.translate(I18n.userAccount, args: {'email': user.email}), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 14, big: 13), ) ), - Text(context.translate(I18n.legacyUserRole, args: {'role': user.role}), + Text(context.translate(I18n.userRole, args: {'role': user.role}), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 14, big: 13), ) @@ -128,7 +129,7 @@ class AppUserCard extends ConsumerWidget { height: SizeUtils.getByScreen(small: 195, big: 185), child: Column( children: [ - Text(context.translate(I18n.legacyDeleteUserDialog), + Text(context.translate(I18n.deleteUserDialog), textAlign: TextAlign.center, style: TextStyle(fontSize: SizeUtils.getByScreen(small: 19, big: 18)), ), @@ -138,8 +139,8 @@ class AppUserCard extends ConsumerWidget { children: [ Expanded(child: PrimaryButton( onPressed: (){Navigator.pop(context);}, - text: context.translate(I18n.legacyCancel), - color: Color(0xFF588EA5), + text: context.translate(I18n.cancel), + color: theme.getColorFor(ThemeCode.legacyPrimary), height: SizeUtils.getByScreen(small: 38, big: 36), radius: SizeUtils.getByScreen(small: 32, big: 34), )), @@ -148,8 +149,8 @@ class AppUserCard extends ConsumerWidget { onPressed: (){ Navigator.pop(context); }, - text: context.translate(I18n.legacyDelete), - color: Color(0xFF588EA5), + text: context.translate(I18n.delete), + color: theme.getColorFor(ThemeCode.legacyPrimary), height: SizeUtils.getByScreen(small: 38, big: 36), radius: SizeUtils.getByScreen(small: 32, big: 34), )) diff --git a/modules/legacy/modules/account/lib/src/features/change_password/presentation/change_password_screen.dart b/modules/legacy/modules/account/lib/src/features/change_password/presentation/change_password_screen.dart index c0f8f2a6..56b6c93a 100644 --- a/modules/legacy/modules/account/lib/src/features/change_password/presentation/change_password_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/change_password/presentation/change_password_screen.dart @@ -19,8 +19,9 @@ class ChangePasswordScreen extends ConsumerWidget { final theme = ref.watch(themePortProvider); - return PageLayout( - title: context.translate(I18n.legacyChangePassword), + return LegacyPageLayout( +theme: theme, + title: context.translate(I18n.changePassword), body: Container( padding: SizeUtils.getByScreen( small: EdgeInsets.symmetric(horizontal: 28, vertical: 10), @@ -68,7 +69,7 @@ class ChangePasswordScreen extends ConsumerWidget { } }, text: context.translate('OK'), - color: Color(0xFF588EA5) + color: theme.getColorFor(ThemeCode.legacyPrimary) ), ); } diff --git a/modules/legacy/modules/account/lib/src/features/delete_account/presentation/delete_account_screen.dart b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/delete_account_screen.dart index 48ea4a75..6fbb0bdd 100644 --- a/modules/legacy/modules/account/lib/src/features/delete_account/presentation/delete_account_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/delete_account_screen.dart @@ -1,4 +1,5 @@ import 'package:account/src/features/delete_account/presentation/state/delete_account_view_model.dart'; +import 'package:account/src/features/delete_account/presentation/widgets/confirm_dialog.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -19,8 +20,9 @@ class DeleteAccountScreen extends ConsumerWidget { final state = ref.watch(deleteAccountViewModelProvider); final viewModel = ref.read(deleteAccountViewModelProvider.notifier); - return PageLayout( - title: context.translate(I18n.legacyDeleteAccount), + return LegacyPageLayout( + theme: theme, + title: context.translate(I18n.deleteAccount), body: SingleChildScrollView(child: Container( margin: EdgeInsets.symmetric(horizontal: 10), child: Column( @@ -49,18 +51,18 @@ class DeleteAccountScreen extends ConsumerWidget { color: Colors.white, ), ), - Text(context.translate(I18n.legacyDeleteAccount), + Text(context.translate(I18n.deleteAccount), style: TextStyle(fontSize: SizeUtils.getByScreen(small: 20, big: 19)), ) ], ), ), SizedBox(height: SizeUtils.getByScreen(small: 8, big: 6)), - Text(context.translate(I18n.legacyDeleteAccountBody1), + Text(context.translate(I18n.deleteAccountBody1), textAlign: TextAlign.start, ), SizedBox(height: SizeUtils.getByScreen(small: 38, big: 36)), - Text(context.translate(I18n.legacyDeleteAccountBody2), + Text(context.translate(I18n.deleteAccountBody2), textAlign: TextAlign.start, style: TextStyle( fontSize: 12, @@ -86,171 +88,11 @@ class DeleteAccountScreen extends ConsumerWidget { ); } }, - text: context.translate(I18n.legacyRequestCancelButton), - color: Color(0xFF588EA5) + text: context.translate(I18n.requestCancelButton), + color: theme.getColorFor(ThemeCode.legacyPrimary) ), ), ); } } -class ConfirmDialog extends ConsumerWidget{ - - final NavigationContract navigationContract; - - const ConfirmDialog({ - super.key, - required this.navigationContract, - }); - - @override - Widget build(BuildContext context, WidgetRef ref) { - final state = ref.watch(deleteAccountViewModelProvider); - final viewModel = ref.read(deleteAccountViewModelProvider.notifier); - - final steps = [ - Container( - height: 210, - width: 500, - color: Colors.white, - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 22, vertical: 11), - big: EdgeInsets.symmetric(horizontal: 20, vertical: 10), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text(context.translate(I18n.legacyVerifyAccount), - style: TextStyle( - fontWeight: FontWeight.w500 - ), - ), - SizedBox(height: SizeUtils.getByScreen(small: 18, big: 16)), - Text('${context.translate(I18n.email)}: ${state.loggedUser!.email}'), - SizedBox(height: SizeUtils.getByScreen(small: 8, big: 6)), - Row( - children: [ - Text('${context.translate(I18n.password)}: '), - SizedBox(width: SizeUtils.getByScreen(small: 12, big: 10)), - Expanded(child: TextField( - controller: viewModel.passwordController, - style: TextStyle(fontSize: 12), - decoration: InputDecoration(hintText: context.translate(I18n.password)), - obscureText: true, - enableSuggestions: false, - autocorrect: true, - )) - ], - ), - if (state.errorMessage.isNotEmpty) - Text( - state.errorMessage, - textAlign: TextAlign.center, - style: TextStyle( - color: Theme.of(context).colorScheme.error, - fontSize: 13, - ), - ), - SizedBox(height: SizeUtils.getByScreen(small: 12, big: 10)), - Row( - children: [ - Expanded(child: SecondaryButton( - onPressed: (){Navigator.pop(context);}, - text: context.translate(I18n.legacyCancel), - color: Color(0xFF588EA5), - height: 40, - radius: 20, - )), - SizedBox(width: SizeUtils.getByScreen(small: 12, big: 10)), - Expanded(child: PrimaryButton( - onPressed: viewModel.nextStep, - text: context.translate(I18n.accept), - color: Color(0xFF588EA5), - height: 40, - radius: 20, - )), - ], - ) - ], - ), - ), - Container( - height: 400, - width: 500, - color: Colors.white, - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 22, vertical: 11), - big: EdgeInsets.symmetric(horizontal: 20, vertical: 10), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - SizedBox(height: SizeUtils.getByScreen(small: 14, big: 12)), - Text(context.translate(I18n.legacyRequestCancelTitle), - style: TextStyle( - fontWeight: FontWeight.w500 - ), - ), - SizedBox(height: SizeUtils.getByScreen(small: 14, big: 12)), - Expanded(child: SingleChildScrollView(child: Column( - children: [ - Text(context.translate(I18n.legacyRequestCancelBody), - style: TextStyle(height: 1.5), - ), - SizedBox(height: SizeUtils.getByScreen(small: 12, big: 10)), - ...List.generate(state.devices.length, (int index) => - CheckboxListTile( - contentPadding: EdgeInsets.zero, - title: Text(context.translate(I18n.legacyDeleteDeviceData, - args: {'name': state.devices[index].carrierName} - ), - style: TextStyle(height: 0), - ), - controlAffinity: ListTileControlAffinity.leading, - value: false, - onChanged: (_){ - viewModel.updateDeleteDevice(index); - } - ) - ), - ] - ))), - SizedBox(height: SizeUtils.getByScreen(small: 12, big: 10)), - Row( - children: [ - Expanded(child: SecondaryButton( - onPressed: (){ - viewModel.resetConfirmStep(); - Navigator.pop(context); - }, - text: context.translate(I18n.legacyCancel), - color: Color(0xFF588EA5), - height: 50, - radius: 25, - )), - SizedBox(width: SizeUtils.getByScreen(small: 12, big: 10)), - Expanded(child: PrimaryButton( - onPressed: () async { - viewModel.deleteAccount(); - if (!context.mounted) return; - - navigationContract.goTo(AppRoutes.login); - }, - text: context.translate(I18n.legacyConfirm), - color: Color(0xFF588EA5), - height: 50, - radius: 25, - )), - ], - ) - ], - ), - ) - ]; - - return steps[state.confirmStep]; - } - -} diff --git a/modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_model.dart b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_model.dart index ab0700f9..d3e22667 100644 --- a/modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_model.dart +++ b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_model.dart @@ -27,29 +27,33 @@ class DeleteAccountViewModel extends Notifier { passwordController = TextEditingController(); passwordController.addListener(_onPasswordChanged); - ref.read(loggedUserProvider.future) - .then((user){ - setUser(user); - return _getLinkedDevicesUseCase.getLinkedDevices(userId: user.id); - }).then(setDevices); - ref.onDispose(disposeListeners); + Future.microtask(() => load()); + return const DeleteAccountViewState(); } + Future load() async { + final user = await ref.read(loggedUserProvider.future); + setUser(user); + + final devices = await _getLinkedDevicesUseCase.getLinkedDevices(userId: user.id); + setDevices(devices); + } + void setUser(UserEntity user) { state = state.copyWith(loggedUser: user); } void setDevices(List devices) { state = state.copyWith( - devices: devices, + deviceNames: devices.map((device) => device.carrierName).toList(), deleteDevices: List.generate(devices.length, (_)=>false), ); } - void updateDeleteDevice(int index) { + void toggleDeleteDevice(int index) { List deleteDevices = state.deleteDevices; deleteDevices[index] = !deleteDevices[index]; diff --git a/modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_state.dart b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_state.dart index 1b7e9ecb..abb076d3 100644 --- a/modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_state.dart +++ b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_state.dart @@ -11,7 +11,7 @@ abstract class DeleteAccountViewState with _$DeleteAccountViewState { @Default(false) bool isLoading, @Default(false) bool isDeleted, @Default(0) int confirmStep, - @Default([]) List devices, + @Default([]) List deviceNames, @Default([]) List deleteDevices, @Default('') String errorMessage, }) = _DeleteAccountViewState; diff --git a/modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_state.freezed.dart b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_state.freezed.dart index c0c64d1b..47f79f30 100644 --- a/modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_state.freezed.dart +++ b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/state/delete_account_view_state.freezed.dart @@ -14,7 +14,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$DeleteAccountViewState { - UserEntity? get loggedUser; String get password; bool get isLoading; bool get isDeleted; int get confirmStep; List get devices; List get deleteDevices; String get errorMessage; + UserEntity? get loggedUser; String get password; bool get isLoading; bool get isDeleted; int get confirmStep; List get deviceNames; List get deleteDevices; String get errorMessage; /// Create a copy of DeleteAccountViewState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -25,16 +25,16 @@ $DeleteAccountViewStateCopyWith get copyWith => _$Delete @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is DeleteAccountViewState&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&(identical(other.password, password) || other.password == password)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isDeleted, isDeleted) || other.isDeleted == isDeleted)&&(identical(other.confirmStep, confirmStep) || other.confirmStep == confirmStep)&&const DeepCollectionEquality().equals(other.devices, devices)&&const DeepCollectionEquality().equals(other.deleteDevices, deleteDevices)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeleteAccountViewState&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&(identical(other.password, password) || other.password == password)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isDeleted, isDeleted) || other.isDeleted == isDeleted)&&(identical(other.confirmStep, confirmStep) || other.confirmStep == confirmStep)&&const DeepCollectionEquality().equals(other.deviceNames, deviceNames)&&const DeepCollectionEquality().equals(other.deleteDevices, deleteDevices)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); } @override -int get hashCode => Object.hash(runtimeType,loggedUser,password,isLoading,isDeleted,confirmStep,const DeepCollectionEquality().hash(devices),const DeepCollectionEquality().hash(deleteDevices),errorMessage); +int get hashCode => Object.hash(runtimeType,loggedUser,password,isLoading,isDeleted,confirmStep,const DeepCollectionEquality().hash(deviceNames),const DeepCollectionEquality().hash(deleteDevices),errorMessage); @override String toString() { - return 'DeleteAccountViewState(loggedUser: $loggedUser, password: $password, isLoading: $isLoading, isDeleted: $isDeleted, confirmStep: $confirmStep, devices: $devices, deleteDevices: $deleteDevices, errorMessage: $errorMessage)'; + return 'DeleteAccountViewState(loggedUser: $loggedUser, password: $password, isLoading: $isLoading, isDeleted: $isDeleted, confirmStep: $confirmStep, deviceNames: $deviceNames, deleteDevices: $deleteDevices, errorMessage: $errorMessage)'; } @@ -45,7 +45,7 @@ abstract mixin class $DeleteAccountViewStateCopyWith<$Res> { factory $DeleteAccountViewStateCopyWith(DeleteAccountViewState value, $Res Function(DeleteAccountViewState) _then) = _$DeleteAccountViewStateCopyWithImpl; @useResult $Res call({ - UserEntity? loggedUser, String password, bool isLoading, bool isDeleted, int confirmStep, List devices, List deleteDevices, String errorMessage + UserEntity? loggedUser, String password, bool isLoading, bool isDeleted, int confirmStep, List deviceNames, List deleteDevices, String errorMessage }); @@ -62,15 +62,15 @@ class _$DeleteAccountViewStateCopyWithImpl<$Res> /// Create a copy of DeleteAccountViewState /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? loggedUser = freezed,Object? password = null,Object? isLoading = null,Object? isDeleted = null,Object? confirmStep = null,Object? devices = null,Object? deleteDevices = null,Object? errorMessage = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? loggedUser = freezed,Object? password = null,Object? isLoading = null,Object? isDeleted = null,Object? confirmStep = null,Object? deviceNames = null,Object? deleteDevices = null,Object? errorMessage = null,}) { return _then(_self.copyWith( loggedUser: freezed == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable as UserEntity?,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable as String,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable as bool,isDeleted: null == isDeleted ? _self.isDeleted : isDeleted // ignore: cast_nullable_to_non_nullable as bool,confirmStep: null == confirmStep ? _self.confirmStep : confirmStep // ignore: cast_nullable_to_non_nullable -as int,devices: null == devices ? _self.devices : devices // ignore: cast_nullable_to_non_nullable -as List,deleteDevices: null == deleteDevices ? _self.deleteDevices : deleteDevices // ignore: cast_nullable_to_non_nullable +as int,deviceNames: null == deviceNames ? _self.deviceNames : deviceNames // ignore: cast_nullable_to_non_nullable +as List,deleteDevices: null == deleteDevices ? _self.deleteDevices : deleteDevices // ignore: cast_nullable_to_non_nullable as List,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable as String, )); @@ -169,10 +169,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( UserEntity? loggedUser, String password, bool isLoading, bool isDeleted, int confirmStep, List devices, List deleteDevices, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( UserEntity? loggedUser, String password, bool isLoading, bool isDeleted, int confirmStep, List deviceNames, List deleteDevices, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _DeleteAccountViewState() when $default != null: -return $default(_that.loggedUser,_that.password,_that.isLoading,_that.isDeleted,_that.confirmStep,_that.devices,_that.deleteDevices,_that.errorMessage);case _: +return $default(_that.loggedUser,_that.password,_that.isLoading,_that.isDeleted,_that.confirmStep,_that.deviceNames,_that.deleteDevices,_that.errorMessage);case _: return orElse(); } @@ -190,10 +190,10 @@ return $default(_that.loggedUser,_that.password,_that.isLoading,_that.isDeleted, /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( UserEntity? loggedUser, String password, bool isLoading, bool isDeleted, int confirmStep, List devices, List deleteDevices, String errorMessage) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( UserEntity? loggedUser, String password, bool isLoading, bool isDeleted, int confirmStep, List deviceNames, List deleteDevices, String errorMessage) $default,) {final _that = this; switch (_that) { case _DeleteAccountViewState(): -return $default(_that.loggedUser,_that.password,_that.isLoading,_that.isDeleted,_that.confirmStep,_that.devices,_that.deleteDevices,_that.errorMessage);case _: +return $default(_that.loggedUser,_that.password,_that.isLoading,_that.isDeleted,_that.confirmStep,_that.deviceNames,_that.deleteDevices,_that.errorMessage);case _: throw StateError('Unexpected subclass'); } @@ -210,10 +210,10 @@ return $default(_that.loggedUser,_that.password,_that.isLoading,_that.isDeleted, /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( UserEntity? loggedUser, String password, bool isLoading, bool isDeleted, int confirmStep, List devices, List deleteDevices, String errorMessage)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( UserEntity? loggedUser, String password, bool isLoading, bool isDeleted, int confirmStep, List deviceNames, List deleteDevices, String errorMessage)? $default,) {final _that = this; switch (_that) { case _DeleteAccountViewState() when $default != null: -return $default(_that.loggedUser,_that.password,_that.isLoading,_that.isDeleted,_that.confirmStep,_that.devices,_that.deleteDevices,_that.errorMessage);case _: +return $default(_that.loggedUser,_that.password,_that.isLoading,_that.isDeleted,_that.confirmStep,_that.deviceNames,_that.deleteDevices,_that.errorMessage);case _: return null; } @@ -225,7 +225,7 @@ return $default(_that.loggedUser,_that.password,_that.isLoading,_that.isDeleted, class _DeleteAccountViewState implements DeleteAccountViewState { - const _DeleteAccountViewState({this.loggedUser, this.password = '', this.isLoading = false, this.isDeleted = false, this.confirmStep = 0, final List devices = const [], final List deleteDevices = const [], this.errorMessage = ''}): _devices = devices,_deleteDevices = deleteDevices; + const _DeleteAccountViewState({this.loggedUser, this.password = '', this.isLoading = false, this.isDeleted = false, this.confirmStep = 0, final List deviceNames = const [], final List deleteDevices = const [], this.errorMessage = ''}): _deviceNames = deviceNames,_deleteDevices = deleteDevices; @override final UserEntity? loggedUser; @@ -233,11 +233,11 @@ class _DeleteAccountViewState implements DeleteAccountViewState { @override@JsonKey() final bool isLoading; @override@JsonKey() final bool isDeleted; @override@JsonKey() final int confirmStep; - final List _devices; -@override@JsonKey() List get devices { - if (_devices is EqualUnmodifiableListView) return _devices; + final List _deviceNames; +@override@JsonKey() List get deviceNames { + if (_deviceNames is EqualUnmodifiableListView) return _deviceNames; // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_devices); + return EqualUnmodifiableListView(_deviceNames); } final List _deleteDevices; @@ -259,16 +259,16 @@ _$DeleteAccountViewStateCopyWith<_DeleteAccountViewState> get copyWith => __$Del @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeleteAccountViewState&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&(identical(other.password, password) || other.password == password)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isDeleted, isDeleted) || other.isDeleted == isDeleted)&&(identical(other.confirmStep, confirmStep) || other.confirmStep == confirmStep)&&const DeepCollectionEquality().equals(other._devices, _devices)&&const DeepCollectionEquality().equals(other._deleteDevices, _deleteDevices)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeleteAccountViewState&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&(identical(other.password, password) || other.password == password)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isDeleted, isDeleted) || other.isDeleted == isDeleted)&&(identical(other.confirmStep, confirmStep) || other.confirmStep == confirmStep)&&const DeepCollectionEquality().equals(other._deviceNames, _deviceNames)&&const DeepCollectionEquality().equals(other._deleteDevices, _deleteDevices)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); } @override -int get hashCode => Object.hash(runtimeType,loggedUser,password,isLoading,isDeleted,confirmStep,const DeepCollectionEquality().hash(_devices),const DeepCollectionEquality().hash(_deleteDevices),errorMessage); +int get hashCode => Object.hash(runtimeType,loggedUser,password,isLoading,isDeleted,confirmStep,const DeepCollectionEquality().hash(_deviceNames),const DeepCollectionEquality().hash(_deleteDevices),errorMessage); @override String toString() { - return 'DeleteAccountViewState(loggedUser: $loggedUser, password: $password, isLoading: $isLoading, isDeleted: $isDeleted, confirmStep: $confirmStep, devices: $devices, deleteDevices: $deleteDevices, errorMessage: $errorMessage)'; + return 'DeleteAccountViewState(loggedUser: $loggedUser, password: $password, isLoading: $isLoading, isDeleted: $isDeleted, confirmStep: $confirmStep, deviceNames: $deviceNames, deleteDevices: $deleteDevices, errorMessage: $errorMessage)'; } @@ -279,7 +279,7 @@ abstract mixin class _$DeleteAccountViewStateCopyWith<$Res> implements $DeleteAc factory _$DeleteAccountViewStateCopyWith(_DeleteAccountViewState value, $Res Function(_DeleteAccountViewState) _then) = __$DeleteAccountViewStateCopyWithImpl; @override @useResult $Res call({ - UserEntity? loggedUser, String password, bool isLoading, bool isDeleted, int confirmStep, List devices, List deleteDevices, String errorMessage + UserEntity? loggedUser, String password, bool isLoading, bool isDeleted, int confirmStep, List deviceNames, List deleteDevices, String errorMessage }); @@ -296,15 +296,15 @@ class __$DeleteAccountViewStateCopyWithImpl<$Res> /// Create a copy of DeleteAccountViewState /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? loggedUser = freezed,Object? password = null,Object? isLoading = null,Object? isDeleted = null,Object? confirmStep = null,Object? devices = null,Object? deleteDevices = null,Object? errorMessage = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? loggedUser = freezed,Object? password = null,Object? isLoading = null,Object? isDeleted = null,Object? confirmStep = null,Object? deviceNames = null,Object? deleteDevices = null,Object? errorMessage = null,}) { return _then(_DeleteAccountViewState( loggedUser: freezed == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable as UserEntity?,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable as String,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable as bool,isDeleted: null == isDeleted ? _self.isDeleted : isDeleted // ignore: cast_nullable_to_non_nullable as bool,confirmStep: null == confirmStep ? _self.confirmStep : confirmStep // ignore: cast_nullable_to_non_nullable -as int,devices: null == devices ? _self._devices : devices // ignore: cast_nullable_to_non_nullable -as List,deleteDevices: null == deleteDevices ? _self._deleteDevices : deleteDevices // ignore: cast_nullable_to_non_nullable +as int,deviceNames: null == deviceNames ? _self._deviceNames : deviceNames // ignore: cast_nullable_to_non_nullable +as List,deleteDevices: null == deleteDevices ? _self._deleteDevices : deleteDevices // ignore: cast_nullable_to_non_nullable as List,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable as String, )); diff --git a/modules/legacy/modules/account/lib/src/features/delete_account/presentation/widgets/confirm_dialog.dart b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/widgets/confirm_dialog.dart new file mode 100644 index 00000000..4e6956c4 --- /dev/null +++ b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/widgets/confirm_dialog.dart @@ -0,0 +1,229 @@ +import 'package:account/src/features/delete_account/presentation/state/delete_account_view_model.dart'; +import 'package:design_system/design_system.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:navigation/app_routes.dart'; +import 'package:navigation/navigation_contract.dart'; +import 'package:sf_localizations/sf_localizations.dart'; +import 'package:utils/utils.dart'; + +class ConfirmDialog extends ConsumerWidget{ + + final NavigationContract navigationContract; + + const ConfirmDialog({ + super.key, + required this.navigationContract, + }); + + @override + Widget build(BuildContext context, WidgetRef ref) { + + final theme = ref.watch(themePortProvider); + + final state = ref.watch(deleteAccountViewModelProvider); + final viewModel = ref.read(deleteAccountViewModelProvider.notifier); + + final steps = [ + VerifyAccountStep( + theme: theme, + email: state.loggedUser!.email, + passwordController: viewModel.passwordController, + errorMessage: state.errorMessage, + nextStep: viewModel.nextStep, + ), + ConfirmRequestStep( + theme: theme, + toggleDeleteDevice: viewModel.toggleDeleteDevice, + deviceNames: state.deviceNames, + onCancel: (){ + viewModel.resetConfirmStep(); + Navigator.pop(context); + }, + onSubmit: () async { + viewModel.deleteAccount(); + if (!context.mounted) return; + + navigationContract.goTo(AppRoutes.login); + }, + ), + ]; + + return steps[state.confirmStep]; + } +} + +class VerifyAccountStep extends StatelessWidget { + + final String email; + final TextEditingController passwordController; + final String errorMessage; + final VoidCallback nextStep; + final ThemePort theme; + + const VerifyAccountStep({ + required this.email, + required this.passwordController, + required this.errorMessage, + required this.nextStep, + required this.theme, + }); + + @override + Widget build(BuildContext context) { + return Container( + height: 210, + width: 500, + color: Colors.white, + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 11), + big: EdgeInsets.symmetric(horizontal: 20, vertical: 10), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(context.translate(I18n.verifyAccount), + style: TextStyle( + fontWeight: FontWeight.w500 + ), + ), + SizedBox(height: SizeUtils.getByScreen(small: 18, big: 16)), + Text('${context.translate(I18n.email)}: ${email}'), + SizedBox(height: SizeUtils.getByScreen(small: 8, big: 6)), + Row( + children: [ + Text('${context.translate(I18n.password)}: '), + SizedBox(width: SizeUtils.getByScreen(small: 12, big: 10)), + Expanded(child: TextField( + controller: passwordController, + style: TextStyle(fontSize: 12), + decoration: InputDecoration(hintText: context.translate(I18n.password)), + obscureText: true, + enableSuggestions: false, + autocorrect: true, + )) + ], + ), + if (errorMessage.isNotEmpty) + Text( + errorMessage, + textAlign: TextAlign.center, + style: TextStyle( + color: Theme.of(context).colorScheme.error, + fontSize: 13, + ), + ), + SizedBox(height: SizeUtils.getByScreen(small: 12, big: 10)), + Row( + children: [ + Expanded(child: SecondaryButton( + onPressed: (){Navigator.pop(context);}, + text: context.translate(I18n.cancel), + color: theme.getColorFor(ThemeCode.legacyPrimary), + height: 40, + radius: 20, + )), + SizedBox(width: SizeUtils.getByScreen(small: 12, big: 10)), + Expanded(child: PrimaryButton( + onPressed: nextStep, + text: context.translate(I18n.accept), + color: theme.getColorFor(ThemeCode.legacyPrimary), + height: 40, + radius: 20, + )), + ], + ) + ], + ), + ); + } + +} + +class ConfirmRequestStep extends StatelessWidget { + + final ThemePort theme; + final Function toggleDeleteDevice; + final List deviceNames; + final VoidCallback onCancel; + final VoidCallback onSubmit; + + const ConfirmRequestStep({ + required this.theme, + required this.toggleDeleteDevice, + required this.deviceNames, + required this.onCancel, + required this.onSubmit, + }); + + @override + Widget build(BuildContext context) { + return Container( + height: 400, + width: 500, + color: Colors.white, + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 11), + big: EdgeInsets.symmetric(horizontal: 20, vertical: 10), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SizedBox(height: SizeUtils.getByScreen(small: 14, big: 12)), + Text(context.translate(I18n.requestCancelTitle), + style: TextStyle( + fontWeight: FontWeight.w500 + ), + ), + SizedBox(height: SizeUtils.getByScreen(small: 14, big: 12)), + Expanded(child: SingleChildScrollView(child: Column( + children: [ + Text(context.translate(I18n.requestCancelBody), + style: TextStyle(height: 1.5), + ), + SizedBox(height: SizeUtils.getByScreen(small: 12, big: 10)), + ...List.generate(deviceNames.length, (int index) => + CheckboxListTile( + contentPadding: EdgeInsets.zero, + title: Text(context.translate(I18n.deleteDeviceData, + args: {'name': deviceNames[index]} + ), + style: TextStyle(height: 0), + ), + controlAffinity: ListTileControlAffinity.leading, + value: false, + onChanged: (_){ + toggleDeleteDevice(index); + } + ) + ), + ] + ))), + SizedBox(height: SizeUtils.getByScreen(small: 12, big: 10)), + Row( + children: [ + Expanded(child: SecondaryButton( + onPressed: onCancel, + text: context.translate(I18n.cancel), + color: theme.getColorFor(ThemeCode.legacyPrimary), + height: 50, + radius: 25, + )), + SizedBox(width: SizeUtils.getByScreen(small: 12, big: 10)), + Expanded(child: PrimaryButton( + onPressed: onSubmit, + text: context.translate(I18n.confirm), + color: theme.getColorFor(ThemeCode.legacyPrimary), + height: 50, + radius: 25, + )), + ], + ) + ], + ), + ); + } + +} \ No newline at end of file diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart index 3a29e975..bfd77859 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart @@ -22,8 +22,9 @@ class EditLinkedDeviceScreen extends ConsumerWidget { final theme = ref.watch(themePortProvider); - return /*PageLayout( - title: context.translate(I18n.legacyEditDeviceTitle), + return /*LegacyPageLayout( +theme: theme, + title: context.translate(I18n.editDeviceTitle), showEdit: true, onEditChange: vm.toggleIsEditing, body: body @@ -43,7 +44,7 @@ class EditLinkedDeviceScreen extends ConsumerWidget { IconButton(onPressed: () {Navigator.pop(context);}, icon: Icon(Icons.arrow_back)), Center( - child: Text(context.translate(I18n.legacyEditDeviceTitle), + child: Text(context.translate(I18n.editDeviceTitle), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 28, big: 27) ), @@ -94,14 +95,14 @@ class EditLinkedDeviceScreen extends ConsumerWidget { CustomTextField( controller: vm.deviceNameController, hint: device.carrierName, - label: context.translate(I18n.legacyName), + label: context.translate(I18n.name), ) ], ), PrimaryButton( onPressed: (){vm.updateDevice(device);}, - text: context.translate(I18n.legacySave), - color: Color(0xFF588EA5) + text: context.translate(I18n.save), + color: theme.getColorFor(ThemeCode.legacyPrimary) ) ], )) diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart index c5eac3f4..7fc6c5b1 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart @@ -21,8 +21,9 @@ class LinkedDevicesScreen extends ConsumerWidget { final theme = ref.watch(themePortProvider); - return PageLayout( - title: context.translate(I18n.legacyLinkedDevices), + return LegacyPageLayout( +theme: theme, + title: context.translate(I18n.linkedDevices), showEdit: true, onEditChange: vm.toggleIsEditing, body: Container( @@ -60,7 +61,7 @@ class LinkedDeviceCard extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); + final theme = ref.watch(themePortProvider); return Container( padding: SizeUtils.getByScreen( @@ -81,7 +82,7 @@ class LinkedDeviceCard extends ConsumerWidget { padding: EdgeInsets.all(SizeUtils.getByScreen(small: 4, big: 12)), child: Icon(SFIcons.watch, size: SizeUtils.getByScreen(small: 40, big: 44), - color: Color(0xFF588EA5), + color: theme.getColorFor(ThemeCode.legacyPrimary), weight: 30, ), ), @@ -121,7 +122,7 @@ class LinkedDeviceCard extends ConsumerWidget { height: SizeUtils.getByScreen(small: 195, big: 185), child: Column( children: [ - Text(context.translate(I18n.legacyDeleteDeviceDialog), + Text(context.translate(I18n.deleteDeviceDialog), textAlign: TextAlign.center, style: TextStyle(fontSize: SizeUtils.getByScreen(small: 19, big: 18)), ), @@ -131,8 +132,8 @@ class LinkedDeviceCard extends ConsumerWidget { children: [ Expanded(child: PrimaryButton( onPressed: (){Navigator.pop(context);}, - text: context.translate(I18n.legacyCancel), - color: Color(0xFF588EA5), + text: context.translate(I18n.cancel), + color: theme.getColorFor(ThemeCode.legacyPrimary), height: SizeUtils.getByScreen(small: 38, big: 36), radius: SizeUtils.getByScreen(small: 32, big: 34), )), @@ -142,8 +143,8 @@ class LinkedDeviceCard extends ConsumerWidget { await onDelete(); Navigator.pop(context); }, - text: context.translate(I18n.legacyDelete), - color: Color(0xFF588EA5), + text: context.translate(I18n.delete), + color: theme.getColorFor(ThemeCode.legacyPrimary), height: SizeUtils.getByScreen(small: 38, big: 36), radius: SizeUtils.getByScreen(small: 32, big: 34), )) @@ -162,7 +163,7 @@ class LinkedDeviceCard extends ConsumerWidget { SizedBox(width: SizeUtils.getByScreen(small: 16, big: 14)), DecoratedBox( decoration: BoxDecoration( - color: Color(0xFF588EA5), + color: theme.getColorFor(ThemeCode.legacyPrimary), borderRadius: BorderRadius.all(Radius.circular(12)), ), child: diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/personal_data_screen.dart b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/personal_data_screen.dart index 92ac5845..e3a29e85 100644 --- a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/personal_data_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/personal_data_screen.dart @@ -20,8 +20,9 @@ class PersonalDataScreen extends ConsumerWidget { final theme = ref.watch(themePortProvider); - return PageLayout( - title: context.translate(I18n.legacyPersonalData), + return LegacyPageLayout( +theme: theme, + title: context.translate(I18n.personalData), body: Container( padding: SizeUtils.getByScreen( small: EdgeInsets.symmetric(horizontal: 48, vertical: 10), @@ -86,8 +87,8 @@ class PersonalDataScreen extends ConsumerWidget { ), footer: PrimaryButton( onPressed: vm.updateUser, - text: context.translate(I18n.legacySubmit), - color: Color(0xFF588EA5) + text: context.translate(I18n.submit), + color: theme.getColorFor(ThemeCode.legacyPrimary) ), ); } diff --git a/modules/legacy/modules/customer_service/lib/src/domain/entities/send_email_request_entity.dart b/modules/legacy/modules/customer_service/lib/src/domain/entities/send_email_request_entity.dart deleted file mode 100644 index 55204429..00000000 --- a/modules/legacy/modules/customer_service/lib/src/domain/entities/send_email_request_entity.dart +++ /dev/null @@ -1,15 +0,0 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; - -part 'send_email_request_entity.freezed.dart'; - -@freezed -abstract class SendEmailRequestEntity with _$SendEmailRequestEntity{ - const factory SendEmailRequestEntity({ - required String country, - required String channel, - required String name, - required String email, - required String subject, - required String body, - }) = _SendEmailRequestEntity; -} \ No newline at end of file diff --git a/modules/legacy/modules/customer_service/lib/src/domain/entities/send_email_request_entity.freezed.dart b/modules/legacy/modules/customer_service/lib/src/domain/entities/send_email_request_entity.freezed.dart deleted file mode 100644 index a92da8c7..00000000 --- a/modules/legacy/modules/customer_service/lib/src/domain/entities/send_email_request_entity.freezed.dart +++ /dev/null @@ -1,286 +0,0 @@ -// 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 'send_email_request_entity.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; -/// @nodoc -mixin _$SendEmailRequestEntity { - - String get country; String get channel; String get name; String get email; String get subject; String get body; -/// Create a copy of SendEmailRequestEntity -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$SendEmailRequestEntityCopyWith get copyWith => _$SendEmailRequestEntityCopyWithImpl(this as SendEmailRequestEntity, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is SendEmailRequestEntity&&(identical(other.country, country) || other.country == country)&&(identical(other.channel, channel) || other.channel == channel)&&(identical(other.name, name) || other.name == name)&&(identical(other.email, email) || other.email == email)&&(identical(other.subject, subject) || other.subject == subject)&&(identical(other.body, body) || other.body == body)); -} - - -@override -int get hashCode => Object.hash(runtimeType,country,channel,name,email,subject,body); - -@override -String toString() { - return 'SendEmailRequestEntity(country: $country, channel: $channel, name: $name, email: $email, subject: $subject, body: $body)'; -} - - -} - -/// @nodoc -abstract mixin class $SendEmailRequestEntityCopyWith<$Res> { - factory $SendEmailRequestEntityCopyWith(SendEmailRequestEntity value, $Res Function(SendEmailRequestEntity) _then) = _$SendEmailRequestEntityCopyWithImpl; -@useResult -$Res call({ - String country, String channel, String name, String email, String subject, String body -}); - - - - -} -/// @nodoc -class _$SendEmailRequestEntityCopyWithImpl<$Res> - implements $SendEmailRequestEntityCopyWith<$Res> { - _$SendEmailRequestEntityCopyWithImpl(this._self, this._then); - - final SendEmailRequestEntity _self; - final $Res Function(SendEmailRequestEntity) _then; - -/// Create a copy of SendEmailRequestEntity -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? country = null,Object? channel = null,Object? name = null,Object? email = null,Object? subject = null,Object? body = null,}) { - return _then(_self.copyWith( -country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable -as String,channel: null == channel ? _self.channel : channel // ignore: cast_nullable_to_non_nullable -as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable -as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable -as String,subject: null == subject ? _self.subject : subject // ignore: cast_nullable_to_non_nullable -as String,body: null == body ? _self.body : body // ignore: cast_nullable_to_non_nullable -as String, - )); -} - -} - - -/// Adds pattern-matching-related methods to [SendEmailRequestEntity]. -extension SendEmailRequestEntityPatterns on SendEmailRequestEntity { -/// 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( _SendEmailRequestEntity value)? $default,{required TResult orElse(),}){ -final _that = this; -switch (_that) { -case _SendEmailRequestEntity() 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( _SendEmailRequestEntity value) $default,){ -final _that = this; -switch (_that) { -case _SendEmailRequestEntity(): -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( _SendEmailRequestEntity value)? $default,){ -final _that = this; -switch (_that) { -case _SendEmailRequestEntity() 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 country, String channel, String name, String email, String subject, String body)? $default,{required TResult orElse(),}) {final _that = this; -switch (_that) { -case _SendEmailRequestEntity() when $default != null: -return $default(_that.country,_that.channel,_that.name,_that.email,_that.subject,_that.body);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 country, String channel, String name, String email, String subject, String body) $default,) {final _that = this; -switch (_that) { -case _SendEmailRequestEntity(): -return $default(_that.country,_that.channel,_that.name,_that.email,_that.subject,_that.body);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 country, String channel, String name, String email, String subject, String body)? $default,) {final _that = this; -switch (_that) { -case _SendEmailRequestEntity() when $default != null: -return $default(_that.country,_that.channel,_that.name,_that.email,_that.subject,_that.body);case _: - return null; - -} -} - -} - -/// @nodoc - - -class _SendEmailRequestEntity implements SendEmailRequestEntity { - const _SendEmailRequestEntity({required this.country, required this.channel, required this.name, required this.email, required this.subject, required this.body}); - - -@override final String country; -@override final String channel; -@override final String name; -@override final String email; -@override final String subject; -@override final String body; - -/// Create a copy of SendEmailRequestEntity -/// with the given fields replaced by the non-null parameter values. -@override @JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -_$SendEmailRequestEntityCopyWith<_SendEmailRequestEntity> get copyWith => __$SendEmailRequestEntityCopyWithImpl<_SendEmailRequestEntity>(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _SendEmailRequestEntity&&(identical(other.country, country) || other.country == country)&&(identical(other.channel, channel) || other.channel == channel)&&(identical(other.name, name) || other.name == name)&&(identical(other.email, email) || other.email == email)&&(identical(other.subject, subject) || other.subject == subject)&&(identical(other.body, body) || other.body == body)); -} - - -@override -int get hashCode => Object.hash(runtimeType,country,channel,name,email,subject,body); - -@override -String toString() { - return 'SendEmailRequestEntity(country: $country, channel: $channel, name: $name, email: $email, subject: $subject, body: $body)'; -} - - -} - -/// @nodoc -abstract mixin class _$SendEmailRequestEntityCopyWith<$Res> implements $SendEmailRequestEntityCopyWith<$Res> { - factory _$SendEmailRequestEntityCopyWith(_SendEmailRequestEntity value, $Res Function(_SendEmailRequestEntity) _then) = __$SendEmailRequestEntityCopyWithImpl; -@override @useResult -$Res call({ - String country, String channel, String name, String email, String subject, String body -}); - - - - -} -/// @nodoc -class __$SendEmailRequestEntityCopyWithImpl<$Res> - implements _$SendEmailRequestEntityCopyWith<$Res> { - __$SendEmailRequestEntityCopyWithImpl(this._self, this._then); - - final _SendEmailRequestEntity _self; - final $Res Function(_SendEmailRequestEntity) _then; - -/// Create a copy of SendEmailRequestEntity -/// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? country = null,Object? channel = null,Object? name = null,Object? email = null,Object? subject = null,Object? body = null,}) { - return _then(_SendEmailRequestEntity( -country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable -as String,channel: null == channel ? _self.channel : channel // ignore: cast_nullable_to_non_nullable -as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable -as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable -as String,subject: null == subject ? _self.subject : subject // ignore: cast_nullable_to_non_nullable -as String,body: null == body ? _self.body : body // ignore: cast_nullable_to_non_nullable -as String, - )); -} - - -} - -// dart format on diff --git a/modules/legacy/modules/customer_service/lib/src/domain/repositories/customer_service_repository.dart b/modules/legacy/modules/customer_service/lib/src/domain/repositories/customer_service_repository.dart deleted file mode 100644 index e69de29b..00000000 diff --git a/modules/legacy/modules/customer_service/lib/src/domain/send_email_use_case.dart b/modules/legacy/modules/customer_service/lib/src/domain/send_email_use_case.dart deleted file mode 100644 index e07870df..00000000 --- a/modules/legacy/modules/customer_service/lib/src/domain/send_email_use_case.dart +++ /dev/null @@ -1,5 +0,0 @@ -import 'package:customer_service/src/domain/entities/send_email_request_entity.dart'; - -abstract class SendEmailUseCase { - Future sendEmail({required SendEmailRequestEntity request}); -} diff --git a/modules/legacy/modules/customer_service/lib/src/domain/send_email_use_case_impl.dart b/modules/legacy/modules/customer_service/lib/src/domain/send_email_use_case_impl.dart deleted file mode 100644 index 86002122..00000000 --- a/modules/legacy/modules/customer_service/lib/src/domain/send_email_use_case_impl.dart +++ /dev/null @@ -1,13 +0,0 @@ -import 'package:customer_service/src/domain/entities/send_email_request_entity.dart'; -import 'package:customer_service/src/domain/send_email_use_case.dart'; - -class SendEmailUseCaseImpl implements SendEmailUseCase { - //SignUpUseCaseImpl(this._repository); - - //final AuthRepository _repository; - - @override - Future sendEmail({required SendEmailRequestEntity request}) async { - //return _repository.signUp(request: request); - } -} diff --git a/modules/legacy/modules/customer_service/lib/src/presentation/contact_screen.dart b/modules/legacy/modules/customer_service/lib/src/presentation/contact_screen.dart index ce9f2eac..9ece614c 100644 --- a/modules/legacy/modules/customer_service/lib/src/presentation/contact_screen.dart +++ b/modules/legacy/modules/customer_service/lib/src/presentation/contact_screen.dart @@ -16,10 +16,45 @@ class ContactScreen extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final theme = ref.watch(themePortProvider); - final vm = ref.read(contactViewModelProvider.notifier); - final viewState = ref.watch(contactViewModelProvider); + final viewModel = ref.read(contactViewModelProvider.notifier); - final List country = [ + return LegacyPageLayout( + theme: theme, + title: context.translate(I18n.contactTitle), + body: Padding( + padding: EdgeInsets.symmetric( + horizontal: SizeUtils.getByScreen(small: 38, big: 36) + ), + child: SingleChildScrollView(child: Column( + children: [ + const _CountrySection(), + SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), + const _ChannelSection(), + SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), + const _NameSection(), + SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), + const _EmailSection(), + SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), + const _SubjectSection(), + SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), + _MessageSection(onSubmit: viewModel.sendEmail), + const _ErrorMessageSection(), + ], + )), + ), + footer: _SendSection(onSend: viewModel.sendEmail), + ); + } +} + +class _CountrySection extends ConsumerWidget { + + const _CountrySection(); + + @override + Widget build(BuildContext context, WidgetRef ref) { + + final List countries = [ 'España', 'Portugal', 'France', @@ -28,81 +63,163 @@ class ContactScreen extends ConsumerWidget { context.translate(I18n.other), ]; - final List channel = [ + final vm = ref.read(contactViewModelProvider.notifier); + + return CustomDropdown( + items: countries.map(Text.new).toList(growable: false), + onChanged: (x){vm.setCountry(x);}, + hint: context.translate(I18n.selectCountry) + ); + } +} + +class _ChannelSection extends ConsumerWidget { + + const _ChannelSection(); + + @override + Widget build(BuildContext context, WidgetRef ref) { + + final List channels = [ context.translate(I18n.channelOnline), context.translate(I18n.channelAmazon), context.translate(I18n.channelStore), context.translate(I18n.other), ]; - return PageLayout( - title: context.translate(I18n.contactTitle), - body: Container( - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 38), - big: EdgeInsets.symmetric(horizontal: 36) - ), - child: SingleChildScrollView(child: Column( - children: [ - CustomDropdown( - items: country.map(Text.new).toList(growable: false), - onChanged: (x){vm.setCountry(x);}, - hint: context.translate(I18n.selectCountry) - ), - SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), - CustomDropdown( - items: channel.map(Text.new).toList(growable: false), - onChanged: (x){vm.setChannel(x);}, - hint: context.translate(I18n.selectChannel) - ), - SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), - CustomTextField( - controller: vm.nameController, - hint: context.translate(I18n.enterName), - ), - SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), - CustomTextField( - controller: vm.emailController, - keyboardType: TextInputType.emailAddress, - hint: context.translate(I18n.enterEmail), - ), - SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), - CustomTextField( - controller: vm.subjectController, - hint: context.translate(I18n.enterSubject), - ), - SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)), - CustomTextField( - controller: vm.bodyController, - keyboardType: TextInputType.multiline, - hint: context.translate(I18n.enterMessage), - lines: 8, - ), - if (viewState.errorMessage.isNotEmpty) ...[ - const SizedBox(height: 4), - Text( - viewState.errorMessage, - textAlign: TextAlign.center, - style: const TextStyle( - color: Color.fromRGBO(239, 17, 17, 1), - fontSize: 12, - ), - ), - ], - ], - )), - ), - footer: Container( - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 38, vertical: 14), - big: EdgeInsets.symmetric(horizontal: 36, vertical: 12) - ), - child: PrimaryButton( - onPressed: vm.sendEmail, - text: context.translate(I18n.sendEmail), - color: theme.getColorFor(ThemeCode.buttonPrimary) - ) - ), + final vm = ref.read(contactViewModelProvider.notifier); + + return CustomDropdown( + items: channels.map(Text.new).toList(growable: false), + onChanged: (x){vm.setChannel(x);}, + hint: context.translate(I18n.selectChannel) ); } +} + +class _NameSection extends ConsumerWidget { + + const _NameSection(); + + @override + Widget build(BuildContext context, WidgetRef ref) { + + final vm = ref.read(contactViewModelProvider.notifier); + + return CustomTextField( + controller: vm.nameController, + hint: context.translate(I18n.enterName), + ); + } +} + +class _EmailSection extends ConsumerWidget { + + const _EmailSection(); + + @override + Widget build(BuildContext context, WidgetRef ref) { + + final vm = ref.read(contactViewModelProvider.notifier); + + return CustomTextField( + controller: vm.emailController, + keyboardType: TextInputType.emailAddress, + hint: context.translate(I18n.enterEmail), + ); + } +} + +class _SubjectSection extends ConsumerWidget { + + const _SubjectSection(); + + @override + Widget build(BuildContext context, WidgetRef ref) { + + final vm = ref.read(contactViewModelProvider.notifier); + + return CustomTextField( + controller: vm.subjectController, + hint: context.translate(I18n.enterSubject), + ); + } +} + +class _MessageSection extends ConsumerWidget { + + final VoidCallback onSubmit; + + const _MessageSection({ + required this.onSubmit, + }); + + @override + Widget build(BuildContext context, WidgetRef ref) { + + final vm = ref.read(contactViewModelProvider.notifier); + + return CustomTextField( + controller: vm.bodyController, + keyboardType: TextInputType.multiline, + hint: context.translate(I18n.enterMessage), + lines: 8, + onSubmitted: (_) => onSubmit(), + ); + } +} + +class _ErrorMessageSection extends ConsumerWidget { + + const _ErrorMessageSection(); + + @override + Widget build(BuildContext context, WidgetRef ref) { + + final viewState = ref.watch(contactViewModelProvider); + + if (viewState.errorMessage.isNotEmpty) { + return Column( + children: [ + const SizedBox(height: 4), + Text( + viewState.errorMessage, + textAlign: TextAlign.center, + style: const TextStyle( + color: Color.fromRGBO(239, 17, 17, 1), + fontSize: 12, + ), + ), + ], + ); + } else return SizedBox.shrink(); + } +} + +class _SendSection extends ConsumerWidget { + + final VoidCallback onSend; + + const _SendSection({ + required this.onSend, + }); + + @override + Widget build(BuildContext context, WidgetRef ref) { + + final theme = ref.read(themePortProvider); + + return Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 38, vertical: 14), + big: EdgeInsets.symmetric(horizontal: 36, vertical: 12) + ), + child: PrimaryButton( + onPressed: onSend, + text: context.translate(I18n.sendEmail), + color: theme.getColorFor(ThemeCode.buttonPrimary) + ) + ); + } + } \ No newline at end of file diff --git a/modules/legacy/modules/customer_service/lib/src/presentation/customer_service_screen.dart b/modules/legacy/modules/customer_service/lib/src/presentation/customer_service_screen.dart index b984c077..53b0e3b0 100644 --- a/modules/legacy/modules/customer_service/lib/src/presentation/customer_service_screen.dart +++ b/modules/legacy/modules/customer_service/lib/src/presentation/customer_service_screen.dart @@ -15,14 +15,15 @@ class CustomerServiceScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - // final theme = ref.watch(themePortProvider); + final theme = ref.watch(themePortProvider); - return PageLayout( + return LegacyPageLayout( + theme: theme, title: context.translate(I18n.customerService), body: Container( padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 18), - big: EdgeInsets.symmetric(horizontal: 16) + small: EdgeInsets.symmetric(horizontal: 18), + big: EdgeInsets.symmetric(horizontal: 16) ), child: Column( children: [ @@ -33,8 +34,17 @@ class CustomerServiceScreen extends ConsumerWidget { throw Exception('Could not launch $url'); } }, - image: 'assets/images/ui/iso_sf.png', - text: context.translate(I18n.supportWebsite) + icon: Image.asset('assets/images/ui/iso_sf.png', + width: SizeUtils.getByScreen(small: 44, big: 48), + height: SizeUtils.getByScreen(small: 44, big: 48), + ), + body: Text(context.translate(I18n.supportWebsite), + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 18, big: 19), + fontWeight: FontWeight.w500, + decoration: TextDecoration.underline + ) + ) ), SizedBox(height: SizeUtils.getByScreen(small: 10, big: 9)), SectionButton( @@ -44,88 +54,43 @@ class CustomerServiceScreen extends ConsumerWidget { throw Exception('Could not launch $url'); } }, - icon: SFIcons.handshake, - text: context.translate(I18n.supportHelp) + icon: Icon(SFIcons.handshake, + size: SizeUtils.getByScreen(small: 44, big: 48), + color: theme.getColorFor(ThemeCode.legacyPrimary), + weight: 30, + ), + body: Text(context.translate(I18n.supportHelp), + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 18, big: 19), + fontWeight: FontWeight.w500, + decoration:TextDecoration.underline + ) + ) ), SizedBox(height: SizeUtils.getByScreen(small: 10, big: 9)), SectionButton( - onPressed: (){Navigator.push(context, - MaterialPageRoute( - builder: (_) => ContactScreen(navigationContract: navigationContract), - ));}, - icon: Icons.email_outlined, - text: context.translate(I18n.contactTitle) + onPressed: (){ + Navigator.push(context, + MaterialPageRoute( + builder: (_) => ContactScreen(navigationContract: navigationContract), + ) + ); + }, + icon: Icon(Icons.email_outlined, + size: SizeUtils.getByScreen(small: 44, big: 48), + color: theme.getColorFor(ThemeCode.legacyPrimary), + weight: 30, + ), + body: Text(context.translate(I18n.contactTitle), + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 18, big: 19), + fontWeight: FontWeight.w500, + ) + ) ), ], ) ) ); } -} - - -class SectionButton extends ConsumerWidget { - - final GestureTapCallback onPressed; - final IconData? icon; - final String? image; - final String text; - - const SectionButton({ - required this.onPressed, - this.icon, - this.image, - 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: 16), - big: EdgeInsets.symmetric(horizontal: 21, vertical: 12) - ), - 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: 12, big: 16)), - child: icon != null - ?Icon(icon, - size: SizeUtils.getByScreen(small: 44, big: 48), - color: Color(0xFF588EA5), - weight: 30, - ) - : Image.asset(image!, - width: SizeUtils.getByScreen(small: 44, big: 48), - height: SizeUtils.getByScreen(small: 44, big: 48), - ), - ), - 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/legacy/modules/customer_service/lib/src/presentation/providers/send_email_use_case_provider.dart b/modules/legacy/modules/customer_service/lib/src/presentation/providers/send_email_use_case_provider.dart deleted file mode 100644 index b4fe853a..00000000 --- a/modules/legacy/modules/customer_service/lib/src/presentation/providers/send_email_use_case_provider.dart +++ /dev/null @@ -1,9 +0,0 @@ -import 'package:customer_service/src/domain/send_email_use_case.dart'; -import 'package:customer_service/src/domain/send_email_use_case_impl.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; - -final sendEmailUseCaseProvider = -Provider.autoDispose((ref) { - //final authRepository = ref.read(customerServiceRepositoryProvider); - return SendEmailUseCaseImpl(); -}); diff --git a/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_model.dart b/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_model.dart index 199b06a0..3a66b0eb 100644 --- a/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_model.dart +++ b/modules/legacy/modules/customer_service/lib/src/presentation/state/contact_view_model.dart @@ -1,5 +1,3 @@ -// import 'package:customer_service/src/domain/send_email_use_case.dart'; -// import 'package:customer_service/src/presentation/providers/send_email_use_case_provider.dart'; import 'package:customer_service/src/presentation/state/contact_view_state.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -12,7 +10,6 @@ NotifierProvider.autoDispose( ); class ContactViewModel extends Notifier { - //late final SendEmailUseCase _sendEmailUseCase; late final TextEditingController nameController; late final TextEditingController emailController; @@ -26,7 +23,6 @@ class ContactViewModel extends Notifier { @override ContactViewState build() { - //_sendEmailUseCase = ref.read(sendEmailUseCaseProvider); nameController = TextEditingController(); emailController = TextEditingController(); diff --git a/modules/legacy/modules/customer_service/lib/src/providers/customer_service_repository_provider.dart b/modules/legacy/modules/customer_service/lib/src/providers/customer_service_repository_provider.dart deleted file mode 100644 index a8d0bd56..00000000 --- a/modules/legacy/modules/customer_service/lib/src/providers/customer_service_repository_provider.dart +++ /dev/null @@ -1,8 +0,0 @@ -/* -import 'package:flutter_riverpod/flutter_riverpod.dart'; - -final customerServiceRepositoryProvider = Provider((ref) { - final remote = ref.read(customerServiceRemoteDatasourceProvider); - return CustomerServiceRepositoryImpl(remote); -}); -*/ diff --git a/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource_impl.dart b/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource_impl.dart index ee555d94..b779a188 100644 --- a/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource_impl.dart +++ b/modules/legacy/modules/functions/lib/src/core/data/datasources/functions_remote_datasource_impl.dart @@ -67,10 +67,10 @@ class FunctionsRemoteDatasourceImpl implements FunctionsRemoteDatasource { throw Exception('Empty response from /users/:userId/contacts'); } - final model = GetContactsResponseModel.fromJson(data); + final model = GetPicturesResponseModel.fromJson(data); return model.toEntity(); } on DioException catch (error) { - throw _mapDioError(error, defaultMessage: 'Error to get contacts'); + throw _mapDioError(error, defaultMessage: 'Error to get pictures'); }*/ return []; } @@ -92,7 +92,13 @@ class FunctionsRemoteDatasourceImpl implements FunctionsRemoteDatasource { } on DioException catch (error) { throw _mapDioError(error, defaultMessage: 'Error to get contacts'); }*/ - return PictureEntity(id: '1', userId: '1111', createdAt: 1111); + return PictureEntity( + id: '1', + deviceId: '1111', + createdAt: DateTime.now(), + takenAt: DateTime.now(), + asset: 'assets/images/ui/iso_sf.png' + ); } @override diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/contacts_screen.dart b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/contacts_screen.dart index 4b5f2f24..319c5f97 100644 --- a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/contacts_screen.dart +++ b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/contacts_screen.dart @@ -40,7 +40,7 @@ class ContactsScreen extends ConsumerWidget { if (!state.isEditing) ...[ DecoratedBox( decoration: BoxDecoration( - color: Color(0xFF588EA5), + color: theme.getColorFor(ThemeCode.legacyPrimary), shape: BoxShape.circle ), child: IconButton(onPressed: vm.toggleIsEditing, @@ -91,7 +91,7 @@ class ContactsScreen extends ConsumerWidget { Container( decoration: BoxDecoration( shape: BoxShape.circle, - color: Color(0xFF588EA5), + color: theme.getColorFor(ThemeCode.legacyPrimary), ), width: SizeUtils.getByScreen(small: 48, big: 46), child: CustomTextButton( @@ -120,7 +120,7 @@ class ContactCard extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); + final theme = ref.watch(themePortProvider); return Container( padding: SizeUtils.getByScreen( @@ -141,7 +141,7 @@ class ContactCard extends ConsumerWidget { padding: EdgeInsets.all(SizeUtils.getByScreen(small: 4, big: 12)), child: Icon(SFIcons.account, size: SizeUtils.getByScreen(small: 40, big: 44), - color: Color(0xFF588EA5), + color: theme.getColorFor(ThemeCode.legacyPrimary), weight: 30, ), ), @@ -181,7 +181,7 @@ class ContactCard extends ConsumerWidget { height: SizeUtils.getByScreen(small: 195, big: 185), child: Column( children: [ - Text(context.translate(I18n.legacyDeleteUserDialog), + Text(context.translate(I18n.deleteUserDialog), textAlign: TextAlign.center, style: TextStyle(fontSize: SizeUtils.getByScreen(small: 19, big: 18)), ), @@ -191,8 +191,8 @@ class ContactCard extends ConsumerWidget { children: [ Expanded(child: PrimaryButton( onPressed: (){Navigator.pop(context);}, - text: context.translate(I18n.legacyCancel), - color: Color(0xFF588EA5), + text: context.translate(I18n.cancel), + color: theme.getColorFor(ThemeCode.legacyPrimary), height: SizeUtils.getByScreen(small: 38, big: 36), radius: SizeUtils.getByScreen(small: 32, big: 34), )), @@ -201,8 +201,8 @@ class ContactCard extends ConsumerWidget { onPressed: (){ Navigator.pop(context); }, - text: context.translate(I18n.legacyDelete), - color: Color(0xFF588EA5), + text: context.translate(I18n.delete), + color: theme.getColorFor(ThemeCode.legacyPrimary), height: SizeUtils.getByScreen(small: 38, big: 36), radius: SizeUtils.getByScreen(small: 32, big: 34), )) @@ -221,7 +221,7 @@ class ContactCard extends ConsumerWidget { SizedBox(width: SizeUtils.getByScreen(small: 16, big: 14)), DecoratedBox( decoration: BoxDecoration( - color: Color(0xFF588EA5), + color: theme.getColorFor(ThemeCode.legacyPrimary), borderRadius: BorderRadius.all(Radius.circular(12)), ), child: diff --git a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/edit_contact_screen.dart b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/edit_contact_screen.dart index eba3b459..ab4eab27 100644 --- a/modules/legacy/modules/functions/lib/src/features/contacts/presentation/edit_contact_screen.dart +++ b/modules/legacy/modules/functions/lib/src/features/contacts/presentation/edit_contact_screen.dart @@ -89,7 +89,7 @@ class EditContactScreen extends ConsumerWidget { CustomTextField( controller: vm.nameController, hint: contact.name, - label: context.translate(I18n.legacyName), + label: context.translate(I18n.name), ), SizedBox(height: SizeUtils.getByScreen(small: 28, big: 26)), Stack( @@ -109,7 +109,7 @@ class EditContactScreen extends ConsumerWidget { icon: DecoratedBox( decoration: BoxDecoration( shape: BoxShape.circle, - color: Color(0xFF588EA5) + color: theme.getColorFor(ThemeCode.legacyPrimary) ), child: Icon( SFIcons.contactsCircle, @@ -126,8 +126,8 @@ class EditContactScreen extends ConsumerWidget { ), PrimaryButton( onPressed: (){vm.updateContact(contact);}, - text: context.translate(I18n.legacySave), - color: Color(0xFF588EA5) + text: context.translate(I18n.save), + color: theme.getColorFor(ThemeCode.legacyPrimary) ) ], )) diff --git a/modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart b/modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart index 6a58eece..700865de 100644 --- a/modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart +++ b/modules/legacy/modules/functions/lib/src/features/functions/functions_screen.dart @@ -2,6 +2,7 @@ import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:functions/src/features/functions/widgets/call_watch_dialog.dart'; +import 'package:legacy_shared/legacy_shared.dart'; import 'package:navigation/navigation.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; @@ -15,180 +16,120 @@ class FunctionsScreen extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final theme = ref.watch(themePortProvider); - return Scaffold( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), - body: SafeArea( - child: Column( - children: [ - Container( - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), - big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) - ), - child: Stack( - children: [ - IconButton(onPressed: () {Navigator.pop(context);}, - icon: Icon(Icons.arrow_back)), - Center( - child: Text(context.translate('Device Features'), - style: TextStyle( - fontSize: SizeUtils.getByScreen(small: 28, big: 27) - ), - ) - ) - ], - ), - ), - SizedBox(height: SizeUtils.getByScreen(small: 30, big: 28)), - Expanded(child: SingleChildScrollView(child: Container( - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), - big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) - ), - child: Column( - children: [ - AppSectionButton( - onPressed: (){navigationContract.pushTo(AppRoutes.remoteConnection);}, - icon: SFIcons.connection, - text: 'Remote connection' - ), - SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), - AppSectionButton( - onPressed: (){}, - icon: SFIcons.calendarCircle, - text: 'Calendar' - ), - SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), - AppSectionButton( - onPressed: (){navigationContract.pushTo(AppRoutes.contacts);}, - icon: SFIcons.contactsCircle, - text: 'Contacts' - ), - SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), - AppSectionButton( - onPressed: (){}, - icon: SFIcons.doNotDisturbCircle, - text: 'Do not disturb' - ), - SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), - AppSectionButton( - onPressed: (){}, - icon: SFIcons.videoCallCircle, - text: 'Video call' - ), - SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), - AppSectionButton( - onPressed: (){}, - icon: SFIcons.healthCircle, - text: 'Health' - ), - SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), - AppSectionButton( - onPressed: (){}, - icon: SFIcons.healthCircle, - text: 'Activity meter' - ), - SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), - AppSectionButton( - onPressed: (){}, - icon: SFIcons.rewardsCircle, - text: 'Rewards' - ), - SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), - AppSectionButton( - onPressed: (){showDialog(context: context, builder: (context)=>Dialog( - child: CallWatchDialog() - ));}, - icon: Icons.call_outlined, - text: 'Call watch' - ), - SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), - AppSectionButton( - onPressed: (){}, - icon: SFIcons.screenTime, - text: 'Apps use' - ), - SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), - AppSectionButton( - onPressed: (){}, - icon: Icons.app_registration_sharp, - text: 'Apps surveillance' - ), - SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), - AppSectionButton( - onPressed: (){}, - icon: SFIcons.friendsCircle, - text: 'Make friends' - ), - SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), - AppSectionButton( - onPressed: (){navigationContract.pushTo(AppRoutes.locateDevice);}, - icon: SFIcons.locateSfCircle, - text: 'Locate your SaveFamily' - ), - ], - ), - ))), - ], - ) - ), - ); - } -} - -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: 14), - big: EdgeInsets.symmetric(horizontal: 21, vertical: 12) + return LegacyPageLayout( + theme: theme, + title: context.translate(I18n.functions), + body: SingleChildScrollView(child: Container( + padding: EdgeInsets.symmetric( + horizontal: SizeUtils.getByScreen(big: 22, small: 21), ), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(SizeUtils.getByScreen(small: 12, big: 18))), - color: theme.getColorFor(ThemeCode.backgroundSecondary), - ), - child: Row( + child: Column( children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.circle, - color: theme.getColorFor(ThemeCode.backgroundPrimary), - ), - padding: EdgeInsets.all(SizeUtils.getByScreen(small: 0, big: 0)), - child: Icon(icon, - size: SizeUtils.getByScreen(small: 52, big: 48), - color: Color(0xFF588EA5), - weight: 30, - ), + AppMenuButton( + color: theme.getColorFor(ThemeCode.legacyPrimary), + onPressed: (){navigationContract.pushTo(AppRoutes.remoteConnection);}, + icon: SFIcons.connection, + text: context.translate(I18n.remoteConnection) + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppMenuButton( + color: theme.getColorFor(ThemeCode.legacyPrimary), + onPressed: (){}, + icon: SFIcons.calendarCircle, + negativeIcon: true, + text: context.translate(I18n.calendar) + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppMenuButton( + color: theme.getColorFor(ThemeCode.legacyPrimary), + onPressed: (){navigationContract.pushTo(AppRoutes.contacts);}, + icon: SFIcons.contactsCircle, + negativeIcon: true, + text: context.translate(I18n.contacts) + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppMenuButton( + color: theme.getColorFor(ThemeCode.legacyPrimary), + onPressed: (){}, + icon: SFIcons.doNotDisturbCircle, + negativeIcon: true, + text: context.translate(I18n.doNotDisturb) + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppMenuButton( + color: theme.getColorFor(ThemeCode.legacyPrimary), + onPressed: (){}, + icon: SFIcons.videoCallCircle, + negativeIcon: true, + text: context.translate(I18n.videoCall) + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppMenuButton( + color: theme.getColorFor(ThemeCode.legacyPrimary), + onPressed: (){}, + icon: SFIcons.healthCircle, + negativeIcon: true, + text: context.translate(I18n.health) + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppMenuButton( + color: theme.getColorFor(ThemeCode.legacyPrimary), + onPressed: (){}, + icon: SFIcons.healthCircle, + negativeIcon: true, + text: context.translate(I18n.activityMeter) + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppMenuButton( + color: theme.getColorFor(ThemeCode.legacyPrimary), + onPressed: (){}, + icon: SFIcons.rewardsCircle, + negativeIcon: true, + text: context.translate(I18n.rewards) + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppMenuButton( + color: theme.getColorFor(ThemeCode.legacyPrimary), + onPressed: (){showDialog(context: context, builder: (context)=>Dialog( + child: CallWatchDialog() + ));}, + icon: Icons.call_outlined, + iconSize: SizeUtils.getByScreen(small: 42, big: 40), + text: context.translate(I18n.callWatch) + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppMenuButton( + color: theme.getColorFor(ThemeCode.legacyPrimary), + onPressed: (){}, + icon: SFIcons.screenTime, + text: context.translate(I18n.appsUse) + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppMenuButton( + color: theme.getColorFor(ThemeCode.legacyPrimary), + onPressed: (){}, + icon: Icons.app_registration_sharp, + text: context.translate(I18n.appsSurveillance) + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppMenuButton( + color: theme.getColorFor(ThemeCode.legacyPrimary), + onPressed: (){}, + icon: SFIcons.friendsCircle, + negativeIcon: true, + text: context.translate(I18n.makeFriends) + ), + SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), + AppMenuButton( + color: theme.getColorFor(ThemeCode.legacyPrimary), + onPressed: (){navigationContract.pushTo(AppRoutes.locateDevice);}, + icon: SFIcons.locateSfCircle, + negativeIcon: true, + text: context.translate(I18n.locateSF) ), - 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/legacy/modules/functions/lib/src/features/functions/widgets/call_watch_dialog.dart b/modules/legacy/modules/functions/lib/src/features/functions/widgets/call_watch_dialog.dart index 5276a08d..2770ad94 100644 --- a/modules/legacy/modules/functions/lib/src/features/functions/widgets/call_watch_dialog.dart +++ b/modules/legacy/modules/functions/lib/src/features/functions/widgets/call_watch_dialog.dart @@ -9,6 +9,7 @@ class CallWatchDialog extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.watch(themePortProvider); final viewModel = ref.read(callWatchViewModelProvider.notifier); final viewState = ref.watch(callWatchViewModelProvider); @@ -32,7 +33,7 @@ class CallWatchDialog extends ConsumerWidget { alignment: Alignment.centerRight, child: IconButton( onPressed: (){Navigator.pop(context);}, - icon: Icon(Icons.close, color: Color(0xFF588EA5)), + icon: Icon(Icons.close, color: theme.getColorFor(ThemeCode.legacyPrimary)), ) ) ], @@ -59,7 +60,7 @@ class CallWatchDialog extends ConsumerWidget { PrimaryButton( onPressed: viewModel.call, text: context.translate('Call me'), - color: Color(0xFF588EA5), + color: theme.getColorFor(ThemeCode.legacyPrimary), height: SizeUtils.getByScreen(small: 38, big: 36), radius: SizeUtils.getByScreen(small: 32, big: 34), ), diff --git a/modules/legacy/modules/functions/lib/src/features/locate_device/presentation/locate_device_screen.dart b/modules/legacy/modules/functions/lib/src/features/locate_device/presentation/locate_device_screen.dart index 7d367592..4d044b23 100644 --- a/modules/legacy/modules/functions/lib/src/features/locate_device/presentation/locate_device_screen.dart +++ b/modules/legacy/modules/functions/lib/src/features/locate_device/presentation/locate_device_screen.dart @@ -1,7 +1,7 @@ import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:functions/src/features/locate_device/presentation/state/locate_device_view_model.dart'; +import 'package:functions/src/features/locate_device/presentation/widgets/locate_device_dialog.dart'; import 'package:navigation/navigation.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; @@ -15,8 +15,11 @@ class LocateDeviceScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - return PageLayout( - title: context.translate('Find your device'), + final theme = ref.watch(themePortProvider); + + return LegacyPageLayout( + theme: theme, + title: context.translate(I18n.locateSF), body: Container( padding: SizeUtils.getByScreen( small: EdgeInsets.symmetric(horizontal: 16), @@ -25,14 +28,14 @@ class LocateDeviceScreen extends ConsumerWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(context.translate('Locate your SaveFamily in nearby locations'), + Text(context.translate(I18n.locateSFBody1), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 18, big: 17), fontWeight: FontWeight.w500, ) ), SizedBox(height: SizeUtils.getByScreen(small: 10, big: 8)), - Text('This function allows you to find the device indoors or in places close to you. When you press the button, the smartwatch will start beeping and you will be able to hear it.', + Text(context.translate(I18n.locateSFBody2), style: TextStyle( fontSize: 16 )) @@ -50,99 +53,11 @@ class LocateDeviceScreen extends ConsumerWidget { child: LocateDialog(), )); }, - text: context.translate('Locate my SaveFamily'), - color: Color(0xFF588EA5), + text: context.translate(I18n.locateSFAction), + color: theme.getColorFor(ThemeCode.legacyPrimary), height: SizeUtils.getByScreen(small: 36, big: 35), ), ) ); } -} - -class LocateDialog extends ConsumerWidget { - - @override - Widget build(BuildContext context, WidgetRef ref) { - - final viewModel = ref.read(locateDeviceViewModelProvider.notifier); - final viewState = ref.watch(locateDeviceViewModelProvider); - - return Container( - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 32, vertical: 30), - big: EdgeInsets.symmetric(horizontal: 30, vertical: 28) - ), - width: SizeUtils.getByScreen(small: 360, big: 350), - height: SizeUtils.getByScreen(small: 210, big: 205), - child: Column( - children: [ - if (viewState.isLoading) - Expanded(child: Center(child: Text(context.translate('Sending...'), - textAlign: TextAlign.center, - style: TextStyle( - fontSize: SizeUtils.getByScreen(small: 25, big: 24), - ), - ))), - if (viewState.isComplete) - Expanded(child: Center(child: Text(context.translate('Sent successfully'), - textAlign: TextAlign.center, - style: TextStyle( - fontSize: SizeUtils.getByScreen(small: 25, big: 24), - ), - ))), - if (viewState.errorMessage.isNotEmpty) ...[ - Expanded(child: Center(child: Text(context.translate('The device is not connected to the Internet'), - textAlign: TextAlign.center, - style: TextStyle( - fontSize: SizeUtils.getByScreen(small: 20, big: 19), - ), - ))), - SizedBox(height: SizeUtils.getByScreen(small: 24, big: 23)), - Expanded(child: PrimaryButton( - onPressed: (){ - Navigator.pop(context); - viewModel.endLocation(); - }, - text: context.translate('OK'), - color: Color(0xFF588EA5), - height: SizeUtils.getByScreen(small: 38, big: 36), - radius: SizeUtils.getByScreen(small: 32, big: 34), - )), - ], - if (!viewState.isComplete && !viewState.isLoading && viewState.errorMessage.isEmpty) ...[ - Text(context.translate('You are going to activate the remote location of your device. It will start ringing.'), - textAlign: TextAlign.center, - style: TextStyle( - fontSize: SizeUtils.getByScreen(small: 19, big: 18), - ), - ), - SizedBox(height: SizeUtils.getByScreen(small: 24, big: 23)), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded(child: PrimaryButton( - onPressed: (){Navigator.pop(context);}, - text: context.translate(I18n.legacyCancel), - color: Color(0xFF588EA5), - height: SizeUtils.getByScreen(small: 38, big: 36), - radius: SizeUtils.getByScreen(small: 32, big: 34), - )), - SizedBox(width: SizeUtils.getByScreen(small: 4, big: 16)), - Expanded(child: PrimaryButton( - onPressed: () { - viewModel.locateDevice(); - }, - text: context.translate(I18n.accept), - color: Color(0xFF588EA5), - height: SizeUtils.getByScreen(small: 38, big: 36), - radius: SizeUtils.getByScreen(small: 32, big: 34), - )) - ], - ) - ] - ], - ), - ); - } - } \ No newline at end of file diff --git a/modules/legacy/modules/functions/lib/src/features/locate_device/presentation/widgets/locate_device_dialog.dart b/modules/legacy/modules/functions/lib/src/features/locate_device/presentation/widgets/locate_device_dialog.dart new file mode 100644 index 00000000..eefa1d35 --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/locate_device/presentation/widgets/locate_device_dialog.dart @@ -0,0 +1,95 @@ +import 'package:design_system/design_system.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:functions/src/features/locate_device/presentation/state/locate_device_view_model.dart'; +import 'package:sf_localizations/sf_localizations.dart'; +import 'package:utils/utils.dart'; + +class LocateDialog extends ConsumerWidget { + + @override + Widget build(BuildContext context, WidgetRef ref) { + + final theme = ref.watch(themePortProvider); + + final viewModel = ref.read(locateDeviceViewModelProvider.notifier); + final viewState = ref.watch(locateDeviceViewModelProvider); + + return Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 32, vertical: 30), + big: EdgeInsets.symmetric(horizontal: 30, vertical: 28) + ), + width: SizeUtils.getByScreen(small: 360, big: 350), + height: SizeUtils.getByScreen(small: 210, big: 205), + child: Column( + children: [ + if (viewState.isLoading) + Expanded(child: Center(child: Text(context.translate('Sending...'), + textAlign: TextAlign.center, + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 25, big: 24), + ), + ))), + if (viewState.isComplete) + Expanded(child: Center(child: Text(context.translate('Sent successfully'), + textAlign: TextAlign.center, + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 25, big: 24), + ), + ))), + if (viewState.errorMessage.isNotEmpty) ...[ + Expanded(child: Center(child: Text(context.translate('The device is not connected to the Internet'), + textAlign: TextAlign.center, + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 20, big: 19), + ), + ))), + SizedBox(height: SizeUtils.getByScreen(small: 24, big: 23)), + Expanded(child: PrimaryButton( + onPressed: (){ + Navigator.pop(context); + viewModel.endLocation(); + }, + text: context.translate('OK'), + color: theme.getColorFor(ThemeCode.legacyPrimary), + height: SizeUtils.getByScreen(small: 38, big: 36), + radius: SizeUtils.getByScreen(small: 32, big: 34), + )), + ], + if (!viewState.isComplete && !viewState.isLoading && viewState.errorMessage.isEmpty) ...[ + Text(context.translate('You are going to activate the remote location of your device. It will start ringing.'), + textAlign: TextAlign.center, + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 19, big: 18), + ), + ), + SizedBox(height: SizeUtils.getByScreen(small: 24, big: 23)), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded(child: PrimaryButton( + onPressed: (){Navigator.pop(context);}, + text: context.translate(I18n.cancel), + color: theme.getColorFor(ThemeCode.legacyPrimary), + height: SizeUtils.getByScreen(small: 38, big: 36), + radius: SizeUtils.getByScreen(small: 32, big: 34), + )), + SizedBox(width: SizeUtils.getByScreen(small: 4, big: 16)), + Expanded(child: PrimaryButton( + onPressed: () { + viewModel.locateDevice(); + }, + text: context.translate(I18n.accept), + color: theme.getColorFor(ThemeCode.legacyPrimary), + height: SizeUtils.getByScreen(small: 38, big: 36), + radius: SizeUtils.getByScreen(small: 32, big: 34), + )) + ], + ) + ] + ], + ), + ); + } +} \ No newline at end of file diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/entities/picture_entity.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/entities/picture_entity.dart index 22df5bc6..5d23a5f8 100644 --- a/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/entities/picture_entity.dart +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/entities/picture_entity.dart @@ -6,7 +6,9 @@ part 'picture_entity.freezed.dart'; abstract class PictureEntity with _$PictureEntity { const factory PictureEntity({ required String id, - required String? userId, - required int createdAt, + required String? deviceId, + required DateTime createdAt, + required DateTime takenAt, + required String asset, }) = _PictureEntity; } diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/entities/picture_entity.freezed.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/entities/picture_entity.freezed.dart index f08a6dcc..fcf3e652 100644 --- a/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/entities/picture_entity.freezed.dart +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/entities/picture_entity.freezed.dart @@ -14,7 +14,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$PictureEntity { - String get id; String? get userId; int get createdAt; + String get id; String? get deviceId; DateTime get createdAt; DateTime get takenAt; String get asset; /// Create a copy of PictureEntity /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -25,16 +25,16 @@ $PictureEntityCopyWith get copyWith => _$PictureEntityCopyWithImp @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is PictureEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is PictureEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.takenAt, takenAt) || other.takenAt == takenAt)&&(identical(other.asset, asset) || other.asset == asset)); } @override -int get hashCode => Object.hash(runtimeType,id,userId,createdAt); +int get hashCode => Object.hash(runtimeType,id,deviceId,createdAt,takenAt,asset); @override String toString() { - return 'PictureEntity(id: $id, userId: $userId, createdAt: $createdAt)'; + return 'PictureEntity(id: $id, deviceId: $deviceId, createdAt: $createdAt, takenAt: $takenAt, asset: $asset)'; } @@ -45,7 +45,7 @@ abstract mixin class $PictureEntityCopyWith<$Res> { factory $PictureEntityCopyWith(PictureEntity value, $Res Function(PictureEntity) _then) = _$PictureEntityCopyWithImpl; @useResult $Res call({ - String id, String? userId, int createdAt + String id, String? deviceId, DateTime createdAt, DateTime takenAt, String asset }); @@ -62,12 +62,14 @@ class _$PictureEntityCopyWithImpl<$Res> /// Create a copy of PictureEntity /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? userId = freezed,Object? createdAt = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? deviceId = freezed,Object? createdAt = null,Object? takenAt = null,Object? asset = null,}) { return _then(_self.copyWith( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable -as String,userId: freezed == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable +as String,deviceId: freezed == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable -as int, +as DateTime,takenAt: null == takenAt ? _self.takenAt : takenAt // ignore: cast_nullable_to_non_nullable +as DateTime,asset: null == asset ? _self.asset : asset // ignore: cast_nullable_to_non_nullable +as String, )); } @@ -152,10 +154,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String? userId, int createdAt)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String? deviceId, DateTime createdAt, DateTime takenAt, String asset)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _PictureEntity() when $default != null: -return $default(_that.id,_that.userId,_that.createdAt);case _: +return $default(_that.id,_that.deviceId,_that.createdAt,_that.takenAt,_that.asset);case _: return orElse(); } @@ -173,10 +175,10 @@ return $default(_that.id,_that.userId,_that.createdAt);case _: /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String id, String? userId, int createdAt) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String id, String? deviceId, DateTime createdAt, DateTime takenAt, String asset) $default,) {final _that = this; switch (_that) { case _PictureEntity(): -return $default(_that.id,_that.userId,_that.createdAt);case _: +return $default(_that.id,_that.deviceId,_that.createdAt,_that.takenAt,_that.asset);case _: throw StateError('Unexpected subclass'); } @@ -193,10 +195,10 @@ return $default(_that.id,_that.userId,_that.createdAt);case _: /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String? userId, int createdAt)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String? deviceId, DateTime createdAt, DateTime takenAt, String asset)? $default,) {final _that = this; switch (_that) { case _PictureEntity() when $default != null: -return $default(_that.id,_that.userId,_that.createdAt);case _: +return $default(_that.id,_that.deviceId,_that.createdAt,_that.takenAt,_that.asset);case _: return null; } @@ -208,12 +210,14 @@ return $default(_that.id,_that.userId,_that.createdAt);case _: class _PictureEntity implements PictureEntity { - const _PictureEntity({required this.id, required this.userId, required this.createdAt}); + const _PictureEntity({required this.id, required this.deviceId, required this.createdAt, required this.takenAt, required this.asset}); @override final String id; -@override final String? userId; -@override final int createdAt; +@override final String? deviceId; +@override final DateTime createdAt; +@override final DateTime takenAt; +@override final String asset; /// Create a copy of PictureEntity /// with the given fields replaced by the non-null parameter values. @@ -225,16 +229,16 @@ _$PictureEntityCopyWith<_PictureEntity> get copyWith => __$PictureEntityCopyWith @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _PictureEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _PictureEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.takenAt, takenAt) || other.takenAt == takenAt)&&(identical(other.asset, asset) || other.asset == asset)); } @override -int get hashCode => Object.hash(runtimeType,id,userId,createdAt); +int get hashCode => Object.hash(runtimeType,id,deviceId,createdAt,takenAt,asset); @override String toString() { - return 'PictureEntity(id: $id, userId: $userId, createdAt: $createdAt)'; + return 'PictureEntity(id: $id, deviceId: $deviceId, createdAt: $createdAt, takenAt: $takenAt, asset: $asset)'; } @@ -245,7 +249,7 @@ abstract mixin class _$PictureEntityCopyWith<$Res> implements $PictureEntityCopy factory _$PictureEntityCopyWith(_PictureEntity value, $Res Function(_PictureEntity) _then) = __$PictureEntityCopyWithImpl; @override @useResult $Res call({ - String id, String? userId, int createdAt + String id, String? deviceId, DateTime createdAt, DateTime takenAt, String asset }); @@ -262,12 +266,14 @@ class __$PictureEntityCopyWithImpl<$Res> /// Create a copy of PictureEntity /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? userId = freezed,Object? createdAt = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? deviceId = freezed,Object? createdAt = null,Object? takenAt = null,Object? asset = null,}) { return _then(_PictureEntity( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable -as String,userId: freezed == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable +as String,deviceId: freezed == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable -as int, +as DateTime,takenAt: null == takenAt ? _self.takenAt : takenAt // ignore: cast_nullable_to_non_nullable +as DateTime,asset: null == asset ? _self.asset : asset // ignore: cast_nullable_to_non_nullable +as String, )); } diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/get_pictures_use_case_impl.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/get_pictures_use_case_impl.dart index b38a448a..91a21c1b 100644 --- a/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/get_pictures_use_case_impl.dart +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/domain/get_pictures_use_case_impl.dart @@ -8,7 +8,13 @@ class GetPicturesUseCaseImpl implements GetPicturesUseCase { final FunctionsRepository _repository; @override - Future> getPictures({required String userId}) { - return _repository.getPictures(userId: userId); + Future> getPictures({required String userId}) async { + // return _repository.getPictures(userId: userId); + return [ + PictureEntity(id: '1', deviceId: '1111', createdAt: DateTime.now(), asset: 'assets/images/ui/iso_sf.png', takenAt: DateTime.now()), + PictureEntity(id: '2', deviceId: '1111', createdAt: DateTime.now(), asset: 'assets/images/ui/iso_sf.png', takenAt: DateTime.now()), + PictureEntity(id: '3', deviceId: '1111', createdAt: DateTime.now(), asset: 'assets/images/ui/iso_sf.png', takenAt: DateTime.now()), + PictureEntity(id: '4', deviceId: '1111', createdAt: DateTime.now(), asset: 'assets/images/ui/iso_sf.png', takenAt: DateTime.now()), + ]; } } \ No newline at end of file diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_camera_screen.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_camera_screen.dart index 12afa923..8f4c77b8 100644 --- a/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_camera_screen.dart +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_camera_screen.dart @@ -1,9 +1,8 @@ -// import 'package:account/src/features/linked_devices/presentation/app_users_screen.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:flutter_svg/flutter_svg.dart'; import 'package:functions/src/features/remote_connection/presentation/state/remote_connection_view_model.dart'; +import 'package:functions/src/features/remote_connection/presentation/widgets/show_picture_dialog.dart'; import 'package:navigation/navigation.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; @@ -18,59 +17,115 @@ class RemoteCameraScreen extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final theme = ref.watch(themePortProvider); - final viewModel = ref.read(remoteConnectionViewModelProvider.notifier); - final viewState = ref.watch(remoteConnectionViewModelProvider); + final isLoadingPictures = ref.watch( + remoteConnectionViewModelProvider.select((s)=>s.isLoadingPictures) + ); - return PageLayout( - title: context.translate('Remote camera'), - body: Expanded(child: GridView.count( - primary: false, - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 24, vertical: 12), - big: EdgeInsets.symmetric(horizontal: 23, vertical: 11) - ), - crossAxisSpacing: 11, - mainAxisSpacing: 11, - crossAxisCount: 3, - childAspectRatio: 0.8, - children: List.generate(12, (int index)=> - Container( - height: SizeUtils.getByScreen(small: 110, big: 105), - width: SizeUtils.getByScreen(small: 60, big: 58), - color: Colors.grey[200], - child: SvgPicture.asset('assets/images/ui/face.svg'), - ) - ), - )), - footer: Container( - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(vertical: 12, horizontal: 26), - big: EdgeInsets.symmetric(vertical: 10, horizontal: 25) - ), - child: PrimaryButton( - onPressed: () async { - showDialog(context: context, builder: (context)=>Dialog( - child: Container( - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 32, vertical: 30), - big: EdgeInsets.symmetric(horizontal: 30, vertical: 28) - ), - width: SizeUtils.getByScreen(small: 360, big: 350), - height: SizeUtils.getByScreen(small: 195, big: 185), - child: Center(child: Text(context.translate('Loading photo...'), - textAlign: TextAlign.center, - style: TextStyle(fontSize: SizeUtils.getByScreen(small: 26, big: 25)), - )), - ), - )); - await viewModel.takePicture(); - Navigator.pop(context); - }, - text: context.translate('Take a picture'), - color: Color(0xFF588EA5), - height: SizeUtils.getByScreen(small: 36, big: 35), - ), - ) + return LegacyPageLayout( + theme: theme, + title: context.translate(I18n.remoteCamera), + body: Expanded(child: isLoadingPictures + ? const Center(child: CircularProgressIndicator()) + : const _GallerySection() + ), + footer: _TakePictureSection(), ); } +} + +class _GallerySection extends ConsumerWidget { + + const _GallerySection(); + + @override + Widget build(BuildContext context, WidgetRef ref) { + + final theme = ref.read(themePortProvider); + + final vm = ref.read(remoteConnectionViewModelProvider.notifier); + + final pictures = ref.watch( + remoteConnectionViewModelProvider.select((s)=>s.pictures) + ); + + return GridView.count( + primary: false, + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 24, vertical: 12), + big: EdgeInsets.symmetric(horizontal: 23, vertical: 11) + ), + crossAxisSpacing: 11, + mainAxisSpacing: 11, + crossAxisCount: 3, + childAspectRatio: 0.8, + children: List.generate(pictures.length, (int index)=> + TextButton( + onPressed: (){ + vm.setPictureIndex(index); + showDialog(context: context, builder: (context)=>Dialog( + child: ShowPictureDialog(), + )); + }, + child: Container( + height: SizeUtils.getByScreen(small: 110, big: 105), + width: SizeUtils.getByScreen(small: 60, big: 58), + decoration: BoxDecoration( + border: Border.fromBorderSide(BorderSide( + color: theme.getColorFor(ThemeCode.textTertiary) + )) + ), + child: Column( + children: [ + Image.asset(pictures[index].asset), + ], + ) + ) + ) + ), + ); + } + +} + +class _TakePictureSection extends ConsumerWidget { + + const _TakePictureSection(); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.read(themePortProvider); + + final vm = ref.read(remoteConnectionViewModelProvider.notifier); + + return Padding( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(vertical: 12, horizontal: 26), + big: EdgeInsets.symmetric(vertical: 10, horizontal: 25) + ), + child: PrimaryButton( + onPressed: () async { + showDialog(context: context, builder: (context)=>Dialog( + child: Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 32, vertical: 30), + big: EdgeInsets.symmetric(horizontal: 30, vertical: 28) + ), + width: SizeUtils.getByScreen(small: 360, big: 350), + height: SizeUtils.getByScreen(small: 195, big: 185), + child: Center(child: Text(context.translate('Loading photo...'), + textAlign: TextAlign.center, + style: TextStyle(fontSize: SizeUtils.getByScreen(small: 26, big: 25)), + )), + ), + )); + await vm.takePicture(); + Navigator.pop(context); + }, + text: context.translate(I18n.takePicture), + color: theme.getColorFor(ThemeCode.legacyPrimary), + height: SizeUtils.getByScreen(small: 36, big: 35), + ), + ); + } + } \ No newline at end of file diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_connection_screen.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_connection_screen.dart index 06c92051..a5d19125 100644 --- a/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_connection_screen.dart +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/remote_connection_screen.dart @@ -1,9 +1,8 @@ -// import 'package:account/src/features/linked_devices/presentation/app_users_screen.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:functions/src/features/remote_connection/presentation/remote_camera_screen.dart'; -import 'package:functions/src/features/remote_connection/presentation/state/remote_connection_view_model.dart'; +import 'package:functions/src/features/remote_connection/presentation/widgets/spy_call_dialog.dart'; import 'package:legacy_shared/legacy_shared.dart'; import 'package:navigation/navigation.dart'; import 'package:sf_localizations/sf_localizations.dart'; @@ -16,35 +15,32 @@ class RemoteConnectionScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - // final theme = ref.watch(themePortProvider); + final theme = ref.watch(themePortProvider); - final viewModel = ref.read(remoteConnectionViewModelProvider.notifier); - final viewState = ref.watch(remoteConnectionViewModelProvider); - - return PageLayout( - title: 'Remote Connection', - body: SingleChildScrollView(child: Container( + return LegacyPageLayout( + theme: theme, + title: context.translate(I18n.remoteConnection), + body: SingleChildScrollView(child: Padding( padding: SizeUtils.getByScreen( small: EdgeInsets.symmetric(horizontal: 22, vertical: 10), big: EdgeInsets.symmetric(horizontal: 21, vertical: 8) ), child: Column( children: [ - AppSectionButton( + _SectionButton( onPressed: (){Navigator.push(context, MaterialPageRoute( builder: (_)=>RemoteCameraScreen(navigationContract: navigationContract) ));}, icon: Icons.photo_camera_outlined, - text: 'Remote camera' + text: I18n.remoteCamera ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)), - AppSectionButton( + _SectionButton( onPressed: (){showDialog(context: context, builder: (context)=>Dialog( - child: CallDialog( - ) + child: SpyCallDialog() ));}, icon: SFIcons.listen, - text: 'Remote listening' + text: I18n.remoteListening ), ], ), @@ -53,82 +49,13 @@ class RemoteConnectionScreen extends ConsumerWidget { } } -class CallDialog extends ConsumerWidget { +class _SectionButton extends ConsumerWidget { - @override - Widget build(BuildContext context, WidgetRef ref) { - - final viewModel = ref.read(remoteConnectionViewModelProvider.notifier); - final viewState = ref.watch(remoteConnectionViewModelProvider); - - return Container( - padding: SizeUtils.getByScreen( - small: EdgeInsets.symmetric(horizontal: 26, vertical: 20), - big: EdgeInsets.symmetric(horizontal: 24, vertical: 18) - ), - width: SizeUtils.getByScreen(small: 390, big: 380), - height: SizeUtils.getByScreen(small: 250, big: 243), - child: Column( - children: [ - Stack( - children: [ - Center(child: Text(context.translate('Remote listening'), - textAlign: TextAlign.center, - style: TextStyle(fontSize: SizeUtils.getByScreen(small: 19, big: 18)), - )), - Align( - alignment: Alignment.centerRight, - child: IconButton( - onPressed: (){Navigator.pop(context);}, - icon: Icon(Icons.close, color: Color(0xFF588EA5)), - ) - ) - ], - ), - SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), - CustomTextField( - controller: viewModel.phoneController, - hint: context.translate('Insert your phone number'), - keyboardType: TextInputType.number, - ), - if (viewState.errorMessage.isNotEmpty) ...[ - const SizedBox(height: 4), - Text( - viewState.errorMessage, - textAlign: TextAlign.center, - style: const TextStyle( - color: Color.fromRGBO(239, 17, 17, 1), - fontSize: 12, - ), - ), - ], - SizedBox(height: SizeUtils.getByScreen(small: 28, big: 27)), - PrimaryButton( - onPressed: () async { - await viewModel.call(); - if (viewState.errorMessage.isEmpty){ - Navigator.pop(context); - } - }, - text: context.translate('Call me'), - color: Color(0xFF588EA5), - height: SizeUtils.getByScreen(small: 38, big: 36), - radius: SizeUtils.getByScreen(small: 32, big: 34), - ), - ], - ), - ); - } - -} - -class AppSectionButton extends ConsumerWidget { - - final GestureTapCallback onPressed; + final VoidCallback onPressed; final IconData icon; final String text; - const AppSectionButton({ + const _SectionButton({ required this.onPressed, required this.icon, required this.text, @@ -136,45 +63,23 @@ class AppSectionButton extends ConsumerWidget { @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: 20), - big: EdgeInsets.symmetric(horizontal: 21, vertical: 18) - ), - 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 - ) - ) - ) - ], - ), + return SectionButton( + onPressed: onPressed, + icon: Icon(icon, + size: SizeUtils.getByScreen(small: 40, big: 44), + color: theme.getColorFor(ThemeCode.legacyPrimary), + weight: 30, + ), + body: 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/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_model.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_model.dart index 5f56e935..96ab5dfa 100644 --- a/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_model.dart +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_model.dart @@ -6,9 +6,7 @@ import 'package:functions/src/features/remote_connection/domain/take_picture_use import 'package:functions/src/features/remote_connection/presentation/providers/get_pictures_use_case_provider.dart'; import 'package:functions/src/features/remote_connection/presentation/providers/take_picture_use_case_provider.dart'; import 'package:functions/src/features/remote_connection/presentation/state/remote_connection_view_state.dart'; -// import 'package:legacy_shared/src/providers/logged_user_provider.dart'; -// import 'package:legacy_shared/src/data/models/entities/user_entity.dart'; -// import 'package:sf_localizations/sf_localizations.dart'; +import 'package:legacy_shared/legacy_shared.dart'; final remoteConnectionViewModelProvider = NotifierProvider.autoDispose( @@ -21,8 +19,6 @@ class RemoteConnectionViewModel extends Notifier { late final TextEditingController phoneController; - // late final UserEntity loggedUser; - static final RegExp _phoneRegex = RegExp(r'^\+?\d{6,15}$'); @override @@ -30,22 +26,27 @@ class RemoteConnectionViewModel extends Notifier { _getPicturesUseCase = ref.read(getPicturesUseCaseProvider); _takePictureUseCase = ref.read(takePictureUseCaseProvider); - // loggedUser = ref.read(loggedUserProvider); - phoneController = TextEditingController(); - phoneController.addListener(_onPhoneChanged); - _getPicturesUseCase.getPictures(userId: '').then(setImages); - ref.onDispose(disposeControllers); + Future.microtask(load); + return const RemoteConnectionViewState(); } + Future load() async { + final loggedUser = await ref.read(loggedUserProvider.future); + + final pictures = await _getPicturesUseCase.getPictures(userId: loggedUser.id); + setImages(pictures); + } + void setImages(List pictures) { state = state.copyWith( - pictures: pictures + pictures: pictures, + isLoadingPictures: false, ); } @@ -56,6 +57,32 @@ class RemoteConnectionViewModel extends Notifier { state = state.copyWith(phone: text, errorMessage: ''); } + void prevPicture() { + int pictureIndex = state.pictureIndex - 1; + + if (pictureIndex < 0) { + pictureIndex = state.pictures.length - 1; + } + + state = state.copyWith( + pictureIndex: pictureIndex + ); + } + + void nextPicture() { + int pictureIndex = (state.pictureIndex + 1) % state.pictures.length; + + state = state.copyWith( + pictureIndex: pictureIndex + ); + } + + void setPictureIndex(int value) { + state = state.copyWith( + pictureIndex: value, + ); + } + Future takePicture() async { try { state = state.copyWith(isTakingPicture: true); @@ -63,7 +90,7 @@ class RemoteConnectionViewModel extends Notifier { await _takePictureUseCase.takePicture(userId: '') .then((picture) { List pictures = state.pictures; - //pictures.add(picture); + pictures.add(picture); state = state.copyWith( isTakingPicture: true, ); @@ -86,7 +113,6 @@ class RemoteConnectionViewModel extends Notifier { state = state.copyWith(errorMessage: 'errorMessagePhoneIsInvalid'); return; } - } void disposeControllers() { diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_state.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_state.dart index f0475062..4ea3be87 100644 --- a/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_state.dart +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_state.dart @@ -8,7 +8,8 @@ abstract class RemoteConnectionViewState with _$RemoteConnectionViewState { const factory RemoteConnectionViewState({ @Default('') String phone, @Default([]) List pictures, - @Default(true) bool isLoadingImages, + @Default(0) int pictureIndex, + @Default(true) bool isLoadingPictures, @Default(false) bool isTakingPicture, @Default(false) bool isCalling, @Default('') String errorMessage diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_state.freezed.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_state.freezed.dart index a7111a7f..b578eb3a 100644 --- a/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_state.freezed.dart +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/state/remote_connection_view_state.freezed.dart @@ -14,7 +14,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$RemoteConnectionViewState { - String get phone; List get pictures; bool get isLoadingImages; bool get isTakingPicture; bool get isCalling; String get errorMessage; + String get phone; List get pictures; int get pictureIndex; bool get isLoadingPictures; bool get isTakingPicture; bool get isCalling; String get errorMessage; /// Create a copy of RemoteConnectionViewState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -25,16 +25,16 @@ $RemoteConnectionViewStateCopyWith get copyWith => _$ @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is RemoteConnectionViewState&&(identical(other.phone, phone) || other.phone == phone)&&const DeepCollectionEquality().equals(other.pictures, pictures)&&(identical(other.isLoadingImages, isLoadingImages) || other.isLoadingImages == isLoadingImages)&&(identical(other.isTakingPicture, isTakingPicture) || other.isTakingPicture == isTakingPicture)&&(identical(other.isCalling, isCalling) || other.isCalling == isCalling)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is RemoteConnectionViewState&&(identical(other.phone, phone) || other.phone == phone)&&const DeepCollectionEquality().equals(other.pictures, pictures)&&(identical(other.pictureIndex, pictureIndex) || other.pictureIndex == pictureIndex)&&(identical(other.isLoadingPictures, isLoadingPictures) || other.isLoadingPictures == isLoadingPictures)&&(identical(other.isTakingPicture, isTakingPicture) || other.isTakingPicture == isTakingPicture)&&(identical(other.isCalling, isCalling) || other.isCalling == isCalling)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); } @override -int get hashCode => Object.hash(runtimeType,phone,const DeepCollectionEquality().hash(pictures),isLoadingImages,isTakingPicture,isCalling,errorMessage); +int get hashCode => Object.hash(runtimeType,phone,const DeepCollectionEquality().hash(pictures),pictureIndex,isLoadingPictures,isTakingPicture,isCalling,errorMessage); @override String toString() { - return 'RemoteConnectionViewState(phone: $phone, pictures: $pictures, isLoadingImages: $isLoadingImages, isTakingPicture: $isTakingPicture, isCalling: $isCalling, errorMessage: $errorMessage)'; + return 'RemoteConnectionViewState(phone: $phone, pictures: $pictures, pictureIndex: $pictureIndex, isLoadingPictures: $isLoadingPictures, isTakingPicture: $isTakingPicture, isCalling: $isCalling, errorMessage: $errorMessage)'; } @@ -45,7 +45,7 @@ abstract mixin class $RemoteConnectionViewStateCopyWith<$Res> { factory $RemoteConnectionViewStateCopyWith(RemoteConnectionViewState value, $Res Function(RemoteConnectionViewState) _then) = _$RemoteConnectionViewStateCopyWithImpl; @useResult $Res call({ - String phone, List pictures, bool isLoadingImages, bool isTakingPicture, bool isCalling, String errorMessage + String phone, List pictures, int pictureIndex, bool isLoadingPictures, bool isTakingPicture, bool isCalling, String errorMessage }); @@ -62,11 +62,12 @@ class _$RemoteConnectionViewStateCopyWithImpl<$Res> /// Create a copy of RemoteConnectionViewState /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? phone = null,Object? pictures = null,Object? isLoadingImages = null,Object? isTakingPicture = null,Object? isCalling = null,Object? errorMessage = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? phone = null,Object? pictures = null,Object? pictureIndex = null,Object? isLoadingPictures = null,Object? isTakingPicture = null,Object? isCalling = null,Object? errorMessage = null,}) { return _then(_self.copyWith( phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable as String,pictures: null == pictures ? _self.pictures : pictures // ignore: cast_nullable_to_non_nullable -as List,isLoadingImages: null == isLoadingImages ? _self.isLoadingImages : isLoadingImages // ignore: cast_nullable_to_non_nullable +as List,pictureIndex: null == pictureIndex ? _self.pictureIndex : pictureIndex // ignore: cast_nullable_to_non_nullable +as int,isLoadingPictures: null == isLoadingPictures ? _self.isLoadingPictures : isLoadingPictures // ignore: cast_nullable_to_non_nullable as bool,isTakingPicture: null == isTakingPicture ? _self.isTakingPicture : isTakingPicture // ignore: cast_nullable_to_non_nullable as bool,isCalling: null == isCalling ? _self.isCalling : isCalling // ignore: cast_nullable_to_non_nullable as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable @@ -155,10 +156,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String phone, List pictures, bool isLoadingImages, bool isTakingPicture, bool isCalling, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String phone, List pictures, int pictureIndex, bool isLoadingPictures, bool isTakingPicture, bool isCalling, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _RemoteConnectionViewState() when $default != null: -return $default(_that.phone,_that.pictures,_that.isLoadingImages,_that.isTakingPicture,_that.isCalling,_that.errorMessage);case _: +return $default(_that.phone,_that.pictures,_that.pictureIndex,_that.isLoadingPictures,_that.isTakingPicture,_that.isCalling,_that.errorMessage);case _: return orElse(); } @@ -176,10 +177,10 @@ return $default(_that.phone,_that.pictures,_that.isLoadingImages,_that.isTakingP /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String phone, List pictures, bool isLoadingImages, bool isTakingPicture, bool isCalling, String errorMessage) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String phone, List pictures, int pictureIndex, bool isLoadingPictures, bool isTakingPicture, bool isCalling, String errorMessage) $default,) {final _that = this; switch (_that) { case _RemoteConnectionViewState(): -return $default(_that.phone,_that.pictures,_that.isLoadingImages,_that.isTakingPicture,_that.isCalling,_that.errorMessage);case _: +return $default(_that.phone,_that.pictures,_that.pictureIndex,_that.isLoadingPictures,_that.isTakingPicture,_that.isCalling,_that.errorMessage);case _: throw StateError('Unexpected subclass'); } @@ -196,10 +197,10 @@ return $default(_that.phone,_that.pictures,_that.isLoadingImages,_that.isTakingP /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String phone, List pictures, bool isLoadingImages, bool isTakingPicture, bool isCalling, String errorMessage)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String phone, List pictures, int pictureIndex, bool isLoadingPictures, bool isTakingPicture, bool isCalling, String errorMessage)? $default,) {final _that = this; switch (_that) { case _RemoteConnectionViewState() when $default != null: -return $default(_that.phone,_that.pictures,_that.isLoadingImages,_that.isTakingPicture,_that.isCalling,_that.errorMessage);case _: +return $default(_that.phone,_that.pictures,_that.pictureIndex,_that.isLoadingPictures,_that.isTakingPicture,_that.isCalling,_that.errorMessage);case _: return null; } @@ -211,7 +212,7 @@ return $default(_that.phone,_that.pictures,_that.isLoadingImages,_that.isTakingP class _RemoteConnectionViewState implements RemoteConnectionViewState { - const _RemoteConnectionViewState({this.phone = '', final List pictures = const [], this.isLoadingImages = true, this.isTakingPicture = false, this.isCalling = false, this.errorMessage = ''}): _pictures = pictures; + const _RemoteConnectionViewState({this.phone = '', final List pictures = const [], this.pictureIndex = 0, this.isLoadingPictures = true, this.isTakingPicture = false, this.isCalling = false, this.errorMessage = ''}): _pictures = pictures; @override@JsonKey() final String phone; @@ -222,7 +223,8 @@ class _RemoteConnectionViewState implements RemoteConnectionViewState { return EqualUnmodifiableListView(_pictures); } -@override@JsonKey() final bool isLoadingImages; +@override@JsonKey() final int pictureIndex; +@override@JsonKey() final bool isLoadingPictures; @override@JsonKey() final bool isTakingPicture; @override@JsonKey() final bool isCalling; @override@JsonKey() final String errorMessage; @@ -237,16 +239,16 @@ _$RemoteConnectionViewStateCopyWith<_RemoteConnectionViewState> get copyWith => @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _RemoteConnectionViewState&&(identical(other.phone, phone) || other.phone == phone)&&const DeepCollectionEquality().equals(other._pictures, _pictures)&&(identical(other.isLoadingImages, isLoadingImages) || other.isLoadingImages == isLoadingImages)&&(identical(other.isTakingPicture, isTakingPicture) || other.isTakingPicture == isTakingPicture)&&(identical(other.isCalling, isCalling) || other.isCalling == isCalling)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _RemoteConnectionViewState&&(identical(other.phone, phone) || other.phone == phone)&&const DeepCollectionEquality().equals(other._pictures, _pictures)&&(identical(other.pictureIndex, pictureIndex) || other.pictureIndex == pictureIndex)&&(identical(other.isLoadingPictures, isLoadingPictures) || other.isLoadingPictures == isLoadingPictures)&&(identical(other.isTakingPicture, isTakingPicture) || other.isTakingPicture == isTakingPicture)&&(identical(other.isCalling, isCalling) || other.isCalling == isCalling)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); } @override -int get hashCode => Object.hash(runtimeType,phone,const DeepCollectionEquality().hash(_pictures),isLoadingImages,isTakingPicture,isCalling,errorMessage); +int get hashCode => Object.hash(runtimeType,phone,const DeepCollectionEquality().hash(_pictures),pictureIndex,isLoadingPictures,isTakingPicture,isCalling,errorMessage); @override String toString() { - return 'RemoteConnectionViewState(phone: $phone, pictures: $pictures, isLoadingImages: $isLoadingImages, isTakingPicture: $isTakingPicture, isCalling: $isCalling, errorMessage: $errorMessage)'; + return 'RemoteConnectionViewState(phone: $phone, pictures: $pictures, pictureIndex: $pictureIndex, isLoadingPictures: $isLoadingPictures, isTakingPicture: $isTakingPicture, isCalling: $isCalling, errorMessage: $errorMessage)'; } @@ -257,7 +259,7 @@ abstract mixin class _$RemoteConnectionViewStateCopyWith<$Res> implements $Remot factory _$RemoteConnectionViewStateCopyWith(_RemoteConnectionViewState value, $Res Function(_RemoteConnectionViewState) _then) = __$RemoteConnectionViewStateCopyWithImpl; @override @useResult $Res call({ - String phone, List pictures, bool isLoadingImages, bool isTakingPicture, bool isCalling, String errorMessage + String phone, List pictures, int pictureIndex, bool isLoadingPictures, bool isTakingPicture, bool isCalling, String errorMessage }); @@ -274,11 +276,12 @@ class __$RemoteConnectionViewStateCopyWithImpl<$Res> /// Create a copy of RemoteConnectionViewState /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? phone = null,Object? pictures = null,Object? isLoadingImages = null,Object? isTakingPicture = null,Object? isCalling = null,Object? errorMessage = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? phone = null,Object? pictures = null,Object? pictureIndex = null,Object? isLoadingPictures = null,Object? isTakingPicture = null,Object? isCalling = null,Object? errorMessage = null,}) { return _then(_RemoteConnectionViewState( phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable as String,pictures: null == pictures ? _self._pictures : pictures // ignore: cast_nullable_to_non_nullable -as List,isLoadingImages: null == isLoadingImages ? _self.isLoadingImages : isLoadingImages // ignore: cast_nullable_to_non_nullable +as List,pictureIndex: null == pictureIndex ? _self.pictureIndex : pictureIndex // ignore: cast_nullable_to_non_nullable +as int,isLoadingPictures: null == isLoadingPictures ? _self.isLoadingPictures : isLoadingPictures // ignore: cast_nullable_to_non_nullable as bool,isTakingPicture: null == isTakingPicture ? _self.isTakingPicture : isTakingPicture // ignore: cast_nullable_to_non_nullable as bool,isCalling: null == isCalling ? _self.isCalling : isCalling // ignore: cast_nullable_to_non_nullable as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/widgets/show_picture_dialog.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/widgets/show_picture_dialog.dart new file mode 100644 index 00000000..b5eac26f --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/widgets/show_picture_dialog.dart @@ -0,0 +1,105 @@ +import 'package:design_system/design_system.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart'; +import 'package:functions/src/features/remote_connection/presentation/state/remote_connection_view_model.dart'; +import 'package:utils/utils.dart'; + +class ShowPictureDialog extends ConsumerWidget { + + const ShowPictureDialog(); + + @override + Widget build(BuildContext context, WidgetRef ref) { + + final theme = ref.read(themePortProvider); + + final viewModel = ref.read(remoteConnectionViewModelProvider.notifier); + final pictures = ref.watch( + remoteConnectionViewModelProvider.select((s)=>s.pictures) + ); + final pictureIndex = ref.watch( + remoteConnectionViewModelProvider.select((s)=>s.pictureIndex) + ); + + return Container( + decoration: BoxDecoration( + color: theme.getColorFor(ThemeCode.backgroundPrimary), + borderRadius: BorderRadius.all(Radius.circular(8)) + ), + height: SizeUtils.getByScreen(small: 350, big: 340), + child: Column( + children: [ + _PictureSection(asset: pictures[pictureIndex].asset), + _MetadataSection(picture: pictures[pictureIndex]), + _ControlsSection( + prev: viewModel.prevPicture, + next: viewModel.nextPicture, + ), + ], + ), + ); + } +} + +class _PictureSection extends ConsumerWidget { + + final String asset; + + const _PictureSection({ + required this.asset, + }); + + @override + Widget build(BuildContext context, WidgetRef ref) { + + return Expanded( + child: Center( + child: Image.asset(asset), + ) + ); + } +} + +class _MetadataSection extends ConsumerWidget { + + final PictureEntity picture; + + const _MetadataSection({ + required this.picture, + }); + + @override + Widget build(BuildContext context, WidgetRef ref) { + + return Column( + children: [ + Text(picture.createdAt.toString()) + ], + ); + } +} + +class _ControlsSection extends ConsumerWidget { + + final VoidCallback prev; + final VoidCallback next; + + const _ControlsSection({ + required this.prev, + required this.next + }); + + @override + Widget build(BuildContext context, WidgetRef ref) { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + IconButton(onPressed: prev, icon: Icon(Icons.arrow_back_ios_new_rounded)), + IconButton(onPressed: next, icon: Icon(Icons.arrow_forward_ios_rounded)), + ], + ); + } + +} \ No newline at end of file diff --git a/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/widgets/spy_call_dialog.dart b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/widgets/spy_call_dialog.dart new file mode 100644 index 00000000..1e1da73a --- /dev/null +++ b/modules/legacy/modules/functions/lib/src/features/remote_connection/presentation/widgets/spy_call_dialog.dart @@ -0,0 +1,156 @@ +import 'package:design_system/design_system.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:functions/src/features/remote_connection/presentation/state/remote_connection_view_model.dart'; +import 'package:sf_localizations/sf_localizations.dart'; +import 'package:utils/utils.dart'; + +class SpyCallDialog extends ConsumerWidget { + + Future _onCall(BuildContext context, WidgetRef ref) async { + + final vm = ref.read(remoteConnectionViewModelProvider.notifier); + + await vm.call(); + if (!context.mounted) return; + + final errorMessage = ref.read( + remoteConnectionViewModelProvider.select((s)=>s.errorMessage) + ); + + if (errorMessage.isNotEmpty) return; + Navigator.pop(context); + + } + + @override + Widget build(BuildContext context, WidgetRef ref) { + + final theme = ref.watch(themePortProvider); + + return Container( + padding: SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 26, vertical: 20), + big: EdgeInsets.symmetric(horizontal: 24, vertical: 18) + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(8)), + color: theme.getColorFor(ThemeCode.backgroundSecondary) + ), + width: SizeUtils.getByScreen(small: 390, big: 380), + height: SizeUtils.getByScreen(small: 250, big: 243), + child: Column( + children: [ + _Header(theme: theme), + SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), + _PhoneSection(onSubmit: () {_onCall(context, ref);}), + const _ErrorMessageSection(), + SizedBox(height: SizeUtils.getByScreen(small: 28, big: 27)), + _CallSection(onPressed: () {_onCall(context, ref);}), + ], + ), + ); + } +} + +class _Header extends StatelessWidget { + + final ThemePort theme; + + const _Header({ + required this.theme, + }); + + @override + Widget build(BuildContext context) { + return Stack( + children: [ + Center(child: Text(context.translate('Remote listening'), + textAlign: TextAlign.center, + style: TextStyle(fontSize: SizeUtils.getByScreen(small: 19, big: 18)), + )), + Align( + alignment: Alignment.centerRight, + child: IconButton( + onPressed: (){Navigator.pop(context);}, + icon: Icon(Icons.close, color: theme.getColorFor(ThemeCode.legacyPrimary)), + ) + ) + ], + ); + } + +} + +class _PhoneSection extends ConsumerWidget { + + final VoidCallback onSubmit; + + const _PhoneSection({ + required this.onSubmit, + }); + + @override + Widget build(BuildContext context, WidgetRef ref) { + + final vm = ref.read(remoteConnectionViewModelProvider.notifier); + + return CustomTextField( + controller: vm.phoneController, + hint: context.translate(I18n.insertPhone), + keyboardType: TextInputType.number, + onSubmitted: (_) => onSubmit(), + ); + } + +} + +class _ErrorMessageSection extends ConsumerWidget { + + const _ErrorMessageSection(); + + @override + Widget build(BuildContext context, WidgetRef ref) { + + final viewState = ref.watch(remoteConnectionViewModelProvider); + + if (viewState.errorMessage.isNotEmpty) { + return Column( + children: [ + const SizedBox(height: 4), + Text( + viewState.errorMessage, + textAlign: TextAlign.center, + style: const TextStyle( + color: Color.fromRGBO(239, 17, 17, 1), + fontSize: 12, + ), + ), + ], + ); + } else return SizedBox.shrink(); + } +} + +class _CallSection extends ConsumerWidget { + + final VoidCallback onPressed; + + const _CallSection({ + required this.onPressed, + }); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.read(themePortProvider); + + return PrimaryButton( + onPressed: onPressed, + text: context.translate(I18n.call), + color: theme.getColorFor(ThemeCode.legacyPrimary), + height: SizeUtils.getByScreen(small: 38, big: 36), + radius: SizeUtils.getByScreen(small: 32, big: 34), + ); + } + +} \ No newline at end of file diff --git a/modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart b/modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart index ac9c073a..dc68dc2d 100644 --- a/modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart +++ b/modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart @@ -16,7 +16,7 @@ class HomeRemoteDatasourceImpl implements HomeRemoteDatasource { @override Future> getDevices({required String userId}) async { try { - final response = await _repository.get>( + /*final response = await _repository.get>( '/$userId/devices', ); final data = response.data!['items']; @@ -24,17 +24,57 @@ class HomeRemoteDatasourceImpl implements HomeRemoteDatasource { throw Exception('Empty response from /:userId/devices'); } - final model = GetDevicesResponseModel.fromJson(data); - /*final model = GetDevicesResponseModel(items: [ + final model = GetDevicesResponseModel.fromJson(data);*/ + final model = GetDevicesResponseModel(items: [ GetDevicesItemResponseModel( id: '1', identificator: '1111', - carrierName: 'Carlos'), + carrierName: 'Carlos', + phone: '111111111', + settings: GetDevicesSettingsResponseModel( + frequency: 0, + frequencyHeartRate: 0, + timezone: 0, + pedometer: true, + language: 'es', + alerts: [] + ), + protocol: '', + type: '', + connectionServer: '', + createdAt: 0, + flags: GetDevicesFlagsResponseModel( + isInOrOut: 'out', + geofenceId: '1', + isBatteryLow: false, + isDisconnect: false + ) + ), GetDevicesItemResponseModel( - id: '2', - identificator: '1112', - carrierName: 'Ana'), - ]);*/ + id: '2', + identificator: '1112', + carrierName: 'Ana', + phone: '222222222', + settings: GetDevicesSettingsResponseModel( + frequency: 0, + frequencyHeartRate: 0, + timezone: 0, + pedometer: true, + language: 'es', + alerts: [] + ), + protocol: '', + type: '', + connectionServer: '', + createdAt: 0, + flags: GetDevicesFlagsResponseModel( + isInOrOut: 'out', + geofenceId: '2', + isBatteryLow: false, + isDisconnect: false + ) + ), + ]); return model.toEntity(); } on DioException catch (error) { throw _mapDioError( diff --git a/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart b/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart index 238b13e4..9225ab80 100644 --- a/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart @@ -25,9 +25,6 @@ class HubScreen extends ConsumerWidget { 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( @@ -36,83 +33,15 @@ class HubScreen extends ConsumerWidget { child: Column( children: [ SizedBox(height: SizeUtils.getByScreen(small: 8, big: 4)), - Stack( - children: [ - SizedBox( - height: SizeUtils.getByScreen(small: 36, big: 36), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Image.asset('assets/images/ui/iso_sf.png', - height: SizeUtils.getByScreen(small: 18, big: 18)), - SizedBox(width: SizeUtils.getByScreen(small: 8, big: 4)), - SizedBox( - width: SizeUtils.getByScreen(small: 104, big: 100), - height: 32, - child: CustomDropdown( - items: viewState.devices.map((DeviceEntity device)=> - Text(device.carrierName) - ).toList(), - values: viewState.devices, - value: viewState.selectedDevice, - onChanged: (device){viewModel.setSelectedDevice(device);}, - height: 32, - color: Colors.transparent, - padding: EdgeInsets.zero, - ), - ), - ] - ) - ), - Center( - child: SvgPicture.asset('assets/images/ui/logo_sf.svg', - height: SizeUtils.getByScreen(small: 36, big: 36)) - ), - ], - ), + _Header(), SizedBox(height: SizeUtils.getByScreen(small: 12, big: 14)), Expanded(child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppSectionButton( - onPressed: (){navigationContract.pushTo(AppRoutes.customerService);}, - icon: SFIcons.customerService, - text: I18n.customerService), - SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), - AppSectionButton( - onPressed: (){navigationContract.pushTo(AppRoutes.dashboardHome);}, - icon: SFIcons.payments, - text: I18n.sfPay), - SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), - AppSectionButton( - onPressed: (){navigationContract.pushTo(AppRoutes.dashboardFunctions);}, - icon: SFIcons.functions, - text: I18n.functions), - SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), - AppSectionButton( - onPressed: (){navigationContract.pushTo(AppRoutes.accountSettings);}, - 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), - + _MenuSection(navigationContract: navigationContract), 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: Minimap(), - ), + _MapSection(), SizedBox(height: SizeUtils.getByScreen(small: 14, big: 13)), ], ), @@ -125,76 +54,165 @@ class HubScreen extends ConsumerWidget { } } -class AppSectionButton extends ConsumerWidget { +class _Header extends ConsumerWidget { - final GestureTapCallback onPressed; - final IconData icon; - final String text; + const _Header(); - const AppSectionButton({ - required this.onPressed, - required this.icon, - required this.text, + @override + Widget build(BuildContext context, WidgetRef ref) { + + final state = ref.watch(hubViewModelProvider); + final vm = ref.read(hubViewModelProvider.notifier); + + return Stack( + children: [ + SizedBox( + height: SizeUtils.getByScreen(small: 36, big: 36), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Image.asset('assets/images/ui/iso_sf.png', + height: SizeUtils.getByScreen(small: 18, big: 18)), + SizedBox(width: SizeUtils.getByScreen(small: 8, big: 4)), + SizedBox( + width: SizeUtils.getByScreen(small: 104, big: 100), + height: 32, + child: CustomDropdown( + items: state.devices.map((DeviceEntity device)=> + Text( + device.carrierName, + overflow: TextOverflow.ellipsis) + ).toList(), + values: state.devices, + value: state.selectedDevice, + onChanged: (device){vm.setSelectedDevice(device);}, + height: 32, + color: Colors.transparent, + padding: EdgeInsets.zero, + ), + ), + ] + ) + ), + Center( + child: SvgPicture.asset('assets/images/ui/logo_sf.svg', + height: SizeUtils.getByScreen(small: 36, big: 36)) + ), + ], + ); + } + +} + +class _MenuSection extends ConsumerWidget { + + final NavigationContract navigationContract; + + const _MenuSection({ + required this.navigationContract, }); @override Widget build(BuildContext context, WidgetRef ref) { + return Column( + children: [ + _SectionButton( + onPressed: (){navigationContract.pushTo(AppRoutes.customerService);}, + icon: SFIcons.customerService, + text: I18n.customerService), + SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), + _SectionButton( + onPressed: (){navigationContract.pushTo(AppRoutes.dashboardHome);}, + icon: SFIcons.payments, + text: I18n.sfPay), + SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), + _SectionButton( + onPressed: (){navigationContract.pushTo(AppRoutes.dashboardFunctions);}, + icon: SFIcons.functions, + text: I18n.functions), + SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), + _SectionButton( + onPressed: (){navigationContract.pushTo(AppRoutes.accountSettings);}, + icon: Icons.manage_accounts_outlined, + text: I18n.accountSettings), + SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), + _SectionButton( + onPressed: (){}, + icon: Icons.settings_outlined, + text: I18n.deviceSettings), + ], + ); + } + +} + +class _SectionButton extends ConsumerWidget { + + final VoidCallback onPressed; + final IconData icon; + final String text; + + const _SectionButton({ + 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 - ) - ) - ) - ], - ), + return SectionButton( + onPressed: onPressed, + icon: Icon(icon, + size: SizeUtils.getByScreen(small: 40, big: 44), + color: theme.getColorFor(ThemeCode.legacyPrimary), + weight: 30, + ), + iconPadding: SizeUtils.getByScreen(small: 14, big: 12), + body: Text(context.translate(text), + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 18, big: 19), + fontWeight: FontWeight.w500 + ) ) ); } } -class Minimap extends ConsumerWidget { +class _MapSection extends ConsumerWidget { - IconData batteryToIcon(int battery) { - if (battery < 15) return Icons.battery_0_bar; - if (battery < 30) return Icons.battery_1_bar; - if (battery < 45) return Icons.battery_2_bar; - if (battery < 60) return Icons.battery_3_bar; - if (battery < 75) return Icons.battery_4_bar; - if (battery < 90) return Icons.battery_5_bar; - return Icons.battery_6_bar; + const _MapSection(); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.read(themePortProvider); + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(context.translate(I18n.watchesOnMap), + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 20, big: 19), + fontWeight: FontWeight.bold, + color: theme.getColorFor(ThemeCode.legacyPrimary), + ), + ), + SizedBox(height: SizeUtils.getByScreen(small: 4, big: 8)), + SizedBox( + height: SizeUtils.getByScreen(small: 200, big: 300), + child: _Minimap(), + ) + ], + ); } +} + +class _Minimap extends ConsumerWidget { + @override Widget build(BuildContext context, WidgetRef ref) { final theme = ref.watch(themePortProvider); @@ -202,11 +220,6 @@ class Minimap extends ConsumerWidget { final viewState = ref.watch(hubViewModelProvider); final viewModel = ref.read(hubViewModelProvider.notifier); - final battery = viewState.selectedPosition?.ncell ?? 0; - final IconData batteryIcon = batteryToIcon(battery); - - final positionDate = DateTime.fromMillisecondsSinceEpoch(viewState.selectedPosition?.positionDate ?? 0); - return FlutterMap( mapController: viewModel.mapController, options: MapOptions( @@ -235,64 +248,96 @@ class Minimap extends ConsumerWidget { if (viewState.selectedPosition != null) Align( alignment: Alignment.bottomCenter, - child: Container( - height: SizeUtils.getByScreen(small: 60, big: 58), - width: SizeUtils.getByScreen(small: 300, big: 298), - margin: EdgeInsets.only(bottom: SizeUtils.getByScreen(small: 20, big: 16)), - decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.backgroundPrimary), - borderRadius: BorderRadius.all(Radius.circular(SizeUtils.getByScreen(small: 9, big: 8))) - ), - child: Row( - children: [ - Icon(SFIcons.location, - size: SizeUtils.getByScreen(small: 40, big: 38), - color: Color(0xFF588EA5), - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SizedBox( - width: SizeUtils.getByScreen(small: 250, big: 248), - child: Text('${viewState.selectedPosition!.address?.street}, ' - '${viewState.selectedPosition!.address?.province}, ' - '${viewState.selectedPosition!.address?.country}', - overflow: TextOverflow.ellipsis, - ) - ), - Row( - children: [ - Text('${positionDate.month.toString().padLeft(2, '0')}-' - '${positionDate.day.toString().padLeft(2, '0')} ' - '${positionDate.hour.toString().padLeft(2, '0')}:' - '${positionDate.minute.toString().padLeft(2, '0')}:' - '${positionDate.second.toString().padLeft(2, '0')}', - style: TextStyle( - fontSize: SizeUtils.getByScreen(small: 12, big: 11) - ), - ), - if (viewState.selectedPosition!.networks.isNotEmpty) - Text(' | ${viewState.selectedPosition!.networks.first.signal}', - style: TextStyle( - fontSize: SizeUtils.getByScreen(small: 12, big: 11) - ), - ), - Icon(batteryIcon), - Text('${viewState.selectedPosition!.ncell ?? 0}%', - style: TextStyle( - fontSize: SizeUtils.getByScreen(small: 12, big: 11) - ), - ) - ], - ) - ], - ) - ], - ), - ), + child: _LocationBanner(), ) ], ); } +} + +class _LocationBanner extends ConsumerWidget { + + IconData toBatteryIcon(int battery) { + if (battery < 15) return Icons.battery_0_bar; + if (battery < 30) return Icons.battery_1_bar; + if (battery < 45) return Icons.battery_2_bar; + if (battery < 60) return Icons.battery_3_bar; + if (battery < 75) return Icons.battery_4_bar; + if (battery < 90) return Icons.battery_5_bar; + return Icons.battery_6_bar; + } + + const _LocationBanner(); + + @override + Widget build(BuildContext context, WidgetRef ref) { + + final theme = ref.read(themePortProvider); + + final viewState = ref.watch(hubViewModelProvider); + + final battery = viewState.selectedPosition?.ncell ?? 0; + final IconData batteryIcon = toBatteryIcon(battery); + + final positionDate = DateTime.fromMillisecondsSinceEpoch(viewState.selectedPosition?.positionDate ?? 0); + + + return Container( + height: SizeUtils.getByScreen(small: 60, big: 58), + width: SizeUtils.getByScreen(small: 300, big: 298), + margin: EdgeInsets.only(bottom: SizeUtils.getByScreen(small: 20, big: 16)), + decoration: BoxDecoration( + color: theme.getColorFor(ThemeCode.backgroundPrimary), + borderRadius: BorderRadius.all(Radius.circular(SizeUtils.getByScreen(small: 9, big: 8))) + ), + child: Row( + children: [ + Icon(SFIcons.location, + size: SizeUtils.getByScreen(small: 40, big: 38), + color: theme.getColorFor(ThemeCode.legacyPrimary), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + width: SizeUtils.getByScreen(small: 250, big: 248), + child: Text('${viewState.selectedPosition!.address?.street}, ' + '${viewState.selectedPosition!.address?.province}, ' + '${viewState.selectedPosition!.address?.country}', + overflow: TextOverflow.ellipsis, + ) + ), + Row( + children: [ + Text('${positionDate.month.toString().padLeft(2, '0')}-' + '${positionDate.day.toString().padLeft(2, '0')} ' + '${positionDate.hour.toString().padLeft(2, '0')}:' + '${positionDate.minute.toString().padLeft(2, '0')}:' + '${positionDate.second.toString().padLeft(2, '0')}', + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 12, big: 11) + ), + ), + if (viewState.selectedPosition!.networks.isNotEmpty) + Text(' | ${viewState.selectedPosition!.networks.first.signal}', + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 12, big: 11) + ), + ), + Icon(batteryIcon), + Text('${viewState.selectedPosition!.ncell ?? 0}%', + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 12, big: 11) + ), + ) + ], + ) + ], + ) + ], + ), + ); + } + } \ No newline at end of file diff --git a/modules/legacy/modules/hub/pubspec.lock b/modules/legacy/modules/hub/pubspec.lock index 16307937..e96db751 100644 --- a/modules/legacy/modules/hub/pubspec.lock +++ b/modules/legacy/modules/hub/pubspec.lock @@ -595,6 +595,13 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.2" + legacy_dashboard_shell: + dependency: "direct main" + description: + path: "../legacy_dashboard_shell" + relative: true + source: path + version: "0.0.1" legacy_shared: dependency: "direct main" description: diff --git a/modules/legacy/modules/hub/pubspec.yaml b/modules/legacy/modules/hub/pubspec.yaml index b1c41d9d..4618b474 100644 --- a/modules/legacy/modules/hub/pubspec.yaml +++ b/modules/legacy/modules/hub/pubspec.yaml @@ -34,6 +34,8 @@ dependencies: #modules dependencies go here dashboard_shell: path: ../../../../modules/dashboard_shell + legacy_dashboard_shell: + path: ../../modules/legacy_dashboard_shell #packages dependencies go here design_system: path: ../../../../packages/design_system diff --git a/modules/legacy/modules/hub/pubspec_overrides.yaml b/modules/legacy/modules/hub/pubspec_overrides.yaml index 04ccd0da..b15761e1 100644 --- a/modules/legacy/modules/hub/pubspec_overrides.yaml +++ b/modules/legacy/modules/hub/pubspec_overrides.yaml @@ -1,3 +1,4 @@ +# melos_managed_dependency_overrides: legacy_dashboard_shell # melos_managed_dependency_overrides: legacy_shared # melos_managed_dependency_overrides: design_system,fonts,navigation,sf_infrastructure,sf_localizations,utils,auth,dashboard_shell,home,notifications,sf_shared,profile dependency_overrides: @@ -11,6 +12,8 @@ dependency_overrides: path: ..\\..\\..\\..\\packages\\fonts home: path: ..\\..\\..\\home + legacy_dashboard_shell: + path: ..\\legacy_dashboard_shell legacy_shared: path: ..\\..\\packages\\legacy_shared navigation: diff --git a/modules/legacy/packages/legacy_shared/lib/src/components/menu_button.dart b/modules/legacy/packages/legacy_shared/lib/src/components/menu_button.dart new file mode 100644 index 00000000..a54cc17a --- /dev/null +++ b/modules/legacy/packages/legacy_shared/lib/src/components/menu_button.dart @@ -0,0 +1,64 @@ +import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; +import 'package:utils/utils.dart'; + +class AppMenuButton extends StatelessWidget { + + final GestureTapCallback onPressed; + final IconData icon; + final bool negativeIcon; + final double? iconSize; + final String text; + final Color color; + + const AppMenuButton({ + required this.onPressed, + required this.icon, + this.negativeIcon = false, + this.iconSize, + required this.text, + required this.color, + }); + + @override + Widget build(BuildContext context) { + + return TextButton( + onPressed: onPressed, + style: ButtonStyle( + overlayColor: WidgetStatePropertyAll(Color(0xFFF7F7F7)) + ), + child: Row( + children: [ + Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: negativeIcon + ? Colors.white + : color, + ), + height: SizeUtils.getByScreen(small: 52, big: 48), + width: SizeUtils.getByScreen(small: 52, big: 48), + child: Icon(icon, + size: iconSize ?? SizeUtils.getByScreen(small: 52, big: 48), + color: negativeIcon + ? color + : Colors.white, + weight: 30, + ), + ), + SizedBox(width: SizeUtils.getByScreen(small: 16, big: 15)), + Expanded( + child: Text(text, + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 18, big: 19), + fontWeight: FontWeight.w500, + color: Color(0xFF4B4B4B) + ) + ) + ) + ], + ), + ); + } +} \ No newline at end of file diff --git a/modules/legacy/packages/legacy_shared/lib/src/components/section_button.dart b/modules/legacy/packages/legacy_shared/lib/src/components/section_button.dart new file mode 100644 index 00000000..8c65539d --- /dev/null +++ b/modules/legacy/packages/legacy_shared/lib/src/components/section_button.dart @@ -0,0 +1,55 @@ +import 'package:flutter/material.dart'; +import 'package:utils/utils.dart'; + +class SectionButton extends StatelessWidget { + + final GestureTapCallback onPressed; + final Widget icon; + final double? iconPadding; + final Widget body; + + const SectionButton({ + required this.onPressed, + required this.icon, + this.iconPadding, + required this.body, + }); + + @override + Widget build(BuildContext context) { + + return TextButton( + onPressed: onPressed, + style: ButtonStyle( + padding: WidgetStatePropertyAll(SizeUtils.getByScreen( + small: EdgeInsets.symmetric(horizontal: 22, vertical: 16), + big: EdgeInsets.symmetric(horizontal: 21, vertical: 12) + )), + backgroundColor: WidgetStatePropertyAll(Color(0xFFF7F7F7)), + foregroundColor: WidgetStatePropertyAll(Color(0xFF4B4B4B)), + shape: WidgetStatePropertyAll( + RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(SizeUtils.getByScreen(small: 12, big: 18))), + ), + ), + ), + child: Row( + children: [ + Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors.white, + ), + padding: EdgeInsets.all( + iconPadding ?? SizeUtils.getByScreen(small: 12, big: 16)), + child: icon, + ), + SizedBox(width: SizeUtils.getByScreen(small: 16, big: 15)), + Expanded( + child: body + ), + ], + ), + ); + } +} \ No newline at end of file diff --git a/modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart b/modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart index 08732649..80117dbb 100644 --- a/modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart +++ b/modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart @@ -1,21 +1,24 @@ +import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; -import 'package:utils/src/size_utils.dart'; +import 'package:utils/utils.dart'; -class PageLayout extends StatelessWidget{ +class LegacyPageLayout extends StatelessWidget{ final String title; final Widget body; final Widget? footer; final bool showEdit; final VoidCallback? onEditChange; + final ThemePort theme; - const PageLayout({ + const LegacyPageLayout({ super.key, required this.title, required this.body, this.footer, this.showEdit = false, - this.onEditChange + this.onEditChange, + required this.theme, }); @override @@ -37,7 +40,7 @@ class PageLayout extends StatelessWidget{ children: [ IconButton(onPressed: () {Navigator.pop(context);}, icon: Icon(Icons.arrow_back, - color: Color(0xFF588EA5), + color: theme.getColorFor(ThemeCode.legacyPrimary), size: 32, ), padding: EdgeInsets.zero, @@ -45,7 +48,7 @@ class PageLayout extends StatelessWidget{ if (showEdit) DecoratedBox( decoration: BoxDecoration( - color: Color(0xFF588EA5), + color: theme.getColorFor(ThemeCode.legacyPrimary), shape: BoxShape.circle ), child: IconButton(onPressed: onEditChange, @@ -65,7 +68,7 @@ class PageLayout extends StatelessWidget{ fontSize: SizeUtils.getByScreen(small: 20, big: 19), fontWeight: FontWeight.w500, letterSpacing: 0, - color: Color(0xFF588EA5) + color: theme.getColorFor(ThemeCode.legacyPrimary) ), ) ) diff --git a/packages/design_system/lib/design_system.dart b/packages/design_system/lib/design_system.dart index 8e4c970d..f1581269 100644 --- a/packages/design_system/lib/design_system.dart +++ b/packages/design_system/lib/design_system.dart @@ -10,4 +10,4 @@ export 'src/buttons/primary_button.dart'; export 'src/buttons/secondary_button.dart'; export 'src/buttons/custom_text_button.dart'; export 'src/dropdowns/dropdown.dart'; -export 'src/dropdowns/country_prefix_picker.dart'; +export 'src/dropdowns/country_prefix_picker.dart'; \ No newline at end of file diff --git a/packages/design_system/lib/src/theme/theme_port.dart b/packages/design_system/lib/src/theme/theme_port.dart index ea346c1f..a0b4e0f3 100644 --- a/packages/design_system/lib/src/theme/theme_port.dart +++ b/packages/design_system/lib/src/theme/theme_port.dart @@ -20,6 +20,7 @@ enum ThemeCode { textTertiary, buttonPrimary, buttonSecondary, + legacyPrimary, } abstract class ThemePort { diff --git a/packages/design_system/lib/src/theme/theme_sf_adapter.dart b/packages/design_system/lib/src/theme/theme_sf_adapter.dart index 942139ae..06863e4f 100644 --- a/packages/design_system/lib/src/theme/theme_sf_adapter.dart +++ b/packages/design_system/lib/src/theme/theme_sf_adapter.dart @@ -13,6 +13,7 @@ class ThemeSfAdapter extends ThemePort { ThemeCode.textTertiary: Color(0xFFE0E0E0), ThemeCode.buttonPrimary: Color(0xFF329e95), ThemeCode.buttonSecondary: Color(0xFF4B4B4B), + ThemeCode.legacyPrimary: Color(0xFF588EA5), }; @override diff --git a/packages/sf_localizations/assets/l10n/en.json b/packages/sf_localizations/assets/l10n/en.json index 81cd554c..5284de92 100755 --- a/packages/sf_localizations/assets/l10n/en.json +++ b/packages/sf_localizations/assets/l10n/en.json @@ -178,5 +178,34 @@ "userRole": "Role: {role}", "copy": "copy", "deviceIdLabel": "ID: {deviceId}", - "regCodeLabel": "Registration code: {regCode}" + "regCodeLabel": "Registration code: {regCode}", + "deleteAccountBody1": "Canceling an account is an irreversible operation. Please confirm that all services related to the account have been properly managed.\n\nAfter canceling your account, you will no longer be able to use this account or recover any content or information you have added or linked (even if you use the same account to register and reuse), including, but not limited to:\n1. You will not be able to log in and use this account.\n2. Your personal information and account history will not be recovered.\n3. All records of third-party services you use through account linking or account binding cannot be recovered. You will no longer be able to log in and use the above services. Love, gold coins, third-party points, orders, tickets, and other coupons you have received will be considered abandoned and will not be used.\n\nPlease note that canceling your account does not mean that the account behavior and related responsibilities prior to the cancellation of this account are exempt or reduced.", + "deleteAccountBody2": "Clicking \"Request account cancellation\" means that you have read and agree to the above description.", + "requestCancelButton": "Request account cancellation", + "verifyAccount": "Verify account", + "requestCancelTitle": "Request account cancellation", + "requestCancelBody": "1. Account cancellation does not mean operational recovery, so please ensure that the account is no longer in use before operating it.\n2. Once an account cancellation request has been successfully submitted, the platform will delete all information related to your account within one hour.", + "deleteDeviceData": "Delete all information related to the {name} device", + "confirm": "Confirm", + "remoteConnection": "Remote connection", + "calendar": "Calendar", + "contacts": "Contacts", + "doNotDisturb": "Do not disturb", + "videoCall": "Video call", + "health": "Health", + "activityMeter": "Activity meter", + "rewards": "Rewards", + "callWatch": "Call watch", + "appsUse": "Apps use", + "appsSurveillance": "Apps surveillance", + "makeFriends": "Make friends", + "locateSF": "Play sound on device", + "locateSFBody1": "Locate your device with a sound.", + "locateSFBody2": "1. Press the Play Sound button to activate the sound on the device.\n2. Press OK.\n3. The device will play a sound.\n4. The device will start sounding after receiving the instructions.", + "locateSFAction": "Locate my SaveFamily", + "insertPhone": "Insert your phone number", + "call": "Call me", + "takePicture": "Take a picture", + "remoteCamera": "Remote Camera", + "remoteListening": "Remote Listening" } \ 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 b6d9d71f..176f142b 100644 --- a/packages/sf_localizations/assets/l10n/es.json +++ b/packages/sf_localizations/assets/l10n/es.json @@ -184,5 +184,26 @@ "requestCancelTitle": "Solicitud de cancelación de la cuenta", "requestCancelBody": "1. La cancelación de la cuenta no es la recuperación operacional, asegúrate de que antes de operar la cuenta ya no se utiliza.\n2. Enviado correctamente una cancelación de la cuenta de la aplicación, la plataforma se eliminará toda la información relacionada con tu cuenta dentro de 1 hora.", "deleteDeviceData": "Borrar toda la información relacionada con el dispositivo de {name}", - "confirm": "Confirmar" + "confirm": "Confirmar", + "remoteConnection": "Conexión remota", + "calendar": "Horario de actividades", + "contacts": "Agenda", + "doNotDisturb": "No molestar", + "videoCall": "Video llamada", + "health": "Salud", + "activityMeter": "Medidor de actividad", + "rewards": "Enviar recompensas", + "callWatch": "Llamar al reloj", + "appsUse": "Uso de las aplicaciones", + "appsSurveillance": "Supervisión de las aplicaciones", + "makeFriends": "Hacer amigos", + "locateSF": "Reproducir sonido en dispositivo", + "locateSFBody1": "Localiza tu dispositivo con un sonido.", + "locateSFBody2": "1. Pulsa el botón Reproducir Sonido para activar el sonido en el dispositivo.\n2. Pulsa OK\n3. El dispositivo reproducirá un sonido\n4. El dispositivo comenzará a sonar después de recibir las instrucciones", + "locateSFAction": "Ubica mi Savefamily", + "insertPhone": "Inserta tu número de teléfono", + "call": "Llámame", + "takePicture": "Tomar fotografía", + "remoteCamera": "Foto remota", + "remoteListening": "Escucha remota" } \ 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 70203512..123b86f9 100755 --- a/packages/sf_localizations/lib/src/generated/i18n.dart +++ b/packages/sf_localizations/lib/src/generated/i18n.dart @@ -184,35 +184,56 @@ class I18n { static const String enterSubject = 'enterSubject'; static const String enterMessage = 'enterMessage'; static const String sendEmail = 'sendEmail'; - static const String legacyPersonalData = 'personalData'; - static const String legacyChangePassword = 'changePassword'; - static const String legacyAddNewSF = 'addNewSF'; - static const String legacyLinkedDevices = 'linkedDevices'; - static const String legacyAppUsers = 'appUsers'; - static const String legacyPrivacyPolicy = 'privacyPolicy'; - static const String legacyLogOut = 'logOut'; + static const String personalData = 'personalData'; + static const String changePassword = 'changePassword'; + static const String addNewSF = 'addNewSF'; + static const String linkedDevices = 'linkedDevices'; + static const String appUsers = 'appUsers'; + static const String privacyPolicy = 'privacyPolicy'; + static const String logOut = 'logOut'; static const String passwordLabel = 'passwordLabel'; - static const String legacySubmit = 'submit'; - static const String legacySave = 'save'; - static const String legacyEditDeviceTitle = 'editDeviceTitle'; - static const String legacyName = 'name'; - static const String legacyDeleteDeviceDialog = 'deleteDeviceDialog'; - static const String legacyDeleteUserDialog = 'deleteUserDialog'; - static const String legacyCancel = 'cancel'; - static const String legacyDelete = 'delete'; - static const String legacyUserAccount = 'userAccount'; - static const String legacyUserRole = 'userRole'; - static const String legacyCopy = 'copy'; - static const String legacyDeviceIdLabel = 'deviceIdLabel'; - static const String legacyRegCodeLabel = 'regCodeLabel'; - static const String legacyRegCode = 'regCode'; - static const String legacyDeleteAccount = 'deleteAccount'; - static const String legacyDeleteAccountBody1 = 'deleteAccountBody1'; - static const String legacyDeleteAccountBody2 = 'deleteAccountBody2'; - static const String legacyRequestCancelButton = 'requestCancelButton'; - static const String legacyVerifyAccount = 'verifyAccount'; - static const String legacyRequestCancelTitle = 'requestCancelTitle'; - static const String legacyRequestCancelBody = 'requestCancelBody'; - static const String legacyDeleteDeviceData = 'deleteDeviceData'; - static const String legacyConfirm = 'confirm'; + static const String submit = 'submit'; + static const String save = 'save'; + static const String editDeviceTitle = 'editDeviceTitle'; + static const String name = 'name'; + static const String deleteDeviceDialog = 'deleteDeviceDialog'; + static const String deleteUserDialog = 'deleteUserDialog'; + static const String cancel = 'cancel'; + static const String delete = 'delete'; + static const String userAccount = 'userAccount'; + static const String userRole = 'userRole'; + static const String copy = 'copy'; + static const String deviceIdLabel = 'deviceIdLabel'; + static const String regCodeLabel = 'regCodeLabel'; + static const String regCode = 'regCode'; + static const String deleteAccount = 'deleteAccount'; + static const String deleteAccountBody1 = 'deleteAccountBody1'; + static const String deleteAccountBody2 = 'deleteAccountBody2'; + static const String requestCancelButton = 'requestCancelButton'; + static const String verifyAccount = 'verifyAccount'; + static const String requestCancelTitle = 'requestCancelTitle'; + static const String requestCancelBody = 'requestCancelBody'; + static const String deleteDeviceData = 'deleteDeviceData'; + static const String confirm = 'confirm'; + static const String remoteConnection = 'remoteConnection'; + static const String calendar = 'calendar'; + static const String contacts = 'contacts'; + static const String doNotDisturb = 'doNotDisturb'; + static const String videoCall = 'videoCall'; + static const String health = 'health'; + static const String activityMeter = 'activityMeter'; + static const String rewards = 'rewards'; + static const String callWatch = 'callWatch'; + static const String appsUse = 'appsUse'; + static const String appsSurveillance = 'appsSurveillance'; + static const String makeFriends = 'makeFriends'; + static const String locateSF = 'locateSF'; + static const String locateSFBody1 = 'locateSFBody1'; + static const String locateSFBody2 = 'locateSFBody2'; + static const String locateSFAction = 'locateSFAction'; + static const String insertPhone = 'insertPhone'; + static const String call = 'call'; + static const String takePicture = 'takePicture'; + static const String remoteCamera = 'remoteCamera'; + static const String remoteListening = 'remoteListening'; }