Merge branch 'main' into pets/fd-740

This commit is contained in:
J. A. Messias 2024-09-12 10:00:29 -03:00
commit f10f9c1f02
18 changed files with 74 additions and 39 deletions

2
android/.tool-versions Normal file
View File

@ -0,0 +1,2 @@
gradle 8.7
kotlin 1.7.10

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -62,11 +62,11 @@
</dict>
</dict>
<key>NSCameraUsageDescription</key>
<string>In order to take a picture or video, this app requires permission to access the camera.</string>
<string>FRE ACCESS HUB Uses the camera for taking profile pictures.</string>
<key>NSFaceIDUsageDescription</key>
<string>Why is my app authenticating using face id?</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>In order to upload data, this app requires permission to access the photo library.</string>
<string>FRE ACCESS HUB Uses the library for allowing the user to pick a photo for his profile picture or for a guest.</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>BGTaskSchedulerPermittedIdentifiers</key>

View File

@ -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.";

View File

@ -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.";

View File

@ -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);

View File

@ -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(

View File

@ -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<MenuButtonWidget> {
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),

View File

@ -79,6 +79,15 @@ class _BottomArrowLinkedLocalsComponentWidgetState
_loading = false;
});
// Verifica se 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;

View File

@ -282,8 +282,8 @@ final kTranslationsMap = <Map<String, Map<String, String>>>[
'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?',

View File

@ -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',

View File

@ -58,8 +58,7 @@ Future<List<SelectedFile>?> 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,

View File

@ -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<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
@ -24,6 +24,9 @@ Future<void> 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<void> initializeApp() async {
await FlutterFlowTheme.initialize();
await FFLocalizations.initialize();
final appState = AppState();
await appState.initializePersistedState();
GoRouter.optionURLReflectsImperativeAPIs = true;
usePathUrlStrategy();
}

View File

@ -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<HomePageWidget> createState() => _HomePageWidgetState();
@ -31,7 +29,8 @@ class _HomePageWidgetState extends State<HomePageWidget> {
late LocalProfileComponentWidget _localProfileComponentWidget;
_HomePageWidgetState() {
_localProfileComponentWidget = LocalProfileComponentWidget(showBottomSheet: showModalSelectLocal);
_localProfileComponentWidget =
LocalProfileComponentWidget(showBottomSheet: showModalSelectLocal);
}
Future<void> processData() async {
@ -57,7 +56,7 @@ class _HomePageWidgetState extends State<HomePageWidget> {
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<HomePageWidget> {
List<dynamic> 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<HomePageWidget> {
),
).then((_) async {
_model.updatePage(() => safeSetState(() {
_localProfileComponentWidget = LocalProfileComponentWidget(showBottomSheet: showModalSelectLocal);
}));
_localProfileComponentWidget = LocalProfileComponentWidget(
showBottomSheet: showModalSelectLocal);
}));
await processData();
});

View File

@ -316,6 +316,7 @@ class PreferencesPageModel with ChangeNotifier {
AppState().deleteOwnerUUID();
context.pop();
context.go(
'/homePage',
extra: <String, dynamic>{
@ -326,16 +327,6 @@ class PreferencesPageModel with ChangeNotifier {
),
},
);
context.replace(
'/homePage',
extra: <String, dynamic>{
kTransitionInfoKey: const TransitionInfo(
hasTransition: true,
transitionType: PageTransitionType.scale,
alignment: Alignment.bottomCenter,
),
},
);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(

View File

@ -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"