Merge branch 'feature/remote-management' into legacy
# Conflicts: # apps/mobile_app/lib/save_family_app.dart # packages/sf_localizations/assets/l10n/de.json # packages/sf_localizations/assets/l10n/en.json # packages/sf_localizations/assets/l10n/es.json # packages/sf_localizations/assets/l10n/fr.json # packages/sf_localizations/assets/l10n/it.json # packages/sf_localizations/assets/l10n/pt.json # packages/sf_localizations/lib/src/generated/i18n.dart
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
|
||||
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
||||
|
||||
<application
|
||||
android:label="@string/app_name"
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,3 +1,6 @@
|
||||
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
|
||||
# permission_handler: enable contacts permission
|
||||
PERMISSION_CONTACTS=1
|
||||
|
||||
@@ -47,6 +47,8 @@
|
||||
<true/>
|
||||
<key>UIStatusBarHidden</key>
|
||||
<true/>
|
||||
<key>NSContactsUsageDescription</key>
|
||||
<string>Necesitamos acceso a tus contactos para seleccionar números de teléfono.</string>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>Necesitamos la cámara para escanear códigos QR</string>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
|
||||
@@ -16,6 +16,7 @@ import 'package:navigation/navigation.dart';
|
||||
import 'package:notifications/notifications.dart';
|
||||
import 'package:payments/payments.dart';
|
||||
import 'package:profile/profile.dart';
|
||||
import 'package:settings/settings.dart';
|
||||
import 'package:splash/splash.dart';
|
||||
|
||||
final GlobalKey<NavigatorState> rootNavigatorKey = GlobalKey<NavigatorState>();
|
||||
@@ -93,10 +94,27 @@ void configureAppRouter() {
|
||||
name: 'device_management',
|
||||
pageBuilder: DeviceManagementBuilder().buildPage,
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: 'scheduled_activities',
|
||||
name: 'scheduled_activities',
|
||||
pageBuilder: const ScheduledActivitiesBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'contacts',
|
||||
name: 'contacts',
|
||||
pageBuilder: ContactsBuilder().buildPage,
|
||||
pageBuilder: const ContactsBuilder().buildPage,
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: 'edit/:contactId',
|
||||
name: 'edit_contact',
|
||||
pageBuilder: const EditContactBuilder().buildPage,
|
||||
),
|
||||
],
|
||||
),
|
||||
GoRoute(
|
||||
path: 'health',
|
||||
name: 'health',
|
||||
pageBuilder: const HealthBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'remote_connection',
|
||||
@@ -113,6 +131,16 @@ void configureAppRouter() {
|
||||
name: 'rewards',
|
||||
pageBuilder: RewardsBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'activity_meter',
|
||||
name: 'activity_meter',
|
||||
pageBuilder: const ActivityMeterBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'apps_use',
|
||||
name: 'apps_use',
|
||||
pageBuilder: const AppsUseBuilder().buildPage,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -141,8 +169,95 @@ void configureAppRouter() {
|
||||
),
|
||||
],
|
||||
),
|
||||
StatefulShellBranch(
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: AppRoutes.settings,
|
||||
name: 'settings',
|
||||
pageBuilder: SettingsBuilder().buildPage,
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: 'alarm',
|
||||
name: 'alarm',
|
||||
pageBuilder: AlarmBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'remote_management',
|
||||
name: 'remote_management',
|
||||
pageBuilder: RemoteManagementBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'sos_agenda',
|
||||
name: 'sos_agenda',
|
||||
pageBuilder: SosContactsBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'sound',
|
||||
name: 'sound',
|
||||
pageBuilder: SoundBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'sync_clock',
|
||||
name: 'sync_clock',
|
||||
pageBuilder: SyncClockBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'app_store',
|
||||
name: 'app_store',
|
||||
pageBuilder: AppStoreBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'battery',
|
||||
name: 'battery',
|
||||
pageBuilder: BatteryBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'block_phone',
|
||||
name: 'block_phone',
|
||||
pageBuilder: BlockPhoneBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'disable_functions',
|
||||
name: 'disable_functions',
|
||||
pageBuilder: DisableFunctionsBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'language',
|
||||
name: 'language',
|
||||
pageBuilder: LanguageBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'legacy_notifications',
|
||||
name: 'legacy_notifications',
|
||||
pageBuilder: LegacyNotificationsBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'remote_on_off',
|
||||
name: 'remote_on_off',
|
||||
pageBuilder: RemoteOnOffBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'sms_alert',
|
||||
name: 'sms_alert',
|
||||
pageBuilder: SmsAlertBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'timezone',
|
||||
name: 'timezone',
|
||||
pageBuilder: TimezoneBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'wifi_settings',
|
||||
name: 'wifi_settings',
|
||||
pageBuilder: WifiSettingsBuilder().buildPage,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
GoRoute(
|
||||
path: AppRoutes.login,
|
||||
name: 'login',
|
||||
|
||||
42
apps/mobile_app/lib/providers/legacy_heartbeat_service.dart
Normal file
42
apps/mobile_app/lib/providers/legacy_heartbeat_service.dart
Normal file
@@ -0,0 +1,42 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:sf_infrastructure/sf_infrastructure.dart';
|
||||
|
||||
class LegacyHeartbeatService {
|
||||
LegacyHeartbeatService({
|
||||
required QuestiaRepository repository,
|
||||
required void Function() onUnauthorized,
|
||||
}) : _repository = repository,
|
||||
_onUnauthorized = onUnauthorized;
|
||||
|
||||
final QuestiaRepository _repository;
|
||||
final void Function() _onUnauthorized;
|
||||
Timer? _timer;
|
||||
|
||||
static const _interval = Duration(minutes: 3);
|
||||
|
||||
void start() {
|
||||
if (_timer != null) return;
|
||||
_beat();
|
||||
_timer = Timer.periodic(_interval, (_) => _beat());
|
||||
debugPrint('[LegacyHeartbeat] started');
|
||||
}
|
||||
|
||||
void stop() {
|
||||
_timer?.cancel();
|
||||
_timer = null;
|
||||
debugPrint('[LegacyHeartbeat] stopped');
|
||||
}
|
||||
|
||||
Future<void> _beat() async {
|
||||
try {
|
||||
await _repository.get<dynamic>('/auth/me');
|
||||
debugPrint('[LegacyHeartbeat] /auth/me => OK');
|
||||
} catch (e) {
|
||||
debugPrint('[LegacyHeartbeat] error: $e');
|
||||
stop();
|
||||
_onUnauthorized();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,9 @@ import 'package:sf_app_platform/navigation/app_router.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
import 'package:sf_app_platform/providers/app_state_provider.dart';
|
||||
import 'package:sf_app_platform/providers/permissions/permissions_provider.dart';
|
||||
import 'package:sf_app_platform/providers/legacy_heartbeat_service.dart';
|
||||
import 'package:sf_app_platform/providers/wallet_heartbeat_service.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:sf_infrastructure/sf_infrastructure.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
@@ -23,6 +25,7 @@ class SaveFamilyApp extends ConsumerStatefulWidget {
|
||||
class SaveFamilyAppState extends ConsumerState<SaveFamilyApp>
|
||||
with WidgetsBindingObserver {
|
||||
late final WalletHeartbeatService walletHeartbeat;
|
||||
late final LegacyHeartbeatService legacyHeartbeat;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -33,13 +36,25 @@ class SaveFamilyAppState extends ConsumerState<SaveFamilyApp>
|
||||
sessionLocal: SessionLocalDatasourceImpl(),
|
||||
onError: () => appRouter.go(AppRoutes.scaTreezor),
|
||||
);
|
||||
onBeforeSessionCleared = walletHeartbeat.stop;
|
||||
walletHeartbeat.start();
|
||||
legacyHeartbeat = LegacyHeartbeatService(
|
||||
repository: GetIt.I<QuestiaRepository>(),
|
||||
onUnauthorized: () {
|
||||
clearSessionData();
|
||||
appRouter.go(AppRoutes.legacyLogin);
|
||||
},
|
||||
);
|
||||
onBeforeSessionCleared = () {
|
||||
walletHeartbeat.stop();
|
||||
legacyHeartbeat.stop();
|
||||
};
|
||||
// walletHeartbeat.start();
|
||||
legacyHeartbeat.start();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
walletHeartbeat.stop();
|
||||
legacyHeartbeat.stop();
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
super.dispose();
|
||||
}
|
||||
@@ -49,10 +64,12 @@ class SaveFamilyAppState extends ConsumerState<SaveFamilyApp>
|
||||
debugPrint('State: $state');
|
||||
ref.read(appLifecycleStateProvider.notifier).setState(state);
|
||||
if (state == AppLifecycleState.resumed) {
|
||||
walletHeartbeat.start();
|
||||
// walletHeartbeat.start();
|
||||
legacyHeartbeat.start();
|
||||
ref.read(permissionsProvider.notifier).checkPermissions();
|
||||
} else if (state == AppLifecycleState.paused) {
|
||||
walletHeartbeat.stop();
|
||||
// walletHeartbeat.stop();
|
||||
legacyHeartbeat.stop();
|
||||
}
|
||||
super.didChangeAppLifecycleState(state);
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/
|
||||
C:/Users/Aitor Arana/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_linux-2.2.1/
|
||||
@@ -1 +1 @@
|
||||
/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.4.1/
|
||||
C:/Users/Aitor Arana/AppData/Local/Pub/Cache/hosted/pub.dev/shared_preferences_linux-2.4.1/
|
||||
@@ -1 +1 @@
|
||||
/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/url_launcher_linux-3.2.2/
|
||||
C:/Users/Aitor Arana/AppData/Local/Pub/Cache/hosted/pub.dev/url_launcher_linux-3.2.2/
|
||||
@@ -406,6 +406,14 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_contacts:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_contacts
|
||||
sha256: "388d32cd33f16640ee169570128c933b45f3259bddbfae7a100bb49e5ffea9ae"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.9+2"
|
||||
flutter_launcher_icons:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
@@ -1081,6 +1089,13 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.5.0"
|
||||
settings:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "../../modules/legacy/modules/settings"
|
||||
relative: true
|
||||
source: path
|
||||
version: "1.0.0+1"
|
||||
sf_infrastructure:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
||||
@@ -65,6 +65,8 @@ dependencies:
|
||||
path: ../../modules/legacy/modules/location
|
||||
legacy_auth:
|
||||
path: ../../modules/legacy/modules/legacy_auth
|
||||
settings:
|
||||
path: ../../modules/legacy/modules/settings
|
||||
#packages dependencies go here
|
||||
navigation:
|
||||
path: ../../packages/navigation
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# melos_managed_dependency_overrides: account,activity,auth,customer_service,dashboard_shell,design_system,flutter_treezor_entrust_sdk_bridge,fonts,home,legacy_dashboard_shell,legacy_shared,navigation,notifications,payments,profile,sca_treezor,sf_infrastructure,sf_localizations,sf_shared,splash,utils,control_panel,device_management,legacy_auth,location
|
||||
# melos_managed_dependency_overrides: settings
|
||||
# melos_managed_dependency_overrides: account,activity,auth,customer_service,dashboard_shell,design_system,flutter_treezor_entrust_sdk_bridge,fonts,home,legacy_dashboard_shell,legacy_shared,navigation,notifications,payments,profile,sca_treezor,sf_infrastructure,sf_localizations,sf_shared,splash,utils,control_panel,device_management
|
||||
dependency_overrides:
|
||||
account:
|
||||
path: ../../modules/legacy/modules/account
|
||||
@@ -40,6 +42,8 @@ dependency_overrides:
|
||||
path: ../../modules/profile
|
||||
sca_treezor:
|
||||
path: ../../packages/sca_treezor
|
||||
settings:
|
||||
path: ../../modules/legacy/modules/settings
|
||||
sf_infrastructure:
|
||||
path: ../../packages/sf_infrastructure
|
||||
sf_localizations:
|
||||
|
||||
Reference in New Issue
Block a user