WIP
This commit is contained in:
parent
fa60cd8e2c
commit
691c318688
|
@ -183,16 +183,15 @@ class _AppState extends State<App> {
|
|||
|
||||
@override void initState() {
|
||||
super.initState();
|
||||
initDeepLinks();
|
||||
|
||||
FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true);
|
||||
|
||||
_appStateNotifier = AppStateNotifier.instance;
|
||||
_router = createRouter(_appStateNotifier);
|
||||
Future.delayed(const Duration(milliseconds: 1000),
|
||||
() => setState(() => _appStateNotifier.stopShowingSplashImage()));
|
||||
|
||||
_setupFirebaseMessaging();
|
||||
// WidgetsBinding.instance.addPersistentFrameCallback((_) => initDeepLinks());
|
||||
}
|
||||
@override void dispose() {
|
||||
_linkSubscription?.cancel();
|
||||
|
@ -202,8 +201,6 @@ class _AppState extends State<App> {
|
|||
|
||||
Future<void> initDeepLinks() async {
|
||||
_appLinks = AppLinks();
|
||||
|
||||
// Handle links
|
||||
_linkSubscription = _appLinks.uriLinkStream.listen((uri) {
|
||||
debugPrint('onAppLink: $uri');
|
||||
openAppLink(uri);
|
||||
|
@ -213,10 +210,8 @@ class _AppState extends State<App> {
|
|||
void openAppLink(Uri uri) {
|
||||
log('openAppLink');
|
||||
log(uri.toString());
|
||||
|
||||
final String email = uri.queryParameters['email'] ?? '';
|
||||
final String token = uri.queryParameters['token'] ?? '';
|
||||
|
||||
log('Email: $email');
|
||||
log('Token: $token');
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import 'package:hub/shared/utils/storage_util.dart';
|
|||
import '/components/templates_components/welcome_template_component/welcome_template_component_widget.dart';
|
||||
import '/flutter_flow/flutter_flow_theme.dart';
|
||||
import '/flutter_flow/flutter_flow_util.dart';
|
||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||
import 'welcome_page_model.dart';
|
||||
|
||||
export 'welcome_page_model.dart';
|
||||
|
@ -23,6 +24,8 @@ class WelcomePageWidget extends StatefulWidget with Switcher {
|
|||
|
||||
class _WelcomePageWidgetState extends State<WelcomePageWidget> {
|
||||
late WelcomePageModel _model;
|
||||
late AppLinks _appLinks;
|
||||
StreamSubscription<Uri>? _linkSubscription;
|
||||
|
||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
|
@ -42,17 +45,47 @@ class _WelcomePageWidgetState extends State<WelcomePageWidget> {
|
|||
StorageUtil().deviceType = 'Web';
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
WidgetsBinding.instance.addPersistentFrameCallback((_) => initDeepLinks());
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@override void dispose() {
|
||||
_model.dispose();
|
||||
_linkSubscription?.cancel();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Future<void> initDeepLinks() async {
|
||||
_appLinks = AppLinks();
|
||||
|
||||
// Handle links
|
||||
_linkSubscription = _appLinks.uriLinkStream.listen((uri) {
|
||||
debugPrint('onAppLink: $uri');
|
||||
openAppLink(uri);
|
||||
});
|
||||
}
|
||||
|
||||
void openAppLink(Uri uri) {
|
||||
log('openAppLink');
|
||||
log(uri.toString());
|
||||
|
||||
final String email = uri.queryParameters['email'] ?? '';
|
||||
final String token = uri.queryParameters['token'] ?? '';
|
||||
|
||||
log('Email: $email');
|
||||
log('Token: $token');
|
||||
|
||||
// Use the extracted email and token as needed
|
||||
if (email.isNotEmpty && token.isNotEmpty) {
|
||||
StorageUtil().context?.push('/forgotPassword', extra: {'email': email, 'token': token});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
StorageUtil().context = context;
|
||||
|
|
Loading…
Reference in New Issue