mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-07-19 15:06:53 +00:00

* feat: try using folder2 * feat: update * feat: implement handlers * fix: compile errors * chore: add unsafe send + sync * feat: remove unsafe impl * fix: replace folder with foler2 * chore: dart compile errors * test: fix test * test: fix test * test: bypass existing tests * feat: open latest view * chore: fix dart warnings * chore: config notification * fix: folder notification bugs * fix: doesn't open the new view after creating * chore: rename struct * refactor: user id * test: fix test * chore: remove unused user_id * fix: fix read workspace views * chore: rename appflowy data folder * chore: update ref * fix: tauri build
47 lines
1.4 KiB
Dart
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, 'data_dev')).create();
|
|
case IntegrationMode.release:
|
|
Directory documentsDir = await getApplicationDocumentsDirectory();
|
|
return Directory(path.join(documentsDir.path, 'data')).create();
|
|
case IntegrationMode.test:
|
|
return Directory(path.join(Directory.current.path, '.sandbox'));
|
|
}
|
|
}
|