feat(explore): the device tells the instance whether to count the person, and what their copies come from (ADR 0019, D3)

Count me stays in the person's settings, which follow them to every device
and are now encrypted; after each sync the device mirrors it to the
instance (`learningCount.setCounted`) and, only while it is on, reports
which publications their copies come from, topics with them
(`reportCopies`). Taken back, the instance forgets the copies. Only people
with an identity report, as only they are counted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-21 21:40:27 +02:00
commit 2f169ae899
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -0,0 +1,29 @@
import 'package:halkyon_learn_flutter/src/feature/explore/data/learning_count_gateway.dart';
/// [LearningCountGateway] in memory: what the instance would keep.
class FakeLearningCountGateway() implements LearningCountGateway {
/// Whether the instance counts the person.
bool isCounted = false;
/// The copies last reported, kept only while counted, as the instance
/// keeps them.
Map<String, Set<String>>? reported;
@override
Future<bool> counted() async => isCounted;
@override
Future<void> setCounted({required bool counted}) async {
isCounted = counted;
if (!counted) {
reported = null;
}
}
@override
Future<void> reportCopies(Map<String, Set<String>> copies) async {
if (isCounted) {
reported = copies;
}
}
}