Skip to content

Show the digital files a reader cannot open yet, with the reason - #50

Merged
fabiodalez-dev merged 3 commits into
mainfrom
feat/digital-access-480
Oct 21, 2026
Merged

fabiodalez-dev merged 3 commits into
mainfrom
feat/digital-access-480

Conversation

@fabiodalez-dev

@fabiodalez-dev fabiodalez-dev commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Pinakes 0.8.6 decides who may open each digital file (fabiodalez-dev/Pinakes#480) and says so per file in the book detail: a file the reader may not open yet keeps its entry, with url: null and access set to login_required or loan_required.

  • The detail page keeps that card, with a lock and the reason in place of the Read/Play button ("For readers who have this book on loan", "Sign in to open it"), in Italian, English, German and French.
  • Closed files all arrive with the same empty address, so the list no longer folds them into one; only open files are deduplicated by address.
  • Signed links last a day. A tap revalidates the file on the server and opens the renewed URL immediately. This works even when the phone clock is wrong; it preserves the page and scroll position, disables repeated taps while pending, and reports a failure only when the request fails. Renewal bypasses both HTTP and repository caches and never falls back to an expired URL. A revoked or removed file is not opened. Audio waits for the reader’s tap so it also receives a checked link.
  • Servers before 0.8.6 send neither field: every file stays open, exactly as before. The app already published keeps working against 0.8.6 too: its parser turns the null address into an empty one and simply leaves the closed files out.

Verification

  • Added 15 regression tests: 9 JVM/Compose tests for renewed URLs, clock-independent opening, pending/failed/revoked requests, retry, retained scroll position, legacy unsigned links, audio and file identity; 6 instrumented tests against the real repository/ViewModel and HTTP cache.
  • testDebugUnitTest: 401 passed, no failures or skips.
  • testReleaseUnitTest: 401 passed, no failures or skips.
  • The 6 DigitalLinkRefreshFlowTest instrumented tests pass on a separate disposable Android 15 emulator, including fresh-cache bypass, HTTP 503/500, unexpected 304, retry, reordered/renamed files and revoked access.
  • lintDebug: 0 errors (120 warnings).
  • Italian, English, German and French refresh-failure messages updated.
  • Source integration with the other open Android PRs checked for merge conflicts.

Pinakes 0.8.6 decides who may open each digital file (fabiodalez-dev/Pinakes#480) and tells the app per file: a closed one keeps its entry with url null and access login_required or loan_required. The detail page now keeps that card, with a lock and the reason ("For readers who have this book on loan", "Sign in to open it") in place of the button, in the four languages.

Closed files all arrive with the same empty address, so the list no longer folds them into one: only the open files are told apart by their address. Servers before 0.8.6 send neither field and every file stays open, as before.

The links to the files the reader may open are signed and last a day. A tap on one that has expired fetches the record again for a fresh link and asks to tap again, instead of opening a file the server would refuse.
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7db25c91-03a4-496a-a23e-e2e677105e88
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues. There are two rough edges in the expired-link path, both inline.

Reviewed changes

I reviewed the initial commit, which adds client support for Pinakes 0.8.6 per-file digital access (fabiodalez-dev/Pinakes#480).

  • Access-aware DigitalAttachment: new nullable visibility/access fields, a locked flag, and pk_exp parsing for signed-link expiry. Older servers send neither field, so their files stay open.
  • digitalFiles dedup: locked files with an empty url are kept. Only open files are deduplicated by address.
  • Locked card UI: LockedDigitalFile shows a lock and the reason (login or loan) in place of the Read/Play button.
  • Expired-link refresh: tapping a signed link that is about to expire reloads the record and asks the reader to tap again.
  • i18n: four new keys in all of en/it/fr/de, with no em dashes.
  • Tests: three Robolectric tests cover closed cards, pre-0.8.6 servers and an expired link.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using claude-opus-5-5 | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues. Both earlier findings are fixed. One minor suggestion inline, about audio playback.

Reviewed changes

I reviewed 1568f7d, which reworks how signed links are renewed after the previous review.

  • Server-side renewal on every tap: removed linkExpired. Any file with a pk_exp is now revalidated with the server and opened in the same tap, so a wrong device clock can no longer cause a refresh loop.
  • In-place refresh: added BookDetailViewModel.refreshDigitalFile. On success it replaces content without a Loading step. A failure leaves the page as it was, and a missing or locked match comes back as FORBIDDEN.
  • Cache bypass: CatalogRepository.book(forceRefresh = true) drops If-None-Match, sends Cache-Control: no-cache, no-store, and never falls back to the cached payload or a 304.
  • File identity: added DigitalAttachment.resourceKey, which strips only the signature parameters, so a renewed file is matched to its old entry even when the server reorders or renames entries.
  • Tap handling: a pending renewal disables every open button and shows loading on the tapped one. Audio no longer starts from the legacy book.audioUrl.
  • i18n/tests: replaced digital_link_refreshed with digital_link_refresh_error in all four locales. Added DigitalLinkRefreshTest (Robolectric) and DigitalLinkRefreshFlowTest (instrumented, MockWebServer).

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using claude-opus-5-5 | 𝕏

Renewing any file swaps in a record whose URLs are all re-signed, so the
player, matched to its card by the full signed URL, left composition and
stopped. The started file is now remembered and matched by resourceKey, and
the player keeps the URL it started with.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found. The audio playback finding from the last review is fixed.

Reviewed changes

I reviewed 2784ecd, which keeps a playing audiobook running when another file of the record is renewed.

  • Audio identity: selectedAudio now holds the started DigitalAttachment, not its URL. The new playingAudioUrl() matches the card by resourceKey and returns the started URL, which feeds both AudioPlayer and its key. Re-signing every URL on a renewal therefore no longer stops or restarts playback. If the audio file becomes locked, the file.locked branch still takes over first.
  • Tests: added PlayingAudioUrlTest, which covers a re-signed audio URL, a different file, and the case with no selection.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

fabiodalez-dev added a commit that referenced this pull request Oct 21, 2026
Bumps the version and records in STATUS what 1.9.0 brings: closed digital files with their reason and signed-link renewal (#50), the restyled loan request sheet (#46), the return date from the server's loan duration (#51) and the wanted-title receive action (#49).
@fabiodalez-dev
fabiodalez-dev merged commit ba68795 into main Oct 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant