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
110 lines
2.9 KiB
Dart
110 lines
2.9 KiB
Dart
import 'package:cutdex/persistence/app_settings_repositories.dart';
|
|
import 'package:cutdex_sdk/timeline_ui.dart' show TimelineRulerTimecodeLayout;
|
|
import 'package:cutdex/workspace/project_state.dart';
|
|
import 'package:cutdex/workspace/persistence/recent_projects.dart';
|
|
|
|
class MemoryProjectLocationSettingsRepository
|
|
implements ProjectLocationSettingsRepository {
|
|
MemoryProjectLocationSettingsRepository([this.value]);
|
|
|
|
String? value;
|
|
|
|
@override
|
|
Future<String?> load() async => value;
|
|
|
|
@override
|
|
Future<void> save(String directory) async => value = directory;
|
|
}
|
|
|
|
class MemoryResourceLocationSettingsRepository
|
|
implements ResourceLocationSettingsRepository {
|
|
MemoryResourceLocationSettingsRepository(this.value);
|
|
|
|
String? value;
|
|
|
|
@override
|
|
Future<String?> load() async => value;
|
|
|
|
@override
|
|
Future<void> save(String directory) async => value = directory;
|
|
}
|
|
|
|
class MemoryMcpSettingsRepository implements McpSettingsRepository {
|
|
McpSettingsValue? value;
|
|
bool failWrites = false;
|
|
|
|
@override
|
|
Future<McpSettingsValue?> load() async => value;
|
|
|
|
@override
|
|
Future<void> save(McpSettingsValue configuration) async {
|
|
if (failWrites) throw StateError('write failed');
|
|
value = configuration;
|
|
}
|
|
}
|
|
|
|
class MemoryAppearanceSettingsRepository
|
|
implements AppearanceSettingsRepository {
|
|
AppAppearance value = AppAppearance.system;
|
|
bool failWrites = false;
|
|
|
|
@override
|
|
Future<AppAppearance> load() async => value;
|
|
|
|
@override
|
|
Future<void> save(AppAppearance mode) async {
|
|
if (failWrites) throw StateError('write failed');
|
|
value = mode;
|
|
}
|
|
}
|
|
|
|
class MemoryPaletteSettingsRepository implements PaletteSettingsRepository {
|
|
AppPalette value = AppPalette.graphite;
|
|
bool failWrites = false;
|
|
|
|
@override
|
|
Future<AppPalette> load() async => value;
|
|
|
|
@override
|
|
Future<void> save(AppPalette palette) async {
|
|
if (failWrites) throw StateError('write failed');
|
|
value = palette;
|
|
}
|
|
}
|
|
|
|
class MemoryTimelineRulerSettingsRepository
|
|
implements TimelineRulerSettingsRepository {
|
|
TimelineRulerTimecodeLayout value = TimelineRulerTimecodeLayout.inline;
|
|
bool failWrites = false;
|
|
|
|
@override
|
|
Future<TimelineRulerTimecodeLayout> load() async => value;
|
|
|
|
@override
|
|
Future<void> save(TimelineRulerTimecodeLayout layout) async {
|
|
if (failWrites) throw StateError('write failed');
|
|
value = layout;
|
|
}
|
|
}
|
|
|
|
class MemoryRecentProjectsRepository implements RecentProjectsRepository {
|
|
List<RecentProject> recent = [];
|
|
final projects = <String, String>{};
|
|
|
|
@override
|
|
Future<List<RecentProject>> load() async => List.of(recent);
|
|
|
|
@override
|
|
Future<void> save(List<RecentProject> projects) async {
|
|
recent = List.of(projects);
|
|
}
|
|
|
|
@override
|
|
Future<String?> lastTimeline(String projectId) async => projects[projectId];
|
|
|
|
@override
|
|
Future<void> rememberTimeline(String projectId, String timelineId) async {
|
|
projects[projectId] = timelineId;
|
|
}
|
|
}
|