Lucas.Xu 3686eabcb3
fix: release/0.1.1 known issues. (#1984)
* fix: #1976 Adding a cover image via upload doesn't work

* fix: #1973 Using the mouse to highlight text very easy to miss the first letter

* fix: #1962 Disable but still show the AI assistants icon in the toolbar menu when an OpenAI key is not provided

* fix: #1964 Text on the UI

* fix: #1966 the loading icon too close to the edge

* fix: #1967  the summarize feature generates duplicate answers

* fix: flutter analyze
2023-03-14 01:06:08 +08:00

47 lines
1.4 KiB
Dart

import 'dart:io';
import 'package:appflowy_backend/appflowy_backend.dart';
import 'package:path_provider/path_provider.dart';
import 'package:path/path.dart' as path;
import '../startup.dart';
class InitRustSDKTask extends LaunchTask {
InitRustSDKTask({
this.directory,
});
// Customize the RustSDK initialization path
final Future<Directory>? directory;
@override
LaunchTaskType get type => LaunchTaskType.dataProcessing;
@override
Future<void> initialize(LaunchContext context) async {
// use the custom directory
if (directory != null) {
return directory!.then((directory) async {
await context.getIt<FlowySDK>().init(directory);
});
} else {
return appFlowyDocumentDirectory().then((directory) async {
await context.getIt<FlowySDK>().init(directory);
});
}
}
}
Future<Directory> appFlowyDocumentDirectory() async {
switch (integrationEnv()) {
case IntegrationMode.develop:
Directory documentsDir = await getApplicationDocumentsDirectory();
return Directory(path.join(documentsDir.path, 'flowy_dev')).create();
case IntegrationMode.release:
Directory documentsDir = await getApplicationDocumentsDirectory();
return Directory(path.join(documentsDir.path, 'flowy')).create();
case IntegrationMode.test:
return Directory(path.join(Directory.current.path, '.sandbox'));
}
}