Browse Source

neon, app: don't require widget WidgetsBinding

pull/374/head
Nikolas Rimikis 1 year ago
parent
commit
dc648d85c0
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 2
      packages/app/integration_test/screenshot_test.dart
  2. 2
      packages/app/lib/main.dart
  3. 3
      packages/neon/neon/lib/neon.dart

2
packages/app/integration_test/screenshot_test.dart

@ -93,9 +93,9 @@ Future runTestApp(
final Account? account, final Account? account,
}) async { }) async {
await runNeon( await runNeon(
binding: binding,
getAppImplementations: getAppImplementations, getAppImplementations: getAppImplementations,
branding: getNeonBranding(), branding: getNeonBranding(),
bindingOverride: binding,
sharedPreferencesOverride: MemorySharedPreferences(), sharedPreferencesOverride: MemorySharedPreferences(),
account: account, account: account,
firstLaunchDisabled: true, firstLaunchDisabled: true,

2
packages/app/lib/main.dart

@ -1,11 +1,9 @@
import 'package:app/apps.dart'; import 'package:app/apps.dart';
import 'package:app/branding.dart'; import 'package:app/branding.dart';
import 'package:flutter/material.dart';
import 'package:neon/neon.dart'; import 'package:neon/neon.dart';
Future main() async { Future main() async {
await runNeon( await runNeon(
binding: WidgetsFlutterBinding.ensureInitialized(),
getAppImplementations: getAppImplementations, getAppImplementations: getAppImplementations,
branding: getNeonBranding(), branding: getNeonBranding(),
); );

3
packages/neon/neon/lib/neon.dart

@ -102,15 +102,16 @@ part 'src/widgets/text_settings_tile.dart';
part 'src/widgets/user_avatar.dart'; part 'src/widgets/user_avatar.dart';
Future runNeon({ Future runNeon({
required final WidgetsBinding binding,
required final Iterable<AppImplementation> Function(SharedPreferences, RequestManager, NeonPlatform) required final Iterable<AppImplementation> Function(SharedPreferences, RequestManager, NeonPlatform)
getAppImplementations, getAppImplementations,
required final Branding branding, required final Branding branding,
final WidgetsBinding? bindingOverride,
final SharedPreferences? sharedPreferencesOverride, final SharedPreferences? sharedPreferencesOverride,
final Account? account, final Account? account,
final bool firstLaunchDisabled = false, final bool firstLaunchDisabled = false,
final bool nextPushDisabled = false, final bool nextPushDisabled = false,
}) async { }) async {
final binding = bindingOverride ?? WidgetsFlutterBinding.ensureInitialized();
FlutterNativeSplash.preserve(widgetsBinding: binding); FlutterNativeSplash.preserve(widgetsBinding: binding);
final sharedPreferences = sharedPreferencesOverride ?? await SharedPreferences.getInstance(); final sharedPreferences = sharedPreferencesOverride ?? await SharedPreferences.getInstance();

Loading…
Cancel
Save