Add saved payout destination UX and service contracts (#54)

This commit is contained in:
Stephan D committed 2026-10-16 12:01:33 +02:00
1 parent a5689876ff
commit 24af794112
49 files changed
+4687 -62

No files matched your search

+12
View File
@@ -37,6 +37,7 @@ class SxchngeApp extends StatefulWidget {
this.identityService,
this.limitsService,
this.walletService,
this.destinationService,
this.twoFactorService,
this.photoService = const FilePhotoService(),
this.loginService = const DummyLoginService(),
@@ -49,6 +50,7 @@ class SxchngeApp extends StatefulWidget {
final IdentityService? identityService;
final LimitsService? limitsService;
final WalletService? walletService;
final DestinationService? destinationService;
final TwoFactorService? twoFactorService;
final PhotoService photoService;
final LoginService loginService;
@@ -89,10 +91,17 @@ class _SxchngeAppState extends State<SxchngeApp> {
initialLocale: _locale.locale.languageCode,
factors: _authFactors,
));
late final _destinationService =
widget.destinationService ??
(_walletService.isSimulated && _walletService is DummyWalletService
? _walletService.destinations
: const UnavailableDestinationService());
late final _destinations = DestinationsProvider(_destinationService);
late final _wallet = WalletProvider(
_walletService,
_analytics,
factors: _factors,
destinations: _destinationService,
);
late final _limits =
widget.limitsService ??
@@ -131,6 +140,7 @@ class _SxchngeAppState extends State<SxchngeApp> {
if (customer != _walletCustomer) {
_walletCustomer = customer;
_wallet.reset();
_destinations.reset();
}
final path = _router.routeInformationProvider.value.uri.path;
if (path == '/' && _previousPath != '/' && _previousPath != '/two-factor') {
@@ -145,6 +155,7 @@ class _SxchngeAppState extends State<SxchngeApp> {
_router.dispose();
_journeys.dispose();
_wallet.dispose();
_destinations.dispose();
if (_walletService is BackendWalletService) {
_walletService.close();
}
@@ -161,6 +172,7 @@ class _SxchngeAppState extends State<SxchngeApp> {
Widget build(BuildContext context) => MultiProvider(
providers: [
ChangeNotifierProvider.value(value: _wallet),
ChangeNotifierProvider.value(value: _destinations),
ChangeNotifierProvider.value(value: _security),
Provider<TwoFactorService>.value(value: _factors),
Provider<JourneyRecorder>.value(value: _journeys),