feat(workspace): refresh desktop editing experience and prepare 0.1.2
Gitea CI / Build Android APK (pull_request) Canceled after 0s
Gitea CI / Build Windows x64 app (pull_request) Canceled after 0s
Gitea CI / Audit and package Windows x64 (pull_request) Canceled after 0s
Gitea CI / Assemble and validate CI artifacts (pull_request) Canceled after 0s
Gitea CI / Gitea CI passed (pull_request) Canceled after 0s
Gitea CI / Check code and tests (pull_request) Canceled after 6m29s

This commit is contained in:
lingjhf committed 2026-10-09 01:56:01 +08:00
1 parent aa5255d1e4
commit 2e0033ce2d
260 files changed
+43963 -5591

No files matched your search

@@ -130,6 +130,11 @@ class ProjectWorkspace {
_project = null;
}
Future<void> deactivateProject() => _run(() async {
await _retireProject();
await _trimWarmProjects();
});
Future<void> _trimWarmProjects() async {
while (_warmProjects.length > 2) {
final file = _warmProjects.removeAt(0);
@@ -261,7 +266,7 @@ class ProjectWorkspace {
retained ??
(name == null
? await ProjectFile.open(directory)
: await ProjectFile.create(
: await _createProjectFile(
directory,
name: name,
initialTimeline: _newTimelineDocument(
@@ -307,6 +312,26 @@ class ProjectWorkspace {
}
});
Future<ProjectFile> _createProjectFile(
Directory directory, {
required String name,
required TimelineDocument initialTimeline,
}) async {
try {
return await ProjectFile.create(
directory,
name: name,
initialTimeline: initialTimeline,
);
} on ProjectFileException catch (error) {
if (error.code != ProjectFileError.conflict) rethrow;
throw AppException(
AppErrorCode.projectAlreadyExists,
diagnostic: error.toString(),
);
}
}
/// Reads timelines from any project without installing it as the active one.
///
/// This intentionally shares the workspace queue with [open] and all active