Compare commits

...

23 Commits

Author SHA1 Message Date
fa36037aac personal data dial code 2026-03-16 17:45:00 +01:00
c9e2adf692 contacts dial codes 2026-03-16 16:22:45 +01:00
995b69eb65 Merge remote-tracking branch 'origin/fusion-app' into legacy 2026-03-16 15:25:16 +01:00
88269c40f8 Add iOS privacy keys for staging/dev flavors, bump build to 4, hide SF Pay button 2026-03-16 15:09:26 +01:00
f1226b4c18 Merge remote-tracking branch 'origin/fusion-app' into legacy
# Conflicts:
#	apps/mobile_app/lib/save_family_app.dart
#	packages/sf_localizations/assets/l10n/de.json
#	packages/sf_localizations/assets/l10n/en.json
#	packages/sf_localizations/assets/l10n/es.json
#	packages/sf_localizations/assets/l10n/fr.json
#	packages/sf_localizations/assets/l10n/it.json
#	packages/sf_localizations/assets/l10n/pt.json
#	packages/sf_localizations/lib/src/generated/i18n.dart
2026-03-16 13:26:08 +01:00
b636550619 navigation fixes 2026-03-16 13:10:55 +01:00
797d236547 fix translation texts 2026-03-16 12:56:17 +01:00
90447ce9a0 Merge branch 'feature/remote-management' into legacy
# Conflicts:
#	apps/mobile_app/lib/save_family_app.dart
#	packages/sf_localizations/assets/l10n/de.json
#	packages/sf_localizations/assets/l10n/en.json
#	packages/sf_localizations/assets/l10n/es.json
#	packages/sf_localizations/assets/l10n/fr.json
#	packages/sf_localizations/assets/l10n/it.json
#	packages/sf_localizations/assets/l10n/pt.json
#	packages/sf_localizations/lib/src/generated/i18n.dart
2026-03-16 12:54:23 +01:00
22ef648b41 Merge remote-tracking branch 'origin/fusion-app' into legacy
# Conflicts:
#	apps/mobile_app/lib/navigation/app_router.dart
#	packages/sf_localizations/assets/l10n/en.json
#	packages/sf_localizations/assets/l10n/es.json
#	packages/sf_localizations/lib/src/generated/i18n.dart
2026-03-16 12:50:54 +01:00
ae4bc7824a Merge remote-tracking branch 'origin/feature/remote-management' into feature/remote-management 2026-03-16 12:47:18 +01:00
4eb4ac81ce Merge origin/feature/remote-management
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 12:46:58 +01:00
01d9d4241b remote management commands 2026-03-16 12:46:13 +01:00
907eaf8d33 commented some tabs to deploy in stores ,persistence login and heartbeaat 2026-03-16 12:40:24 +01:00
440bbcac66 device management features, settings module and contact sync
Device management:
  - Activity meter with steps charts and history
  - Apps usage with daily breakdown and top apps
  - Health monitoring (heart rate, oxygen, blood pressure)
  - Scheduled activities with timeline and CRUD
  - Contacts sync to device via contact-lists
  - Locate device, rewards refactor

  Settings (new module):
  - Block phone
  - SOS contacts
  - WiFi networks
  - Alarm refactor with full CRUD
  - Settings menu with feature stubs

  Account:
  - Personal data and account settings refactor

  Shared:
  - 100+ i18n keys in 6 languages
  - New routes in app_router
  - WeekDayChips, TimeRangeSelector shared widgets
  - Legacy dashboard shell simplified
2026-03-16 08:37:52 +01:00
904cfee2a9 comment some widgets 2026-03-13 09:44:59 +01:00
69b3cf358a add edit profile screens (child/parent) with SCA, paginated transactions, and reactive state refresh 2026-03-12 22:42:38 +01:00
ec4e42b408 settings ui 2026-03-12 17:40:06 +01:00
9bf06f2480 contacts endpoints and state fix 2026-03-12 17:11:26 +01:00
903e1991e1 delete account endpoint 2026-03-12 11:12:13 +01:00
f9d8f59195 personal data ui fix and endpoint 2026-03-11 17:35:00 +01:00
ffc0a1f103 legacy device setup screen flow from account settings 2026-03-11 13:11:11 +01:00
53cadd8499 linked devices state and models fix 2026-03-11 11:56:39 +01:00
b4bb90d357 change password state fix and endpoint 2026-03-10 17:35:48 +01:00
546 changed files with 39804 additions and 6011 deletions

View File

@@ -0,0 +1 @@
{"version":2,"entries":[{"package":"sf_app_platform_mono_repo","rootUri":"../","packageUri":"lib/"}]}

View File

@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_secure_storage","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.3/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"android":[{"name":"flutter_secure_storage","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_android","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_android-2.2.20/","native_build":true,"dependencies":[],"dev_dependency":false}],"macos":[{"name":"flutter_secure_storage_macos","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_macos-3.1.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.3/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"linux":[{"name":"flutter_secure_storage_linux","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_linux-1.2.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_linux","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[],"dev_dependency":false}],"windows":[{"name":"flutter_secure_storage_windows","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_windows-3.1.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_windows","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[],"dev_dependency":false}],"web":[{"name":"flutter_secure_storage_web","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_web-1.2.1/","dependencies":[],"dev_dependency":false}]},"dependencyGraph":[{"name":"flutter_secure_storage","dependencies":["flutter_secure_storage_linux","flutter_secure_storage_macos","flutter_secure_storage_web","flutter_secure_storage_windows"]},{"name":"flutter_secure_storage_linux","dependencies":[]},{"name":"flutter_secure_storage_macos","dependencies":[]},{"name":"flutter_secure_storage_web","dependencies":[]},{"name":"flutter_secure_storage_windows","dependencies":["path_provider"]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2026-02-27 12:35:56.235180","version":"3.35.7","swift_package_manager_enabled":{"ios":false,"macos":false}}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_secure_storage","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.3/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"android":[{"name":"flutter_secure_storage","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_android","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_android-2.2.20/","native_build":true,"dependencies":[],"dev_dependency":false}],"macos":[{"name":"flutter_secure_storage_macos","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_macos-3.1.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.3/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"linux":[{"name":"flutter_secure_storage_linux","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_linux-1.2.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_linux","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[],"dev_dependency":false}],"windows":[{"name":"flutter_secure_storage_windows","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_windows-3.1.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_windows","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[],"dev_dependency":false}],"web":[{"name":"flutter_secure_storage_web","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_web-1.2.1/","dependencies":[],"dev_dependency":false}]},"dependencyGraph":[{"name":"flutter_secure_storage","dependencies":["flutter_secure_storage_linux","flutter_secure_storage_macos","flutter_secure_storage_web","flutter_secure_storage_windows"]},{"name":"flutter_secure_storage_linux","dependencies":[]},{"name":"flutter_secure_storage_macos","dependencies":[]},{"name":"flutter_secure_storage_web","dependencies":[]},{"name":"flutter_secure_storage_windows","dependencies":["path_provider"]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2026-03-13 09:52:54.635963","version":"3.35.7","swift_package_manager_enabled":{"ios":false,"macos":false}}

View File

@@ -4,6 +4,7 @@
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<application
android:label="@string/app_name"

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,6 @@
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
# permission_handler: enable contacts permission
PERMISSION_CONTACTS=1

View File

@@ -1,5 +1,7 @@
PODS:
- Flutter (1.0.0)
- flutter_contacts (0.0.1):
- Flutter
- flutter_native_splash (2.4.3):
- Flutter
- flutter_treezor_entrust_sdk_bridge (0.0.1):
@@ -23,6 +25,7 @@ PODS:
DEPENDENCIES:
- Flutter (from `Flutter`)
- flutter_contacts (from `.symlinks/plugins/flutter_contacts/ios`)
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
- flutter_treezor_entrust_sdk_bridge (from `.symlinks/plugins/flutter_treezor_entrust_sdk_bridge/ios`)
- mobile_scanner (from `.symlinks/plugins/mobile_scanner/darwin`)
@@ -35,6 +38,8 @@ DEPENDENCIES:
EXTERNAL SOURCES:
Flutter:
:path: Flutter
flutter_contacts:
:path: ".symlinks/plugins/flutter_contacts/ios"
flutter_native_splash:
:path: ".symlinks/plugins/flutter_native_splash/ios"
flutter_treezor_entrust_sdk_bridge:
@@ -54,6 +59,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
flutter_contacts: edb1c5ce76aa433e20e6cb14c615f4c0b66e0983
flutter_native_splash: df59bb2e1421aa0282cb2e95618af4dcb0c56c29
flutter_treezor_entrust_sdk_bridge: 4c2c94fb74ab57576e8d49f5f2a4b214e41141fe
mobile_scanner: 77265f3dc8d580810e91849d4a0811a90467ed5e

View File

@@ -47,8 +47,14 @@
<true/>
<key>UIStatusBarHidden</key>
<true/>
<key>NSContactsUsageDescription</key>
<string>Necesitamos acceso a tus contactos para seleccionar números de teléfono.</string>
<key>NSCameraUsageDescription</key>
<string>Necesitamos la cámara para escanear códigos QR</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Usamos tu ubicación para verificar la seguridad de las transacciones.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Usamos tu ubicación para verificar la seguridad de las transacciones.</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSFaceIDUsageDescription</key>

View File

@@ -47,8 +47,14 @@
<true/>
<key>UIStatusBarHidden</key>
<true/>
<key>NSContactsUsageDescription</key>
<string>Necesitamos acceso a tus contactos para seleccionar números de teléfono.</string>
<key>NSCameraUsageDescription</key>
<string>Necesitamos la cámara para escanear códigos QR</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Usamos tu ubicación para verificar la seguridad de las transacciones.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Usamos tu ubicación para verificar la seguridad de las transacciones.</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSFaceIDUsageDescription</key>

View File

@@ -47,6 +47,8 @@
<true/>
<key>UIStatusBarHidden</key>
<true/>
<key>NSContactsUsageDescription</key>
<string>Necesitamos acceso a tus contactos para seleccionar números de teléfono.</string>
<key>NSCameraUsageDescription</key>
<string>Necesitamos la cámara para escanear códigos QR</string>
<key>NSLocationWhenInUseUsageDescription</key>

View File

@@ -16,6 +16,7 @@ import 'package:navigation/navigation.dart';
import 'package:notifications/notifications.dart';
import 'package:payments/payments.dart';
import 'package:profile/profile.dart';
import 'package:settings/settings.dart';
import 'package:splash/splash.dart';
final GlobalKey<NavigatorState> rootNavigatorKey = GlobalKey<NavigatorState>();
@@ -25,7 +26,7 @@ late final GoRouter appRouter;
void configureAppRouter() {
appRouter = GoRouter(
navigatorKey: rootNavigatorKey,
initialLocation: AppRoutes.controlPanel,
initialLocation: AppRoutes.splash,
debugLogDiagnostics: true,
routes: [
GoRoute(
@@ -93,10 +94,27 @@ void configureAppRouter() {
name: 'device_management',
pageBuilder: DeviceManagementBuilder().buildPage,
routes: [
GoRoute(
path: 'scheduled_activities',
name: 'scheduled_activities',
pageBuilder: const ScheduledActivitiesBuilder().buildPage,
),
GoRoute(
path: 'contacts',
name: 'contacts',
pageBuilder: ContactsBuilder().buildPage,
pageBuilder: const ContactsBuilder().buildPage,
routes: [
GoRoute(
path: 'edit/:contactId',
name: 'edit_contact',
pageBuilder: const EditContactBuilder().buildPage,
),
],
),
GoRoute(
path: 'health',
name: 'health',
pageBuilder: const HealthBuilder().buildPage,
),
GoRoute(
path: 'remote_connection',
@@ -113,6 +131,16 @@ void configureAppRouter() {
name: 'rewards',
pageBuilder: RewardsBuilder().buildPage,
),
GoRoute(
path: 'activity_meter',
name: 'activity_meter',
pageBuilder: const ActivityMeterBuilder().buildPage,
),
GoRoute(
path: 'apps_use',
name: 'apps_use',
pageBuilder: const AppsUseBuilder().buildPage,
),
],
),
],
@@ -130,7 +158,7 @@ void configureAppRouter() {
StatefulShellBranch(
routes: [
GoRoute(
path: '${ AppRoutes.legacyDashboard}/chat',
path: '${AppRoutes.legacyDashboard}/chat',
name: 'legacy_chat',
pageBuilder: (context, state) => MaterialPage<void>(
key: state.pageKey,
@@ -141,8 +169,95 @@ void configureAppRouter() {
),
],
),
StatefulShellBranch(
routes: [
GoRoute(
path: AppRoutes.settings,
name: 'settings',
pageBuilder: SettingsBuilder().buildPage,
routes: [
GoRoute(
path: 'alarm',
name: 'alarm',
pageBuilder: AlarmBuilder().buildPage,
),
GoRoute(
path: 'remote_management',
name: 'remote_management',
pageBuilder: RemoteManagementBuilder().buildPage,
),
GoRoute(
path: 'sos_agenda',
name: 'sos_agenda',
pageBuilder: SosContactsBuilder().buildPage,
),
GoRoute(
path: 'sound',
name: 'sound',
pageBuilder: SoundBuilder().buildPage,
),
GoRoute(
path: 'sync_clock',
name: 'sync_clock',
pageBuilder: SyncClockBuilder().buildPage,
),
GoRoute(
path: 'app_store',
name: 'app_store',
pageBuilder: AppStoreBuilder().buildPage,
),
GoRoute(
path: 'battery',
name: 'battery',
pageBuilder: BatteryBuilder().buildPage,
),
GoRoute(
path: 'block_phone',
name: 'block_phone',
pageBuilder: BlockPhoneBuilder().buildPage,
),
GoRoute(
path: 'disable_functions',
name: 'disable_functions',
pageBuilder: DisableFunctionsBuilder().buildPage,
),
GoRoute(
path: 'language',
name: 'language',
pageBuilder: LanguageBuilder().buildPage,
),
GoRoute(
path: 'legacy_notifications',
name: 'legacy_notifications',
pageBuilder: LegacyNotificationsBuilder().buildPage,
),
GoRoute(
path: 'remote_on_off',
name: 'remote_on_off',
pageBuilder: RemoteOnOffBuilder().buildPage,
),
GoRoute(
path: 'sms_alert',
name: 'sms_alert',
pageBuilder: SmsAlertBuilder().buildPage,
),
GoRoute(
path: 'timezone',
name: 'timezone',
pageBuilder: TimezoneBuilder().buildPage,
),
GoRoute(
path: 'wifi_settings',
name: 'wifi_settings',
pageBuilder: WifiSettingsBuilder().buildPage,
),
],
),
],
),
],
),
GoRoute(
path: AppRoutes.login,
name: 'login',
@@ -271,6 +386,12 @@ void configureAppRouter() {
name: 'home_extract',
pageBuilder: const ExtractBuilder().buildPage,
),
GoRoute(
path: 'edit',
name: 'home_edit_child_profile',
pageBuilder:
const EditChildProfileBuilder().buildPage,
),
],
),
],
@@ -312,6 +433,12 @@ void configureAppRouter() {
name: 'profile_settings',
pageBuilder: const ProfileSettingsBuilder().buildPage,
routes: [
GoRoute(
path: 'edit-personal-data',
name: 'profile_edit_personal_data',
pageBuilder:
const EditPersonalDataBuilder().buildPage,
),
GoRoute(
path: 'payment-methods',
name: 'profile_payment_methods',

View File

@@ -0,0 +1,42 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
class LegacyHeartbeatService {
LegacyHeartbeatService({
required QuestiaRepository repository,
required void Function() onUnauthorized,
}) : _repository = repository,
_onUnauthorized = onUnauthorized;
final QuestiaRepository _repository;
final void Function() _onUnauthorized;
Timer? _timer;
static const _interval = Duration(minutes: 3);
void start() {
if (_timer != null) return;
_beat();
_timer = Timer.periodic(_interval, (_) => _beat());
debugPrint('[LegacyHeartbeat] started');
}
void stop() {
_timer?.cancel();
_timer = null;
debugPrint('[LegacyHeartbeat] stopped');
}
Future<void> _beat() async {
try {
await _repository.get<dynamic>('/auth/me');
debugPrint('[LegacyHeartbeat] /auth/me => OK');
} catch (e) {
debugPrint('[LegacyHeartbeat] error: $e');
stop();
_onUnauthorized();
}
}
}

View File

@@ -6,7 +6,9 @@ import 'package:sf_app_platform/navigation/app_router.dart';
import 'package:navigation/navigation.dart';
import 'package:sf_app_platform/providers/app_state_provider.dart';
import 'package:sf_app_platform/providers/permissions/permissions_provider.dart';
import 'package:sf_app_platform/providers/legacy_heartbeat_service.dart';
import 'package:sf_app_platform/providers/wallet_heartbeat_service.dart';
import 'package:get_it/get_it.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
import 'package:sf_shared/sf_shared.dart';
import 'package:sf_localizations/sf_localizations.dart';
@@ -23,6 +25,7 @@ class SaveFamilyApp extends ConsumerStatefulWidget {
class SaveFamilyAppState extends ConsumerState<SaveFamilyApp>
with WidgetsBindingObserver {
late final WalletHeartbeatService walletHeartbeat;
late final LegacyHeartbeatService legacyHeartbeat;
@override
void initState() {
@@ -33,13 +36,34 @@ class SaveFamilyAppState extends ConsumerState<SaveFamilyApp>
sessionLocal: SessionLocalDatasourceImpl(),
onError: () => appRouter.go(AppRoutes.scaTreezor),
);
onBeforeSessionCleared = walletHeartbeat.stop;
// walletHeartbeat.start();
legacyHeartbeat = LegacyHeartbeatService(
repository: GetIt.I<QuestiaRepository>(),
onUnauthorized: () {
clearSessionData();
appRouter.go(AppRoutes.legacyLogin);
},
);
onBeforeSessionCleared = () {
walletHeartbeat.stop();
legacyHeartbeat.stop();
};
appRouter.routerDelegate.addListener(_onRouteChanged);
}
void _onRouteChanged() {
final location = appRouter.routerDelegate.currentConfiguration.uri.path;
if (location.startsWith(AppRoutes.legacyDashboard)) {
legacyHeartbeat.start();
} else {
legacyHeartbeat.stop();
}
}
@override
void dispose() {
appRouter.routerDelegate.removeListener(_onRouteChanged);
walletHeartbeat.stop();
legacyHeartbeat.stop();
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}
@@ -50,9 +74,11 @@ class SaveFamilyAppState extends ConsumerState<SaveFamilyApp>
ref.read(appLifecycleStateProvider.notifier).setState(state);
if (state == AppLifecycleState.resumed) {
// walletHeartbeat.start();
_onRouteChanged();
ref.read(permissionsProvider.notifier).checkPermissions();
} else if (state == AppLifecycleState.paused) {
// walletHeartbeat.stop();
legacyHeartbeat.stop();
}
super.didChangeAppLifecycleState(state);
}

View File

@@ -1 +1 @@
/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/
C:/Users/Aitor Arana/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_linux-2.2.1/

View File

@@ -1 +1 @@
/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.4.1/
C:/Users/Aitor Arana/AppData/Local/Pub/Cache/hosted/pub.dev/shared_preferences_linux-2.4.1/

View File

@@ -1 +1 @@
/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/url_launcher_linux-3.2.2/
C:/Users/Aitor Arana/AppData/Local/Pub/Cache/hosted/pub.dev/url_launcher_linux-3.2.2/

View File

@@ -406,6 +406,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_contacts:
dependency: transitive
description:
name: flutter_contacts
sha256: "388d32cd33f16640ee169570128c933b45f3259bddbfae7a100bb49e5ffea9ae"
url: "https://pub.dev"
source: hosted
version: "1.1.9+2"
flutter_launcher_icons:
dependency: "direct dev"
description:
@@ -1081,6 +1089,13 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.5.0"
settings:
dependency: "direct main"
description:
path: "../../modules/legacy/modules/settings"
relative: true
source: path
version: "1.0.0+1"
sf_infrastructure:
dependency: "direct main"
description:

View File

@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1
version: 1.0.0+4
environment:
sdk: ^3.9.2
@@ -65,6 +65,8 @@ dependencies:
path: ../../modules/legacy/modules/location
legacy_auth:
path: ../../modules/legacy/modules/legacy_auth
settings:
path: ../../modules/legacy/modules/settings
#packages dependencies go here
navigation:
path: ../../packages/navigation

View File

@@ -1,4 +1,6 @@
# melos_managed_dependency_overrides: account,activity,auth,customer_service,dashboard_shell,design_system,flutter_treezor_entrust_sdk_bridge,fonts,home,legacy_dashboard_shell,legacy_shared,navigation,notifications,payments,profile,sca_treezor,sf_infrastructure,sf_localizations,sf_shared,splash,utils,control_panel,device_management,legacy_auth,location
# melos_managed_dependency_overrides: settings
# melos_managed_dependency_overrides: account,activity,auth,customer_service,dashboard_shell,design_system,flutter_treezor_entrust_sdk_bridge,fonts,home,legacy_dashboard_shell,legacy_shared,navigation,notifications,payments,profile,sca_treezor,sf_infrastructure,sf_localizations,sf_shared,splash,utils,control_panel,device_management
dependency_overrides:
account:
path: ../../modules/legacy/modules/account
@@ -40,6 +42,8 @@ dependency_overrides:
path: ../../modules/profile
sca_treezor:
path: ../../packages/sca_treezor
settings:
path: ../../modules/legacy/modules/settings
sf_infrastructure:
path: ../../packages/sf_infrastructure
sf_localizations:

View File

@@ -22,6 +22,15 @@
<excludeFolder url="file://$MODULE_DIR$/modules/legacy/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/modules/legacy/.pub" />
<excludeFolder url="file://$MODULE_DIR$/modules/legacy/build" />
<excludeFolder url="file://$MODULE_DIR$/linux/flutter/ephemeral/.plugin_symlinks/flutter_secure_storage_linux/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/linux/flutter/ephemeral/.plugin_symlinks/flutter_secure_storage_linux/.pub" />
<excludeFolder url="file://$MODULE_DIR$/linux/flutter/ephemeral/.plugin_symlinks/flutter_secure_storage_linux/build" />
<excludeFolder url="file://$MODULE_DIR$/linux/flutter/ephemeral/.plugin_symlinks/path_provider_linux/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/linux/flutter/ephemeral/.plugin_symlinks/path_provider_linux/.pub" />
<excludeFolder url="file://$MODULE_DIR$/linux/flutter/ephemeral/.plugin_symlinks/path_provider_linux/build" />
<excludeFolder url="file://$MODULE_DIR$/linux/flutter/ephemeral/.plugin_symlinks/path_provider_linux/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/linux/flutter/ephemeral/.plugin_symlinks/path_provider_linux/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/linux/flutter/ephemeral/.plugin_symlinks/path_provider_linux/example/build" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
{"version":2,"entries":[{"package":"design_system","rootUri":"../../../packages/design_system/","packageUri":"lib/"},{"package":"flutter_treezor_entrust_sdk_bridge","rootUri":"../../../packages/flutter_treezor_entrust_sdk_bridge/","packageUri":"lib/"},{"package":"fonts","rootUri":"../../../packages/fonts/","packageUri":"lib/"},{"package":"get_it","rootUri":"file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/get_it-9.2.0/","packageUri":"lib/","config":{"name":"get_it","issueTracker":"https://github.com/fluttercommunity/get_it/issues","version":"0.0.1","materialIconCodePoint":"0xe189"}},{"package":"sca_treezor","rootUri":"../../../packages/sca_treezor/","packageUri":"lib/"},{"package":"sf_infrastructure","rootUri":"../../../packages/sf_infrastructure/","packageUri":"lib/"},{"package":"sf_localizations","rootUri":"../../../packages/sf_localizations/","packageUri":"lib/"},{"package":"sf_shared","rootUri":"../../../packages/sf_shared/","packageUri":"lib/"},{"package":"shared_preferences","rootUri":"file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/shared_preferences-2.5.4/","packageUri":"lib/","config":{"name":"shared_preferences","issueTracker":"https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+shared_preferences%22","version":"1.0.0","materialIconCodePoint":"0xe683"}},{"package":"utils","rootUri":"../../../packages/utils/","packageUri":"lib/"},{"package":"activity","rootUri":"../","packageUri":"lib/"}]}

View File

@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_treezor_entrust_sdk_bridge","path":"C:\\\\dev\\\\sf-app-platform\\\\packages\\\\flutter_treezor_entrust_sdk_bridge\\\\","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.5.1\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.5.6\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"android":[{"name":"flutter_treezor_entrust_sdk_bridge","path":"C:\\\\dev\\\\sf-app-platform\\\\packages\\\\flutter_treezor_entrust_sdk_bridge\\\\","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_android","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.2.22\\\\","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_android","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_android-2.4.20\\\\","native_build":true,"dependencies":[],"dev_dependency":false}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.5.1\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.5.6\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_linux","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_linux-2.4.1\\\\","native_build":false,"dependencies":["path_provider_linux"],"dev_dependency":false}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.3.0\\\\","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_windows","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_windows-2.4.1\\\\","native_build":false,"dependencies":["path_provider_windows"],"dev_dependency":false}],"web":[{"name":"shared_preferences_web","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_web-2.4.3\\\\","dependencies":[],"dev_dependency":false}]},"dependencyGraph":[{"name":"flutter_treezor_entrust_sdk_bridge","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]}],"date_created":"2026-03-09 10:57:00.990731","version":"3.35.6","swift_package_manager_enabled":{"ios":false,"macos":false}}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_treezor_entrust_sdk_bridge","path":"C:\\\\dev\\\\sf-app-platform\\\\packages\\\\flutter_treezor_entrust_sdk_bridge\\\\","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.5.1\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.5.6\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"android":[{"name":"flutter_treezor_entrust_sdk_bridge","path":"C:\\\\dev\\\\sf-app-platform\\\\packages\\\\flutter_treezor_entrust_sdk_bridge\\\\","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_android","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.2.22\\\\","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_android","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_android-2.4.20\\\\","native_build":true,"dependencies":[],"dev_dependency":false}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.5.1\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.5.6\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_linux","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_linux-2.4.1\\\\","native_build":false,"dependencies":["path_provider_linux"],"dev_dependency":false}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.3.0\\\\","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_windows","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_windows-2.4.1\\\\","native_build":false,"dependencies":["path_provider_windows"],"dev_dependency":false}],"web":[{"name":"shared_preferences_web","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_web-2.4.3\\\\","dependencies":[],"dev_dependency":false}]},"dependencyGraph":[{"name":"flutter_treezor_entrust_sdk_bridge","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]}],"date_created":"2026-03-16 09:33:25.098373","version":"3.35.6","swift_package_manager_enabled":{"ios":false,"macos":false}}

View File

@@ -0,0 +1,3 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:

View File

@@ -1,5 +1,6 @@
export 'src/presentation/activity_screen.dart';
export 'src/widgets/activity_list.dart';
export 'src/widgets/pagination_bar.dart';
export 'src/widgets/transaction_tile.dart';
export 'src/activity_builder.dart';
export 'src/providers/activity_providers.dart';

View File

@@ -17,7 +17,7 @@ class GetWalletTransactionsUseCaseImpl implements GetWalletTransactionsUseCase {
required String walletId,
Map<String, dynamic>? queryParameters,
}) {
return _repository.getWalletTransactions(
return _repository.getWalletOperations(
walletId: walletId,
queryParameters: queryParameters,
);

View File

@@ -5,6 +5,7 @@ import 'package:sf_shared/sf_shared.dart';
import 'package:sf_localizations/sf_localizations.dart';
import 'package:activity/src/presentation/state/activity_view_model.dart';
import 'package:activity/src/presentation/state/activity_view_state.dart';
import 'package:activity/src/widgets/pagination_bar.dart';
import 'package:activity/src/widgets/transaction_tile.dart';
class ActivityScreen extends ConsumerStatefulWidget {
@@ -173,7 +174,7 @@ class _ActivityScreenState extends ConsumerState<ActivityScreen> {
return _buildError(context, theme, viewState.errorMessage);
}
if (viewState.transactions.isEmpty) {
if (viewState.transactionPages.isEmpty) {
return Center(
child: Text(
context.translate(I18n.activityNoTransactions),
@@ -185,38 +186,48 @@ class _ActivityScreenState extends ConsumerState<ActivityScreen> {
);
}
final walletId = viewState.selectedTab!.walletId;
final balanceAsync = ref.watch(walletBalanceProvider(walletId));
final currentTransactions = viewState.transactionPages[viewState.currentPage];
return RefreshIndicator(
onRefresh: () =>
ref.read(activityViewModelProvider.notifier).loadTabs(),
child: ListView.builder(
child: ListView(
physics: const AlwaysScrollableScrollPhysics(),
padding: const EdgeInsets.symmetric(horizontal: 24),
itemCount: viewState.transactions.length + 1,
itemBuilder: (context, index) {
if (index == 0) {
return Padding(
padding: const EdgeInsets.only(bottom: 16),
child: balanceAsync.when(
loading: () =>
const Center(child: AppLoadingIndicator(size: 48)),
error: (_, __) => const SizedBox.shrink(),
data: (balance) => WalletBalanceBlock(
availableBalance: balance.availableBalance,
allocatedBalance: balance.allocatedBalance,
totalBalance: balance.totalBalance,
),
),
);
}
final transaction = viewState.transactions[index - 1];
return Padding(
padding: const EdgeInsets.only(bottom: 12),
child: TransactionTile(transaction: transaction),
);
},
children: [
// TODO: WalletBalanceBlock temporarily hidden
// final walletId = viewState.selectedTab!.walletId;
// final balanceAsync = ref.watch(walletBalanceProvider(walletId));
// Padding(
// padding: const EdgeInsets.only(bottom: 16),
// child: balanceAsync.when(
// loading: () =>
// const Center(child: AppLoadingIndicator(size: 48)),
// error: (_, __) => const SizedBox.shrink(),
// data: (balance) => WalletBalanceBlock(
// availableBalance: balance.availableBalance,
// allocatedBalance: balance.allocatedBalance,
// totalBalance: balance.totalBalance,
// ),
// ),
// ),
...currentTransactions.map(
(tx) => Padding(
padding: const EdgeInsets.only(bottom: 12),
child: TransactionTile(transaction: tx),
),
),
PaginationBar(
currentPage: viewState.currentPage,
totalPages: viewState.transactionPages.length,
hasMore: viewState.nextCursor != null,
isLoadingMore: viewState.isLoadingMore,
onPageChanged: (page) =>
ref.read(activityViewModelProvider.notifier).setPage(page),
onLoadMore: () =>
ref.read(activityViewModelProvider.notifier).loadMore(),
),
],
),
);
}

View File

@@ -73,20 +73,27 @@ class ActivityViewModel extends Notifier<ActivityViewState> {
final tab = state.selectedTab;
if (tab == null) return;
state = state.copyWith(isLoadingTransactions: true, errorMessage: '');
state = state.copyWith(
isLoadingTransactions: true,
errorMessage: '',
transactionPages: [],
nextCursor: null,
currentPage: 0,
);
try {
final query = TransactionsQuery(
walletId: tab.walletId,
dateFilter: state.selectedDateFilter,
);
final transactions =
final response =
await ref.read(walletTransactionsProvider(query).future);
if (!ref.mounted) return;
state = state.copyWith(
isLoadingTransactions: false,
transactions: transactions,
transactionPages: [response.items],
nextCursor: response.nextCursor,
);
} catch (e) {
if (!ref.mounted) return;
@@ -97,6 +104,38 @@ class ActivityViewModel extends Notifier<ActivityViewState> {
}
}
Future<void> loadMore() async {
final tab = state.selectedTab;
if (tab == null || state.isLoadingMore || state.nextCursor == null) return;
state = state.copyWith(isLoadingMore: true);
try {
final query = TransactionsQuery(
walletId: tab.walletId,
dateFilter: state.selectedDateFilter,
cursor: state.nextCursor,
);
final response =
await ref.read(walletTransactionsProvider(query).future);
if (!ref.mounted) return;
state = state.copyWith(
isLoadingMore: false,
transactionPages: [...state.transactionPages, response.items],
nextCursor: response.nextCursor,
currentPage: state.transactionPages.length,
);
} catch (e) {
if (!ref.mounted) return;
state = state.copyWith(isLoadingMore: false);
}
}
void setPage(int page) {
state = state.copyWith(currentPage: page);
}
void selectWallet(int index) {
if (index == state.selectedWalletIndex) return;
state = state.copyWith(selectedWalletIndex: index);

View File

@@ -14,7 +14,10 @@ abstract class ActivityViewState with _$ActivityViewState {
@Default([]) List<WalletTab> tabs,
@Default(0) int selectedWalletIndex,
@Default(DateFilter.today) DateFilter selectedDateFilter,
@Default([]) List<WalletTransactionEntity> transactions,
@Default([]) List<List<WalletTransactionEntity>> transactionPages,
String? nextCursor,
@Default(false) bool isLoadingMore,
@Default(0) int currentPage,
@Default('') String errorMessage,
}) = _ActivityViewState;

View File

@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$ActivityViewState {
bool get isLoading; bool get isLoadingTransactions; List<WalletTab> get tabs; int get selectedWalletIndex; DateFilter get selectedDateFilter; List<WalletTransactionEntity> get transactions; String get errorMessage;
bool get isLoading; bool get isLoadingTransactions; List<WalletTab> get tabs; int get selectedWalletIndex; DateFilter get selectedDateFilter; List<List<WalletTransactionEntity>> get transactionPages; String? get nextCursor; bool get isLoadingMore; int get currentPage; String get errorMessage;
/// Create a copy of ActivityViewState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -25,16 +25,16 @@ $ActivityViewStateCopyWith<ActivityViewState> get copyWith => _$ActivityViewStat
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is ActivityViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isLoadingTransactions, isLoadingTransactions) || other.isLoadingTransactions == isLoadingTransactions)&&const DeepCollectionEquality().equals(other.tabs, tabs)&&(identical(other.selectedWalletIndex, selectedWalletIndex) || other.selectedWalletIndex == selectedWalletIndex)&&(identical(other.selectedDateFilter, selectedDateFilter) || other.selectedDateFilter == selectedDateFilter)&&const DeepCollectionEquality().equals(other.transactions, transactions)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
return identical(this, other) || (other.runtimeType == runtimeType&&other is ActivityViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isLoadingTransactions, isLoadingTransactions) || other.isLoadingTransactions == isLoadingTransactions)&&const DeepCollectionEquality().equals(other.tabs, tabs)&&(identical(other.selectedWalletIndex, selectedWalletIndex) || other.selectedWalletIndex == selectedWalletIndex)&&(identical(other.selectedDateFilter, selectedDateFilter) || other.selectedDateFilter == selectedDateFilter)&&const DeepCollectionEquality().equals(other.transactionPages, transactionPages)&&(identical(other.nextCursor, nextCursor) || other.nextCursor == nextCursor)&&(identical(other.isLoadingMore, isLoadingMore) || other.isLoadingMore == isLoadingMore)&&(identical(other.currentPage, currentPage) || other.currentPage == currentPage)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
}
@override
int get hashCode => Object.hash(runtimeType,isLoading,isLoadingTransactions,const DeepCollectionEquality().hash(tabs),selectedWalletIndex,selectedDateFilter,const DeepCollectionEquality().hash(transactions),errorMessage);
int get hashCode => Object.hash(runtimeType,isLoading,isLoadingTransactions,const DeepCollectionEquality().hash(tabs),selectedWalletIndex,selectedDateFilter,const DeepCollectionEquality().hash(transactionPages),nextCursor,isLoadingMore,currentPage,errorMessage);
@override
String toString() {
return 'ActivityViewState(isLoading: $isLoading, isLoadingTransactions: $isLoadingTransactions, tabs: $tabs, selectedWalletIndex: $selectedWalletIndex, selectedDateFilter: $selectedDateFilter, transactions: $transactions, errorMessage: $errorMessage)';
return 'ActivityViewState(isLoading: $isLoading, isLoadingTransactions: $isLoadingTransactions, tabs: $tabs, selectedWalletIndex: $selectedWalletIndex, selectedDateFilter: $selectedDateFilter, transactionPages: $transactionPages, nextCursor: $nextCursor, isLoadingMore: $isLoadingMore, currentPage: $currentPage, errorMessage: $errorMessage)';
}
@@ -45,7 +45,7 @@ abstract mixin class $ActivityViewStateCopyWith<$Res> {
factory $ActivityViewStateCopyWith(ActivityViewState value, $Res Function(ActivityViewState) _then) = _$ActivityViewStateCopyWithImpl;
@useResult
$Res call({
bool isLoading, bool isLoadingTransactions, List<WalletTab> tabs, int selectedWalletIndex, DateFilter selectedDateFilter, List<WalletTransactionEntity> transactions, String errorMessage
bool isLoading, bool isLoadingTransactions, List<WalletTab> tabs, int selectedWalletIndex, DateFilter selectedDateFilter, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage, String errorMessage
});
@@ -62,15 +62,18 @@ class _$ActivityViewStateCopyWithImpl<$Res>
/// Create a copy of ActivityViewState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? isLoadingTransactions = null,Object? tabs = null,Object? selectedWalletIndex = null,Object? selectedDateFilter = null,Object? transactions = null,Object? errorMessage = null,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? isLoadingTransactions = null,Object? tabs = null,Object? selectedWalletIndex = null,Object? selectedDateFilter = null,Object? transactionPages = null,Object? nextCursor = freezed,Object? isLoadingMore = null,Object? currentPage = null,Object? errorMessage = null,}) {
return _then(_self.copyWith(
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,isLoadingTransactions: null == isLoadingTransactions ? _self.isLoadingTransactions : isLoadingTransactions // ignore: cast_nullable_to_non_nullable
as bool,tabs: null == tabs ? _self.tabs : tabs // ignore: cast_nullable_to_non_nullable
as List<WalletTab>,selectedWalletIndex: null == selectedWalletIndex ? _self.selectedWalletIndex : selectedWalletIndex // ignore: cast_nullable_to_non_nullable
as int,selectedDateFilter: null == selectedDateFilter ? _self.selectedDateFilter : selectedDateFilter // ignore: cast_nullable_to_non_nullable
as DateFilter,transactions: null == transactions ? _self.transactions : transactions // ignore: cast_nullable_to_non_nullable
as List<WalletTransactionEntity>,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as DateFilter,transactionPages: null == transactionPages ? _self.transactionPages : transactionPages // ignore: cast_nullable_to_non_nullable
as List<List<WalletTransactionEntity>>,nextCursor: freezed == nextCursor ? _self.nextCursor : nextCursor // ignore: cast_nullable_to_non_nullable
as String?,isLoadingMore: null == isLoadingMore ? _self.isLoadingMore : isLoadingMore // ignore: cast_nullable_to_non_nullable
as bool,currentPage: null == currentPage ? _self.currentPage : currentPage // ignore: cast_nullable_to_non_nullable
as int,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,
));
}
@@ -156,10 +159,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, bool isLoadingTransactions, List<WalletTab> tabs, int selectedWalletIndex, DateFilter selectedDateFilter, List<WalletTransactionEntity> transactions, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, bool isLoadingTransactions, List<WalletTab> tabs, int selectedWalletIndex, DateFilter selectedDateFilter, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _ActivityViewState() when $default != null:
return $default(_that.isLoading,_that.isLoadingTransactions,_that.tabs,_that.selectedWalletIndex,_that.selectedDateFilter,_that.transactions,_that.errorMessage);case _:
return $default(_that.isLoading,_that.isLoadingTransactions,_that.tabs,_that.selectedWalletIndex,_that.selectedDateFilter,_that.transactionPages,_that.nextCursor,_that.isLoadingMore,_that.currentPage,_that.errorMessage);case _:
return orElse();
}
@@ -177,10 +180,10 @@ return $default(_that.isLoading,_that.isLoadingTransactions,_that.tabs,_that.sel
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, bool isLoadingTransactions, List<WalletTab> tabs, int selectedWalletIndex, DateFilter selectedDateFilter, List<WalletTransactionEntity> transactions, String errorMessage) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, bool isLoadingTransactions, List<WalletTab> tabs, int selectedWalletIndex, DateFilter selectedDateFilter, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage, String errorMessage) $default,) {final _that = this;
switch (_that) {
case _ActivityViewState():
return $default(_that.isLoading,_that.isLoadingTransactions,_that.tabs,_that.selectedWalletIndex,_that.selectedDateFilter,_that.transactions,_that.errorMessage);case _:
return $default(_that.isLoading,_that.isLoadingTransactions,_that.tabs,_that.selectedWalletIndex,_that.selectedDateFilter,_that.transactionPages,_that.nextCursor,_that.isLoadingMore,_that.currentPage,_that.errorMessage);case _:
throw StateError('Unexpected subclass');
}
@@ -197,10 +200,10 @@ return $default(_that.isLoading,_that.isLoadingTransactions,_that.tabs,_that.sel
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, bool isLoadingTransactions, List<WalletTab> tabs, int selectedWalletIndex, DateFilter selectedDateFilter, List<WalletTransactionEntity> transactions, String errorMessage)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, bool isLoadingTransactions, List<WalletTab> tabs, int selectedWalletIndex, DateFilter selectedDateFilter, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage, String errorMessage)? $default,) {final _that = this;
switch (_that) {
case _ActivityViewState() when $default != null:
return $default(_that.isLoading,_that.isLoadingTransactions,_that.tabs,_that.selectedWalletIndex,_that.selectedDateFilter,_that.transactions,_that.errorMessage);case _:
return $default(_that.isLoading,_that.isLoadingTransactions,_that.tabs,_that.selectedWalletIndex,_that.selectedDateFilter,_that.transactionPages,_that.nextCursor,_that.isLoadingMore,_that.currentPage,_that.errorMessage);case _:
return null;
}
@@ -212,7 +215,7 @@ return $default(_that.isLoading,_that.isLoadingTransactions,_that.tabs,_that.sel
class _ActivityViewState extends ActivityViewState {
const _ActivityViewState({this.isLoading = false, this.isLoadingTransactions = false, final List<WalletTab> tabs = const [], this.selectedWalletIndex = 0, this.selectedDateFilter = DateFilter.today, final List<WalletTransactionEntity> transactions = const [], this.errorMessage = ''}): _tabs = tabs,_transactions = transactions,super._();
const _ActivityViewState({this.isLoading = false, this.isLoadingTransactions = false, final List<WalletTab> tabs = const [], this.selectedWalletIndex = 0, this.selectedDateFilter = DateFilter.today, final List<List<WalletTransactionEntity>> transactionPages = const [], this.nextCursor, this.isLoadingMore = false, this.currentPage = 0, this.errorMessage = ''}): _tabs = tabs,_transactionPages = transactionPages,super._();
@override@JsonKey() final bool isLoading;
@@ -226,13 +229,16 @@ class _ActivityViewState extends ActivityViewState {
@override@JsonKey() final int selectedWalletIndex;
@override@JsonKey() final DateFilter selectedDateFilter;
final List<WalletTransactionEntity> _transactions;
@override@JsonKey() List<WalletTransactionEntity> get transactions {
if (_transactions is EqualUnmodifiableListView) return _transactions;
final List<List<WalletTransactionEntity>> _transactionPages;
@override@JsonKey() List<List<WalletTransactionEntity>> get transactionPages {
if (_transactionPages is EqualUnmodifiableListView) return _transactionPages;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_transactions);
return EqualUnmodifiableListView(_transactionPages);
}
@override final String? nextCursor;
@override@JsonKey() final bool isLoadingMore;
@override@JsonKey() final int currentPage;
@override@JsonKey() final String errorMessage;
/// Create a copy of ActivityViewState
@@ -245,16 +251,16 @@ _$ActivityViewStateCopyWith<_ActivityViewState> get copyWith => __$ActivityViewS
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ActivityViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isLoadingTransactions, isLoadingTransactions) || other.isLoadingTransactions == isLoadingTransactions)&&const DeepCollectionEquality().equals(other._tabs, _tabs)&&(identical(other.selectedWalletIndex, selectedWalletIndex) || other.selectedWalletIndex == selectedWalletIndex)&&(identical(other.selectedDateFilter, selectedDateFilter) || other.selectedDateFilter == selectedDateFilter)&&const DeepCollectionEquality().equals(other._transactions, _transactions)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ActivityViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isLoadingTransactions, isLoadingTransactions) || other.isLoadingTransactions == isLoadingTransactions)&&const DeepCollectionEquality().equals(other._tabs, _tabs)&&(identical(other.selectedWalletIndex, selectedWalletIndex) || other.selectedWalletIndex == selectedWalletIndex)&&(identical(other.selectedDateFilter, selectedDateFilter) || other.selectedDateFilter == selectedDateFilter)&&const DeepCollectionEquality().equals(other._transactionPages, _transactionPages)&&(identical(other.nextCursor, nextCursor) || other.nextCursor == nextCursor)&&(identical(other.isLoadingMore, isLoadingMore) || other.isLoadingMore == isLoadingMore)&&(identical(other.currentPage, currentPage) || other.currentPage == currentPage)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
}
@override
int get hashCode => Object.hash(runtimeType,isLoading,isLoadingTransactions,const DeepCollectionEquality().hash(_tabs),selectedWalletIndex,selectedDateFilter,const DeepCollectionEquality().hash(_transactions),errorMessage);
int get hashCode => Object.hash(runtimeType,isLoading,isLoadingTransactions,const DeepCollectionEquality().hash(_tabs),selectedWalletIndex,selectedDateFilter,const DeepCollectionEquality().hash(_transactionPages),nextCursor,isLoadingMore,currentPage,errorMessage);
@override
String toString() {
return 'ActivityViewState(isLoading: $isLoading, isLoadingTransactions: $isLoadingTransactions, tabs: $tabs, selectedWalletIndex: $selectedWalletIndex, selectedDateFilter: $selectedDateFilter, transactions: $transactions, errorMessage: $errorMessage)';
return 'ActivityViewState(isLoading: $isLoading, isLoadingTransactions: $isLoadingTransactions, tabs: $tabs, selectedWalletIndex: $selectedWalletIndex, selectedDateFilter: $selectedDateFilter, transactionPages: $transactionPages, nextCursor: $nextCursor, isLoadingMore: $isLoadingMore, currentPage: $currentPage, errorMessage: $errorMessage)';
}
@@ -265,7 +271,7 @@ abstract mixin class _$ActivityViewStateCopyWith<$Res> implements $ActivityViewS
factory _$ActivityViewStateCopyWith(_ActivityViewState value, $Res Function(_ActivityViewState) _then) = __$ActivityViewStateCopyWithImpl;
@override @useResult
$Res call({
bool isLoading, bool isLoadingTransactions, List<WalletTab> tabs, int selectedWalletIndex, DateFilter selectedDateFilter, List<WalletTransactionEntity> transactions, String errorMessage
bool isLoading, bool isLoadingTransactions, List<WalletTab> tabs, int selectedWalletIndex, DateFilter selectedDateFilter, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage, String errorMessage
});
@@ -282,15 +288,18 @@ class __$ActivityViewStateCopyWithImpl<$Res>
/// Create a copy of ActivityViewState
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? isLoadingTransactions = null,Object? tabs = null,Object? selectedWalletIndex = null,Object? selectedDateFilter = null,Object? transactions = null,Object? errorMessage = null,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? isLoadingTransactions = null,Object? tabs = null,Object? selectedWalletIndex = null,Object? selectedDateFilter = null,Object? transactionPages = null,Object? nextCursor = freezed,Object? isLoadingMore = null,Object? currentPage = null,Object? errorMessage = null,}) {
return _then(_ActivityViewState(
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,isLoadingTransactions: null == isLoadingTransactions ? _self.isLoadingTransactions : isLoadingTransactions // ignore: cast_nullable_to_non_nullable
as bool,tabs: null == tabs ? _self._tabs : tabs // ignore: cast_nullable_to_non_nullable
as List<WalletTab>,selectedWalletIndex: null == selectedWalletIndex ? _self.selectedWalletIndex : selectedWalletIndex // ignore: cast_nullable_to_non_nullable
as int,selectedDateFilter: null == selectedDateFilter ? _self.selectedDateFilter : selectedDateFilter // ignore: cast_nullable_to_non_nullable
as DateFilter,transactions: null == transactions ? _self._transactions : transactions // ignore: cast_nullable_to_non_nullable
as List<WalletTransactionEntity>,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as DateFilter,transactionPages: null == transactionPages ? _self._transactionPages : transactionPages // ignore: cast_nullable_to_non_nullable
as List<List<WalletTransactionEntity>>,nextCursor: freezed == nextCursor ? _self.nextCursor : nextCursor // ignore: cast_nullable_to_non_nullable
as String?,isLoadingMore: null == isLoadingMore ? _self.isLoadingMore : isLoadingMore // ignore: cast_nullable_to_non_nullable
as bool,currentPage: null == currentPage ? _self.currentPage : currentPage // ignore: cast_nullable_to_non_nullable
as int,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,
));
}

View File

@@ -0,0 +1,103 @@
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
class PaginationBar extends ConsumerWidget {
final int currentPage;
final int totalPages;
final bool hasMore;
final bool isLoadingMore;
final ValueChanged<int> onPageChanged;
final VoidCallback onLoadMore;
const PaginationBar({
super.key,
required this.currentPage,
required this.totalPages,
required this.hasMore,
required this.isLoadingMore,
required this.onPageChanged,
required this.onLoadMore,
});
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.watch(themePortProvider);
final textColor = theme.getColorFor(ThemeCode.textPrimary);
final primaryColor = theme.getColorFor(ThemeCode.buttonPrimary);
return Padding(
padding: const EdgeInsets.symmetric(vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
onPressed: currentPage > 0
? () => onPageChanged(currentPage - 1)
: null,
icon: Icon(Icons.chevron_left, color: currentPage > 0 ? primaryColor : Colors.grey),
iconSize: 28,
constraints: const BoxConstraints(minWidth: 36, minHeight: 36),
padding: EdgeInsets.zero,
),
Flexible(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
mainAxisSize: MainAxisSize.min,
children: List.generate(totalPages, (index) {
final isSelected = index == currentPage;
return GestureDetector(
onTap: () => onPageChanged(index),
child: Container(
width: 32,
height: 32,
margin: const EdgeInsets.symmetric(horizontal: 4),
decoration: BoxDecoration(
color: isSelected ? primaryColor : Colors.transparent,
borderRadius: BorderRadius.circular(8),
border: isSelected ? null : Border.all(color: Colors.grey.shade300),
),
alignment: Alignment.center,
child: Text(
'${index + 1}',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: isSelected ? Colors.white : textColor,
),
),
),
);
}),
),
),
),
if (hasMore)
isLoadingMore
? const Padding(
padding: EdgeInsets.only(left: 8),
child: AppLoadingIndicator(size: 20),
)
: IconButton(
onPressed: onLoadMore,
icon: Icon(Icons.add_circle_outline, color: primaryColor),
iconSize: 28,
constraints: const BoxConstraints(minWidth: 36, minHeight: 36),
padding: EdgeInsets.zero,
tooltip: 'Load more',
),
IconButton(
onPressed: currentPage < totalPages - 1
? () => onPageChanged(currentPage + 1)
: null,
icon: Icon(Icons.chevron_right, color: currentPage < totalPages - 1 ? primaryColor : Colors.grey),
iconSize: 28,
constraints: const BoxConstraints(minWidth: 36, minHeight: 36),
padding: EdgeInsets.zero,
),
],
),
);
}
}

View File

@@ -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:intl/intl.dart';
import 'package:sf_shared/sf_shared.dart';
import 'package:sf_localizations/sf_localizations.dart';
@@ -12,9 +13,18 @@ class TransactionTile extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.watch(themePortProvider);
final color = _color(transaction.transactionType);
final icon = _icon(transaction.transactionType);
final label = context.translate(_i18nKey(transaction.transactionType));
final isDeclined = transaction.status == 'DECLINED';
final isCredit = transaction.direction == 'CREDIT';
final color = isDeclined ? Colors.grey : _color(transaction.operationType);
final icon = _icon(transaction.operationType);
final label = transaction.merchantName ??
context.translate(_i18nKey(transaction.operationType));
final amountPrefix = isCredit ? '+' : '-';
final amountColor = isDeclined
? Colors.grey
: isCredit
? Colors.green
: Colors.red;
return Container(
padding: const EdgeInsets.all(16),
@@ -41,19 +51,27 @@ class TransactionTile extends ConsumerWidget {
),
),
Text(
'${transaction.amount} ${transaction.currency}',
'$amountPrefix${transaction.amount.toStringAsFixed(2)} ${transaction.currency}',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
color: theme.getColorFor(ThemeCode.textPrimary),
color: amountColor,
decoration: isDeclined ? TextDecoration.lineThrough : null,
),
),
],
),
if (transaction.name.isNotEmpty) ...[
if (transaction.messageToUser != null &&
transaction.messageToUser!.isNotEmpty) ...[
const SizedBox(height: 8),
Text(
transaction.name,
transaction.messageToUser!,
style: const TextStyle(fontSize: 13, color: Colors.red),
),
] else if (transaction.label.isNotEmpty) ...[
const SizedBox(height: 8),
Text(
transaction.label,
style: TextStyle(
fontSize: 14,
color: theme.getColorFor(ThemeCode.textPrimary),
@@ -61,12 +79,65 @@ class TransactionTile extends ConsumerWidget {
),
],
const SizedBox(height: 4),
Text(
transaction.executionDate,
style: TextStyle(
fontSize: 12,
color: theme.getColorFor(ThemeCode.textPrimary),
),
Wrap(
spacing: 8,
runSpacing: 4,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
Text(
_formatDate(transaction.createdDate, context),
style: TextStyle(
fontSize: 12,
color: theme.getColorFor(ThemeCode.textPrimary),
),
),
if (transaction.merchantCity != null &&
transaction.merchantCity!.isNotEmpty)
Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.location_on, size: 12,
color: theme.getColorFor(ThemeCode.textPrimary),
),
const SizedBox(width: 2),
Text(
transaction.merchantCity!,
style: TextStyle(
fontSize: 12,
color: theme.getColorFor(ThemeCode.textPrimary),
),
),
],
),
if (transaction.maskedPan != null &&
transaction.maskedPan!.isNotEmpty)
Text(
transaction.maskedPan!,
style: TextStyle(
fontSize: 12,
color: theme.getColorFor(ThemeCode.textPrimary),
),
),
if (isDeclined)
Container(
padding: const EdgeInsets.symmetric(
horizontal: 6,
vertical: 2,
),
decoration: BoxDecoration(
color: Colors.red.withAlpha(0x1A),
borderRadius: BorderRadius.circular(4),
),
child: Text(
transaction.status,
style: const TextStyle(
fontSize: 10,
fontWeight: FontWeight.w600,
color: Colors.red,
),
),
),
],
),
],
),
@@ -74,82 +145,51 @@ class TransactionTile extends ConsumerWidget {
}
static IconData _icon(TransactionType type) => switch (type) {
TransactionType.payin ||
TransactionType.payinAcquiring ||
TransactionType.checkPayin => Icons.arrow_downward,
TransactionType.payout ||
TransactionType.payoutSctInstantEmit => Icons.arrow_upward,
TransactionType.payinRefund ||
TransactionType.payoutRefund ||
TransactionType.payinRefundAcquiring ||
TransactionType.checkRefund => Icons.replay,
TransactionType.transfer ||
TransactionType.sctr ||
TransactionType.sctrInst ||
TransactionType.creditInternationalTransfer => Icons.swap_horiz,
TransactionType.cardTopup => Icons.arrow_downward,
TransactionType.cardTransaction => Icons.credit_card,
TransactionType.sdde || TransactionType.sddr => Icons.account_balance,
TransactionType.creditTransferReturned ||
TransactionType.payinSctInstantRecall ||
TransactionType.payinSctInstantEmitRecall ||
TransactionType.sctrRecall ||
TransactionType.sddrReversal => Icons.undo,
TransactionType.bankTransfer ||
TransactionType.instantBankTransfer => Icons.account_balance,
TransactionType.walletTransfer => Icons.swap_horiz,
TransactionType.bankDirectDebit => Icons.account_balance_wallet,
TransactionType.check => Icons.receipt_long,
TransactionType.creditNote => Icons.replay,
TransactionType.fees => Icons.monetization_on,
TransactionType.unknown => Icons.help_outline,
};
static Color _color(TransactionType type) => switch (type) {
TransactionType.payin ||
TransactionType.payinAcquiring ||
TransactionType.checkPayin => Colors.green,
TransactionType.payout ||
TransactionType.payoutSctInstantEmit => Colors.red,
TransactionType.payinRefund ||
TransactionType.payoutRefund ||
TransactionType.payinRefundAcquiring ||
TransactionType.checkRefund ||
TransactionType.creditTransferReturned ||
TransactionType.payinSctInstantRecall ||
TransactionType.payinSctInstantEmitRecall ||
TransactionType.sctrRecall ||
TransactionType.sddrReversal => Colors.orange,
TransactionType.transfer ||
TransactionType.sctr ||
TransactionType.sctrInst ||
TransactionType.creditInternationalTransfer ||
TransactionType.sdde ||
TransactionType.sddr => Colors.blue,
TransactionType.cardTopup => Colors.green,
TransactionType.cardTransaction => Colors.purple,
TransactionType.bankTransfer ||
TransactionType.instantBankTransfer ||
TransactionType.walletTransfer => Colors.blue,
TransactionType.bankDirectDebit => Colors.red,
TransactionType.check => Colors.teal,
TransactionType.creditNote => Colors.orange,
TransactionType.fees => Colors.red,
TransactionType.unknown => Colors.grey,
};
static String _i18nKey(TransactionType type) => switch (type) {
TransactionType.payin => I18n.transactionPayin,
TransactionType.payout => I18n.transactionPayout,
TransactionType.transfer => I18n.transactionTransfer,
TransactionType.payinRefund => I18n.transactionPayinRefund,
TransactionType.payoutRefund => I18n.transactionPayoutRefund,
TransactionType.bankDirectDebit => I18n.transactionBankDirectDebit,
TransactionType.bankTransfer => I18n.transactionBankTransfer,
TransactionType.cardTopup => I18n.transactionCardTopup,
TransactionType.cardTransaction => I18n.transactionCardPayment,
TransactionType.payinAcquiring => I18n.transactionPayinAcquiring,
TransactionType.payinRefundAcquiring =>
I18n.transactionPayinRefundAcquiring,
TransactionType.sctrInst => I18n.transactionSctrInst,
TransactionType.payinSctInstantRecall =>
I18n.transactionPayinSctInstantRecall,
TransactionType.payoutSctInstantEmit =>
I18n.transactionPayoutSctInstantEmit,
TransactionType.payinSctInstantEmitRecall =>
I18n.transactionPayinSctInstantEmitRecall,
TransactionType.creditTransferReturned =>
I18n.transactionCreditTransferReturned,
TransactionType.checkPayin => I18n.transactionCheckPayin,
TransactionType.sdde => I18n.transactionSdde,
TransactionType.sddr => I18n.transactionSddr,
TransactionType.sddrReversal => I18n.transactionSddrReversal,
TransactionType.sctrRecall => I18n.transactionSctrRecall,
TransactionType.checkRefund => I18n.transactionCheckRefund,
TransactionType.sctr => I18n.transactionSctr,
TransactionType.creditInternationalTransfer =>
I18n.transactionCreditInternationalTransfer,
TransactionType.check => I18n.transactionCheck,
TransactionType.creditNote => I18n.transactionCreditNote,
TransactionType.fees => I18n.transactionFees,
TransactionType.instantBankTransfer => I18n.transactionInstantBankTransfer,
TransactionType.walletTransfer => I18n.transactionWalletTransfer,
TransactionType.unknown => I18n.transactionUnknown,
};
static String _formatDate(String raw, BuildContext context) {
try {
final date = DateTime.parse(raw).toLocal();
final locale = Localizations.localeOf(context).languageCode;
return DateFormat('d MMM yyyy · HH:mm', locale).format(date);
} catch (_) {
return raw;
}
}
}

View File

@@ -32,7 +32,7 @@ class OnboardingScreen extends ConsumerWidget {
void goToNext() {
if (isLast) {
navigationContract.goTo(AppRoutes.login);
navigationContract.goTo(AppRoutes.legacyLogin);
} else {
pageController.nextPage(
duration: const Duration(milliseconds: 400),
@@ -111,7 +111,7 @@ class OnboardingScreen extends ConsumerWidget {
? const SizedBox.shrink()
: TextButton(
onPressed: () =>
navigationContract.goTo(AppRoutes.login),
navigationContract.goTo(AppRoutes.legacyLogin),
child: Text(
context.translate(I18n.skip),
style: AppFonts.stolzlStyle(

View File

@@ -0,0 +1,3 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:

View File

@@ -7,3 +7,4 @@ export 'src/features/lock_card/lock_card_builder.dart';
export 'src/features/limits/limits_builder.dart';
export 'src/features/goals/goals_builder.dart';
export 'src/features/extract/extract_builder.dart';
export 'src/features/edit_child_profile/edit_child_profile_builder.dart';

View File

@@ -1,6 +1,5 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:sf_shared/sf_shared.dart';
@@ -15,11 +14,12 @@ class ChildDataNotifier extends Notifier<ChildDataState> {
final String childId;
ChildDataNotifier(this.childId);
late final TreezorRepository _treezorRepository;
late final UserRepository _userRepository;
late TreezorRepository _treezorRepository;
late UserRepository _userRepository;
@override
ChildDataState build() {
ref.watch(walletRefreshProvider);
final link = ref.keepAlive();
final timer = Timer(const Duration(minutes: 5), link.close);
ref.onDispose(timer.cancel);
@@ -56,9 +56,7 @@ class ChildDataNotifier extends Notifier<ChildDataState> {
device = await _userRepository.getDeviceByIdentificator(
identificator: childProfile.deviceIdentificator,
);
} catch (e) {
debugPrint('Error fetching device for child $childId: $e');
}
} catch (_) {}
if (!ref.mounted) return;

View File

@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:navigation/navigation.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:sf_localizations/sf_localizations.dart';
import 'package:sf_shared/sf_shared.dart';
import '../../card_colors.dart';
import '../../presentation/state/home_view_model.dart';
@@ -162,14 +163,60 @@ class _ChildWalletScreenState extends ConsumerState<ChildWalletScreen> {
),
),
_buildGenderAvatar(device?.carrierGenre, 50),
Text(
childName,
style: TextStyle(
color: theme.getColorFor(ThemeCode.backgroundPrimary),
fontWeight: FontWeight.bold,
fontSize: 20,
Expanded(
child: Text(
childName,
style: TextStyle(
color: theme.getColorFor(
ThemeCode.backgroundPrimary,
),
fontWeight: FontWeight.bold,
fontSize: 20,
),
),
),
PopupMenuButton<String>(
icon: Icon(
Icons.more_vert,
color: theme.getColorFor(ThemeCode.backgroundPrimary),
),
onSelected: (value) {
if (value == 'edit') {
widget.navigation.pushTo(
AppRoutes.editChildProfile(widget.childId),
);
} else if (value == 'delete') {
_showDeleteConfirmation();
}
},
itemBuilder: (_) => [
PopupMenuItem(
value: 'edit',
child: Row(
spacing: 8,
children: [
Icon(Icons.edit_outlined),
Text(
context.translate(I18n.editChildProfile),
),
],
),
),
PopupMenuItem(
value: 'delete',
child: Row(
spacing: 8,
children: [
Icon(Icons.delete_outline, color: Colors.red),
Text(
context.translate(I18n.deleteDevice),
style: TextStyle(color: Colors.red),
),
],
),
),
],
),
],
),
Column(
@@ -196,76 +243,37 @@ class _ChildWalletScreenState extends ConsumerState<ChildWalletScreen> {
minHeight: 10,
borderRadius: BorderRadius.all(Radius.circular(5)),
),
if (CardStatus.fromString(viewState.cardStatus) ==
CardStatus.lost ||
CardStatus.fromString(viewState.cardStatus) ==
CardStatus.stolen)
TextButton(
style: ButtonStyle(
padding: WidgetStatePropertyAll(EdgeInsets.all(0)),
),
onPressed: viewState.isUpdatingCard
? null
: () => _showDeleteConfirmation(context, ref),
child: Row(
spacing: 10,
children: [
Icon(
Icons.delete_outline,
size: 24,
color: theme.getColorFor(
ThemeCode.textSecondary,
),
),
Text(
context.translate(I18n.deleteDevice),
style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: 16,
color: theme.getColorFor(
ThemeCode.textSecondary,
),
),
),
],
),
)
else
TextButton(
style: ButtonStyle(
padding: WidgetStatePropertyAll(EdgeInsets.all(0)),
),
onPressed: () =>
_showCardStatusSheet(context, ref, theme),
child: Row(
spacing: 10,
children: [
Icon(
Icons.lock_outline,
size: 24,
color: theme.getColorFor(
ThemeCode.textSecondary,
),
),
Text(
locked
? context.translate(
I18n.childWalletUnlockCard,
)
: context.translate(
I18n.childWalletLockCard,
),
style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: 16,
color: theme.getColorFor(
ThemeCode.textSecondary,
),
),
),
],
),
TextButton(
style: ButtonStyle(
padding: WidgetStatePropertyAll(EdgeInsets.all(0)),
),
onPressed: () =>
_showCardStatusSheet(context, ref, theme),
child: Row(
spacing: 10,
children: [
Icon(
Icons.lock_outline,
size: 24,
color: theme.getColorFor(ThemeCode.textSecondary),
),
Text(
locked
? context.translate(
I18n.childWalletUnlockCard,
)
: context.translate(I18n.childWalletLockCard),
style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: 16,
color: theme.getColorFor(
ThemeCode.textSecondary,
),
),
),
],
),
),
],
),
Column(
@@ -302,7 +310,7 @@ class _ChildWalletScreenState extends ConsumerState<ChildWalletScreen> {
child: AppLoadingIndicator(size: 48),
),
)
else if (viewState.transactions.isEmpty)
else if (viewState.transactionPages.isEmpty)
Padding(
padding: const EdgeInsets.all(24),
child: Center(
@@ -319,13 +327,34 @@ class _ChildWalletScreenState extends ConsumerState<ChildWalletScreen> {
),
),
)
else
...viewState.transactions.map(
else ...[
...viewState.transactionPages[viewState.currentPage].map(
(tx) => Padding(
padding: const EdgeInsets.only(bottom: 12),
child: TransactionTile(transaction: tx),
),
),
PaginationBar(
currentPage: viewState.currentPage,
totalPages: viewState.transactionPages.length,
hasMore: viewState.nextCursor != null,
isLoadingMore: viewState.isLoadingMore,
onPageChanged: (page) => ref
.read(
childWalletViewModelProvider(
widget.childId,
).notifier,
)
.setPage(page),
onLoadMore: () => ref
.read(
childWalletViewModelProvider(
widget.childId,
).notifier,
)
.loadMore(),
),
],
],
),
),
@@ -342,17 +371,13 @@ class _ChildWalletScreenState extends ConsumerState<ChildWalletScreen> {
Widget _buildGenderAvatar(String? carrierGenre, double size) {
final IconData icon;
final Color color;
switch (carrierGenre) {
case 'M':
icon = Icons.face;
color = const Color(0xFF64B5F6);
case 'F':
icon = Icons.face_3;
color = const Color(0xFFF48FB1);
default:
icon = Icons.face_2;
color = const Color(0xFF90A4AE);
}
return CircleAvatar(
radius: size / 2,
@@ -376,47 +401,108 @@ class _ChildWalletScreenState extends ConsumerState<ChildWalletScreen> {
);
}
void _showDeleteConfirmation(BuildContext context, WidgetRef ref) {
Future<void> _showDeleteConfirmation() async {
final theme = ref.read(themePortProvider);
final userRepo = ref.read(userRepositoryProvider);
final navigator = Navigator.of(context, rootNavigator: true);
final checkingText = context.translate(I18n.deleteDeviceChecking);
final notAllowedTitle = context.translate(I18n.deleteDeviceNotAllowedTitle);
final nonZeroText = context.translate(
I18n.deleteDeviceWalletNonZeroBalance,
);
final acceptText = context.translate(I18n.accept);
final confirmTitle = context.translate(I18n.deleteDeviceConfirmTitle);
final confirmMessage = context.translate(I18n.deleteDeviceConfirmMessage);
final cancelText = context.translate(I18n.cancel);
final deleteText = context.translate(I18n.deleteDevice);
final successText = context.translate(I18n.deleteDeviceSuccess);
final bgColor = theme.getColorFor(ThemeCode.backgroundPrimary);
final shape = RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
);
showDialog(
context: context,
barrierDismissible: false,
builder: (_) => AlertDialog(
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
title: Text(context.translate(I18n.deleteDeviceConfirmTitle)),
content: Text(context.translate(I18n.deleteDeviceConfirmMessage)),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text(context.translate(I18n.cancel)),
),
TextButton(
onPressed: () async {
Navigator.of(context).pop();
final viewModel = ref.read(
childWalletViewModelProvider(widget.childId).notifier,
);
final success = await viewModel.deleteDevice();
if (success && context.mounted) {
ref
.read(homeViewModelProvider.notifier)
.removeChild(widget.childId);
showTopSnackbar(
context,
message: context.translate(I18n.deleteDeviceSuccess),
type: MessageType.success,
);
widget.navigation.goBack();
}
},
child: Text(
context.translate(I18n.deleteDevice),
style: TextStyle(color: Colors.red),
),
),
],
backgroundColor: bgColor,
shape: shape,
content: Row(
spacing: 16,
children: [const AppLoadingIndicator(size: 24), Text(checkingText)],
),
),
);
try {
final deletability = await userRepo.checkChildProfileDeletability(
childProfileId: widget.childId,
);
if (!mounted) return;
navigator.pop();
if (!deletability.isDeletable) {
if (!mounted) return;
showDialog(
context: context,
builder: (ctx) => AlertDialog(
backgroundColor: bgColor,
shape: shape,
title: Text(notAllowedTitle),
content: Text(nonZeroText),
actions: [
TextButton(
onPressed: () => Navigator.of(ctx).pop(),
child: Text(acceptText),
),
],
),
);
return;
}
if (!mounted) return;
showDialog(
context: context,
builder: (ctx) => AlertDialog(
backgroundColor: bgColor,
shape: shape,
title: Text(confirmTitle),
content: Text(confirmMessage),
actions: [
TextButton(
onPressed: () => Navigator.of(ctx).pop(),
child: Text(cancelText),
),
TextButton(
onPressed: () async {
Navigator.of(ctx).pop();
final viewModel = ref.read(
childWalletViewModelProvider(widget.childId).notifier,
);
final success = await viewModel.deleteDevice();
if (success && mounted) {
ref
.read(homeViewModelProvider.notifier)
.removeChild(widget.childId);
showTopSnackbar(
context,
message: successText,
type: MessageType.success,
);
widget.navigation.goBack();
}
},
child: Text(deleteText, style: TextStyle(color: Colors.red)),
),
],
),
);
} catch (e) {
if (!mounted) return;
navigator.pop();
showTopSnackbar(context, message: e.toString(), type: MessageType.error);
}
}
}
@@ -463,13 +549,19 @@ class _CardStatusSheetState extends ConsumerState<_CardStatusSheet> {
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
),
const SizedBox(height: 20),
...statuses.map(
(status) => RadioListTile<String>(
title: Text(context.translate(_labelKey(status))),
value: status,
groupValue: _selected,
activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
onChanged: (v) => setState(() => _selected = v!),
RadioGroup<String>(
groupValue: _selected!,
onChanged: (v) => setState(() => _selected = v),
child: Column(
children: statuses
.map(
(status) => RadioListTile<String>(
title: Text(context.translate(_labelKey(status))),
value: status,
activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
),
)
.toList(),
),
),
const SizedBox(height: 16),

View File

@@ -5,7 +5,6 @@ import 'package:get_it/get_it.dart';
import 'package:sca_treezor/sca_treezor.dart';
import 'package:sf_shared/sf_shared.dart';
import '../../card_colors.dart';
import 'child_data_provider.dart';
import 'child_wallet_view_state.dart';
@@ -19,8 +18,8 @@ class ChildWalletViewModel extends Notifier<ChildWalletViewState> {
final String childId;
ChildWalletViewModel(this.childId);
late final TreezorWalletConnectionService _connectionService;
late final TreezorWalletSignatureService _signatureService;
late TreezorWalletConnectionService _connectionService;
late TreezorWalletSignatureService _signatureService;
@override
ChildWalletViewState build() {
@@ -43,6 +42,8 @@ class ChildWalletViewModel extends Notifier<ChildWalletViewState> {
}
});
ref.watch(walletRefreshProvider);
final data = ref.read(childDataProvider(childId));
final initialState = ChildWalletViewState(
isLoading: data.isLoading,
@@ -66,19 +67,53 @@ class ChildWalletViewModel extends Notifier<ChildWalletViewState> {
state = state.copyWith(isLoadingTransactions: true);
try {
final query = TransactionsQuery(walletId: walletId);
final transactions =
await ref.read(walletTransactionsProvider(query).future);
final response = await ref.read(
walletTransactionsProvider(query).future,
);
if (!ref.mounted) return;
state = state.copyWith(
isLoadingTransactions: false,
transactions: transactions,
transactionPages: [response.items],
nextCursor: response.nextCursor,
currentPage: 0,
);
} catch (_) {
} catch (e) {
if (!ref.mounted) return;
state = state.copyWith(isLoadingTransactions: false);
}
}
Future<void> loadMore() async {
final walletId = state.childProfile?.walletId;
if (walletId == null || state.isLoadingMore || state.nextCursor == null) return;
state = state.copyWith(isLoadingMore: true);
try {
final query = TransactionsQuery(
walletId: walletId,
cursor: state.nextCursor,
);
final response = await ref.read(
walletTransactionsProvider(query).future,
);
if (!ref.mounted) return;
state = state.copyWith(
isLoadingMore: false,
transactionPages: [...state.transactionPages, response.items],
nextCursor: response.nextCursor,
currentPage: state.transactionPages.length,
);
} catch (_) {
if (!ref.mounted) return;
state = state.copyWith(isLoadingMore: false);
}
}
void setPage(int page) {
state = state.copyWith(currentPage: page);
}
Future<void> _loadCard(String walletId) async {
try {
final card = await ref
@@ -181,6 +216,12 @@ class ChildWalletViewModel extends Notifier<ChildWalletViewState> {
}
}
Future<ChildProfileDeletabilityEntity> checkDeletability() async {
return ref
.read(userRepositoryProvider)
.checkChildProfileDeletability(childProfileId: childId);
}
Future<bool> deleteDevice() async {
final deviceId = state.device?.id;
if (deviceId == null || deviceId.isEmpty) return false;
@@ -195,7 +236,10 @@ class ChildWalletViewModel extends Notifier<ChildWalletViewState> {
return true;
} catch (e) {
if (!ref.mounted) return false;
state = state.copyWith(isUpdatingCard: false, cardStatusError: e.toString());
state = state.copyWith(
isUpdatingCard: false,
cardStatusError: e.toString(),
);
return false;
}
}

View File

@@ -22,6 +22,9 @@ abstract class ChildWalletViewState with _$ChildWalletViewState {
@Default('') String pin,
@Default(false) bool isSigning,
@Default(false) bool isLoadingTransactions,
@Default([]) List<WalletTransactionEntity> transactions,
@Default([]) List<List<WalletTransactionEntity>> transactionPages,
String? nextCursor,
@Default(false) bool isLoadingMore,
@Default(0) int currentPage,
}) = _ChildWalletViewState;
}

View File

@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$ChildWalletViewState {
bool get isLoading; ChildProfileEntity? get childProfile; ChildWalletEntity? get childWallet; DeviceEntity? get device; String get cardId; String get cardStatus; bool get locked; String get errorMessage; bool get isUpdatingCard; String get cardStatusError; bool get cardStatusSuccess; bool get showPin; String get selectedStatus; String get pin; bool get isSigning; bool get isLoadingTransactions; List<WalletTransactionEntity> get transactions;
bool get isLoading; ChildProfileEntity? get childProfile; ChildWalletEntity? get childWallet; DeviceEntity? get device; String get cardId; String get cardStatus; bool get locked; String get errorMessage; bool get isUpdatingCard; String get cardStatusError; bool get cardStatusSuccess; bool get showPin; String get selectedStatus; String get pin; bool get isSigning; bool get isLoadingTransactions; List<List<WalletTransactionEntity>> get transactionPages; String? get nextCursor; bool get isLoadingMore; int get currentPage;
/// Create a copy of ChildWalletViewState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -25,16 +25,16 @@ $ChildWalletViewStateCopyWith<ChildWalletViewState> get copyWith => _$ChildWalle
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is ChildWalletViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.childProfile, childProfile) || other.childProfile == childProfile)&&(identical(other.childWallet, childWallet) || other.childWallet == childWallet)&&(identical(other.device, device) || other.device == device)&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.cardStatus, cardStatus) || other.cardStatus == cardStatus)&&(identical(other.locked, locked) || other.locked == locked)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isUpdatingCard, isUpdatingCard) || other.isUpdatingCard == isUpdatingCard)&&(identical(other.cardStatusError, cardStatusError) || other.cardStatusError == cardStatusError)&&(identical(other.cardStatusSuccess, cardStatusSuccess) || other.cardStatusSuccess == cardStatusSuccess)&&(identical(other.showPin, showPin) || other.showPin == showPin)&&(identical(other.selectedStatus, selectedStatus) || other.selectedStatus == selectedStatus)&&(identical(other.pin, pin) || other.pin == pin)&&(identical(other.isSigning, isSigning) || other.isSigning == isSigning)&&(identical(other.isLoadingTransactions, isLoadingTransactions) || other.isLoadingTransactions == isLoadingTransactions)&&const DeepCollectionEquality().equals(other.transactions, transactions));
return identical(this, other) || (other.runtimeType == runtimeType&&other is ChildWalletViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.childProfile, childProfile) || other.childProfile == childProfile)&&(identical(other.childWallet, childWallet) || other.childWallet == childWallet)&&(identical(other.device, device) || other.device == device)&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.cardStatus, cardStatus) || other.cardStatus == cardStatus)&&(identical(other.locked, locked) || other.locked == locked)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isUpdatingCard, isUpdatingCard) || other.isUpdatingCard == isUpdatingCard)&&(identical(other.cardStatusError, cardStatusError) || other.cardStatusError == cardStatusError)&&(identical(other.cardStatusSuccess, cardStatusSuccess) || other.cardStatusSuccess == cardStatusSuccess)&&(identical(other.showPin, showPin) || other.showPin == showPin)&&(identical(other.selectedStatus, selectedStatus) || other.selectedStatus == selectedStatus)&&(identical(other.pin, pin) || other.pin == pin)&&(identical(other.isSigning, isSigning) || other.isSigning == isSigning)&&(identical(other.isLoadingTransactions, isLoadingTransactions) || other.isLoadingTransactions == isLoadingTransactions)&&const DeepCollectionEquality().equals(other.transactionPages, transactionPages)&&(identical(other.nextCursor, nextCursor) || other.nextCursor == nextCursor)&&(identical(other.isLoadingMore, isLoadingMore) || other.isLoadingMore == isLoadingMore)&&(identical(other.currentPage, currentPage) || other.currentPage == currentPage));
}
@override
int get hashCode => Object.hash(runtimeType,isLoading,childProfile,childWallet,device,cardId,cardStatus,locked,errorMessage,isUpdatingCard,cardStatusError,cardStatusSuccess,showPin,selectedStatus,pin,isSigning,isLoadingTransactions,const DeepCollectionEquality().hash(transactions));
int get hashCode => Object.hashAll([runtimeType,isLoading,childProfile,childWallet,device,cardId,cardStatus,locked,errorMessage,isUpdatingCard,cardStatusError,cardStatusSuccess,showPin,selectedStatus,pin,isSigning,isLoadingTransactions,const DeepCollectionEquality().hash(transactionPages),nextCursor,isLoadingMore,currentPage]);
@override
String toString() {
return 'ChildWalletViewState(isLoading: $isLoading, childProfile: $childProfile, childWallet: $childWallet, device: $device, cardId: $cardId, cardStatus: $cardStatus, locked: $locked, errorMessage: $errorMessage, isUpdatingCard: $isUpdatingCard, cardStatusError: $cardStatusError, cardStatusSuccess: $cardStatusSuccess, showPin: $showPin, selectedStatus: $selectedStatus, pin: $pin, isSigning: $isSigning, isLoadingTransactions: $isLoadingTransactions, transactions: $transactions)';
return 'ChildWalletViewState(isLoading: $isLoading, childProfile: $childProfile, childWallet: $childWallet, device: $device, cardId: $cardId, cardStatus: $cardStatus, locked: $locked, errorMessage: $errorMessage, isUpdatingCard: $isUpdatingCard, cardStatusError: $cardStatusError, cardStatusSuccess: $cardStatusSuccess, showPin: $showPin, selectedStatus: $selectedStatus, pin: $pin, isSigning: $isSigning, isLoadingTransactions: $isLoadingTransactions, transactionPages: $transactionPages, nextCursor: $nextCursor, isLoadingMore: $isLoadingMore, currentPage: $currentPage)';
}
@@ -45,7 +45,7 @@ abstract mixin class $ChildWalletViewStateCopyWith<$Res> {
factory $ChildWalletViewStateCopyWith(ChildWalletViewState value, $Res Function(ChildWalletViewState) _then) = _$ChildWalletViewStateCopyWithImpl;
@useResult
$Res call({
bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<WalletTransactionEntity> transactions
bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage
});
@@ -62,7 +62,7 @@ class _$ChildWalletViewStateCopyWithImpl<$Res>
/// Create a copy of ChildWalletViewState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? childProfile = freezed,Object? childWallet = freezed,Object? device = freezed,Object? cardId = null,Object? cardStatus = null,Object? locked = null,Object? errorMessage = null,Object? isUpdatingCard = null,Object? cardStatusError = null,Object? cardStatusSuccess = null,Object? showPin = null,Object? selectedStatus = null,Object? pin = null,Object? isSigning = null,Object? isLoadingTransactions = null,Object? transactions = null,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? childProfile = freezed,Object? childWallet = freezed,Object? device = freezed,Object? cardId = null,Object? cardStatus = null,Object? locked = null,Object? errorMessage = null,Object? isUpdatingCard = null,Object? cardStatusError = null,Object? cardStatusSuccess = null,Object? showPin = null,Object? selectedStatus = null,Object? pin = null,Object? isSigning = null,Object? isLoadingTransactions = null,Object? transactionPages = null,Object? nextCursor = freezed,Object? isLoadingMore = null,Object? currentPage = null,}) {
return _then(_self.copyWith(
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,childProfile: freezed == childProfile ? _self.childProfile : childProfile // ignore: cast_nullable_to_non_nullable
@@ -80,8 +80,11 @@ as bool,selectedStatus: null == selectedStatus ? _self.selectedStatus : selected
as String,pin: null == pin ? _self.pin : pin // ignore: cast_nullable_to_non_nullable
as String,isSigning: null == isSigning ? _self.isSigning : isSigning // ignore: cast_nullable_to_non_nullable
as bool,isLoadingTransactions: null == isLoadingTransactions ? _self.isLoadingTransactions : isLoadingTransactions // ignore: cast_nullable_to_non_nullable
as bool,transactions: null == transactions ? _self.transactions : transactions // ignore: cast_nullable_to_non_nullable
as List<WalletTransactionEntity>,
as bool,transactionPages: null == transactionPages ? _self.transactionPages : transactionPages // ignore: cast_nullable_to_non_nullable
as List<List<WalletTransactionEntity>>,nextCursor: freezed == nextCursor ? _self.nextCursor : nextCursor // ignore: cast_nullable_to_non_nullable
as String?,isLoadingMore: null == isLoadingMore ? _self.isLoadingMore : isLoadingMore // ignore: cast_nullable_to_non_nullable
as bool,currentPage: null == currentPage ? _self.currentPage : currentPage // ignore: cast_nullable_to_non_nullable
as int,
));
}
/// Create a copy of ChildWalletViewState
@@ -202,10 +205,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<WalletTransactionEntity> transactions)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _ChildWalletViewState() when $default != null:
return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.device,_that.cardId,_that.cardStatus,_that.locked,_that.errorMessage,_that.isUpdatingCard,_that.cardStatusError,_that.cardStatusSuccess,_that.showPin,_that.selectedStatus,_that.pin,_that.isSigning,_that.isLoadingTransactions,_that.transactions);case _:
return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.device,_that.cardId,_that.cardStatus,_that.locked,_that.errorMessage,_that.isUpdatingCard,_that.cardStatusError,_that.cardStatusSuccess,_that.showPin,_that.selectedStatus,_that.pin,_that.isSigning,_that.isLoadingTransactions,_that.transactionPages,_that.nextCursor,_that.isLoadingMore,_that.currentPage);case _:
return orElse();
}
@@ -223,10 +226,10 @@ return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.devic
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<WalletTransactionEntity> transactions) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage) $default,) {final _that = this;
switch (_that) {
case _ChildWalletViewState():
return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.device,_that.cardId,_that.cardStatus,_that.locked,_that.errorMessage,_that.isUpdatingCard,_that.cardStatusError,_that.cardStatusSuccess,_that.showPin,_that.selectedStatus,_that.pin,_that.isSigning,_that.isLoadingTransactions,_that.transactions);case _:
return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.device,_that.cardId,_that.cardStatus,_that.locked,_that.errorMessage,_that.isUpdatingCard,_that.cardStatusError,_that.cardStatusSuccess,_that.showPin,_that.selectedStatus,_that.pin,_that.isSigning,_that.isLoadingTransactions,_that.transactionPages,_that.nextCursor,_that.isLoadingMore,_that.currentPage);case _:
throw StateError('Unexpected subclass');
}
@@ -243,10 +246,10 @@ return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.devic
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<WalletTransactionEntity> transactions)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage)? $default,) {final _that = this;
switch (_that) {
case _ChildWalletViewState() when $default != null:
return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.device,_that.cardId,_that.cardStatus,_that.locked,_that.errorMessage,_that.isUpdatingCard,_that.cardStatusError,_that.cardStatusSuccess,_that.showPin,_that.selectedStatus,_that.pin,_that.isSigning,_that.isLoadingTransactions,_that.transactions);case _:
return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.device,_that.cardId,_that.cardStatus,_that.locked,_that.errorMessage,_that.isUpdatingCard,_that.cardStatusError,_that.cardStatusSuccess,_that.showPin,_that.selectedStatus,_that.pin,_that.isSigning,_that.isLoadingTransactions,_that.transactionPages,_that.nextCursor,_that.isLoadingMore,_that.currentPage);case _:
return null;
}
@@ -258,7 +261,7 @@ return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.devic
class _ChildWalletViewState implements ChildWalletViewState {
const _ChildWalletViewState({this.isLoading = true, this.childProfile, this.childWallet, this.device, this.cardId = '', this.cardStatus = '', this.locked = false, this.errorMessage = '', this.isUpdatingCard = false, this.cardStatusError = '', this.cardStatusSuccess = false, this.showPin = false, this.selectedStatus = '', this.pin = '', this.isSigning = false, this.isLoadingTransactions = false, final List<WalletTransactionEntity> transactions = const []}): _transactions = transactions;
const _ChildWalletViewState({this.isLoading = true, this.childProfile, this.childWallet, this.device, this.cardId = '', this.cardStatus = '', this.locked = false, this.errorMessage = '', this.isUpdatingCard = false, this.cardStatusError = '', this.cardStatusSuccess = false, this.showPin = false, this.selectedStatus = '', this.pin = '', this.isSigning = false, this.isLoadingTransactions = false, final List<List<WalletTransactionEntity>> transactionPages = const [], this.nextCursor, this.isLoadingMore = false, this.currentPage = 0}): _transactionPages = transactionPages;
@override@JsonKey() final bool isLoading;
@@ -277,13 +280,16 @@ class _ChildWalletViewState implements ChildWalletViewState {
@override@JsonKey() final String pin;
@override@JsonKey() final bool isSigning;
@override@JsonKey() final bool isLoadingTransactions;
final List<WalletTransactionEntity> _transactions;
@override@JsonKey() List<WalletTransactionEntity> get transactions {
if (_transactions is EqualUnmodifiableListView) return _transactions;
final List<List<WalletTransactionEntity>> _transactionPages;
@override@JsonKey() List<List<WalletTransactionEntity>> get transactionPages {
if (_transactionPages is EqualUnmodifiableListView) return _transactionPages;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_transactions);
return EqualUnmodifiableListView(_transactionPages);
}
@override final String? nextCursor;
@override@JsonKey() final bool isLoadingMore;
@override@JsonKey() final int currentPage;
/// Create a copy of ChildWalletViewState
/// with the given fields replaced by the non-null parameter values.
@@ -295,16 +301,16 @@ _$ChildWalletViewStateCopyWith<_ChildWalletViewState> get copyWith => __$ChildWa
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ChildWalletViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.childProfile, childProfile) || other.childProfile == childProfile)&&(identical(other.childWallet, childWallet) || other.childWallet == childWallet)&&(identical(other.device, device) || other.device == device)&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.cardStatus, cardStatus) || other.cardStatus == cardStatus)&&(identical(other.locked, locked) || other.locked == locked)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isUpdatingCard, isUpdatingCard) || other.isUpdatingCard == isUpdatingCard)&&(identical(other.cardStatusError, cardStatusError) || other.cardStatusError == cardStatusError)&&(identical(other.cardStatusSuccess, cardStatusSuccess) || other.cardStatusSuccess == cardStatusSuccess)&&(identical(other.showPin, showPin) || other.showPin == showPin)&&(identical(other.selectedStatus, selectedStatus) || other.selectedStatus == selectedStatus)&&(identical(other.pin, pin) || other.pin == pin)&&(identical(other.isSigning, isSigning) || other.isSigning == isSigning)&&(identical(other.isLoadingTransactions, isLoadingTransactions) || other.isLoadingTransactions == isLoadingTransactions)&&const DeepCollectionEquality().equals(other._transactions, _transactions));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ChildWalletViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.childProfile, childProfile) || other.childProfile == childProfile)&&(identical(other.childWallet, childWallet) || other.childWallet == childWallet)&&(identical(other.device, device) || other.device == device)&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.cardStatus, cardStatus) || other.cardStatus == cardStatus)&&(identical(other.locked, locked) || other.locked == locked)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isUpdatingCard, isUpdatingCard) || other.isUpdatingCard == isUpdatingCard)&&(identical(other.cardStatusError, cardStatusError) || other.cardStatusError == cardStatusError)&&(identical(other.cardStatusSuccess, cardStatusSuccess) || other.cardStatusSuccess == cardStatusSuccess)&&(identical(other.showPin, showPin) || other.showPin == showPin)&&(identical(other.selectedStatus, selectedStatus) || other.selectedStatus == selectedStatus)&&(identical(other.pin, pin) || other.pin == pin)&&(identical(other.isSigning, isSigning) || other.isSigning == isSigning)&&(identical(other.isLoadingTransactions, isLoadingTransactions) || other.isLoadingTransactions == isLoadingTransactions)&&const DeepCollectionEquality().equals(other._transactionPages, _transactionPages)&&(identical(other.nextCursor, nextCursor) || other.nextCursor == nextCursor)&&(identical(other.isLoadingMore, isLoadingMore) || other.isLoadingMore == isLoadingMore)&&(identical(other.currentPage, currentPage) || other.currentPage == currentPage));
}
@override
int get hashCode => Object.hash(runtimeType,isLoading,childProfile,childWallet,device,cardId,cardStatus,locked,errorMessage,isUpdatingCard,cardStatusError,cardStatusSuccess,showPin,selectedStatus,pin,isSigning,isLoadingTransactions,const DeepCollectionEquality().hash(_transactions));
int get hashCode => Object.hashAll([runtimeType,isLoading,childProfile,childWallet,device,cardId,cardStatus,locked,errorMessage,isUpdatingCard,cardStatusError,cardStatusSuccess,showPin,selectedStatus,pin,isSigning,isLoadingTransactions,const DeepCollectionEquality().hash(_transactionPages),nextCursor,isLoadingMore,currentPage]);
@override
String toString() {
return 'ChildWalletViewState(isLoading: $isLoading, childProfile: $childProfile, childWallet: $childWallet, device: $device, cardId: $cardId, cardStatus: $cardStatus, locked: $locked, errorMessage: $errorMessage, isUpdatingCard: $isUpdatingCard, cardStatusError: $cardStatusError, cardStatusSuccess: $cardStatusSuccess, showPin: $showPin, selectedStatus: $selectedStatus, pin: $pin, isSigning: $isSigning, isLoadingTransactions: $isLoadingTransactions, transactions: $transactions)';
return 'ChildWalletViewState(isLoading: $isLoading, childProfile: $childProfile, childWallet: $childWallet, device: $device, cardId: $cardId, cardStatus: $cardStatus, locked: $locked, errorMessage: $errorMessage, isUpdatingCard: $isUpdatingCard, cardStatusError: $cardStatusError, cardStatusSuccess: $cardStatusSuccess, showPin: $showPin, selectedStatus: $selectedStatus, pin: $pin, isSigning: $isSigning, isLoadingTransactions: $isLoadingTransactions, transactionPages: $transactionPages, nextCursor: $nextCursor, isLoadingMore: $isLoadingMore, currentPage: $currentPage)';
}
@@ -315,7 +321,7 @@ abstract mixin class _$ChildWalletViewStateCopyWith<$Res> implements $ChildWalle
factory _$ChildWalletViewStateCopyWith(_ChildWalletViewState value, $Res Function(_ChildWalletViewState) _then) = __$ChildWalletViewStateCopyWithImpl;
@override @useResult
$Res call({
bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<WalletTransactionEntity> transactions
bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage
});
@@ -332,7 +338,7 @@ class __$ChildWalletViewStateCopyWithImpl<$Res>
/// Create a copy of ChildWalletViewState
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? childProfile = freezed,Object? childWallet = freezed,Object? device = freezed,Object? cardId = null,Object? cardStatus = null,Object? locked = null,Object? errorMessage = null,Object? isUpdatingCard = null,Object? cardStatusError = null,Object? cardStatusSuccess = null,Object? showPin = null,Object? selectedStatus = null,Object? pin = null,Object? isSigning = null,Object? isLoadingTransactions = null,Object? transactions = null,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? childProfile = freezed,Object? childWallet = freezed,Object? device = freezed,Object? cardId = null,Object? cardStatus = null,Object? locked = null,Object? errorMessage = null,Object? isUpdatingCard = null,Object? cardStatusError = null,Object? cardStatusSuccess = null,Object? showPin = null,Object? selectedStatus = null,Object? pin = null,Object? isSigning = null,Object? isLoadingTransactions = null,Object? transactionPages = null,Object? nextCursor = freezed,Object? isLoadingMore = null,Object? currentPage = null,}) {
return _then(_ChildWalletViewState(
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,childProfile: freezed == childProfile ? _self.childProfile : childProfile // ignore: cast_nullable_to_non_nullable
@@ -350,8 +356,11 @@ as bool,selectedStatus: null == selectedStatus ? _self.selectedStatus : selected
as String,pin: null == pin ? _self.pin : pin // ignore: cast_nullable_to_non_nullable
as String,isSigning: null == isSigning ? _self.isSigning : isSigning // ignore: cast_nullable_to_non_nullable
as bool,isLoadingTransactions: null == isLoadingTransactions ? _self.isLoadingTransactions : isLoadingTransactions // ignore: cast_nullable_to_non_nullable
as bool,transactions: null == transactions ? _self._transactions : transactions // ignore: cast_nullable_to_non_nullable
as List<WalletTransactionEntity>,
as bool,transactionPages: null == transactionPages ? _self._transactionPages : transactionPages // ignore: cast_nullable_to_non_nullable
as List<List<WalletTransactionEntity>>,nextCursor: freezed == nextCursor ? _self.nextCursor : nextCursor // ignore: cast_nullable_to_non_nullable
as String?,isLoadingMore: null == isLoadingMore ? _self.isLoadingMore : isLoadingMore // ignore: cast_nullable_to_non_nullable
as bool,currentPage: null == currentPage ? _self.currentPage : currentPage // ignore: cast_nullable_to_non_nullable
as int,
));
}

View File

@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:sf_shared/sf_shared.dart';
import '../../presentation/state/home_view_model.dart';
import '../child_wallet/child_data_provider.dart';
import 'deposit_view_state.dart';
@@ -100,8 +99,7 @@ class DepositViewModel extends Notifier<DepositViewState> {
);
if (!ref.mounted) return;
ref.read(childDataProvider(childId).notifier).load();
ref.read(homeViewModelProvider.notifier).refreshChildWallet(childId);
ref.read(walletRefreshProvider.notifier).refresh();
await ref.read(parentWalletBalanceProvider.notifier).refresh();
if (!ref.mounted) return;
state = state.copyWith(isSubmitting: false, success: true);

View File

@@ -0,0 +1,22 @@
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:go_router/go_router.dart';
import 'package:navigation/navigation.dart';
import 'presentation/edit_child_profile_screen.dart';
class EditChildProfileBuilder {
const EditChildProfileBuilder();
Page<void> buildPage(BuildContext context, GoRouterState state) {
final childWalletId = state.pathParameters['childWalletId'] ?? '';
final navigationContract = GetIt.I<NavigationContract>();
return MaterialPage(
key: state.pageKey,
child: EditChildProfileScreen(
childId: childWalletId,
navigation: navigationContract,
),
);
}
}

View File

@@ -0,0 +1,191 @@
import 'package:auth/auth.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 'edit_child_profile_view_model.dart';
class EditChildProfileScreen extends ConsumerWidget {
final String childId;
final NavigationContract navigation;
const EditChildProfileScreen({
super.key,
required this.childId,
required this.navigation,
});
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.watch(themePortProvider);
final viewState = ref.watch(editChildProfileViewModelProvider(childId));
final viewModel =
ref.read(editChildProfileViewModelProvider(childId).notifier);
ref.listen(editChildProfileViewModelProvider(childId), (prev, next) {
if (next.saveSuccess && !(prev?.saveSuccess ?? false)) {
showTopSnackbar(
context,
message: context.translate(I18n.editChildProfileSaveSuccess),
type: MessageType.success,
);
navigation.goBack();
}
if (next.errorMessage.isNotEmpty &&
!next.showPin &&
next.errorMessage != (prev?.errorMessage ?? '')) {
showTopSnackbar(
context,
message: next.errorMessage,
type: MessageType.error,
);
}
});
if (viewState.isLoading) {
return Scaffold(
backgroundColor: theme.getColorFor(ThemeCode.backgroundSecondary),
body: const Center(child: AppLoadingIndicator()),
);
}
if (viewState.showPin) {
return _buildPinScaffold(context, theme, viewState, viewModel);
}
return _buildFormScaffold(context, theme, viewState, viewModel);
}
Widget _buildPinScaffold(
BuildContext context,
ThemePort theme,
EditChildProfileViewState viewState,
EditChildProfileViewModel viewModel,
) {
return Scaffold(
backgroundColor: theme.getColorFor(ThemeCode.backgroundSecondary),
appBar: AppBar(
backgroundColor: theme.getColorFor(ThemeCode.backgroundSecondary),
leading: IconButton(
icon: Icon(
Icons.arrow_back,
color: theme.getColorFor(ThemeCode.textPrimary),
),
onPressed: viewModel.cancelPin,
),
),
body: SafeArea(
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: ScaPinView(
title: context.translate(I18n.scaPinEnter),
pin: viewState.pin,
isProcessing: viewState.isSigning || viewState.isSaving,
processingText: context.translate(I18n.scaSigning),
canSubmit: viewModel.canSubmitPin,
submitText: context.translate(I18n.scaConnect),
clearPinText: context.translate(I18n.scaClearPin),
onDigitPressed: viewModel.onDigitPressed,
onBackspacePressed: viewModel.onBackspacePressed,
onClearPin: viewModel.onClearPin,
onSubmit: () => viewModel.onPinSubmit(),
),
),
),
if (viewState.errorMessage.isNotEmpty)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Text(
viewState.errorMessage,
style: const TextStyle(color: Colors.red),
textAlign: TextAlign.center,
),
),
TextButton(
onPressed: viewModel.cancelPin,
child: Text(context.translate(I18n.cancel)),
),
],
),
),
);
}
Widget _buildFormScaffold(
BuildContext context,
ThemePort theme,
EditChildProfileViewState viewState,
EditChildProfileViewModel viewModel,
) {
return Scaffold(
backgroundColor: theme.getColorFor(ThemeCode.backgroundSecondary),
appBar: AppBar(
backgroundColor: theme.getColorFor(ThemeCode.backgroundSecondary),
leading: IconButton(
icon: Icon(
Icons.arrow_back,
color: theme.getColorFor(ThemeCode.textPrimary),
),
onPressed: () => navigation.goBack(),
),
title: Text(
context.translate(I18n.editChildProfileTitle),
style: TextStyle(color: theme.getColorFor(ThemeCode.textPrimary)),
),
),
body: Padding(
padding: const EdgeInsets.all(20),
child: Column(
children: [
Expanded(
child: ListView(
children: [
TextFormField(
initialValue: viewState.firstName,
decoration: InputDecoration(
labelText: context.translate(I18n.firstNameLabel),
border: const OutlineInputBorder(),
),
onChanged: viewModel.setFirstName,
),
const SizedBox(height: 16),
TextFormField(
initialValue: viewState.lastName,
decoration: InputDecoration(
labelText: context.translate(I18n.lastNameLabel),
border: const OutlineInputBorder(),
),
onChanged: viewModel.setLastName,
),
const SizedBox(height: 16),
TextFormField(
initialValue: viewState.address,
decoration: InputDecoration(
labelText: context.translate(I18n.streetLabel),
border: const OutlineInputBorder(),
),
onChanged: viewModel.setAddress,
),
],
),
),
PrimaryButton(
onPressed: () => viewModel.requestPin(),
text: context.translate(I18n.profileSettingsSave),
color: theme.getColorFor(ThemeCode.buttonPrimary),
),
TextButton(
onPressed: () => navigation.goBack(),
child: Text(context.translate(I18n.cancel)),
),
],
),
),
);
}
}

View File

@@ -0,0 +1,155 @@
import 'dart:convert';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:get_it/get_it.dart';
import 'package:sca_treezor/sca_treezor.dart';
import 'package:sf_shared/sf_shared.dart';
import '../../child_wallet/child_data_provider.dart';
export 'edit_child_profile_view_state.dart';
import 'edit_child_profile_view_state.dart';
final editChildProfileViewModelProvider = NotifierProvider.autoDispose
.family<EditChildProfileViewModel, EditChildProfileViewState, String>(
EditChildProfileViewModel.new,
);
class EditChildProfileViewModel extends Notifier<EditChildProfileViewState> {
final String childId;
EditChildProfileViewModel(this.childId);
late TreezorWalletConnectionService _connectionService;
late TreezorWalletSignatureService _signatureService;
@override
EditChildProfileViewState build() {
_connectionService = GetIt.I<TreezorWalletConnectionService>();
_signatureService = GetIt.I<TreezorWalletSignatureService>();
Future.microtask(() => _loadChildProfile());
return const EditChildProfileViewState();
}
Future<void> _loadChildProfile() async {
state = state.copyWith(isLoading: true, errorMessage: '');
try {
final childData = ref.read(childDataProvider(childId));
var childProfile = childData.childProfile;
if (childProfile == null) {
final profiles =
await ref.read(userRepositoryProvider).getChildProfiles();
childProfile = profiles.where((p) => p.id == childId).firstOrNull;
if (childProfile == null) {
state = state.copyWith(
isLoading: false,
errorMessage: 'Child profile not found',
);
return;
}
if (!ref.mounted) return;
}
state = state.copyWith(
isLoading: false,
firstName: childProfile.firstName,
lastName: childProfile.lastName,
address: childProfile.address,
childProfileId: childProfile.id,
treezorUserId: childProfile.treezorUserId,
);
} catch (e) {
if (!ref.mounted) return;
state = state.copyWith(isLoading: false, errorMessage: e.toString());
}
}
void setFirstName(String value) =>
state = state.copyWith(firstName: value, saveSuccess: false);
void setLastName(String value) =>
state = state.copyWith(lastName: value, saveSuccess: false);
void setAddress(String value) =>
state = state.copyWith(address: value, saveSuccess: false);
void requestPin() {
state = state.copyWith(showPin: true, pin: '', errorMessage: '');
}
void cancelPin() {
state = state.copyWith(showPin: false, pin: '');
}
void onDigitPressed(String digit) {
if (state.pin.length >= 6) return;
state = state.copyWith(pin: state.pin + digit, errorMessage: '');
}
void onBackspacePressed() {
if (state.pin.isEmpty) return;
state = state.copyWith(pin: state.pin.substring(0, state.pin.length - 1));
}
void onClearPin() {
state = state.copyWith(pin: '');
}
bool get canSubmitPin => state.pin.length == 6;
Future<void> onPinSubmit() async {
state = state.copyWith(isSigning: true, errorMessage: '');
try {
await _connectionService.connectWithPin(loginPin: state.pin);
if (!ref.mounted) return;
final scaProof = await _generateScaProof();
if (!ref.mounted) return;
state = state.copyWith(isSigning: false, isSaving: true, pin: '');
await ref.read(userRepositoryProvider).updateChildProfile(
childProfileId: state.childProfileId,
scaProof: scaProof,
firstName: state.firstName,
lastName: state.lastName,
address: state.address,
);
if (!ref.mounted) return;
ref.read(walletRefreshProvider.notifier).refresh();
state = state.copyWith(
isSaving: false,
saveSuccess: true,
showPin: false,
);
} catch (e) {
if (!ref.mounted) return;
state = state.copyWith(
isSigning: false,
isSaving: false,
pin: '',
errorMessage: e.toString(),
);
}
}
Future<String> _generateScaProof() async {
final url =
'https://savefamily.sandbox.treezor.co/v1/users/${state.treezorUserId}';
final scaBody = <String, dynamic>{
'firstName': state.firstName,
'lastName': state.lastName,
};
return _signatureService.generateJwsWithPin(
message: '',
input: jsonEncode({'url': url, 'body': scaBody}),
pin: state.pin,
);
}
}

View File

@@ -0,0 +1,21 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'edit_child_profile_view_state.freezed.dart';
@freezed
abstract class EditChildProfileViewState with _$EditChildProfileViewState {
const factory EditChildProfileViewState({
@Default(true) bool isLoading,
@Default(false) bool isSaving,
@Default(false) bool isSigning,
@Default(false) bool showPin,
@Default('') String pin,
@Default('') String firstName,
@Default('') String lastName,
@Default('') String address,
@Default('') String childProfileId,
@Default('') String treezorUserId,
@Default('') String errorMessage,
@Default(false) bool saveSuccess,
}) = _EditChildProfileViewState;
}

View File

@@ -0,0 +1,304 @@
// 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 'edit_child_profile_view_state.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$EditChildProfileViewState {
bool get isLoading; bool get isSaving; bool get isSigning; bool get showPin; String get pin; String get firstName; String get lastName; String get address; String get childProfileId; String get treezorUserId; String get errorMessage; bool get saveSuccess;
/// Create a copy of EditChildProfileViewState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$EditChildProfileViewStateCopyWith<EditChildProfileViewState> get copyWith => _$EditChildProfileViewStateCopyWithImpl<EditChildProfileViewState>(this as EditChildProfileViewState, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is EditChildProfileViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isSaving, isSaving) || other.isSaving == isSaving)&&(identical(other.isSigning, isSigning) || other.isSigning == isSigning)&&(identical(other.showPin, showPin) || other.showPin == showPin)&&(identical(other.pin, pin) || other.pin == pin)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.address, address) || other.address == address)&&(identical(other.childProfileId, childProfileId) || other.childProfileId == childProfileId)&&(identical(other.treezorUserId, treezorUserId) || other.treezorUserId == treezorUserId)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.saveSuccess, saveSuccess) || other.saveSuccess == saveSuccess));
}
@override
int get hashCode => Object.hash(runtimeType,isLoading,isSaving,isSigning,showPin,pin,firstName,lastName,address,childProfileId,treezorUserId,errorMessage,saveSuccess);
@override
String toString() {
return 'EditChildProfileViewState(isLoading: $isLoading, isSaving: $isSaving, isSigning: $isSigning, showPin: $showPin, pin: $pin, firstName: $firstName, lastName: $lastName, address: $address, childProfileId: $childProfileId, treezorUserId: $treezorUserId, errorMessage: $errorMessage, saveSuccess: $saveSuccess)';
}
}
/// @nodoc
abstract mixin class $EditChildProfileViewStateCopyWith<$Res> {
factory $EditChildProfileViewStateCopyWith(EditChildProfileViewState value, $Res Function(EditChildProfileViewState) _then) = _$EditChildProfileViewStateCopyWithImpl;
@useResult
$Res call({
bool isLoading, bool isSaving, bool isSigning, bool showPin, String pin, String firstName, String lastName, String address, String childProfileId, String treezorUserId, String errorMessage, bool saveSuccess
});
}
/// @nodoc
class _$EditChildProfileViewStateCopyWithImpl<$Res>
implements $EditChildProfileViewStateCopyWith<$Res> {
_$EditChildProfileViewStateCopyWithImpl(this._self, this._then);
final EditChildProfileViewState _self;
final $Res Function(EditChildProfileViewState) _then;
/// Create a copy of EditChildProfileViewState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? isSaving = null,Object? isSigning = null,Object? showPin = null,Object? pin = null,Object? firstName = null,Object? lastName = null,Object? address = null,Object? childProfileId = null,Object? treezorUserId = null,Object? errorMessage = null,Object? saveSuccess = null,}) {
return _then(_self.copyWith(
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,isSaving: null == isSaving ? _self.isSaving : isSaving // ignore: cast_nullable_to_non_nullable
as bool,isSigning: null == isSigning ? _self.isSigning : isSigning // ignore: cast_nullable_to_non_nullable
as bool,showPin: null == showPin ? _self.showPin : showPin // ignore: cast_nullable_to_non_nullable
as bool,pin: null == pin ? _self.pin : pin // 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,address: null == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
as String,childProfileId: null == childProfileId ? _self.childProfileId : childProfileId // ignore: cast_nullable_to_non_nullable
as String,treezorUserId: null == treezorUserId ? _self.treezorUserId : treezorUserId // ignore: cast_nullable_to_non_nullable
as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,saveSuccess: null == saveSuccess ? _self.saveSuccess : saveSuccess // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
/// Adds pattern-matching-related methods to [EditChildProfileViewState].
extension EditChildProfileViewStatePatterns on EditChildProfileViewState {
/// 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 extends Object?>(TResult Function( _EditChildProfileViewState value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _EditChildProfileViewState() 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 extends Object?>(TResult Function( _EditChildProfileViewState value) $default,){
final _that = this;
switch (_that) {
case _EditChildProfileViewState():
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 extends Object?>(TResult? Function( _EditChildProfileViewState value)? $default,){
final _that = this;
switch (_that) {
case _EditChildProfileViewState() 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 extends Object?>(TResult Function( bool isLoading, bool isSaving, bool isSigning, bool showPin, String pin, String firstName, String lastName, String address, String childProfileId, String treezorUserId, String errorMessage, bool saveSuccess)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _EditChildProfileViewState() when $default != null:
return $default(_that.isLoading,_that.isSaving,_that.isSigning,_that.showPin,_that.pin,_that.firstName,_that.lastName,_that.address,_that.childProfileId,_that.treezorUserId,_that.errorMessage,_that.saveSuccess);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 extends Object?>(TResult Function( bool isLoading, bool isSaving, bool isSigning, bool showPin, String pin, String firstName, String lastName, String address, String childProfileId, String treezorUserId, String errorMessage, bool saveSuccess) $default,) {final _that = this;
switch (_that) {
case _EditChildProfileViewState():
return $default(_that.isLoading,_that.isSaving,_that.isSigning,_that.showPin,_that.pin,_that.firstName,_that.lastName,_that.address,_that.childProfileId,_that.treezorUserId,_that.errorMessage,_that.saveSuccess);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 extends Object?>(TResult? Function( bool isLoading, bool isSaving, bool isSigning, bool showPin, String pin, String firstName, String lastName, String address, String childProfileId, String treezorUserId, String errorMessage, bool saveSuccess)? $default,) {final _that = this;
switch (_that) {
case _EditChildProfileViewState() when $default != null:
return $default(_that.isLoading,_that.isSaving,_that.isSigning,_that.showPin,_that.pin,_that.firstName,_that.lastName,_that.address,_that.childProfileId,_that.treezorUserId,_that.errorMessage,_that.saveSuccess);case _:
return null;
}
}
}
/// @nodoc
class _EditChildProfileViewState implements EditChildProfileViewState {
const _EditChildProfileViewState({this.isLoading = true, this.isSaving = false, this.isSigning = false, this.showPin = false, this.pin = '', this.firstName = '', this.lastName = '', this.address = '', this.childProfileId = '', this.treezorUserId = '', this.errorMessage = '', this.saveSuccess = false});
@override@JsonKey() final bool isLoading;
@override@JsonKey() final bool isSaving;
@override@JsonKey() final bool isSigning;
@override@JsonKey() final bool showPin;
@override@JsonKey() final String pin;
@override@JsonKey() final String firstName;
@override@JsonKey() final String lastName;
@override@JsonKey() final String address;
@override@JsonKey() final String childProfileId;
@override@JsonKey() final String treezorUserId;
@override@JsonKey() final String errorMessage;
@override@JsonKey() final bool saveSuccess;
/// Create a copy of EditChildProfileViewState
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$EditChildProfileViewStateCopyWith<_EditChildProfileViewState> get copyWith => __$EditChildProfileViewStateCopyWithImpl<_EditChildProfileViewState>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _EditChildProfileViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isSaving, isSaving) || other.isSaving == isSaving)&&(identical(other.isSigning, isSigning) || other.isSigning == isSigning)&&(identical(other.showPin, showPin) || other.showPin == showPin)&&(identical(other.pin, pin) || other.pin == pin)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.address, address) || other.address == address)&&(identical(other.childProfileId, childProfileId) || other.childProfileId == childProfileId)&&(identical(other.treezorUserId, treezorUserId) || other.treezorUserId == treezorUserId)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.saveSuccess, saveSuccess) || other.saveSuccess == saveSuccess));
}
@override
int get hashCode => Object.hash(runtimeType,isLoading,isSaving,isSigning,showPin,pin,firstName,lastName,address,childProfileId,treezorUserId,errorMessage,saveSuccess);
@override
String toString() {
return 'EditChildProfileViewState(isLoading: $isLoading, isSaving: $isSaving, isSigning: $isSigning, showPin: $showPin, pin: $pin, firstName: $firstName, lastName: $lastName, address: $address, childProfileId: $childProfileId, treezorUserId: $treezorUserId, errorMessage: $errorMessage, saveSuccess: $saveSuccess)';
}
}
/// @nodoc
abstract mixin class _$EditChildProfileViewStateCopyWith<$Res> implements $EditChildProfileViewStateCopyWith<$Res> {
factory _$EditChildProfileViewStateCopyWith(_EditChildProfileViewState value, $Res Function(_EditChildProfileViewState) _then) = __$EditChildProfileViewStateCopyWithImpl;
@override @useResult
$Res call({
bool isLoading, bool isSaving, bool isSigning, bool showPin, String pin, String firstName, String lastName, String address, String childProfileId, String treezorUserId, String errorMessage, bool saveSuccess
});
}
/// @nodoc
class __$EditChildProfileViewStateCopyWithImpl<$Res>
implements _$EditChildProfileViewStateCopyWith<$Res> {
__$EditChildProfileViewStateCopyWithImpl(this._self, this._then);
final _EditChildProfileViewState _self;
final $Res Function(_EditChildProfileViewState) _then;
/// Create a copy of EditChildProfileViewState
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? isSaving = null,Object? isSigning = null,Object? showPin = null,Object? pin = null,Object? firstName = null,Object? lastName = null,Object? address = null,Object? childProfileId = null,Object? treezorUserId = null,Object? errorMessage = null,Object? saveSuccess = null,}) {
return _then(_EditChildProfileViewState(
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,isSaving: null == isSaving ? _self.isSaving : isSaving // ignore: cast_nullable_to_non_nullable
as bool,isSigning: null == isSigning ? _self.isSigning : isSigning // ignore: cast_nullable_to_non_nullable
as bool,showPin: null == showPin ? _self.showPin : showPin // ignore: cast_nullable_to_non_nullable
as bool,pin: null == pin ? _self.pin : pin // 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,address: null == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
as String,childProfileId: null == childProfileId ? _self.childProfileId : childProfileId // ignore: cast_nullable_to_non_nullable
as String,treezorUserId: null == treezorUserId ? _self.treezorUserId : treezorUserId // ignore: cast_nullable_to_non_nullable
as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,saveSuccess: null == saveSuccess ? _self.saveSuccess : saveSuccess // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
// dart format on

View File

@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:sf_shared/sf_shared.dart';
import '../../presentation/state/home_view_model.dart';
import '../child_wallet/child_data_provider.dart';
import 'extract_view_state.dart';
@@ -92,8 +91,7 @@ class ExtractViewModel extends Notifier<ExtractViewState> {
);
if (!ref.mounted) return;
ref.read(childDataProvider(childId).notifier).load();
ref.read(homeViewModelProvider.notifier).refreshChildWallet(childId);
ref.read(walletRefreshProvider.notifier).refresh();
ref.read(parentWalletBalanceProvider.notifier).applyOptimisticPayin(amount);
state = state.copyWith(isSubmitting: false, success: true);
} catch (e) {

View File

@@ -37,32 +37,20 @@ class HomeScreen extends ConsumerWidget {
margin: EdgeInsets.all(30),
child: Column(
children: [
Row(
children: [
Expanded(
child: Text.rich(
Align(
alignment: Alignment.centerLeft,
child: Text.rich(
TextSpan(
text: context.translate(I18n.homeGreeting),
style: TextStyle(fontSize: 25),
children: <TextSpan>[
TextSpan(
text: context.translate(I18n.homeGreeting),
style: TextStyle(fontSize: 25),
children: <TextSpan>[
TextSpan(
text: viewState.userName,
style: TextStyle(fontWeight: FontWeight.w500),
),
],
text: viewState.userName,
style: TextStyle(fontWeight: FontWeight.w500),
),
),
],
),
IconButton(
onPressed: () =>
navigationContract.pushTo(AppRoutes.deviceSetup),
icon: Icon(
Icons.person_add_outlined,
color: theme.getColorFor(ThemeCode.textPrimary),
),
tooltip: context.translate(I18n.homeAddAnotherKid),
),
],
),
),
const ChildWalletsSlider(),
Align(

View File

@@ -5,4 +5,4 @@ export 'src/features/personal_data/personal_data_builder.dart';
export 'src/features/change_password/change_password_builder.dart';
export 'src/features/linked_devices/linked_devices_builder.dart';
export 'src/features/app_users/app_users_builder.dart';
export 'src/features/delete_account/delete_account_builder.dart';
export 'src/features/delete_account/delete_account_builder.dart';

View File

@@ -1,20 +0,0 @@
import 'package:account/src/features/change_password/domain/models/entities/change_password_request_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:sf_shared/sf_shared.dart';
abstract class AccountRemoteDatasource {
Future<List<DeviceEntity>> getLinkedDevices({required String userId});
Future<void> deleteDevice({required String userId, required String deviceId});
Future<void> updateDevice({required String userId, required String deviceId, required UpdateDeviceRequestEntity request});
Future<void> updateUser({required String userId, required UpdateUserRequestEntity request});
Future<List<UserEntity>> getAppUsers({required String userId});
Future<void> deleteAppUser({required String userId});
Future<void> changePassword({required String userId, required ChangePasswordRequestEntity request});
}

View File

@@ -1,193 +0,0 @@
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/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: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:dio/dio.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
import 'package:sf_shared/sf_shared.dart';
import '../models/get_linked_devices_response_model.dart';
class AccountRemoteDatasourceImpl implements AccountRemoteDatasource {
AccountRemoteDatasourceImpl(this._repository);
final QuestiaRepository _repository;
@override
Future<List<DeviceEntity>> getLinkedDevices({required String userId}) async {
try {
final response = await _repository.get<Map<String, dynamic>>(
'/$userId/devices',
);
final data = response.data!['items'];
if (data == null || data.isEmpty) {
throw Exception('Empty response from /:userId/devices');
}
final model = GetLinkedDevicesResponseModel.fromJson(data);
return model.toEntity();
} on DioException catch (error) {
throw _mapDioError(
error,
defaultMessage: error.message ?? 'Error getting devices',
);
}
}
@override
Future<void> deleteDevice({required String userId, required String deviceId}) async {
try {
await _repository.put<void>(
'/users/$userId/devices/$deviceId',
);
} on DioException catch (error) {
throw _mapDioError(error, defaultMessage: 'Error to delete device');
}
}
@override
Future<void> updateDevice({required String userId, required String deviceId, required UpdateDeviceRequestEntity request}) async {
throw UnimplementedError();
try {
final body = request.toModel().toJson();
await _repository.put<void>(
'/users/$userId/devices/$deviceId',
body: body,
);
} on DioException catch (error) {
throw _mapDioError(error, defaultMessage: 'Error to update device');
}
}
@override
Future<void> updateUser({required String userId, required UpdateUserRequestEntity request}) async {
try {
final body = request.toModel().toJson();
await _repository.put<void>(
'/users/$userId',
body: body,
);
} on DioException catch (error) {
throw _mapDioError(error, defaultMessage: 'Error to update user');
}
}
@override
Future<List<UserEntity>> getAppUsers({required String userId}) async {
try {
final response = await _repository.get<Map<String, dynamic>>(
'/$userId/devices',
);
final data = response.data!['items'];
if (data == null || data.isEmpty) {
throw Exception('Empty response from /:userId/devices');
}
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',
);
}
}
@override
Future<void> deleteAppUser({required String userId}) async {
throw UnimplementedError();
try {
await _repository.delete<void>(
'/users/$userId',
);
} on DioException catch (error) {
throw _mapDioError(error, defaultMessage: 'Error to delete device');
}
}
@override
Future<void> changePassword({required String userId, required ChangePasswordRequestEntity request}) async {
try {
final body = request.toModel().toJson();
await _repository.put<void>(
'/auth/change-password',
body: body,
);
} on DioException catch (error) {
throw _mapDioError(error, defaultMessage: 'Error to change password');
}
}
}
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;
}

View File

@@ -0,0 +1,5 @@
import 'package:account/src/features/change_password/domain/models/entities/change_password_request_entity.dart';
abstract class ChangePasswordRemoteDatasource {
Future<void> changePassword({required String userId, required ChangePasswordRequestEntity request});
}

View File

@@ -0,0 +1,27 @@
import 'package:account/src/core/data/models/change_password_request_model.dart';
import 'package:dio/dio.dart';
import 'package:legacy_shared/legacy_shared.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
import '../../../features/change_password/domain/models/entities/change_password_request_entity.dart';
import 'change_password_remote_datasource.dart';
class ChangePasswordRemoteDatasourceImpl implements ChangePasswordRemoteDatasource {
ChangePasswordRemoteDatasourceImpl(this._repository);
final QuestiaRepository _repository;
@override
Future<void> changePassword(
{required String userId, required ChangePasswordRequestEntity request}) async {
try {
final body = request.toModel().toJson();
await _repository.put<void>(
'/auth/change-password',
body: body,
);
} on DioException catch (error) {
throw mapDioError(error, defaultMessage: 'Error to change password');
}
}
}

View File

@@ -0,0 +1,7 @@
import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart';
abstract class DevicesRemoteDatasource {
Future<void> deleteDevice({required String userId, required String deviceId});
Future<void> updateDevice({required String userId, required UpdateDeviceRequestEntity request});
}

View File

@@ -0,0 +1,37 @@
import 'package:account/src/core/data/models/update_device_request_model.dart';
import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart';
import 'package:dio/dio.dart';
import 'package:legacy_shared/legacy_shared.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
import 'devices_remote_datasource.dart';
class DevicesRemoteDatasourceImpl implements DevicesRemoteDatasource {
DevicesRemoteDatasourceImpl(this._repository);
final QuestiaRepository _repository;
@override
Future<void> deleteDevice({required String userId, required String deviceId}) async {
try {
await _repository.delete<void>(
'/devices/$deviceId',
);
} on DioException catch (error) {
throw mapDioError(error, defaultMessage: 'Error to delete device');
}
}
@override
Future<void> updateDevice({required String userId, required UpdateDeviceRequestEntity request}) async {
try {
final body = request.toModel().toJson();
await _repository.put<void>(
'/devices',
body: body,
);
} on DioException catch (error) {
throw mapDioError(error, defaultMessage: 'Error to update device');
}
}
}

View File

@@ -0,0 +1,10 @@
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
import 'package:sf_shared/sf_shared.dart';
abstract class UsersRemoteDatasource {
Future<void> updateUser({required String userId, required UpdateUserRequestEntity request});
Future<List<UserEntity>> getUsers({required String userId});
Future<void> deleteUser({required String userId});
}

View File

@@ -0,0 +1,59 @@
import 'package:account/src/core/data/datasource/users_remote_datasource.dart';
import 'package:account/src/core/data/models/get_app_users_response_model.dart';
import 'package:account/src/core/data/models/update_user_request_model.dart';
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
import 'package:dio/dio.dart';
import 'package:legacy_shared/legacy_shared.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
import 'package:sf_shared/sf_shared.dart';
class UsersRemoteDatasourceImpl implements UsersRemoteDatasource {
UsersRemoteDatasourceImpl(this._repository);
final QuestiaRepository _repository;
@override
Future<List<UserEntity>> getUsers({required String userId}) async {
try {
final response = await _repository.get<Map<String, dynamic>>(
'/users/$userId/user-devices',
);
final data = response.data!['items'];
if (data == null || data.isEmpty) {
throw Exception('Empty response from /users/$userId/user-devices');
}
final model = GetAppUsersResponseModel.fromJson(data);
return model.toEntity();
} on DioException catch (error) {
throw mapDioError(
error,
defaultMessage: error.message ?? 'Error getting devices',
);
}
}
@override
Future<void> updateUser({required String userId, required UpdateUserRequestEntity request}) async {
try {
final body = request.toModel().toJson();
await _repository.put<void>(
'/users/$userId',
body: body,
);
} on DioException catch (error) {
throw mapDioError(error, defaultMessage: 'Error to update user');
}
}
@override
Future<void> deleteUser({required String userId}) async {
try {
await _repository.delete<void>(
'/users/$userId',
);
} on DioException catch (error) {
throw mapDioError(error, defaultMessage: 'Error to delete device');
}
}
}

View File

@@ -1,67 +0,0 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:sf_shared/sf_shared.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<GetLinkedDevicesItemResponseModel> items,
}) = _GetLinkedDevicesResponseModel;
factory GetLinkedDevicesResponseModel.fromJson(Map<String, dynamic> json) =>
_$GetLinkedDevicesResponseModelFromJson(json);
}
@freezed
abstract class GetLinkedDevicesItemResponseModel with _$GetLinkedDevicesItemResponseModel {
const factory GetLinkedDevicesItemResponseModel({
required String identificator,
required String carrierName,
required String phone,
required String id,
@Default({}) Map<String, dynamic> settings,
required String protocol,
required String type,
required String connectionServer,
required String createdAt,
@Default({}) Map<String, dynamic> flags,
}) =
_GetLinkedDevicesItemResponseModel;
factory GetLinkedDevicesItemResponseModel.fromJson(Map<String, dynamic> json) =>
_$GetLinkedDevicesItemResponseModelFromJson(json);
}
extension GetDevicesResponseModelMapper on GetLinkedDevicesResponseModel {
List<DeviceEntity> toEntity() {
return items.map((GetLinkedDevicesItemResponseModel item) => DeviceEntity(
identificator: item.identificator,
carrierName: item.carrierName,
phone: item.phone,
id: item.id,
settings: item.settings,
protocol: item.protocol,
type: item.type,
connectionServer: item.connectionServer,
createdAt: item.createdAt,
flags: item.flags,
)).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<String> alerts,
}) = _GetLinkedDevicesSettingsResponseModel;
factory GetLinkedDevicesSettingsResponseModel.fromJson(Map<String, dynamic> json) =>
_$GetLinkedDevicesSettingsResponseModelFromJson(json);
}

View File

@@ -1,869 +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 'get_linked_devices_response_model.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$GetLinkedDevicesResponseModel {
List<GetLinkedDevicesItemResponseModel> 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<GetLinkedDevicesResponseModel> get copyWith => _$GetLinkedDevicesResponseModelCopyWithImpl<GetLinkedDevicesResponseModel>(this as GetLinkedDevicesResponseModel, _$identity);
/// Serializes this GetLinkedDevicesResponseModel to a JSON map.
Map<String, dynamic> 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<GetLinkedDevicesItemResponseModel> 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<GetLinkedDevicesItemResponseModel>,
));
}
}
/// 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 extends Object?>(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 extends Object?>(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 extends Object?>(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 extends Object?>(TResult Function( List<GetLinkedDevicesItemResponseModel> 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 extends Object?>(TResult Function( List<GetLinkedDevicesItemResponseModel> 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 extends Object?>(TResult? Function( List<GetLinkedDevicesItemResponseModel> 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<GetLinkedDevicesItemResponseModel> items}): _items = items;
factory _GetLinkedDevicesResponseModel.fromJson(Map<String, dynamic> json) => _$GetLinkedDevicesResponseModelFromJson(json);
final List<GetLinkedDevicesItemResponseModel> _items;
@override List<GetLinkedDevicesItemResponseModel> 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<String, dynamic> 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<GetLinkedDevicesItemResponseModel> 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<GetLinkedDevicesItemResponseModel>,
));
}
}
/// @nodoc
mixin _$GetLinkedDevicesItemResponseModel {
String get identificator; String get carrierName; String get phone; String get id; Map<String, dynamic> get settings; String get protocol; String get type; String get connectionServer; String get createdAt; Map<String, dynamic> get flags;
/// 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<GetLinkedDevicesItemResponseModel> get copyWith => _$GetLinkedDevicesItemResponseModelCopyWithImpl<GetLinkedDevicesItemResponseModel>(this as GetLinkedDevicesItemResponseModel, _$identity);
/// Serializes this GetLinkedDevicesItemResponseModel to a JSON map.
Map<String, dynamic> 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.carrierName, carrierName) || other.carrierName == carrierName)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.id, id) || other.id == id)&&const DeepCollectionEquality().equals(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)&&const DeepCollectionEquality().equals(other.flags, flags));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,identificator,carrierName,phone,id,const DeepCollectionEquality().hash(settings),protocol,type,connectionServer,createdAt,const DeepCollectionEquality().hash(flags));
@override
String toString() {
return 'GetLinkedDevicesItemResponseModel(identificator: $identificator, carrierName: $carrierName, phone: $phone, id: $id, settings: $settings, protocol: $protocol, type: $type, connectionServer: $connectionServer, createdAt: $createdAt, flags: $flags)';
}
}
/// @nodoc
abstract mixin class $GetLinkedDevicesItemResponseModelCopyWith<$Res> {
factory $GetLinkedDevicesItemResponseModelCopyWith(GetLinkedDevicesItemResponseModel value, $Res Function(GetLinkedDevicesItemResponseModel) _then) = _$GetLinkedDevicesItemResponseModelCopyWithImpl;
@useResult
$Res call({
String identificator, String carrierName, String phone, String id, Map<String, dynamic> settings, String protocol, String type, String connectionServer, String createdAt, Map<String, dynamic> flags
});
}
/// @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? 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,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 Map<String, dynamic>,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 String,flags: null == flags ? _self.flags : flags // ignore: cast_nullable_to_non_nullable
as Map<String, dynamic>,
));
}
}
/// 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 extends Object?>(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 extends Object?>(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 extends Object?>(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 extends Object?>(TResult Function( String identificator, String carrierName, String phone, String id, Map<String, dynamic> settings, String protocol, String type, String connectionServer, String createdAt, Map<String, dynamic> flags)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _GetLinkedDevicesItemResponseModel() when $default != null:
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();
}
}
/// 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 extends Object?>(TResult Function( String identificator, String carrierName, String phone, String id, Map<String, dynamic> settings, String protocol, String type, String connectionServer, String createdAt, Map<String, dynamic> flags) $default,) {final _that = this;
switch (_that) {
case _GetLinkedDevicesItemResponseModel():
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');
}
}
/// 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 extends Object?>(TResult? Function( String identificator, String carrierName, String phone, String id, Map<String, dynamic> settings, String protocol, String type, String connectionServer, String createdAt, Map<String, dynamic> flags)? $default,) {final _that = this;
switch (_that) {
case _GetLinkedDevicesItemResponseModel() when $default != null:
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;
}
}
}
/// @nodoc
@JsonSerializable()
class _GetLinkedDevicesItemResponseModel implements GetLinkedDevicesItemResponseModel {
const _GetLinkedDevicesItemResponseModel({required this.identificator, required this.carrierName, required this.phone, required this.id, final Map<String, dynamic> settings = const {}, required this.protocol, required this.type, required this.connectionServer, required this.createdAt, final Map<String, dynamic> flags = const {}}): _settings = settings,_flags = flags;
factory _GetLinkedDevicesItemResponseModel.fromJson(Map<String, dynamic> json) => _$GetLinkedDevicesItemResponseModelFromJson(json);
@override final String identificator;
@override final String carrierName;
@override final String phone;
@override final String id;
final Map<String, dynamic> _settings;
@override@JsonKey() Map<String, dynamic> get settings {
if (_settings is EqualUnmodifiableMapView) return _settings;
// ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_settings);
}
@override final String protocol;
@override final String type;
@override final String connectionServer;
@override final String createdAt;
final Map<String, dynamic> _flags;
@override@JsonKey() Map<String, dynamic> get flags {
if (_flags is EqualUnmodifiableMapView) return _flags;
// ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_flags);
}
/// 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<String, dynamic> 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.carrierName, carrierName) || other.carrierName == carrierName)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.id, id) || other.id == id)&&const DeepCollectionEquality().equals(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)&&const DeepCollectionEquality().equals(other._flags, _flags));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,identificator,carrierName,phone,id,const DeepCollectionEquality().hash(_settings),protocol,type,connectionServer,createdAt,const DeepCollectionEquality().hash(_flags));
@override
String toString() {
return 'GetLinkedDevicesItemResponseModel(identificator: $identificator, carrierName: $carrierName, phone: $phone, id: $id, settings: $settings, protocol: $protocol, type: $type, connectionServer: $connectionServer, createdAt: $createdAt, flags: $flags)';
}
}
/// @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 carrierName, String phone, String id, Map<String, dynamic> settings, String protocol, String type, String connectionServer, String createdAt, Map<String, dynamic> flags
});
}
/// @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? 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,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 Map<String, dynamic>,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 String,flags: null == flags ? _self._flags : flags // ignore: cast_nullable_to_non_nullable
as Map<String, dynamic>,
));
}
}
/// @nodoc
mixin _$GetLinkedDevicesSettingsResponseModel {
int get frequency; int get frequencyHeartRate; int get timezone; bool get pedometer; String get language; List<String> 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<GetLinkedDevicesSettingsResponseModel> get copyWith => _$GetLinkedDevicesSettingsResponseModelCopyWithImpl<GetLinkedDevicesSettingsResponseModel>(this as GetLinkedDevicesSettingsResponseModel, _$identity);
/// Serializes this GetLinkedDevicesSettingsResponseModel to a JSON map.
Map<String, dynamic> 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<String> 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<String>,
));
}
}
/// 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 extends Object?>(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 extends Object?>(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 extends Object?>(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 extends Object?>(TResult Function( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List<String> 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 extends Object?>(TResult Function( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List<String> 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 extends Object?>(TResult? Function( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List<String> 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<String> alerts}): _alerts = alerts;
factory _GetLinkedDevicesSettingsResponseModel.fromJson(Map<String, dynamic> 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<String> _alerts;
@override List<String> 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<String, dynamic> 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<String> 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<String>,
));
}
}
// dart format on

View File

@@ -1,77 +0,0 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'get_linked_devices_response_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_GetLinkedDevicesResponseModel _$GetLinkedDevicesResponseModelFromJson(
Map<String, dynamic> json,
) => _GetLinkedDevicesResponseModel(
items: (json['items'] as List<dynamic>)
.map(
(e) => GetLinkedDevicesItemResponseModel.fromJson(
e as Map<String, dynamic>,
),
)
.toList(),
);
Map<String, dynamic> _$GetLinkedDevicesResponseModelToJson(
_GetLinkedDevicesResponseModel instance,
) => <String, dynamic>{'items': instance.items};
_GetLinkedDevicesItemResponseModel _$GetLinkedDevicesItemResponseModelFromJson(
Map<String, dynamic> json,
) => _GetLinkedDevicesItemResponseModel(
identificator: json['identificator'] as String,
carrierName: json['carrierName'] as String,
phone: json['phone'] as String,
id: json['id'] as String,
settings: json['settings'] as Map<String, dynamic>? ?? const {},
protocol: json['protocol'] as String,
type: json['type'] as String,
connectionServer: json['connectionServer'] as String,
createdAt: json['createdAt'] as String,
flags: json['flags'] as Map<String, dynamic>? ?? const {},
);
Map<String, dynamic> _$GetLinkedDevicesItemResponseModelToJson(
_GetLinkedDevicesItemResponseModel instance,
) => <String, dynamic>{
'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,
};
_GetLinkedDevicesSettingsResponseModel
_$GetLinkedDevicesSettingsResponseModelFromJson(Map<String, dynamic> 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<dynamic>)
.map((e) => e as String)
.toList(),
);
Map<String, dynamic> _$GetLinkedDevicesSettingsResponseModelToJson(
_GetLinkedDevicesSettingsResponseModel instance,
) => <String, dynamic>{
'frequency': instance.frequency,
'frequencyHeartRate': instance.frequencyHeartRate,
'timezone': instance.timezone,
'pedometer': instance.pedometer,
'language': instance.language,
'alerts': instance.alerts,
};

View File

@@ -8,7 +8,7 @@ part 'update_device_request_model.g.dart';
abstract class UpdateDeviceRequestModel with _$UpdateDeviceRequestModel {
const factory UpdateDeviceRequestModel({
required String identificator,
required String name,
required String carrierName,
}) = _UpdateDeviceRequestModel;
factory UpdateDeviceRequestModel.fromJson(Map<String, dynamic> json) =>
@@ -18,6 +18,6 @@ abstract class UpdateDeviceRequestModel with _$UpdateDeviceRequestModel {
extension UpdateDeviceRequestModelMapper on UpdateDeviceRequestEntity {
UpdateDeviceRequestModel toModel() => UpdateDeviceRequestModel(
identificator: identificator,
name: name,
carrierName: carrierName,
);
}

View File

@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$UpdateDeviceRequestModel {
String get identificator; String get name;
String get identificator; String get carrierName;
/// Create a copy of UpdateDeviceRequestModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -28,16 +28,16 @@ $UpdateDeviceRequestModelCopyWith<UpdateDeviceRequestModel> get copyWith => _$Up
@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));
return identical(this, other) || (other.runtimeType == runtimeType&&other is UpdateDeviceRequestModel&&(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,identificator,name);
int get hashCode => Object.hash(runtimeType,identificator,carrierName);
@override
String toString() {
return 'UpdateDeviceRequestModel(identificator: $identificator, name: $name)';
return 'UpdateDeviceRequestModel(identificator: $identificator, carrierName: $carrierName)';
}
@@ -48,7 +48,7 @@ abstract mixin class $UpdateDeviceRequestModelCopyWith<$Res> {
factory $UpdateDeviceRequestModelCopyWith(UpdateDeviceRequestModel value, $Res Function(UpdateDeviceRequestModel) _then) = _$UpdateDeviceRequestModelCopyWithImpl;
@useResult
$Res call({
String identificator, String name
String identificator, String carrierName
});
@@ -65,10 +65,10 @@ class _$UpdateDeviceRequestModelCopyWithImpl<$Res>
/// 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,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? identificator = null,Object? carrierName = 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,carrierName: null == carrierName ? _self.carrierName : carrierName // ignore: cast_nullable_to_non_nullable
as String,
));
}
@@ -154,10 +154,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String identificator, String name)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String identificator, String carrierName)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _UpdateDeviceRequestModel() when $default != null:
return $default(_that.identificator,_that.name);case _:
return $default(_that.identificator,_that.carrierName);case _:
return orElse();
}
@@ -175,10 +175,10 @@ return $default(_that.identificator,_that.name);case _:
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String identificator, String name) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String identificator, String carrierName) $default,) {final _that = this;
switch (_that) {
case _UpdateDeviceRequestModel():
return $default(_that.identificator,_that.name);case _:
return $default(_that.identificator,_that.carrierName);case _:
throw StateError('Unexpected subclass');
}
@@ -195,10 +195,10 @@ return $default(_that.identificator,_that.name);case _:
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String identificator, String name)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String identificator, String carrierName)? $default,) {final _that = this;
switch (_that) {
case _UpdateDeviceRequestModel() when $default != null:
return $default(_that.identificator,_that.name);case _:
return $default(_that.identificator,_that.carrierName);case _:
return null;
}
@@ -210,11 +210,11 @@ return $default(_that.identificator,_that.name);case _:
@JsonSerializable()
class _UpdateDeviceRequestModel implements UpdateDeviceRequestModel {
const _UpdateDeviceRequestModel({required this.identificator, required this.name});
const _UpdateDeviceRequestModel({required this.identificator, required this.carrierName});
factory _UpdateDeviceRequestModel.fromJson(Map<String, dynamic> json) => _$UpdateDeviceRequestModelFromJson(json);
@override final String identificator;
@override final String name;
@override final String carrierName;
/// Create a copy of UpdateDeviceRequestModel
/// with the given fields replaced by the non-null parameter values.
@@ -229,16 +229,16 @@ Map<String, dynamic> 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));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _UpdateDeviceRequestModel&&(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,identificator,name);
int get hashCode => Object.hash(runtimeType,identificator,carrierName);
@override
String toString() {
return 'UpdateDeviceRequestModel(identificator: $identificator, name: $name)';
return 'UpdateDeviceRequestModel(identificator: $identificator, carrierName: $carrierName)';
}
@@ -249,7 +249,7 @@ abstract mixin class _$UpdateDeviceRequestModelCopyWith<$Res> implements $Update
factory _$UpdateDeviceRequestModelCopyWith(_UpdateDeviceRequestModel value, $Res Function(_UpdateDeviceRequestModel) _then) = __$UpdateDeviceRequestModelCopyWithImpl;
@override @useResult
$Res call({
String identificator, String name
String identificator, String carrierName
});
@@ -266,10 +266,10 @@ class __$UpdateDeviceRequestModelCopyWithImpl<$Res>
/// 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,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? identificator = null,Object? carrierName = 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,carrierName: null == carrierName ? _self.carrierName : carrierName // ignore: cast_nullable_to_non_nullable
as String,
));
}

View File

@@ -10,12 +10,12 @@ _UpdateDeviceRequestModel _$UpdateDeviceRequestModelFromJson(
Map<String, dynamic> json,
) => _UpdateDeviceRequestModel(
identificator: json['identificator'] as String,
name: json['name'] as String,
carrierName: json['carrierName'] as String,
);
Map<String, dynamic> _$UpdateDeviceRequestModelToJson(
_UpdateDeviceRequestModel instance,
) => <String, dynamic>{
'identificator': instance.identificator,
'name': instance.name,
'carrierName': instance.carrierName,
};

View File

@@ -7,19 +7,8 @@ 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;
@@ -29,19 +18,8 @@ abstract class UpdateUserRequestModel with _$UpdateUserRequestModel {
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,
);
}

View File

@@ -15,7 +15,7 @@ T _$identity<T>(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;
String? get firstName; String? get lastName; String? get phone;
/// Create a copy of UpdateUserRequestModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -28,16 +28,16 @@ $UpdateUserRequestModelCopyWith<UpdateUserRequestModel> get copyWith => _$Update
@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));
return identical(this, other) || (other.runtimeType == runtimeType&&other is UpdateUserRequestModel&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(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);
int get hashCode => Object.hash(runtimeType,firstName,lastName,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)';
return 'UpdateUserRequestModel(firstName: $firstName, lastName: $lastName, phone: $phone)';
}
@@ -48,7 +48,7 @@ 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
String? firstName, String? lastName, String? phone
});
@@ -65,21 +65,10 @@ class _$UpdateUserRequestModelCopyWithImpl<$Res>
/// 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,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? firstName = freezed,Object? lastName = 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
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?,
));
@@ -166,10 +155,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(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;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? firstName, String? lastName, 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 $default(_that.firstName,_that.lastName,_that.phone);case _:
return orElse();
}
@@ -187,10 +176,10 @@ return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.up
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(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;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? firstName, String? lastName, 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 _:
return $default(_that.firstName,_that.lastName,_that.phone);case _:
throw StateError('Unexpected subclass');
}
@@ -207,10 +196,10 @@ return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.up
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(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;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? firstName, String? lastName, 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 $default(_that.firstName,_that.lastName,_that.phone);case _:
return null;
}
@@ -222,22 +211,11 @@ return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.up
@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});
const _UpdateUserRequestModel({this.firstName, this.lastName, this.phone});
factory _UpdateUserRequestModel.fromJson(Map<String, dynamic> 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
@@ -253,16 +231,16 @@ Map<String, dynamic> 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));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _UpdateUserRequestModel&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(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);
int get hashCode => Object.hash(runtimeType,firstName,lastName,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)';
return 'UpdateUserRequestModel(firstName: $firstName, lastName: $lastName, phone: $phone)';
}
@@ -273,7 +251,7 @@ abstract mixin class _$UpdateUserRequestModelCopyWith<$Res> implements $UpdateUs
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
String? firstName, String? lastName, String? phone
});
@@ -290,21 +268,10 @@ class __$UpdateUserRequestModelCopyWithImpl<$Res>
/// 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,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? firstName = freezed,Object? lastName = 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
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?,
));

View File

@@ -9,37 +9,15 @@ part of 'update_user_request_model.dart';
_UpdateUserRequestModel _$UpdateUserRequestModelFromJson(
Map<String, dynamic> 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<String, dynamic> _$UpdateUserRequestModelToJson(
_UpdateUserRequestModel instance,
) => <String, dynamic>{
'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,
};

View File

@@ -1,47 +0,0 @@
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: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:sf_shared/sf_shared.dart';
class AccountRepositoryImpl implements AccountRepository {
const AccountRepositoryImpl(this._remote);
final AccountRemoteDatasource _remote;
@override
Future<List<DeviceEntity>> getLinkedDevices({required String userId}) {
return _remote.getLinkedDevices(userId: userId);
}
@override
Future<void> deleteDevice({required String userId, required String deviceId}) {
return _remote.deleteDevice(userId: userId, deviceId: deviceId);
}
@override
Future<void> updateDevice({required String userId, required String deviceId, required UpdateDeviceRequestEntity request}) {
return _remote.updateDevice(userId: userId, deviceId: deviceId, request: request);
}
@override
Future<void> updateUser({required String userId, required UpdateUserRequestEntity request}) {
return _remote.updateUser(userId: userId, request: request);
}
@override
Future<List<UserEntity>> getAppUsers({required String userId}) {
return _remote.getAppUsers(userId: userId);
}
@override
Future<void> deleteAppUser({required String userId}) {
return _remote.deleteAppUser(userId: userId);
}
@override
Future<void> changePassword({required String userId, required ChangePasswordRequestEntity request}) {
return _remote.changePassword(userId: userId, request: request);
}
}

View File

@@ -0,0 +1,15 @@
import 'package:account/src/features/change_password/domain/models/entities/change_password_request_entity.dart';
import '../../domain/repositories/change_password_repository.dart';
import '../datasource/change_password_remote_datasource.dart';
class ChangePasswordRepositoryImpl implements ChangePasswordRepository {
const ChangePasswordRepositoryImpl(this._remote);
final ChangePasswordRemoteDatasource _remote;
@override
Future<void> changePassword({required String userId, required ChangePasswordRequestEntity request}) {
return _remote.changePassword(userId: userId, request: request);
}
}

View File

@@ -0,0 +1,20 @@
import 'package:account/src/core/data/datasource/devices_remote_datasource.dart';
import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart';
import '../../domain/repositories/devices_repository.dart';
class DevicesRepositoryImpl implements DevicesRepository {
const DevicesRepositoryImpl(this._remote);
final DevicesRemoteDatasource _remote;
@override
Future<void> deleteDevice({required String userId, required String deviceId}) {
return _remote.deleteDevice(userId: userId, deviceId: deviceId);
}
@override
Future<void> updateDevice({required String userId, required UpdateDeviceRequestEntity request}) {
return _remote.updateDevice(userId: userId, request: request);
}
}

View File

@@ -0,0 +1,26 @@
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
import 'package:sf_shared/sf_shared.dart';
import '../../domain/repositories/users_repository.dart';
import '../datasource/users_remote_datasource.dart';
class UsersRepositoryImpl implements UsersRepository {
const UsersRepositoryImpl(this._remote);
final UsersRemoteDatasource _remote;
@override
Future<void> updateUser({required String userId, required UpdateUserRequestEntity request}) {
return _remote.updateUser(userId: userId, request: request);
}
@override
Future<List<UserEntity>> getUsers({required String userId}) {
return _remote.getUsers(userId: userId);
}
@override
Future<void> deleteUser({required String userId}) {
return _remote.deleteUser(userId: userId);
}
}

View File

@@ -1,30 +0,0 @@
import 'package:account/src/features/change_password/domain/models/entities/change_password_request_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:sf_shared/sf_shared.dart';
abstract class AccountRepository {
Future<List<DeviceEntity>> getLinkedDevices({required String userId});
Future<void> deleteDevice({required String userId, required String deviceId});
Future<void> updateDevice({
required String userId,
required String deviceId,
required UpdateDeviceRequestEntity request
});
Future<void> updateUser({
required String userId,
required UpdateUserRequestEntity request
});
Future<List<UserEntity>> getAppUsers({required String userId});
Future<void> deleteAppUser({required String userId});
Future<void> changePassword({
required String userId,
required ChangePasswordRequestEntity request
});
}

View File

@@ -0,0 +1,8 @@
import 'package:account/src/features/change_password/domain/models/entities/change_password_request_entity.dart';
abstract class ChangePasswordRepository {
Future<void> changePassword({
required String userId,
required ChangePasswordRequestEntity request
});
}

View File

@@ -0,0 +1,10 @@
import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart';
abstract class DevicesRepository {
Future<void> deleteDevice({required String userId, required String deviceId});
Future<void> updateDevice({
required String userId,
required UpdateDeviceRequestEntity request
});
}

View File

@@ -0,0 +1,13 @@
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
import 'package:sf_shared/sf_shared.dart';
abstract class UsersRepository {
Future<void> updateUser({
required String userId,
required UpdateUserRequestEntity request
});
Future<List<UserEntity>> getUsers({required String userId});
Future<void> deleteUser({required String userId});
}

View File

@@ -1,9 +0,0 @@
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<AccountRemoteDatasource>((ref) {
final questiaRepository = getIt<QuestiaRepository>();
return AccountRemoteDatasourceImpl(questiaRepository);
});

View File

@@ -1,9 +0,0 @@
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<AccountRepository>((ref) {
final remote = ref.read(accountRemoteDatasourceProvider);
return AccountRepositoryImpl(remote);
});

View File

@@ -0,0 +1,10 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
import '../data/datasource/change_password_remote_datasource.dart';
import '../data/datasource/change_password_remote_datasource_impl.dart';
final changePasswordRemoteDatasourceProvider = Provider<ChangePasswordRemoteDatasource>((ref) {
final questiaRepository = getIt<QuestiaRepository>();
return ChangePasswordRemoteDatasourceImpl(questiaRepository);
});

View File

@@ -0,0 +1,10 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../data/repositories/change_password_repository_impl.dart';
import '../domain/repositories/change_password_repository.dart';
import 'change_password_remote_datasource_provider.dart';
final changePasswordRepositoryProvider = Provider<ChangePasswordRepository>((ref) {
final remote = ref.read(changePasswordRemoteDatasourceProvider);
return ChangePasswordRepositoryImpl(remote);
});

View File

@@ -0,0 +1,10 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
import '../data/datasource/devices_remote_datasource.dart';
import '../data/datasource/devices_remote_datasource_impl.dart';
final devicesRemoteDatasourceProvider = Provider<DevicesRemoteDatasource>((ref) {
final questiaRepository = getIt<QuestiaRepository>();
return DevicesRemoteDatasourceImpl(questiaRepository);
});

View File

@@ -0,0 +1,10 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../data/repositories/devices_repository_impl.dart';
import '../domain/repositories/devices_repository.dart';
import 'devices_remote_datasource_provider.dart';
final devicesRepositoryProvider = Provider<DevicesRepository>((ref) {
final remote = ref.read(devicesRemoteDatasourceProvider);
return DevicesRepositoryImpl(remote);
});

View File

@@ -0,0 +1,10 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
import '../data/datasource/users_remote_datasource.dart';
import '../data/datasource/users_remote_datasource_impl.dart';
final usersRemoteDatasourceProvider = Provider<UsersRemoteDatasource>((ref) {
final questiaRepository = getIt<QuestiaRepository>();
return UsersRemoteDatasourceImpl(questiaRepository);
});

View File

@@ -0,0 +1,10 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../data/repositories/users_repository_impl.dart';
import '../domain/repositories/users_repository.dart';
import 'users_remote_datasource_provider.dart';
final usersRepositoryProvider = Provider<UsersRepository>((ref) {
final remote = ref.read(usersRemoteDatasourceProvider);
return UsersRepositoryImpl(remote);
});

View File

@@ -1,3 +1,4 @@
import 'package:account/src/features/account_settings/presentation/state/account_settings_view_model.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
@@ -6,257 +7,173 @@ 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';
import 'widgets/reg_code_dialog.dart';
class AccountSettingsScreen extends ConsumerWidget {
final NavigationContract navigationContract;
static final _privacyUrl =
'https://savefamilygps.com/pages/politica-de-privacidad-reloj-gps-infantil-localizador-savefamily';
const AccountSettingsScreen({super.key, required this.navigationContract});
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.watch(themePortProvider);
final color = theme.getColorFor(ThemeCode.legacyPrimary);
final selectedDevice = ref.watch(selectedDeviceProvider);
final isLoggingOut = ref.watch(
accountSettingsViewModelProvider.select((s) => s.isLoggingOut),
);
ref.listen(accountSettingsViewModelProvider.select((s) => s.isLoggingOut), (
prev,
isLoggingOut,
) {
if (prev == true && !isLoggingOut) {
navigationContract.goTo(AppRoutes.legacyLogin);
}
});
return LegacyPageLayout(
theme: theme,
theme: theme,
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)
body: SingleChildScrollView(
child: Padding(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8),
),
child: Column(
children: [
_item(
context,
onPressed: () =>
navigationContract.pushTo(AppRoutes.personalData),
icon: SFIcons.account,
text: I18n.personalData,
color: color,
),
_item(
context,
onPressed: () =>
navigationContract.pushTo(AppRoutes.changePassword),
icon: Icons.lock,
text: I18n.changePassword,
color: color,
),
_item(
context,
onPressed: () =>
navigationContract.pushTo(AppRoutes.legacyDeviceSetup),
icon: Icons.add_circle_outline,
text: I18n.addNewSF,
color: color,
),
_item(
context,
onPressed: () =>
navigationContract.pushTo(AppRoutes.linkedDevices),
icon: Icons.account_circle_outlined,
text: I18n.linkedDevices,
color: color,
),
// _item(context, onPressed: () => navigationContract.pushTo(AppRoutes.appUsers), icon: Icons.groups_outlined, text: I18n.appUsers, color: color),
_item(
context,
onPressed: () async {
final Uri url = Uri.parse(_privacyUrl);
if (!await launchUrl(url)) {
throw Exception('Could not launch $url');
}
},
icon: SFIcons.privacy,
text: I18n.privacyPolicy,
color: color,
),
_item(
context,
onPressed: () {
showDialog(
context: context,
builder: (context) => Dialog(
backgroundColor: Colors.transparent,
child: RegCodeDialog(
regCode: selectedDevice?.id ?? '',
deviceId: selectedDevice?.identificator ?? '',
name: selectedDevice?.carrierName ?? '',
),
),
);
},
icon: Icons.qr_code,
text: I18n.regCode,
color: color,
),
_item(
context,
onPressed: () =>
navigationContract.pushTo(AppRoutes.deleteAccount),
icon: Icons.no_accounts,
text: I18n.deleteAccount,
color: color,
),
],
),
),
child: Column(
children: [
AppSectionButton(
onPressed: (){navigationContract.pushTo(AppRoutes.personalData);},
icon: SFIcons.account,
text: I18n.personalData
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){navigationContract.pushTo(AppRoutes.changePassword);},
icon: Icons.lock,
text: I18n.changePassword
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){},
icon: Icons.add_circle_outline,
text: I18n.addNewSF
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){navigationContract.pushTo(AppRoutes.linkedDevices);},
icon: Icons.account_circle_outlined,
text: I18n.linkedDevices
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){navigationContract.pushTo(AppRoutes.appUsers);},
icon: Icons.groups_outlined,
text: I18n.appUsers
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
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.privacyPolicy
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){
showDialog(context: context, builder: (context)=>Dialog(
backgroundColor: Colors.transparent,
child: RegCodeDialog(
regCode: selectedDevice?.id ?? '',
deviceId: selectedDevice?.identificator ?? '',
name: selectedDevice?.carrierName ?? ''
),
));
},
icon: Icons.qr_code,
text: I18n.regCode
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){navigationContract.pushTo(AppRoutes.deleteAccount);},
icon: Icons.no_accounts,
text: I18n.deleteAccount
),
],
),
)),
),
footer: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(vertical: 12, horizontal: 30),
big: EdgeInsets.symmetric(vertical: 10, horizontal: 28)
big: EdgeInsets.symmetric(vertical: 10, horizontal: 28),
),
child: PrimaryButton(text: context.translate(I18n.logOut), color: theme.getColorFor(ThemeCode.legacyPrimary)),
)
);
}
}
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.watch(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: theme.getColorFor(ThemeCode.legacyPrimary),
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
child: PrimaryButton(
text: context.translate(I18n.logOut),
color: theme.getColorFor(ThemeCode.legacyPrimary),
leading: isLoggingOut
? const SizedBox(
height: 18,
width: 18,
child: CircularProgressIndicator(
strokeWidth: 2,
color: Colors.white,
),
)
)
)
],
: null,
onPressed: isLoggingOut
? () {}
: ref.read(accountSettingsViewModelProvider.notifier).logout,
),
)
);
}
}
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.deviceIdLabel,
args: {'deviceId': deviceId})),
TextButton(
onPressed: (){Clipboard.setData(ClipboardData(text: deviceId));},
child: Text(context.translate(I18n.copy)),
)
],
),
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.regCodeLabel,
args: {'regCode': regCode})),
TextButton(
onPressed: (){Clipboard.setData(ClipboardData(text: regCode));},
child: Text(context.translate(I18n.copy))
)
],
)
],
),
),
),
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,
),
)
),
],
),
);
}
}
Widget _item(
BuildContext context, {
required VoidCallback onPressed,
required IconData icon,
required String text,
required Color color,
}) {
return Padding(
padding: EdgeInsets.only(
bottom: SizeUtils.getByScreen(small: 16, big: 15),
),
child: SectionButton(
onPressed: onPressed,
icon: Icon(
icon,
size: SizeUtils.getByScreen(small: 28, big: 26),
color: color,
),
body: Text(
context.translate(text),
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 18, big: 19),
fontWeight: FontWeight.w500,
),
),
),
);
}
}

View File

@@ -0,0 +1,30 @@
import 'package:account/src/features/account_settings/presentation/state/account_settings_view_state.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:legacy_auth/legacy_auth.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
final accountSettingsViewModelProvider =
NotifierProvider.autoDispose<AccountSettingsViewModel, AccountSettingsViewState>(
AccountSettingsViewModel.new,
);
class AccountSettingsViewModel extends Notifier<AccountSettingsViewState> {
@override
AccountSettingsViewState build() {
return const AccountSettingsViewState();
}
Future<void> logout() async {
if (state.isLoggingOut) return;
state = state.copyWith(isLoggingOut: true, errorMessage: '');
try {
await ref.read(legacyAuthRepositoryProvider).logout();
} catch (_) {}
await clearSessionData();
state = state.copyWith(isLoggingOut: false);
}
}

View File

@@ -0,0 +1,11 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'account_settings_view_state.freezed.dart';
@freezed
abstract class AccountSettingsViewState with _$AccountSettingsViewState {
const factory AccountSettingsViewState({
@Default(false) bool isLoggingOut,
@Default('') String errorMessage,
}) = _AccountSettingsViewState;
}

View File

@@ -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 'account_settings_view_state.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$AccountSettingsViewState {
bool get isLoggingOut; String get errorMessage;
/// Create a copy of AccountSettingsViewState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$AccountSettingsViewStateCopyWith<AccountSettingsViewState> get copyWith => _$AccountSettingsViewStateCopyWithImpl<AccountSettingsViewState>(this as AccountSettingsViewState, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is AccountSettingsViewState&&(identical(other.isLoggingOut, isLoggingOut) || other.isLoggingOut == isLoggingOut)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
}
@override
int get hashCode => Object.hash(runtimeType,isLoggingOut,errorMessage);
@override
String toString() {
return 'AccountSettingsViewState(isLoggingOut: $isLoggingOut, errorMessage: $errorMessage)';
}
}
/// @nodoc
abstract mixin class $AccountSettingsViewStateCopyWith<$Res> {
factory $AccountSettingsViewStateCopyWith(AccountSettingsViewState value, $Res Function(AccountSettingsViewState) _then) = _$AccountSettingsViewStateCopyWithImpl;
@useResult
$Res call({
bool isLoggingOut, String errorMessage
});
}
/// @nodoc
class _$AccountSettingsViewStateCopyWithImpl<$Res>
implements $AccountSettingsViewStateCopyWith<$Res> {
_$AccountSettingsViewStateCopyWithImpl(this._self, this._then);
final AccountSettingsViewState _self;
final $Res Function(AccountSettingsViewState) _then;
/// Create a copy of AccountSettingsViewState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? isLoggingOut = null,Object? errorMessage = null,}) {
return _then(_self.copyWith(
isLoggingOut: null == isLoggingOut ? _self.isLoggingOut : isLoggingOut // 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 [AccountSettingsViewState].
extension AccountSettingsViewStatePatterns on AccountSettingsViewState {
/// 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 extends Object?>(TResult Function( _AccountSettingsViewState value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _AccountSettingsViewState() 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 extends Object?>(TResult Function( _AccountSettingsViewState value) $default,){
final _that = this;
switch (_that) {
case _AccountSettingsViewState():
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 extends Object?>(TResult? Function( _AccountSettingsViewState value)? $default,){
final _that = this;
switch (_that) {
case _AccountSettingsViewState() 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 extends Object?>(TResult Function( bool isLoggingOut, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _AccountSettingsViewState() when $default != null:
return $default(_that.isLoggingOut,_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 extends Object?>(TResult Function( bool isLoggingOut, String errorMessage) $default,) {final _that = this;
switch (_that) {
case _AccountSettingsViewState():
return $default(_that.isLoggingOut,_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 extends Object?>(TResult? Function( bool isLoggingOut, String errorMessage)? $default,) {final _that = this;
switch (_that) {
case _AccountSettingsViewState() when $default != null:
return $default(_that.isLoggingOut,_that.errorMessage);case _:
return null;
}
}
}
/// @nodoc
class _AccountSettingsViewState implements AccountSettingsViewState {
const _AccountSettingsViewState({this.isLoggingOut = false, this.errorMessage = ''});
@override@JsonKey() final bool isLoggingOut;
@override@JsonKey() final String errorMessage;
/// Create a copy of AccountSettingsViewState
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$AccountSettingsViewStateCopyWith<_AccountSettingsViewState> get copyWith => __$AccountSettingsViewStateCopyWithImpl<_AccountSettingsViewState>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AccountSettingsViewState&&(identical(other.isLoggingOut, isLoggingOut) || other.isLoggingOut == isLoggingOut)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
}
@override
int get hashCode => Object.hash(runtimeType,isLoggingOut,errorMessage);
@override
String toString() {
return 'AccountSettingsViewState(isLoggingOut: $isLoggingOut, errorMessage: $errorMessage)';
}
}
/// @nodoc
abstract mixin class _$AccountSettingsViewStateCopyWith<$Res> implements $AccountSettingsViewStateCopyWith<$Res> {
factory _$AccountSettingsViewStateCopyWith(_AccountSettingsViewState value, $Res Function(_AccountSettingsViewState) _then) = __$AccountSettingsViewStateCopyWithImpl;
@override @useResult
$Res call({
bool isLoggingOut, String errorMessage
});
}
/// @nodoc
class __$AccountSettingsViewStateCopyWithImpl<$Res>
implements _$AccountSettingsViewStateCopyWith<$Res> {
__$AccountSettingsViewStateCopyWithImpl(this._self, this._then);
final _AccountSettingsViewState _self;
final $Res Function(_AccountSettingsViewState) _then;
/// Create a copy of AccountSettingsViewState
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? isLoggingOut = null,Object? errorMessage = null,}) {
return _then(_AccountSettingsViewState(
isLoggingOut: null == isLoggingOut ? _self.isLoggingOut : isLoggingOut // 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

View File

@@ -0,0 +1,134 @@
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:sf_localizations/sf_localizations.dart';
import 'package:utils/utils.dart';
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,
});
static const _iconRadius = 40.0;
@override
Widget build(BuildContext context) {
return Stack(
clipBehavior: Clip.none,
alignment: Alignment.topCenter,
children: [
Container(
width: SizeUtils.getByScreen(small: 320, big: 340),
margin: const EdgeInsets.only(top: _iconRadius),
padding: EdgeInsets.only(
top: _iconRadius + SizeUtils.getByScreen(small: 12, big: 10),
bottom: SizeUtils.getByScreen(small: 20, big: 18),
left: SizeUtils.getByScreen(small: 20, big: 18),
right: SizeUtils.getByScreen(small: 20, big: 18),
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Align(
alignment: Alignment.topRight,
child: GestureDetector(
onTap: () => Navigator.pop(context),
child: const Icon(Icons.close, size: 22, color: Colors.grey),
),
),
Text(
name,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 16),
_CopyableField(
label: context.translate(
I18n.deviceIdLabel,
args: {'deviceId': deviceId},
),
value: deviceId,
),
const SizedBox(height: 20),
QrImageView(
data: regCode,
version: QrVersions.auto,
size: SizeUtils.getByScreen(small: 120, big: 120),
padding: EdgeInsets.zero,
),
const SizedBox(height: 16),
_CopyableField(
label: context.translate(
I18n.regCodeLabel,
args: {'regCode': regCode},
),
value: regCode,
),
],
),
),
Container(
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFF00A1C6),
),
padding: EdgeInsets.all(SizeUtils.getByScreen(small: 16, big: 16)),
child: Icon(
SFIcons.watch,
size: SizeUtils.getByScreen(small: 68, big: 66),
color: Colors.white,
),
),
],
);
}
}
class _CopyableField extends StatelessWidget {
final String label;
final String value;
const _CopyableField({required this.label, required this.value});
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () => Clipboard.setData(ClipboardData(text: value)),
child: Container(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
decoration: BoxDecoration(
color: Colors.grey.withValues(alpha: 0.08),
borderRadius: BorderRadius.circular(8),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Flexible(
child: Text(
label,
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 13),
),
),
const SizedBox(width: 6),
const Icon(Icons.copy, size: 14, color: Colors.grey),
],
),
),
);
}
}

View File

@@ -1,4 +0,0 @@
abstract class DeleteAppUserUseCase {
Future<void> deleteAppUser({required String userId});
}

View File

@@ -1,13 +0,0 @@
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<void> deleteAppUser({required String userId}) {
return _repository.deleteAppUser(userId: userId);
}
}

View File

@@ -1,5 +0,0 @@
import 'package:sf_shared/sf_shared.dart';
abstract class GetAppUsersUseCase {
Future<List<UserEntity>> getAppUsers({required String userId});
}

View File

@@ -1,14 +0,0 @@
import 'package:account/src/core/domain/repositories/account_repository.dart';
import 'package:account/src/features/app_users/domain/get_app_users_use_case.dart';
import 'package:sf_shared/sf_shared.dart';
class GetAppUsersUseCaseImpl implements GetAppUsersUseCase {
GetAppUsersUseCaseImpl(this._repository);
final AccountRepository _repository;
@override
Future<List<UserEntity>> getAppUsers({required String userId}) {
return _repository.getAppUsers(userId: userId);
}
}

View File

@@ -1,9 +0,0 @@
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<DeleteAppUserUseCase>((ref) {
final authRepository = ref.read(accountRepositoryProvider);
return DeleteAppUserUseCaseImpl(authRepository);
});

View File

@@ -1,9 +0,0 @@
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<GetAppUsersUseCase>((ref) {
final authRepository = ref.read(accountRepositoryProvider);
return GetAppUsersUseCaseImpl(authRepository);
});

View File

@@ -1,8 +1,5 @@
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/core/domain/repositories/users_repository.dart';
import 'package:account/src/core/providers/users_repository_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_shared/sf_shared.dart';
@@ -13,13 +10,11 @@ NotifierProvider.autoDispose<AppUsersViewModel, AppUsersViewState>(
);
class AppUsersViewModel extends Notifier<AppUsersViewState> {
late final GetAppUsersUseCase _getAppUsersUseCase;
late final DeleteAppUserUseCase _deleteAppUserUseCase;
late final UsersRepository _usersRepository;
@override
AppUsersViewState build() {
_getAppUsersUseCase = ref.read(getAppUsersUseCaseProvider);
_deleteAppUserUseCase = ref.read(deleteAppUserUseCaseProvider);
_usersRepository = ref.read(usersRepositoryProvider);
_init();
@@ -30,7 +25,7 @@ class AppUsersViewModel extends Notifier<AppUsersViewState> {
final user = await ref.read(userInfoProvider.future);
setUser(user);
final appUsers = await _getAppUsersUseCase.getAppUsers(userId: user.id);
final appUsers = await _usersRepository.getUsers(userId: user.id);
setAppUsers(appUsers);
}
@@ -49,7 +44,7 @@ class AppUsersViewModel extends Notifier<AppUsersViewState> {
state = state.copyWith(isEditing: !state.isEditing);
}
void deleteAppUser() {
_deleteAppUserUseCase.deleteAppUser(userId: state.loggedUser!.id);
void deleteUser() {
_usersRepository.deleteUser(userId: state.loggedUser!.id);
}
}

View File

@@ -1,11 +1,11 @@
import 'package:account/src/core/domain/repositories/account_repository.dart';
import 'package:account/src/core/domain/repositories/change_password_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;
final ChangePasswordRepository _repository;
@override
Future<void> changePassword({required String userId, required ChangePasswordRequestEntity request}) {

View File

@@ -14,13 +14,11 @@ class ChangePasswordScreen extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final vm = ref.read(changePasswordViewModelProvider.notifier);
final state = ref.watch(changePasswordViewModelProvider);
final theme = ref.watch(themePortProvider);
return LegacyPageLayout(
theme: theme,
theme: theme,
title: context.translate(I18n.changePassword),
body: Container(
padding: SizeUtils.getByScreen(
@@ -30,45 +28,156 @@ theme: theme,
child: SingleChildScrollView(child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
CustomTextField(
controller: vm.currentPasswordController,
hint: '********',
label: context.translate(I18n.password),
),
const _PasswordSection(),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
CustomTextField(
controller: vm.newPasswordController,
hint: '********',
label: context.translate(I18n.newPassword),
),
const _NewPasswordSection(),
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,
),
),
],
const _RepeatPasswordSection(),
const _ErrorMessageSection()
],
))
),
footer: PrimaryButton(
footer: _SaveSection(navigationContract: navigationContract),
);
}
}
class _PasswordSection extends ConsumerWidget {
const _PasswordSection();
@override
Widget build(BuildContext context, WidgetRef ref) {
final vm = ref.read(changePasswordViewModelProvider.notifier);
final showPassword = ref.watch(
changePasswordViewModelProvider.select((s)=>s.showCurrentPassword)
);
return CustomTextField(
controller: vm.currentPasswordController,
hint: '********',
label: context.translate(I18n.password),
showPassword: showPassword,
onVisibilityChanged: vm.toggleCurrentPasswordVisibility,
);
}
}
class _NewPasswordSection extends ConsumerWidget {
const _NewPasswordSection();
@override
Widget build(BuildContext context, WidgetRef ref) {
final vm = ref.read(changePasswordViewModelProvider.notifier);
final showPassword = ref.watch(
changePasswordViewModelProvider.select((s)=>s.showCurrentPassword)
);
return CustomTextField(
controller: vm.newPasswordController,
hint: '********',
label: context.translate(I18n.newPassword),
showPassword: showPassword,
onVisibilityChanged: vm.toggleNewPasswordVisibility,
);
}
}
class _RepeatPasswordSection extends ConsumerWidget {
const _RepeatPasswordSection();
@override
Widget build(BuildContext context, WidgetRef ref) {
final vm = ref.read(changePasswordViewModelProvider.notifier);
final showPassword = ref.watch(
changePasswordViewModelProvider.select((s)=>s.showCurrentPassword)
);
return CustomTextField(
controller: vm.repeatPasswordController,
hint: '********',
label: context.translate(I18n.repeatPassword),
showPassword: showPassword,
onVisibilityChanged: vm.toggleRepeatedPasswordVisibility,
);
}
}
class _ErrorMessageSection extends ConsumerWidget {
const _ErrorMessageSection();
@override
Widget build(BuildContext context, WidgetRef ref) {
final errorMessage = ref.watch(
changePasswordViewModelProvider.select((s)=>s.errorMessage)
);
if (errorMessage.isNotEmpty) {
return Column(
children: [
const SizedBox(height: 8),
Text(
errorMessage,
textAlign: TextAlign.center,
style: const TextStyle(
color: Color.fromRGBO(239, 17, 17, 1),
fontSize: 12,
),
),
],
);
} else return SizedBox.shrink();
}
}
class _SaveSection extends ConsumerWidget {
final NavigationContract navigationContract;
const _SaveSection({required this.navigationContract});
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.read(themePortProvider);
final vm = ref.read(changePasswordViewModelProvider.notifier);
return Padding(
padding: EdgeInsets.symmetric(horizontal: 24, vertical: 10),
child: PrimaryButton(
onPressed: () async {
final bool res = await vm.changePassword();
if (res){
navigationContract.goBack();
await vm.submit();
final errorMessage = ref.read(
changePasswordViewModelProvider.select((s)=>s.errorMessage)
);
if (errorMessage.isNotEmpty) {
showTopSnackbar(
context,
message: errorMessage,
type: MessageType.error
);
return;
}
final isComplete = ref.read(
changePasswordViewModelProvider.select((s)=>s.isComplete)
);
if (isComplete){
navigationContract.goTo(AppRoutes.legacyLogin);
}
},
text: context.translate('OK'),
text: context.translate(I18n.save),
color: theme.getColorFor(ThemeCode.legacyPrimary)
),
);

View File

@@ -1,9 +1,10 @@
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';
import '../../../../core/providers/change_password_repository_provider.dart';
final changePasswordUseCaseProvider = Provider.autoDispose<ChangePasswordUseCase>((ref) {
final accountRepository = ref.read(accountRepositoryProvider);
return ChangePasswordUseCaseImpl(accountRepository);
final changePassword = ref.read(changePasswordRepositoryProvider);
return ChangePasswordUseCaseImpl(changePassword);
});

View File

@@ -4,11 +4,8 @@ import 'package:account/src/features/change_password/presentation/providers/chan
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_shared/sf_shared.dart';
// import 'package:sf_localizations/sf_localizations.dart';
final changePasswordViewModelProvider =
NotifierProvider.autoDispose<ChangePasswordViewModel, ChangePasswordViewState>(
ChangePasswordViewModel.new,
@@ -26,6 +23,13 @@ class ChangePasswordViewModel extends Notifier<ChangePasswordViewState> {
ChangePasswordViewState build() {
_changePasswordUseCase = ref.read(changePasswordUseCaseProvider);
_initControllers();
return const ChangePasswordViewState();
}
void _initControllers() {
currentPasswordController = TextEditingController();
currentPasswordController.addListener(_onCurrentPasswordChanged);
@@ -33,24 +37,27 @@ class ChangePasswordViewModel extends Notifier<ChangePasswordViewState> {
newPasswordController.addListener(_onNewPasswordChanged);
repeatPasswordController = TextEditingController();
repeatPasswordController.addListener(_onRepeatPasswordController);
repeatPasswordController.addListener(_onRepeatPasswordChanged);
ref.onDispose(disposeControllers);
_init();
return const ChangePasswordViewState();
}
Future<void> _init() async {
final user = await ref.read(userInfoProvider.future);
setUser(user);
void toggleCurrentPasswordVisibility() {
state = state.copyWith(
showCurrentPassword: !state.showCurrentPassword
);
}
void setUser(UserEntity user) {
state = state.copyWith(loggedUser: user);
void toggleNewPasswordVisibility() {
state = state.copyWith(
showNewPassword: !state.showNewPassword
);
}
void toggleRepeatedPasswordVisibility() {
state = state.copyWith(
showRepeatedPassword: !state.showRepeatedPassword
);
}
void _onCurrentPasswordChanged() {
@@ -60,6 +67,7 @@ class ChangePasswordViewModel extends Notifier<ChangePasswordViewState> {
state = state.copyWith(
currentPassword: value,
errorMessage: ''
);
}
@@ -70,16 +78,18 @@ class ChangePasswordViewModel extends Notifier<ChangePasswordViewState> {
state = state.copyWith(
newPassword: value,
errorMessage: ''
);
}
void _onRepeatPasswordController() {
void _onRepeatPasswordChanged() {
final value = repeatPasswordController.text;
if (value == state.repeatPassword) return;
state = state.copyWith(
repeatPassword: value,
errorMessage: ''
);
}
@@ -110,28 +120,36 @@ class ChangePasswordViewModel extends Notifier<ChangePasswordViewState> {
);
}
Future<bool> changePassword() async {
if (state.isLoading) return false;
if (!_validateForm()) return false;
Future<void> submit() async {
if (state.isLoading) return;
if (!_validateForm()) return;
try {
state = state.copyWith(
isLoading: true,
isComplete: false
);
final user = await ref.read(userInfoProvider.future);
final request = _toRequest();
await _changePasswordUseCase.changePassword(userId: state.loggedUser!.id, request: request);
ref.invalidate(userInfoProvider);
return true;
await _changePasswordUseCase.changePassword(userId: user.id, request: request);
state = state.copyWith(
isLoading: false,
isComplete: true
);
} catch (e) {
if (!ref.mounted) return false;
if (!ref.mounted) return;
_finishWithError(message: e.toString());
return false;
return;
}
}
void _finishWithError({required String message}) {
state = state.copyWith(
isLoading: false,
isComplete: false,
errorMessage: message,
);
}
@@ -143,7 +161,7 @@ class ChangePasswordViewModel extends Notifier<ChangePasswordViewState> {
newPasswordController.removeListener(_onNewPasswordChanged);
newPasswordController.dispose();
repeatPasswordController.removeListener(_onRepeatPasswordController);
repeatPasswordController.removeListener(_onRepeatPasswordChanged);
repeatPasswordController.dispose();
}

View File

@@ -1,13 +1,15 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:sf_shared/sf_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(false) bool isComplete,
@Default(false) bool showCurrentPassword,
@Default(false) bool showNewPassword,
@Default(false) bool showRepeatedPassword,
@Default('') String currentPassword,
@Default('') String newPassword,
@Default('') String repeatPassword,

View File

@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$ChangePasswordViewState {
UserEntity? get loggedUser; bool get isLoading; String get currentPassword; String get newPassword; String get repeatPassword; String get errorMessage;
bool get isLoading; bool get isComplete; bool get showCurrentPassword; bool get showNewPassword; bool get showRepeatedPassword; 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)
@@ -25,16 +25,16 @@ $ChangePasswordViewStateCopyWith<ChangePasswordViewState> get copyWith => _$Chan
@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));
return identical(this, other) || (other.runtimeType == runtimeType&&other is ChangePasswordViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isComplete, isComplete) || other.isComplete == isComplete)&&(identical(other.showCurrentPassword, showCurrentPassword) || other.showCurrentPassword == showCurrentPassword)&&(identical(other.showNewPassword, showNewPassword) || other.showNewPassword == showNewPassword)&&(identical(other.showRepeatedPassword, showRepeatedPassword) || other.showRepeatedPassword == showRepeatedPassword)&&(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);
int get hashCode => Object.hash(runtimeType,isLoading,isComplete,showCurrentPassword,showNewPassword,showRepeatedPassword,currentPassword,newPassword,repeatPassword,errorMessage);
@override
String toString() {
return 'ChangePasswordViewState(loggedUser: $loggedUser, isLoading: $isLoading, currentPassword: $currentPassword, newPassword: $newPassword, repeatPassword: $repeatPassword, errorMessage: $errorMessage)';
return 'ChangePasswordViewState(isLoading: $isLoading, isComplete: $isComplete, showCurrentPassword: $showCurrentPassword, showNewPassword: $showNewPassword, showRepeatedPassword: $showRepeatedPassword, currentPassword: $currentPassword, newPassword: $newPassword, repeatPassword: $repeatPassword, errorMessage: $errorMessage)';
}
@@ -45,11 +45,11 @@ 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
bool isLoading, bool isComplete, bool showCurrentPassword, bool showNewPassword, bool showRepeatedPassword, String currentPassword, String newPassword, String repeatPassword, String errorMessage
});
$UserEntityCopyWith<$Res>? get loggedUser;
}
/// @nodoc
@@ -62,10 +62,13 @@ class _$ChangePasswordViewStateCopyWithImpl<$Res>
/// 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,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? isComplete = null,Object? showCurrentPassword = null,Object? showNewPassword = null,Object? showRepeatedPassword = 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
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,showCurrentPassword: null == showCurrentPassword ? _self.showCurrentPassword : showCurrentPassword // ignore: cast_nullable_to_non_nullable
as bool,showNewPassword: null == showNewPassword ? _self.showNewPassword : showNewPassword // ignore: cast_nullable_to_non_nullable
as bool,showRepeatedPassword: null == showRepeatedPassword ? _self.showRepeatedPassword : showRepeatedPassword // 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
@@ -73,19 +76,7 @@ as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage
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));
});
}
}
@@ -167,10 +158,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( UserEntity? loggedUser, bool isLoading, String currentPassword, String newPassword, String repeatPassword, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, bool isComplete, bool showCurrentPassword, bool showNewPassword, bool showRepeatedPassword, 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 $default(_that.isLoading,_that.isComplete,_that.showCurrentPassword,_that.showNewPassword,_that.showRepeatedPassword,_that.currentPassword,_that.newPassword,_that.repeatPassword,_that.errorMessage);case _:
return orElse();
}
@@ -188,10 +179,10 @@ return $default(_that.loggedUser,_that.isLoading,_that.currentPassword,_that.new
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( UserEntity? loggedUser, bool isLoading, String currentPassword, String newPassword, String repeatPassword, String errorMessage) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, bool isComplete, bool showCurrentPassword, bool showNewPassword, bool showRepeatedPassword, 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 _:
return $default(_that.isLoading,_that.isComplete,_that.showCurrentPassword,_that.showNewPassword,_that.showRepeatedPassword,_that.currentPassword,_that.newPassword,_that.repeatPassword,_that.errorMessage);case _:
throw StateError('Unexpected subclass');
}
@@ -208,10 +199,10 @@ return $default(_that.loggedUser,_that.isLoading,_that.currentPassword,_that.new
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( UserEntity? loggedUser, bool isLoading, String currentPassword, String newPassword, String repeatPassword, String errorMessage)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, bool isComplete, bool showCurrentPassword, bool showNewPassword, bool showRepeatedPassword, 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 $default(_that.isLoading,_that.isComplete,_that.showCurrentPassword,_that.showNewPassword,_that.showRepeatedPassword,_that.currentPassword,_that.newPassword,_that.repeatPassword,_that.errorMessage);case _:
return null;
}
@@ -223,11 +214,14 @@ return $default(_that.loggedUser,_that.isLoading,_that.currentPassword,_that.new
class _ChangePasswordViewState implements ChangePasswordViewState {
const _ChangePasswordViewState({this.loggedUser, this.isLoading = false, this.currentPassword = '', this.newPassword = '', this.repeatPassword = '', this.errorMessage = ''});
const _ChangePasswordViewState({this.isLoading = false, this.isComplete = false, this.showCurrentPassword = false, this.showNewPassword = false, this.showRepeatedPassword = false, this.currentPassword = '', this.newPassword = '', this.repeatPassword = '', this.errorMessage = ''});
@override final UserEntity? loggedUser;
@override@JsonKey() final bool isLoading;
@override@JsonKey() final bool isComplete;
@override@JsonKey() final bool showCurrentPassword;
@override@JsonKey() final bool showNewPassword;
@override@JsonKey() final bool showRepeatedPassword;
@override@JsonKey() final String currentPassword;
@override@JsonKey() final String newPassword;
@override@JsonKey() final String repeatPassword;
@@ -243,16 +237,16 @@ _$ChangePasswordViewStateCopyWith<_ChangePasswordViewState> get copyWith => __$C
@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));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ChangePasswordViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isComplete, isComplete) || other.isComplete == isComplete)&&(identical(other.showCurrentPassword, showCurrentPassword) || other.showCurrentPassword == showCurrentPassword)&&(identical(other.showNewPassword, showNewPassword) || other.showNewPassword == showNewPassword)&&(identical(other.showRepeatedPassword, showRepeatedPassword) || other.showRepeatedPassword == showRepeatedPassword)&&(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);
int get hashCode => Object.hash(runtimeType,isLoading,isComplete,showCurrentPassword,showNewPassword,showRepeatedPassword,currentPassword,newPassword,repeatPassword,errorMessage);
@override
String toString() {
return 'ChangePasswordViewState(loggedUser: $loggedUser, isLoading: $isLoading, currentPassword: $currentPassword, newPassword: $newPassword, repeatPassword: $repeatPassword, errorMessage: $errorMessage)';
return 'ChangePasswordViewState(isLoading: $isLoading, isComplete: $isComplete, showCurrentPassword: $showCurrentPassword, showNewPassword: $showNewPassword, showRepeatedPassword: $showRepeatedPassword, currentPassword: $currentPassword, newPassword: $newPassword, repeatPassword: $repeatPassword, errorMessage: $errorMessage)';
}
@@ -263,11 +257,11 @@ abstract mixin class _$ChangePasswordViewStateCopyWith<$Res> implements $ChangeP
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
bool isLoading, bool isComplete, bool showCurrentPassword, bool showNewPassword, bool showRepeatedPassword, String currentPassword, String newPassword, String repeatPassword, String errorMessage
});
@override $UserEntityCopyWith<$Res>? get loggedUser;
}
/// @nodoc
@@ -280,10 +274,13 @@ class __$ChangePasswordViewStateCopyWithImpl<$Res>
/// 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,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? isComplete = null,Object? showCurrentPassword = null,Object? showNewPassword = null,Object? showRepeatedPassword = 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
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,showCurrentPassword: null == showCurrentPassword ? _self.showCurrentPassword : showCurrentPassword // ignore: cast_nullable_to_non_nullable
as bool,showNewPassword: null == showNewPassword ? _self.showNewPassword : showNewPassword // ignore: cast_nullable_to_non_nullable
as bool,showRepeatedPassword: null == showRepeatedPassword ? _self.showRepeatedPassword : showRepeatedPassword // 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
@@ -292,19 +289,7 @@ 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

Some files were not shown because too many files have changed in this diff Show More