chore: await Sytem launch

This commit is contained in:
appflowy 2022-02-19 17:12:44 +08:00
parent 6fc8197468
commit 2781809f87
4 changed files with 6 additions and 10 deletions

View File

@ -14,5 +14,5 @@ void main() async {
WidgetsFlutterBinding.ensureInitialized();
await EasyLocalization.ensureInitialized();
System.run(FlowyApp());
await System.run(FlowyApp());
}

View File

@ -33,7 +33,7 @@ abstract class EntryPoint {
}
class System {
static void run(EntryPoint f) {
static Future<void> run(EntryPoint f) async {
// Specify the env
const env = IntegrationEnv.dev;
@ -94,7 +94,7 @@ class AppLauncher {
tasks.add(task);
}
void launch() async {
Future<void> launch() async {
final context = LaunchContext(getIt, env);
for (var task in tasks) {
await task.initialize(context);

View File

@ -2,7 +2,6 @@ import 'dart:io';
import 'package:app_flowy/startup/startup.dart';
import 'package:path_provider/path_provider.dart';
import 'package:flowy_sdk/flowy_sdk.dart';
import 'package:flutter/material.dart';
class InitRustSDKTask extends LaunchTask {
@override
@ -10,8 +9,6 @@ class InitRustSDKTask extends LaunchTask {
@override
Future<void> initialize(LaunchContext context) async {
WidgetsFlutterBinding.ensureInitialized();
Directory directory = await getApplicationDocumentsDirectory();
final documentPath = directory.path;

View File

@ -1,17 +1,16 @@
import 'package:app_flowy/startup/startup.dart';
import 'package:app_flowy/user/infrastructure/repos/auth_repo.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra/uuid.dart';
import 'package:flowy_sdk/log.dart';
import 'package:flowy_sdk/protobuf/flowy-user-data-model/protobuf.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
class FlowyTest {
static Future<FlowyTest> setup() async {
WidgetsFlutterBinding.ensureInitialized();
TestWidgetsFlutterBinding.ensureInitialized();
// await EasyLocalization.ensureInitialized();
System.run(FlowyTestApp());
await System.run(FlowyTestApp());
return FlowyTest();
}