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:
parent
64fdfa091d
commit
2f169ae899
1 changed files with 221 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue