perf(learn): a conversation deleted goes at once, with an Undo

Deleting a kept conversation asked first and then waited while its
turns were blanked and deleted. It now goes as a card or a note does:
ConversationDeletions, a DelayedDeletions opened with the person's
data, takes it off the history at once (the list leaves out what is
pending), offers Undo for a moment on the sheet (hasSnackBars), and
blanks and deletes it once that is over; a deletion that fails shows
the conversation again, as every DelayedDeletions does. The question
before deleting goes, as Undo replaces it.

Whats-New: A conversation with an assistant is deleted at once, and Undo brings it back.
Whats-New-De: Eine Unterhaltung mit einem Assistenten wird sofort gelöscht, und „Rückgängig“ holt sie zurück.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-11-07 23:07:23 +01:00
commit 891e9dfd75
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64
2 changed files with 106 additions and 71 deletions

View file

@ -764,8 +764,8 @@ void main() {
});
testWidgets('kept conversations are listed in the field, those about '
'where the person is first; one opens in its sheet, and goes after '
'asking (D48)', (tester) async {
'where the person is first; one opens in its sheet, and goes at once, '
'with an Undo (D48)', (tester) async {
final conversations = ConversationRepository(kept);
addTearDown(conversations.dispose);
final id = await conversations.start(
@ -799,13 +799,24 @@ void main() {
await tester.tap(find.byTooltip('Conversations'));
await tester.pumpAndSettle();
// Gone at once, with an Undo for a moment, as a card or a note.
await tester.tap(find.byTooltip('Delete conversation'));
await tester.pump();
expect(find.text('Why て-form?'), findsNothing);
await tester.pumpAndSettle();
await tester.tap(find.text('Delete'));
expect(find.text('Conversation deleted'), findsOneWidget);
await tester.tap(find.text('Undo'));
await tester.pumpAndSettle();
expect(find.text('Why て-form?'), findsOneWidget);
await tester.tap(find.byTooltip('Delete conversation'));
await tester.pump();
expect(find.text('No conversations yet'), findsOneWidget);
expect(kept.blanked, isEmpty, reason: 'Undo is still offered');
await tester.pump(const Duration(seconds: 5));
await tester.pumpAndSettle();
expect(kept.blanked, [id]);
expect(find.text('No conversations yet'), findsOneWidget);
});
testWidgets("a device that can't seal answers, and says it keeps nothing "

View file

@ -23,6 +23,7 @@ import 'package:halkyon_learn_flutter/src/feature/archive/data/archive_reader.da
import 'package:halkyon_learn_flutter/src/feature/archive/model/import_archive.dart';
import 'package:halkyon_learn_flutter/src/feature/assistant/data/assistant_files.dart';
import 'package:halkyon_learn_flutter/src/feature/assistant/data/assistant_lookups.dart';
import 'package:halkyon_learn_flutter/src/feature/assistant/data/conversation_deletions.dart';
import 'package:halkyon_learn_flutter/src/feature/assistant/data/conversation_repository.dart';
import 'package:halkyon_learn_flutter/src/feature/assistant/data/photo_picker.dart';
import 'package:halkyon_learn_flutter/src/feature/assistant/data/web_search.dart';
@ -345,6 +346,7 @@ Dependencies testDependencies({
final pathDeletions = LearningPathDeletions(paths);
final stepDeletions = StepDeletions(paths);
final pdfDeletions = PdfDeletions(pdfSources);
final conversationDeletions = ConversationDeletions(conversations);
final studysetTabs = StudysetTabs(
studysetTabStore ?? MemoryStudysetTabStore(),
);
@ -376,6 +378,7 @@ Dependencies testDependencies({
pathDeletions: pathDeletions,
stepDeletions: stepDeletions,
pdfDeletions: pdfDeletions,
conversationDeletions: conversationDeletions,
pomodoroRuns: pomodoroRuns ?? MemoryPomodoroRunStore(),
studysetTabs: studysetTabs,
privateOffer: privateOffer ?? MemoryPrivateOfferStore(),
@ -427,6 +430,7 @@ Dependencies testDependencies({
await pathDeletions.dispose();
await stepDeletions.dispose();
await pdfDeletions.dispose();
await conversationDeletions.dispose();
await studysetProgress.dispose();
await studysets.dispose();
await tags.dispose();