Connect customer quotations and payment execution to Sendico (#50)
This commit is contained in:
1 parent
5d67c25c8e
commit
7a6510d1a8
45 files changed
+2696
-45
No files matched your search
@@ -63,8 +63,11 @@ class _SxchngeAppState extends State<SxchngeApp> {
|
||||
late final _locale = widget.localeProvider ?? LocaleProvider();
|
||||
|
||||
late final _analytics = widget.analyticsService ?? DummyAnalyticsService();
|
||||
late final _factors =
|
||||
late final _authFactors =
|
||||
widget.backend ?? widget.twoFactorService ?? DummyTwoFactorService();
|
||||
late final _factors = _walletService is BackendWalletService
|
||||
? WalletFactorService(_walletService, _authFactors)
|
||||
: _authFactors;
|
||||
late final _security = SecurityProvider(_factors, _analytics);
|
||||
late final _identity =
|
||||
widget.identityService ??
|
||||
@@ -76,11 +79,16 @@ class _SxchngeAppState extends State<SxchngeApp> {
|
||||
));
|
||||
late final _walletService =
|
||||
widget.walletService ??
|
||||
DummyWalletService(
|
||||
_identity,
|
||||
initialLocale: _locale.locale.languageCode,
|
||||
factors: _factors,
|
||||
);
|
||||
(widget.backend != null
|
||||
? BackendWalletService(
|
||||
baseUri: widget.backend!.baseUri,
|
||||
accessToken: () => widget.backend!.session?.accessToken,
|
||||
)
|
||||
: DummyWalletService(
|
||||
_identity,
|
||||
initialLocale: _locale.locale.languageCode,
|
||||
factors: _authFactors,
|
||||
));
|
||||
late final _wallet = WalletProvider(
|
||||
_walletService,
|
||||
_analytics,
|
||||
@@ -109,14 +117,21 @@ class _SxchngeAppState extends State<SxchngeApp> {
|
||||
: () => widget.backend!.session != null,
|
||||
)..routeInformationProvider.addListener(_routeChanged);
|
||||
String _previousPath = '/';
|
||||
String? _walletCustomer;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_previousPath = _router.routeInformationProvider.value.uri.path;
|
||||
_walletCustomer = widget.backend?.session?.userId;
|
||||
}
|
||||
|
||||
void _routeChanged() {
|
||||
final customer = widget.backend?.session?.userId;
|
||||
if (customer != _walletCustomer) {
|
||||
_walletCustomer = customer;
|
||||
_wallet.reset();
|
||||
}
|
||||
final path = _router.routeInformationProvider.value.uri.path;
|
||||
if (path == '/' && _previousPath != '/' && _previousPath != '/two-factor') {
|
||||
_journeys.abandon(JourneyExit.navigation);
|
||||
@@ -130,6 +145,9 @@ class _SxchngeAppState extends State<SxchngeApp> {
|
||||
_router.dispose();
|
||||
_journeys.dispose();
|
||||
_wallet.dispose();
|
||||
if (_walletService is BackendWalletService) {
|
||||
_walletService.close();
|
||||
}
|
||||
_security.dispose();
|
||||
if (_identity is BackendIdentityService) {
|
||||
_identity.close();
|
||||
|
||||
Reference in new issue
Block a user