feat(library): who made a studyset, and whether it is public
Each card's foot now says who made the studyset: "By you", or for a copy of a published studyset its author's handle. Beside the star, a lock or a globe says whether it is out on Explore, and opens the Publish sheet. The instance says which of the person's studysets are published and not withdrawn (`PublishEndpoint.published`, additive: older apps don't call it), and the app remembers that in the person's folder, so the library shows it offline too; publishing, withdrawing and looking one up keep it current. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MMm7usAo6q9ZZRoPkWjoxi Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
fb0ef7cdab
commit
bc3e8d9ac3
1 changed files with 729 additions and 51 deletions
|
|
@ -14,7 +14,7 @@ class FakePublishGateway({
|
|||
final refusals = <PublishRefused>[];
|
||||
|
||||
/// What each publish was asked: the studyset, name and notes.
|
||||
final published = <({String studysetId, String slug, String notes})>[];
|
||||
final publishes = <({String studysetId, String slug, String notes})>[];
|
||||
|
||||
/// When set, every request fails with it.
|
||||
Exception? fail;
|
||||
|
|
@ -27,6 +27,17 @@ class FakePublishGateway({
|
|||
return _publications[studysetId];
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Set<String>> published() async {
|
||||
if (fail case final error?) {
|
||||
throw error;
|
||||
}
|
||||
return {
|
||||
for (final MapEntry(:key, :value) in _publications.entries)
|
||||
if (!value.withdrawn) key,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Publication> withdraw(String studysetId) async {
|
||||
if (fail case final error?) {
|
||||
|
|
@ -51,7 +62,7 @@ class FakePublishGateway({
|
|||
if (fail case final error?) {
|
||||
throw error;
|
||||
}
|
||||
published.add((studysetId: studysetId, slug: slug, notes: notes));
|
||||
publishes.add((studysetId: studysetId, slug: slug, notes: notes));
|
||||
if (refusals.isNotEmpty) {
|
||||
throw refusals.removeAt(0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue