This commit is contained in:
J. A. Messias 2024-11-07 14:47:42 -03:00
parent 23242ae571
commit 52a81659d4
2 changed files with 9 additions and 8 deletions

View File

@ -47,11 +47,9 @@ Future<void> initializeApp() async {
Future<void> _initializeTracking() async { Future<void> _initializeTracking() async {
await AppTrackingTransparency.requestTrackingAuthorization(); await AppTrackingTransparency.requestTrackingAuthorization();
} }
Future<void> _initializeFirebase() async { Future<void> _initializeFirebase() async {
await Firebase.initializeApp(); await Firebase.initializeApp();
} }
Future<void> _initializeNotificationService() async { Future<void> _initializeNotificationService() async {
await NotificationService.initialize(); await NotificationService.initialize();
} }
@ -59,7 +57,6 @@ Future<void> _initializeNotificationService() async {
void _initializeUrlStrategy() { void _initializeUrlStrategy() {
setUrlStrategy(PathUrlStrategy()); setUrlStrategy(PathUrlStrategy());
} }
void _initializeSystemSettings() { void _initializeSystemSettings() {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
if (kDebugMode) { if (kDebugMode) {
@ -78,7 +75,6 @@ Future<void> _initializeFlutterFlow() async {
GoRouter.optionURLReflectsImperativeAPIs = true; GoRouter.optionURLReflectsImperativeAPIs = true;
usePathUrlStrategy(); usePathUrlStrategy();
} }
Future<void> _foregroundHandlerMessage(RemoteMessage message) async { Future<void> _foregroundHandlerMessage(RemoteMessage message) async {
if (message.data['click_action'] == 'enroll_cond') { if (message.data['click_action'] == 'enroll_cond') {
await StorageHelper().set(SecureStorageKey.haveLocal.value, 'true', Storage.SecureStorage); await StorageHelper().set(SecureStorageKey.haveLocal.value, 'true', Storage.SecureStorage);
@ -92,7 +88,6 @@ Future<void> _foregroundHandlerMessage(RemoteMessage message) async {
payload: Map<String, String>.from(message.data)); payload: Map<String, String>.from(message.data));
} }
} }
Future<void> _backgroundHandlerMessage(RemoteMessage message) async { Future<void> _backgroundHandlerMessage(RemoteMessage message) async {
if (message.data['click_action'] == 'enroll_cond') { if (message.data['click_action'] == 'enroll_cond') {
await StorageHelper().set(SecureStorageKey.haveLocal.value, 'true', Storage.SecureStorage); await StorageHelper().set(SecureStorageKey.haveLocal.value, 'true', Storage.SecureStorage);
@ -108,7 +103,6 @@ class App extends StatefulWidget {
static _AppState of(BuildContext context) => context.findAncestorStateOfType<_AppState>()!; static _AppState of(BuildContext context) => context.findAncestorStateOfType<_AppState>()!;
} }
class _AppState extends State<App> with WidgetsBindingObserver { class _AppState extends State<App> with WidgetsBindingObserver {
Locale? _locale = FFLocalizations.getStoredLocale(); Locale? _locale = FFLocalizations.getStoredLocale();
ThemeMode _themeMode = FlutterFlowTheme.themeMode; ThemeMode _themeMode = FlutterFlowTheme.themeMode;
@ -277,7 +271,7 @@ class _AppState extends State<App> with WidgetsBindingObserver {
@override @override
void didChangeAppLifecycleState(AppLifecycleState state) async { void didChangeAppLifecycleState(AppLifecycleState state) async {
if(state == AppLifecycleState.resumed) await _initializeNotificationService(); if(state == AppLifecycleState.resumed) await LocalizationService.processLocals(context);
} }
@override @override
@ -296,3 +290,4 @@ class _AppState extends State<App> with WidgetsBindingObserver {
); );
} }
} }

View File

@ -213,11 +213,17 @@ class LocalizationService {
// await DialogUtil.error(context, errorMsg).whenComplete(() async => await AuthenticationService.signOut(context)); // await DialogUtil.error(context, errorMsg).whenComplete(() async => await AuthenticationService.signOut(context));
} }
else if (isAuthenticated && !isDevLinked) { else if (isAuthenticated && !isDevLinked) {
final String log = '''
devUUID: $devUUID
userUUID: $userUUID
''';
errorMsg = FFLocalizations.of(context).getVariableText( errorMsg = FFLocalizations.of(context).getVariableText(
ptText: 'Não foi possível vincular o dispositivo, tente novamente.', ptText: 'Não foi possível vincular o dispositivo, tente novamente.',
enText: 'Unable to link device, try again', enText: 'Unable to link device, try again',
); );
await DialogUtil.warning(context, errorMsg); await DialogUtil.warning(context, errorMsg+log);
} }
else if (isAuthenticated && isDevLinked) await DialogUtil.error(context, errorMsg).whenComplete(() async => await selectLocal(context)); else if (isAuthenticated && isDevLinked) await DialogUtil.error(context, errorMsg).whenComplete(() async => await selectLocal(context));