feat(share): share your random pick as an image - #72
Merged
Conversation
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.
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.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
ShareRepositorydomain interface withAndroid (FileProvider +
ACTION_SEND) and iOS (UIActivityViewController)implementations, wired through the Koin platform modules and the Android
manifest.
ShareCard(branded card with poster, title, dicepattern and Google Play badge),
ShareButtonand a previewDialogthatcaptures the card to an
ImageBitmapviaGraphicsLayerbefore sharing.the
RandomFilmViewModelvia constructor injection. Poster aspect ratiofixed to 2:3 so the shared card is not cropped.
sharing delegated to the
HistoryViewModelvia constructor injection.shareand the card tagline localized across all 13 locales.ShareRepositorymocks in both view model test suites plusshare button/dialog coverage in the instrumented component tests.