WIP
This commit is contained in:
parent
69ecb375dd
commit
36931e14b0
|
@ -3,7 +3,7 @@
|
|||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>FlutterDeepLinkingEnabled</key>
|
||||
<false/>
|
||||
<true/>
|
||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||
<true/>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
|
|
|
@ -181,47 +181,32 @@ class _AppState extends State<App> {
|
|||
);
|
||||
};
|
||||
|
||||
@override void initState() {
|
||||
super.initState();
|
||||
|
||||
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();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
Future<void> initDeepLinks() async {
|
||||
_appLinks = AppLinks();
|
||||
_linkSubscription = _appLinks.uriLinkStream.listen((uri) {
|
||||
debugPrint('onAppLink: $uri');
|
||||
openAppLink(uri);
|
||||
final bool isRecovered = StorageUtil().isRecovered;
|
||||
if (isRecovered) openAppLink(uri);
|
||||
});
|
||||
}
|
||||
|
||||
void openAppLink(Uri uri) {
|
||||
log('openAppLink');
|
||||
log(uri.toString());
|
||||
final bool isRecovered = !StorageUtil().isRecovered;
|
||||
if(isRecovered) return;
|
||||
StorageUtil().isRecovered = false;
|
||||
|
||||
final String email = uri.queryParameters['email'] ?? '';
|
||||
final String token = uri.queryParameters['token'] ?? '';
|
||||
log('Email: $email');
|
||||
log('Token: $token');
|
||||
final BuildContext context = StorageUtil().context!;
|
||||
final Future<Object?> Function(String, {Object? extra}) nav = context.push;
|
||||
final bool isNotEmpty = email.isNotEmpty && token.isNotEmpty;
|
||||
log('openAppLink: $uri');
|
||||
|
||||
if (isNotEmpty) nav('/forgotPassword', extra: {'email': email, 'token': token});
|
||||
|
||||
// Use the extracted email and token as needed
|
||||
// navigatorKey.currentState?.pushNamed('/forgotPassword', arguments: {'email': email, 'token': token});
|
||||
if (email.isNotEmpty && token.isNotEmpty)
|
||||
StorageUtil().context?.push('/forgotPassword', extra: {'email': email, 'token': token});
|
||||
|
||||
}
|
||||
|
||||
void _setupFirebaseMessaging() async {
|
||||
FirebaseMessaging messaging = FirebaseMessaging.instance;
|
||||
RemoteMessage? initialMessage = await messaging.getInitialMessage();
|
||||
|
@ -261,8 +246,23 @@ class _AppState extends State<App> {
|
|||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@override void initState() {
|
||||
super.initState();
|
||||
|
||||
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();
|
||||
super.dispose();
|
||||
}
|
||||
@override Widget build(BuildContext context) {
|
||||
return MaterialApp.router(
|
||||
key: navigatorKey,
|
||||
title: 'FRE ACCESS HUB',
|
||||
|
|
|
@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_animate/flutter_animate.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||
import 'package:hub/shared/utils/storage_util.dart';
|
||||
|
||||
import '../../components/atomic_components/shared_components_atoms/atom_image_svg_theme.dart';
|
||||
import '../../flutter_flow/flutter_flow_animations.dart';
|
||||
|
@ -111,6 +112,7 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
|
|||
),
|
||||
onPressed: () async {
|
||||
context.pop();
|
||||
StorageUtil().isRecovered = true;
|
||||
},
|
||||
),
|
||||
title: Text(
|
||||
|
|
|
@ -184,6 +184,12 @@ class StorageUtil {
|
|||
log('SQLiteStorageHelper: Initialization complete');
|
||||
}
|
||||
|
||||
bool _isRecovered = true;
|
||||
bool get isRecovered => _isRecovered;
|
||||
set isRecovered(bool value) => _isRecovered = value;
|
||||
|
||||
|
||||
|
||||
bool _isFirstRun = true;
|
||||
bool get isFirstRun => _isFirstRun;
|
||||
set isFirstRun(bool value) {
|
||||
|
|
Loading…
Reference in New Issue