Skip to content

feat(share): share your random pick as an image - #72

Merged
Nacchofer31 merged 17 commits into
masterfrom
feat/sm-sharing
Sep 3, 2026
Merged

feat(share): share your random pick as an image#72
Nacchofer31 merged 17 commits into
masterfrom
feat/sm-sharing

Conversation

@Nacchofer31

Copy link
Copy Markdown
Owner

Summary

Adds the ability to share a random pick as a branded image card, both from
the random film screen and from the pick history.

What's included

  • Share infrastructure: new ShareRepository domain interface with
    Android (FileProvider + ACTION_SEND) and iOS (UIActivityViewController)
    implementations, wired through the Koin platform modules and the Android
    manifest.
  • Shareable card UI: ShareCard (branded card with poster, title, dice
    pattern and Google Play badge), ShareButton and a preview Dialog that
    captures the card to an ImageBitmap via GraphicsLayer before sharing.
  • Random film screen: share button next to Reroll; sharing delegated to
    the RandomFilmViewModel via constructor injection. Poster aspect ratio
    fixed to 2:3 so the shared card is not cropped.
  • History screen: share button below the favorite button on each card,
    sharing delegated to the HistoryViewModel via constructor injection.
  • i18n: share and the card tagline localized across all 13 locales.
  • Tests: ShareRepository mocks in both view model test suites plus
    share button/dialog coverage in the instrumented component tests.

Add ShareRepository domain interface with Android (FileProvider + ACTION_SEND) and iOS (UIActivityViewController) implementations, wired via Koin platform modules and the Android FileProvider manifest entry.
Add ShareCard composable (branded card with poster, title, dice pattern and Google Play badge), ShareButton and a preview dialog that captures the card via GraphicsLayer to an ImageBitmap before sharing.
Add share button to the film poster, open the share dialog from the screen and delegate sharing to the ViewModel via ShareRepository injection. Fix poster aspect ratio to 2:3 so the shared card is not cropped.
Add a share button below the favorite button on history cards and open the share dialog from the history screen, delegating to the ViewModel via ShareRepository injection.
Add the share button label and the share card tagline to every locale file.
Add ShareRepository mocks to the view model tests and share button/dialog coverage to the instrumented component tests.
Add the share card preview mockup to the design file.
@Nacchofer31 Nacchofer31 self-assigned this Aug 31, 2026
The share button click test matched two 'Share' nodes (the poster button and the dialog button). Tag the dialog button and target it by testTag.
The share button test asserted before the suspend toImageBitmap coroutine finished on slow CI emulators. Replace waitForIdle with waitUntil on the callback flag.
Capture the GraphicsLayer to an ImageBitmap in a LaunchedEffect once the layer has non-zero size, instead of in the click handler where it could hang or produce a 0-sized bitmap on slow emulators.
Silence the ExperimentalCoroutinesApi warning on the UnconfinedTestDispatcher property in the history view model test.
The captured share image showed a black poster because AsyncImage loads asynchronously after the first frame. Notify when the poster finishes loading and only then capture the GraphicsLayer.
The instrumented test asserting the share callback relied on a real GraphicsLayer snapshot (Coil + emulator), which is inherently flaky on CI. The dialog-open test and ViewModel unit tests already cover the wiring.
In landscape the share dialog content exceeded the screen height and got cut off. Add vertical scroll so the card and buttons remain reachable.
ShareRepositoryImplAndroid and ShareRepositoryImplIos require device/context and are not JVM-testable. Exclude them from both the JaCoCo file filter and the Codecov ignore list, matching the InAppReview implementations.
Assert the share dialog opens and closes from the random film screen, and add a history screen test that opens the share dialog from a pick card.
The dialog close assertion was flaky on CI because Compose Dialog closes asynchronously on a platform window. Keep the open assertion, which covers the dialog show logic.
@Nacchofer31
Nacchofer31 merged commit b5cb99c into master Sep 3, 2026
11 of 13 checks passed
@Nacchofer31
Nacchofer31 deleted the feat/sm-sharing branch September 3, 2026 08:45
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