wip: add try-catch
This commit is contained in:
parent
40e2e75a09
commit
4bdce5e2ba
|
@ -1,4 +1,5 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:developer';
|
||||||
import 'package:app_links/app_links.dart';
|
import 'package:app_links/app_links.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||||
|
@ -33,39 +34,49 @@ class DeepLinkService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _handleDeepLink(Uri uri) async {
|
Future<void> _handleDeepLink(Uri uri) async {
|
||||||
print('Handling deep link: $uri');
|
try {
|
||||||
if (StorageHelper().isRecovered) return;
|
print('Handling deep link: $uri');
|
||||||
|
if (StorageHelper().isRecovered) return;
|
||||||
|
|
||||||
StorageHelper().isRecovered = true;
|
StorageHelper().isRecovered = true;
|
||||||
final email = uri.queryParameters['email'] ?? '';
|
final email = uri.queryParameters['email'] ?? '';
|
||||||
final token = uri.queryParameters['token'] ?? '';
|
final token = uri.queryParameters['token'] ?? '';
|
||||||
print('email: $email, token: $token');
|
print('email: $email, token: $token');
|
||||||
|
|
||||||
if (email.isNotEmpty && token.isNotEmpty) {
|
if (email.isNotEmpty && token.isNotEmpty) {
|
||||||
await _showForgotPasswordScreen(email, token);
|
await _showForgotPasswordScreen(email, token);
|
||||||
|
}
|
||||||
|
} catch (e, s) {
|
||||||
|
print('Error handling deep link: $e');
|
||||||
|
log('Error handling', error: e, stackTrace: s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _showForgotPasswordScreen(String email, String token) async {
|
Future<void> _showForgotPasswordScreen(String email, String token) async {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
try {
|
||||||
final theme = FlutterFlowTheme.of(StorageHelper().context!);
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
final screen = ForgotPasswordScreen(email: email, token: token);
|
final theme = FlutterFlowTheme.of(StorageHelper().context!);
|
||||||
await showModalBottomSheet(
|
final screen = ForgotPasswordScreen(email: email, token: token);
|
||||||
context: StorageHelper().context!,
|
await showModalBottomSheet(
|
||||||
builder: (context) => Padding(
|
context: StorageHelper().context!,
|
||||||
padding: MediaQuery.viewInsetsOf(context),
|
builder: (context) => Padding(
|
||||||
child: screen,
|
padding: MediaQuery.viewInsetsOf(context),
|
||||||
),
|
child: screen,
|
||||||
isScrollControlled: true,
|
),
|
||||||
backgroundColor: theme.primaryBackground,
|
isScrollControlled: true,
|
||||||
showDragHandle: true,
|
backgroundColor: theme.primaryBackground,
|
||||||
useSafeArea: true,
|
showDragHandle: true,
|
||||||
enableDrag: true,
|
useSafeArea: true,
|
||||||
).whenComplete(() {
|
enableDrag: true,
|
||||||
StorageHelper().isRecovered = false;
|
).whenComplete(() {
|
||||||
print('showModalBottomSheet completed');
|
StorageHelper().isRecovered = false;
|
||||||
|
print('showModalBottomSheet completed');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
} catch (e, s) {
|
||||||
|
print('Error showing forgot password screen: $e');
|
||||||
|
log('Error handling', error: e, stackTrace: s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
|
Loading…
Reference in New Issue