Files
cutdex/lib/integrations/app_update_coordinator.dart
lingjhf 27e77fff39 feat: initial Cutdex application
Add the Flutter video editing application with project management, media
import, timeline editing, preview, AI assistance, diagnostics and settings.

Include shared UI and native host packages, platform runners, application
tests and release tooling.

Provide usage and contribution guides, the MIT license and third-party
notices. Exclude local credentials, build outputs and validation data.
2026-10-05 23:36:23 +08:00

40 lines
1.3 KiB
Dart

import 'package:riverpod_annotation/riverpod_annotation.dart';
import '../features/assistant/agent_conversation_service.dart';
import '../workspace/projects.dart';
import 'app_update_bridge.dart';
Future<void> prepareForAppUpdateQuit(Ref ref) async {
await ref.read(agentConversationRegistryProvider).cancelAll();
await ref.read(projectsProvider.notifier).prepareToQuit();
}
// Keep the saved workspace recoverable if the updater cannot be launched.
Future<void> installWindowsUpdate(Ref ref) async {
final bridge = ref.read(appUpdateBridgeProvider);
await bridge.validateInstall();
final registry = ref.read(agentConversationRegistryProvider);
await registry.cancelAll();
await registry.whilePaused(() async {
final projects = ref.read(projectsProvider.notifier);
await ref.read(projectsProvider.future);
final snapshot = ref.read(projectsProvider).requireValue;
await projects.prepareToQuit();
try {
await bridge.install();
} catch (_) {
ref.invalidate(projectsProvider);
if (snapshot.activeProject case final project?) {
await ref
.read(projectsProvider.notifier)
.open(
project.path,
expectedId: project.id,
timelineId: snapshot.timeline?.id,
);
}
rethrow;
}
});
}