From dc648d85c087ef65fb4f6afeefe8435ad87c1ce0 Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Tue, 13 Jun 2023 11:37:34 +0200 Subject: [PATCH] neon, app: don't require widget WidgetsBinding --- packages/app/integration_test/screenshot_test.dart | 2 +- packages/app/lib/main.dart | 2 -- packages/neon/neon/lib/neon.dart | 3 ++- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/app/integration_test/screenshot_test.dart b/packages/app/integration_test/screenshot_test.dart index ae18b993..064af93d 100644 --- a/packages/app/integration_test/screenshot_test.dart +++ b/packages/app/integration_test/screenshot_test.dart @@ -93,9 +93,9 @@ Future runTestApp( final Account? account, }) async { await runNeon( - binding: binding, getAppImplementations: getAppImplementations, branding: getNeonBranding(), + bindingOverride: binding, sharedPreferencesOverride: MemorySharedPreferences(), account: account, firstLaunchDisabled: true, diff --git a/packages/app/lib/main.dart b/packages/app/lib/main.dart index 6d3a21d3..2a2e91b7 100644 --- a/packages/app/lib/main.dart +++ b/packages/app/lib/main.dart @@ -1,11 +1,9 @@ import 'package:app/apps.dart'; import 'package:app/branding.dart'; -import 'package:flutter/material.dart'; import 'package:neon/neon.dart'; Future main() async { await runNeon( - binding: WidgetsFlutterBinding.ensureInitialized(), getAppImplementations: getAppImplementations, branding: getNeonBranding(), ); diff --git a/packages/neon/neon/lib/neon.dart b/packages/neon/neon/lib/neon.dart index 3ecbe8d2..6542e5b0 100644 --- a/packages/neon/neon/lib/neon.dart +++ b/packages/neon/neon/lib/neon.dart @@ -102,15 +102,16 @@ part 'src/widgets/text_settings_tile.dart'; part 'src/widgets/user_avatar.dart'; Future runNeon({ - required final WidgetsBinding binding, required final Iterable Function(SharedPreferences, RequestManager, NeonPlatform) getAppImplementations, required final Branding branding, + final WidgetsBinding? bindingOverride, final SharedPreferences? sharedPreferencesOverride, final Account? account, final bool firstLaunchDisabled = false, final bool nextPushDisabled = false, }) async { + final binding = bindingOverride ?? WidgetsFlutterBinding.ensureInitialized(); FlutterNativeSplash.preserve(widgetsBinding: binding); final sharedPreferences = sharedPreferencesOverride ?? await SharedPreferences.getInstance();