Integrate email notifications into signup and login (#38)
This commit is contained in:
1 parent
326d58f705
commit
ad5a061164
55 files changed
+1859
-3464
No files matched your search
@@ -20,13 +20,19 @@ import 'generated/i18n/app_localizations.dart';
|
||||
Future<void> main() async {
|
||||
final binding = WidgetsFlutterBinding.ensureInitialized();
|
||||
final locale = await LocaleProvider.load(binding.platformDispatcher.locales);
|
||||
runApp(SxchngeApp(localeProvider: locale));
|
||||
const apiUrl = String.fromEnvironment('SXCHNGE_API_URL');
|
||||
const clientId = String.fromEnvironment('SXCHNGE_CLIENT_ID');
|
||||
final backend = apiUrl.isEmpty
|
||||
? null
|
||||
: BackendAuthServices(baseUri: Uri.parse(apiUrl), clientId: clientId);
|
||||
runApp(SxchngeApp(localeProvider: locale, backend: backend));
|
||||
}
|
||||
|
||||
class SxchngeApp extends StatefulWidget {
|
||||
const SxchngeApp({
|
||||
super.key,
|
||||
this.localeProvider,
|
||||
this.backend,
|
||||
this.analyticsService,
|
||||
this.identityService,
|
||||
this.limitsService,
|
||||
@@ -38,6 +44,7 @@ class SxchngeApp extends StatefulWidget {
|
||||
this.verificationService = const DummyVerificationService(),
|
||||
});
|
||||
final LocaleProvider? localeProvider;
|
||||
final BackendAuthServices? backend;
|
||||
final AnalyticsService? analyticsService;
|
||||
final IdentityService? identityService;
|
||||
final LimitsService? limitsService;
|
||||
@@ -56,7 +63,8 @@ class _SxchngeAppState extends State<SxchngeApp> {
|
||||
late final _locale = widget.localeProvider ?? LocaleProvider();
|
||||
|
||||
late final _analytics = widget.analyticsService ?? DummyAnalyticsService();
|
||||
late final _factors = widget.twoFactorService ?? DummyTwoFactorService();
|
||||
late final _factors =
|
||||
widget.backend ?? widget.twoFactorService ?? DummyTwoFactorService();
|
||||
late final _security = SecurityProvider(_factors, _analytics);
|
||||
late final _identity = widget.identityService ?? DummyIdentityService();
|
||||
late final _walletService =
|
||||
@@ -79,12 +87,18 @@ class _SxchngeAppState extends State<SxchngeApp> {
|
||||
late final _journeys = JourneyRecorder(_analytics);
|
||||
late final _services = InstrumentedAuthServices(
|
||||
recorder: _journeys,
|
||||
loginService: GuardedLoginService(widget.loginService, _factors),
|
||||
signupService: widget.signupService,
|
||||
verificationService: widget.verificationService,
|
||||
loginService: GuardedLoginService(
|
||||
widget.backend ?? widget.loginService,
|
||||
_factors,
|
||||
),
|
||||
signupService: widget.backend ?? widget.signupService,
|
||||
verificationService: widget.backend ?? widget.verificationService,
|
||||
);
|
||||
late final _router = createAppRouter()
|
||||
..routeInformationProvider.addListener(_routeChanged);
|
||||
late final _router = createAppRouter(
|
||||
authenticated: widget.backend == null
|
||||
? null
|
||||
: () => widget.backend!.session != null,
|
||||
)..routeInformationProvider.addListener(_routeChanged);
|
||||
String _previousPath = '/';
|
||||
|
||||
@override
|
||||
@@ -109,6 +123,7 @@ class _SxchngeAppState extends State<SxchngeApp> {
|
||||
_wallet.dispose();
|
||||
_security.dispose();
|
||||
_locale.dispose();
|
||||
widget.backend?.close();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user