-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathutils.dart
51 lines (43 loc) · 1.97 KB
/
utils.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:localmaterialnotes/app.dart';
import 'package:localmaterialnotes/common/constants/constants.dart';
import 'package:localmaterialnotes/common/preferences/preferences_utils.dart';
import 'package:localmaterialnotes/common/system/flag_secure_utils.dart';
import 'package:localmaterialnotes/common/system/info_utils.dart';
import 'package:localmaterialnotes/common/ui/theme_utils.dart';
import 'package:localmaterialnotes/navigation/navigation_routes.dart';
import 'package:localmaterialnotes/pages/bin/bin_page.dart';
import 'package:localmaterialnotes/pages/settings/settings_main_page.dart';
import 'package:localmaterialnotes/services/backup/auto_backup_service.dart';
import 'package:localmaterialnotes/services/labels/labels_service.dart';
import 'package:localmaterialnotes/services/notes/notes_service.dart';
import 'package:patrol/patrol.dart';
import 'package:shared_preferences/shared_preferences.dart';
Future<Widget> get app async {
// Mock the preferences
SharedPreferences.setMockInitialValues({});
// Initialize the utilities
await PreferencesUtils().ensureInitialized();
await InfoUtils().ensureInitialized();
await ThemeUtils().ensureInitialized();
// Initialize the services
await NotesService().ensureInitialized();
await LabelsService().ensureInitialized();
// No need to await this, it can be performed in the background
AutoExportUtils().ensureInitialized();
// Set FLAG_SECURE if needed
await setFlagSecureIfNeeded();
return ProviderScope(
child: App(),
);
}
Future<void> openBin(PatrolIntegrationTester $) async {
NavigationRoute.bin.push(rootNavigatorKey.currentContext!, BinPage());
await $.pumpAndSettle();
}
Future<void> openSettingsMain(PatrolIntegrationTester $) async {
NavigationRoute.settings.push(rootNavigatorKey.currentContext!, SettingsMainPage());
await $.pumpAndSettle();
}