A framework for building convergent cross-platform Nextcloud clients using Flutter.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.5 KiB

2 years ago
import 'package:flutter/material.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:neon/src/neon.dart';
import 'package:package_info_plus/package_info_plus.dart';
2 years ago
import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
FlutterNativeSplash.preserve(widgetsBinding: WidgetsBinding.instance);
final sharedPreferences = await SharedPreferences.getInstance();
final platform = await getNeonPlatform();
final cache = Cache(platform);
await cache.init();
final requestManager = RequestManager(cache);
final allAppImplementations = getAppImplementations(sharedPreferences, requestManager, platform);
2 years ago
final packageInfo = await PackageInfo.fromPlatform();
2 years ago
final globalOptions = GlobalOptions(
AppStorage('global', sharedPreferences),
packageInfo,
2 years ago
);
final accountsBloc = AccountsBloc(
requestManager,
platform,
AppStorage('accounts', sharedPreferences),
2 years ago
sharedPreferences,
globalOptions,
allAppImplementations,
2 years ago
);
final pushNotificationsBloc = PushNotificationsBloc(
accountsBloc,
sharedPreferences,
globalOptions,
platform,
);
final firstLaunchBloc = FirstLaunchBloc(sharedPreferences);
final nextPushBloc = NextPushBloc(accountsBloc, globalOptions);
2 years ago
runApp(
MultiProvider(
providers: [
Provider<SharedPreferences>(
create: (final _) => sharedPreferences,
),
Provider<NeonPlatform>(
2 years ago
create: (final _) => platform,
),
Provider<GlobalOptions>(
create: (final _) => globalOptions,
),
Provider<RequestManager>(
create: (final _) => requestManager,
),
Provider<AccountsBloc>(
create: (final _) => accountsBloc,
),
Provider<PushNotificationsBloc>(
create: (final _) => pushNotificationsBloc,
),
Provider<FirstLaunchBloc>(
create: (final _) => firstLaunchBloc,
),
Provider<NextPushBloc>(
create: (final _) => nextPushBloc,
),
2 years ago
Provider<List<AppImplementation>>(
create: (final _) => allAppImplementations,
),
Provider<PackageInfo>(
create: (final _) => packageInfo,
),
2 years ago
],
child: NeonApp(
accountsBloc: accountsBloc,
sharedPreferences: sharedPreferences,
platform: platform,
globalOptions: globalOptions,
),
2 years ago
),
);
}