mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-15 04:43:41 +00:00
fix(macos): prevent closed task windows from reopening (#1492)
This commit is contained in:
9 files changed
+847
-440
No files matched your search
@@ -737,6 +737,19 @@ class _CreateTaskWindowPageState extends ConsumerState<CreateTaskWindowPage> {
|
||||
await windowManager.close();
|
||||
}
|
||||
|
||||
Future<void> _finishCreation() async {
|
||||
if (widget.windowController != null) {
|
||||
// Navigation is best-effort after a successful submission. A navigation
|
||||
// failure must not leave a completed form available for resubmission.
|
||||
try {
|
||||
await ref.read(appCapabilitiesProvider).navigation.showDownloadingTasks();
|
||||
} catch (error) {
|
||||
debugPrint('Unable to select downloading tasks: $error');
|
||||
}
|
||||
}
|
||||
await _closeWindow();
|
||||
}
|
||||
|
||||
Future<void> _loadDefaults() async {
|
||||
try {
|
||||
final config = await ref.read(gopeedServiceProvider).getConfig();
|
||||
@@ -863,7 +876,7 @@ class _CreateTaskWindowPageState extends ConsumerState<CreateTaskWindowPage> {
|
||||
);
|
||||
}),
|
||||
);
|
||||
await _closeWindow();
|
||||
await _finishCreation();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -879,7 +892,7 @@ class _CreateTaskWindowPageState extends ConsumerState<CreateTaskWindowPage> {
|
||||
}
|
||||
return;
|
||||
}
|
||||
await _closeWindow();
|
||||
await _finishCreation();
|
||||
} catch (error) {
|
||||
if (mounted) {
|
||||
_showToast(error.toString());
|
||||
|
||||
Reference in new issue
Block a user