diff --git a/android/.tool-versions b/android/.tool-versions new file mode 100644 index 00000000..93158317 --- /dev/null +++ b/android/.tool-versions @@ -0,0 +1,2 @@ +gradle 8.7 +kotlin 1.7.10 diff --git a/assets/fonts/SFPRODISPLAYBOLD.otf b/assets/fonts/SFPRODISPLAYBOLD.otf new file mode 100644 index 00000000..025b25c2 Binary files /dev/null and b/assets/fonts/SFPRODISPLAYBOLD.otf differ diff --git a/assets/fonts/SFPRODISPLAYMEDIUM.otf b/assets/fonts/SFPRODISPLAYMEDIUM.otf new file mode 100644 index 00000000..b2f7daca Binary files /dev/null and b/assets/fonts/SFPRODISPLAYMEDIUM.otf differ diff --git a/assets/fonts/SFPRODISPLAYREGULAR.otf b/assets/fonts/SFPRODISPLAYREGULAR.otf new file mode 100644 index 00000000..09aaca9f Binary files /dev/null and b/assets/fonts/SFPRODISPLAYREGULAR.otf differ diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 50c7e216..de941755 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -62,11 +62,11 @@ NSCameraUsageDescription - In order to take a picture or video, this app requires permission to access the camera. + FRE ACCESS HUB Uses the camera for taking profile pictures. NSFaceIDUsageDescription Why is my app authenticating using face id? NSPhotoLibraryUsageDescription - In order to upload data, this app requires permission to access the photo library. + FRE ACCESS HUB Uses the library for allowing the user to pick a photo for his profile picture or for a guest. UIApplicationSupportsIndirectInputEvents BGTaskSchedulerPermittedIdentifiers diff --git a/ios/Runner/en.lproj/InfoPlist.strings b/ios/Runner/en.lproj/InfoPlist.strings index 9b1e3bbf..456788ca 100644 --- a/ios/Runner/en.lproj/InfoPlist.strings +++ b/ios/Runner/en.lproj/InfoPlist.strings @@ -1 +1,2 @@ -NSCameraUsageDescription = "dd/mm/yyyy"; +NSCameraUsageDescription = "FRE ACCESS HUB Uses the camera for taking profile pictures."; +NSPhotoLibraryUsageDescription = "FRE ACCESS HUB Uses the library for allowing the user to pick a photo for his profile picture or for a guest."; \ No newline at end of file diff --git a/ios/Runner/pt.lproj/InfoPlist.strings b/ios/Runner/pt.lproj/InfoPlist.strings index 8b137891..d819bbdf 100644 --- a/ios/Runner/pt.lproj/InfoPlist.strings +++ b/ios/Runner/pt.lproj/InfoPlist.strings @@ -1 +1,2 @@ - +NSCameraUsageDescription = "FRE ACCESS HUB Usa a câmera para tirar fotos de perfil."; +NSPhotoLibraryUsageDescription = "FRE ACCESS HUB Utiliza a biblioteca para permitir que o usuário escolha uma foto para sua foto de perfil ou para um convidado."; \ No newline at end of file diff --git a/lib/app_state.dart b/lib/app_state.dart index d6ae1b91..b01723f7 100644 --- a/lib/app_state.dart +++ b/lib/app_state.dart @@ -163,6 +163,10 @@ class AppState extends ChangeNotifier { await _safeInitAsync(() async { _haveLocal = await secureStorage.getBool('ff_have_local') ?? _haveLocal; }); + + await _safeInitAsync(() async { + _isRequestOSNotification = await secureStorage.getBool('ff_request_os_notification') ?? _isRequestOSNotification; + }); } void update(VoidCallback callback) { @@ -171,9 +175,20 @@ class AppState extends ChangeNotifier { } late FlutterSecureStorage secureStorage; + bool _isRequestOSNotification = false; + bool get isRequestOSNotification => _isRequestOSNotification; + set isRequestOSNotification(bool value) { + _isRequestOSNotification = value; + secureStorage.setBool('ff_request_os_notification', value); + } + void deleteIsRequestOSNotification() { + secureStorage.delete(key: 'ff_request_os_notification'); + } + bool _whatsapp = false; bool get whatsapp => _whatsapp; + set whatsapp(bool value) { _whatsapp = value; secureStorage.setBool('whatsapp', value); diff --git a/lib/backend/notifications/notification_service.dart b/lib/backend/notifications/notification_service.dart index 8a535379..a494b6b6 100644 --- a/lib/backend/notifications/notification_service.dart +++ b/lib/backend/notifications/notification_service.dart @@ -1,6 +1,7 @@ import 'dart:developer'; import 'package:awesome_notifications/awesome_notifications.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:hub/actions/actions.dart'; import 'package:hub/components/templates_components/access_notification_modal_template_component/access_notification_modal_template_component_widget.dart'; @@ -37,13 +38,16 @@ class NotificationService { channelGroupKey: 'basic_channel_group', channelGroupName: 'group_1') ], - debug: true); - await AwesomeNotifications() - .isNotificationAllowed() - .then((isAllowed) async { - if (!isAllowed) { - await AwesomeNotifications().requestPermissionToSendNotifications(); + debug: kDebugMode); + + await AwesomeNotifications().isNotificationAllowed().then((isAllowed) async { + if (!AppState().isRequestOSNotification) { + if (!isAllowed) { + AppState().isRequestOSNotification = true; + await AwesomeNotifications().requestPermissionToSendNotifications(); + } } + return; }); await AwesomeNotifications().setListeners( diff --git a/lib/components/atomic_components/menu_button_item/menu_button_item_widget.dart b/lib/components/atomic_components/menu_button_item/menu_button_item_widget.dart index 8cb63095..40fdc3a2 100644 --- a/lib/components/atomic_components/menu_button_item/menu_button_item_widget.dart +++ b/lib/components/atomic_components/menu_button_item/menu_button_item_widget.dart @@ -2,6 +2,9 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hub/components/molecular_components/menu_item/menu_item.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; +import 'package:hub/shared/utils/dialog_util.dart'; + +import '../../../app_state.dart'; class MenuButtonWidget extends MenuEntry { const MenuButtonWidget({ @@ -30,7 +33,11 @@ class _MenuButtonWidgetState extends State { hoverColor: Colors.transparent, highlightColor: Colors.transparent, onTap: () async { - await widget.action?.call(); + if (AppState().cliUUID.isEmpty) { + return DialogUtil.warningDefault(context); + } else { + await widget.action?.call(); + } }, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 0), diff --git a/lib/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart b/lib/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart index 29186c59..dae150a6 100644 --- a/lib/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart +++ b/lib/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart @@ -79,6 +79,15 @@ class _BottomArrowLinkedLocalsComponentWidgetState _loading = false; }); + // Verifica se há apenas um local e se o status é 'A' + if (locals.length == 1 && locals[0]['CLU_STATUS'] == 'A') { + final local = locals[0]; + AppState().cliUUID = local['CLI_ID']; + AppState().local = local['CLI_NOME']; + AppState().ownerUUID = local['CLU_OWNER_ID']; + context.pop(); + } + return response; } @@ -90,7 +99,7 @@ class _BottomArrowLinkedLocalsComponentWidgetState }); return null; - } catch (e, s) { + } catch (e) { setState(() { _hasData = false; _loading = false; diff --git a/lib/flutter_flow/internationalization.dart b/lib/flutter_flow/internationalization.dart index 88c34cc6..ac5543a0 100644 --- a/lib/flutter_flow/internationalization.dart +++ b/lib/flutter_flow/internationalization.dart @@ -282,8 +282,8 @@ final kTranslationsMap = >>[ 'en': 'Does the visit end after the first access?', }, 'lgv0q5ht': { - 'pt': 'Visita única', - 'en': 'Single visit', + 'pt': 'Entrada única', + 'en': 'Single entry', }, 'eftcs67c': { 'pt': 'Você tem alguma observação sobre esta visita?', diff --git a/lib/flutter_flow/nav/nav.dart b/lib/flutter_flow/nav/nav.dart index eabaae56..ae40af8f 100644 --- a/lib/flutter_flow/nav/nav.dart +++ b/lib/flutter_flow/nav/nav.dart @@ -81,7 +81,11 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) => GoRouter( FFRoute( name: 'homePage', path: '/homePage', - builder: (context, params) => const HomePageWidget(), + builder: (context, params) { + return HomePageWidget( + key: UniqueKey(), + ); + }, ), FFRoute( name: 'receptionPage', diff --git a/lib/flutter_flow/upload_data.dart b/lib/flutter_flow/upload_data.dart index ed5e1e7b..1e3b8b9e 100644 --- a/lib/flutter_flow/upload_data.dart +++ b/lib/flutter_flow/upload_data.dart @@ -58,8 +58,7 @@ Future?> selectMediaWithSourceBottomSheet({ bool includeDimensions = false, bool includeBlurHash = false, }) async { - createUploadMediaListTile( - String label, MediaSource mediaSource, IconData icon) => + createUploadMediaListTile(String label, MediaSource mediaSource, IconData icon) => ListTile( title: Row( mainAxisAlignment: MainAxisAlignment.center, diff --git a/lib/main.dart b/lib/main.dart index cc6223f8..2f51907a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,6 @@ import 'dart:developer'; +import 'package:app_tracking_transparency/app_tracking_transparency.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_crashlytics/firebase_crashlytics.dart'; import 'package:flutter/foundation.dart'; @@ -15,7 +16,6 @@ import 'package:hub/flutter_flow/internationalization.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:provider/provider.dart'; import 'package:responsive_framework/responsive_framework.dart'; -import 'package:app_tracking_transparency/app_tracking_transparency.dart'; final GlobalKey navigatorKey = GlobalKey(); @@ -24,6 +24,9 @@ Future initializeApp() async { final status = await AppTrackingTransparency.requestTrackingAuthorization(); + final appState = AppState(); + await appState.initializePersistedState(); + await Firebase.initializeApp(); await FirebaseMessagingService().initNotifications(); await NotificationService.initialize(); @@ -41,8 +44,6 @@ Future initializeApp() async { await FlutterFlowTheme.initialize(); await FFLocalizations.initialize(); - final appState = AppState(); - await appState.initializePersistedState(); GoRouter.optionURLReflectsImperativeAPIs = true; usePathUrlStrategy(); } diff --git a/lib/pages/home_page/home_page_widget.dart b/lib/pages/home_page/home_page_widget.dart index 4ca38299..f9ec154b 100644 --- a/lib/pages/home_page/home_page_widget.dart +++ b/lib/pages/home_page/home_page_widget.dart @@ -1,5 +1,4 @@ import 'dart:async'; -import 'dart:developer'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; @@ -16,10 +15,9 @@ import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/pages/home_page/home_page_model.dart'; import 'package:hub/shared/utils/dialog_util.dart'; import 'package:hub/shared/widgets/drawer_widget/drawer_widget.dart'; -import 'package:rxdart/rxdart.dart'; class HomePageWidget extends StatefulWidget { - const HomePageWidget({Key? key}); + const HomePageWidget({Key? key}) : super(key: key); @override State createState() => _HomePageWidgetState(); @@ -31,7 +29,8 @@ class _HomePageWidgetState extends State { late LocalProfileComponentWidget _localProfileComponentWidget; _HomePageWidgetState() { - _localProfileComponentWidget = LocalProfileComponentWidget(showBottomSheet: showModalSelectLocal); + _localProfileComponentWidget = + LocalProfileComponentWidget(showBottomSheet: showModalSelectLocal); } Future processData() async { @@ -57,7 +56,7 @@ class _HomePageWidgetState extends State { DialogUtil.warningDefault(context).whenComplete(() => processLocals()); safeSetState(() {}); return; - } catch(e, s) { + } catch (e, s) { DialogUtil.warningDefault(context).whenComplete(() => processLocals()); } } @@ -71,7 +70,8 @@ class _HomePageWidgetState extends State { List locals = response.jsonBody['locais'] ?? []; - final activeLocals = locals.where((local) => local['CLU_STATUS'] == 'A').toList(); + final activeLocals = + locals.where((local) => local['CLU_STATUS'] == 'A').toList(); if (activeLocals.isEmpty || AppState().cliUUID.isEmpty) { await showModalSelectLocal(); @@ -96,8 +96,9 @@ class _HomePageWidgetState extends State { ), ).then((_) async { _model.updatePage(() => safeSetState(() { - _localProfileComponentWidget = LocalProfileComponentWidget(showBottomSheet: showModalSelectLocal); - })); + _localProfileComponentWidget = LocalProfileComponentWidget( + showBottomSheet: showModalSelectLocal); + })); await processData(); }); diff --git a/lib/pages/preferences_settings_page/preferences_settings_model.dart b/lib/pages/preferences_settings_page/preferences_settings_model.dart index 0b8c6a57..795d5417 100644 --- a/lib/pages/preferences_settings_page/preferences_settings_model.dart +++ b/lib/pages/preferences_settings_page/preferences_settings_model.dart @@ -316,6 +316,7 @@ class PreferencesPageModel with ChangeNotifier { AppState().deleteOwnerUUID(); context.pop(); + context.go( '/homePage', extra: { @@ -326,16 +327,6 @@ class PreferencesPageModel with ChangeNotifier { ), }, ); - context.replace( - '/homePage', - extra: { - kTransitionInfoKey: const TransitionInfo( - hasTransition: true, - transitionType: PageTransitionType.scale, - alignment: Alignment.bottomCenter, - ), - }, - ); ScaffoldMessenger.of(context).showSnackBar( SnackBar( diff --git a/pubspec.yaml b/pubspec.yaml index e5d8b014..148e4c8b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: A new Flutter project. publish_to: "none" -version: 1.0.0+6 +version: 1.0.0+9 environment: sdk: ">=3.0.0 <4.0.0"