2023-02-14 01:46:25 +00:00
|
|
|
import 'package:appflowy_backend/log.dart';
|
2021-12-07 17:28:50 +00:00
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
2023-02-14 01:46:25 +00:00
|
|
|
import 'package:flutter/foundation.dart';
|
2021-06-19 15:41:19 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2022-12-20 03:14:42 +00:00
|
|
|
import 'package:hotkey_manager/hotkey_manager.dart';
|
|
|
|
|
|
|
|
import 'startup/launch_configuration.dart';
|
|
|
|
import 'startup/startup.dart';
|
|
|
|
import 'user/presentation/splash_screen.dart';
|
2023-02-11 06:16:38 +00:00
|
|
|
import 'window/window.dart';
|
2021-06-19 15:41:19 +00:00
|
|
|
|
2021-09-12 14:19:59 +00:00
|
|
|
class FlowyApp implements EntryPoint {
|
2021-06-19 15:41:19 +00:00
|
|
|
@override
|
2022-12-20 03:14:42 +00:00
|
|
|
Widget create(LaunchConfiguration config) {
|
|
|
|
return SplashScreen(
|
|
|
|
autoRegister: config.autoRegistrationSupported,
|
|
|
|
);
|
2021-06-19 15:41:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-20 03:14:42 +00:00
|
|
|
Future<void> main() async {
|
2021-12-07 17:28:50 +00:00
|
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
|
2023-02-14 01:46:25 +00:00
|
|
|
// Handle platform errors not caught by Flutter.
|
|
|
|
// Reduces the likelihood of the app crashing, and logs the error.
|
|
|
|
PlatformDispatcher.instance.onError = (error, stack) {
|
|
|
|
Log.error('Uncaught platform error', error, stack);
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
|
2023-02-09 06:42:18 +00:00
|
|
|
await EasyLocalization.ensureInitialized();
|
2022-08-08 08:36:26 +00:00
|
|
|
await hotKeyManager.unregisterAll();
|
2023-02-09 06:42:18 +00:00
|
|
|
|
2023-02-11 06:16:38 +00:00
|
|
|
await AppWindow.initialize();
|
2022-08-08 08:36:26 +00:00
|
|
|
|
2022-02-20 08:10:50 +00:00
|
|
|
await FlowyRunner.run(FlowyApp());
|
2021-06-19 15:41:19 +00:00
|
|
|
}
|