diff --git a/packages/app/integration_test/screenshot_test.dart b/packages/app/integration_test/screenshot_test.dart index 7ad759e4..5c093a2a 100644 --- a/packages/app/integration_test/screenshot_test.dart +++ b/packages/app/integration_test/screenshot_test.dart @@ -20,7 +20,7 @@ Future runTestApp( final Account? account, }) async { await runNeon( - getAppImplementations: getAppImplementations, + appImplementations: appImplementations, theme: neonTheme, bindingOverride: binding, account: account, diff --git a/packages/app/lib/apps.dart b/packages/app/lib/apps.dart index b93b4baa..7fe30719 100644 --- a/packages/app/lib/apps.dart +++ b/packages/app/lib/apps.dart @@ -3,14 +3,10 @@ import 'package:neon_files/neon_files.dart'; import 'package:neon_news/neon_news.dart'; import 'package:neon_notes/neon_notes.dart'; import 'package:neon_notifications/neon_notifications.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -List getAppImplementations( - final SharedPreferences sharedPreferences, -) => - [ - FilesApp(sharedPreferences), - NewsApp(sharedPreferences), - NotesApp(sharedPreferences), - NotificationsApp(sharedPreferences), - ]; +final List appImplementations = [ + FilesApp(), + NewsApp(), + NotesApp(), + NotificationsApp(), +]; diff --git a/packages/app/lib/main.dart b/packages/app/lib/main.dart index fcfdac75..62c13ad3 100644 --- a/packages/app/lib/main.dart +++ b/packages/app/lib/main.dart @@ -4,7 +4,7 @@ import 'package:neon/neon.dart'; Future main() async { await runNeon( - getAppImplementations: getAppImplementations, + appImplementations: appImplementations, theme: neonTheme, ); } diff --git a/packages/app/pubspec.lock b/packages/app/pubspec.lock index c06c2b75..e2a64504 100644 --- a/packages/app/pubspec.lock +++ b/packages/app/pubspec.lock @@ -349,10 +349,10 @@ packages: dependency: transitive description: name: flutter_local_notifications - sha256: "3cc40fe8c50ab8383f3e053a499f00f975636622ecdc8e20a77418ece3b1e975" + sha256: "3002092e5b8ce2f86c3361422e52e6db6776c23ee21e0b2f71b892bf4259ef04" url: "https://pub.dev" source: hosted - version: "15.1.0+1" + version: "15.1.1" flutter_local_notifications_linux: dependency: transitive description: @@ -383,7 +383,7 @@ packages: source: hosted version: "0.6.17+1" flutter_native_splash: - dependency: "direct main" + dependency: transitive description: name: flutter_native_splash sha256: ecff62b3b893f2f665de7e4ad3de89f738941fcfcaaba8ee601e749efafa4698 @@ -1044,7 +1044,7 @@ packages: source: hosted version: "3.3.0" shared_preferences: - dependency: "direct main" + dependency: "direct dev" description: name: shared_preferences sha256: "0344316c947ffeb3a529eac929e1978fcd37c26be4e8468628bac399365a3ca1" @@ -1443,10 +1443,10 @@ packages: dependency: transitive description: name: webview_flutter - sha256: "789d52bd789373cc1e100fb634af2127e86c99cf9abde09499743270c5de8d00" + sha256: "04a0782fb058b7c71f2048935583488f4d32e9147ca403abc4e58f1de9964629" url: "https://pub.dev" source: hosted - version: "4.2.2" + version: "4.2.3" webview_flutter_android: dependency: transitive description: diff --git a/packages/app/pubspec.yaml b/packages/app/pubspec.yaml index fd67684a..9e744172 100644 --- a/packages/app/pubspec.yaml +++ b/packages/app/pubspec.yaml @@ -9,7 +9,6 @@ environment: dependencies: flutter: sdk: flutter - flutter_native_splash: ^2.3.2 flutter_svg: ^2.0.7 neon: git: @@ -31,7 +30,6 @@ dependencies: git: url: https://github.com/nextcloud/neon path: packages/neon/neon_notifications - shared_preferences: ^2.2.0 dev_dependencies: flutter_test: @@ -43,6 +41,7 @@ dev_dependencies: git: url: https://github.com/nextcloud/neon path: packages/neon_lints + shared_preferences: ^2.2.0 flutter: uses-material-design: true diff --git a/packages/neon/neon/lib/neon.dart b/packages/neon/neon/lib/neon.dart index 93cb201f..8b23e1b6 100644 --- a/packages/neon/neon/lib/neon.dart +++ b/packages/neon/neon/lib/neon.dart @@ -17,10 +17,9 @@ import 'package:neon/src/utils/request_manager.dart'; import 'package:neon/src/utils/user_agent.dart'; import 'package:package_info_plus/package_info_plus.dart'; import 'package:provider/provider.dart'; -import 'package:shared_preferences/shared_preferences.dart'; Future runNeon({ - required final Iterable Function(SharedPreferences) getAppImplementations, + required final Iterable appImplementations, required final NeonTheme theme, @visibleForTesting final WidgetsBinding? bindingOverride, @visibleForTesting final Account? account, @@ -30,14 +29,10 @@ Future runNeon({ final binding = bindingOverride ?? WidgetsFlutterBinding.ensureInitialized(); FlutterNativeSplash.preserve(widgetsBinding: binding); - final sharedPreferences = await SharedPreferences.getInstance(); - await NeonPlatform.setup(); await RequestManager.instance.initCache(); await AppStorage.init(); - final allAppImplementations = getAppImplementations(sharedPreferences); - final packageInfo = await PackageInfo.fromPlatform(); buildUserAgent(packageInfo); @@ -47,7 +42,7 @@ Future runNeon({ final accountsBloc = AccountsBloc( globalOptions, - allAppImplementations, + appImplementations, ); if (account != null) { accountsBloc @@ -86,7 +81,7 @@ Future runNeon({ create: (final _) => nextPushBloc, ), Provider>( - create: (final _) => allAppImplementations, + create: (final _) => appImplementations, ), Provider( create: (final _) => packageInfo, diff --git a/packages/neon/neon/lib/src/models/app_implementation.dart b/packages/neon/neon/lib/src/models/app_implementation.dart index 0e0ee87e..0b5bcafd 100644 --- a/packages/neon/neon/lib/src/models/app_implementation.dart +++ b/packages/neon/neon/lib/src/models/app_implementation.dart @@ -11,12 +11,9 @@ import 'package:neon/src/settings/models/storage.dart'; import 'package:neon/src/widgets/drawer_destination.dart'; import 'package:provider/provider.dart'; import 'package:rxdart/rxdart.dart'; -import 'package:shared_preferences/shared_preferences.dart'; abstract class AppImplementation { - AppImplementation( - final SharedPreferences sharedPreferences, - ) { + AppImplementation() { final storage = AppStorage('app-$id'); options = buildOptions(storage); } diff --git a/packages/neon/neon/lib/src/models/notifications_interface.dart b/packages/neon/neon/lib/src/models/notifications_interface.dart index bf2fcdb1..b67b3cee 100644 --- a/packages/neon/neon/lib/src/models/notifications_interface.dart +++ b/packages/neon/neon/lib/src/models/notifications_interface.dart @@ -4,7 +4,7 @@ import 'package:neon/src/settings/models/nextcloud_app_options.dart'; abstract interface class NotificationsAppInterface extends AppImplementation { - NotificationsAppInterface(super.sharedPreferences); + NotificationsAppInterface(); } abstract interface class NotificationsBlocInterface extends InteractiveBloc { diff --git a/packages/neon/neon_files/lib/neon_files.dart b/packages/neon/neon_files/lib/neon_files.dart index ea3f00e0..b7c48b13 100644 --- a/packages/neon/neon_files/lib/neon_files.dart +++ b/packages/neon/neon_files/lib/neon_files.dart @@ -44,7 +44,7 @@ part 'widgets/browser_view.dart'; part 'widgets/file_preview.dart'; class FilesApp extends AppImplementation { - FilesApp(super.sharedPreferences); + FilesApp(); @override String id = AppIDs.files; diff --git a/packages/neon/neon_news/lib/neon_news.dart b/packages/neon/neon_news/lib/neon_news.dart index 47b3bf13..acb4ad08 100644 --- a/packages/neon/neon_news/lib/neon_news.dart +++ b/packages/neon/neon_news/lib/neon_news.dart @@ -52,7 +52,7 @@ part 'widgets/folder_view.dart'; part 'widgets/folders_view.dart'; class NewsApp extends AppImplementation { - NewsApp(super.sharedPreferences); + NewsApp(); @override String id = AppIDs.news; diff --git a/packages/neon/neon_notes/lib/neon_notes.dart b/packages/neon/neon_notes/lib/neon_notes.dart index 7f511280..af8fbb94 100644 --- a/packages/neon/neon_notes/lib/neon_notes.dart +++ b/packages/neon/neon_notes/lib/neon_notes.dart @@ -42,7 +42,7 @@ part 'widgets/notes_floating_action_button.dart'; part 'widgets/notes_view.dart'; class NotesApp extends AppImplementation { - NotesApp(super.sharedPreferences); + NotesApp(); @override String id = AppIDs.notes; diff --git a/packages/neon/neon_notifications/lib/neon_notifications.dart b/packages/neon/neon_notifications/lib/neon_notifications.dart index 20e9aee6..902dd7b4 100644 --- a/packages/neon/neon_notifications/lib/neon_notifications.dart +++ b/packages/neon/neon_notifications/lib/neon_notifications.dart @@ -22,7 +22,7 @@ part 'pages/main.dart'; class NotificationsApp extends AppImplementation implements NotificationsAppInterface { - NotificationsApp(super.sharedPreferences); + NotificationsApp(); @override String id = AppIDs.notifications;