fix long image sharing#2150
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Pull request overview
Fixes share-image capture for long status posts by replacing the previous GraphicsLayer.toImageBitmap() approach (which is bounded by the on-screen preview size and uses hardware bitmaps incompatible with Bitmap.compress) with an off-screen ComposeView that is measured/laid out with unbounded height and drawn into a software bitmap. Also introduces a LocalNetworkImageAllowHardware composition local so Coil image requests can avoid hardware-backed bitmaps during the capture pass.
Changes:
- Add expect/actual
applyAllowHardwareandLocalNetworkImageAllowHardwareto toggle Coil'sallowHardwareper Android (no-op on iOS/JVM). - Extract
StatusSharePreview/StatusShareCardand rewritecaptureShareBitmapto inflate a detachedComposeViewinto a hiddenFrameLayout, measure withUNSPECIFIEDheight, then draw into a softwareBitmap. - Disable hardware bitmaps (and incidentally crossfade) for
NetworkImage,SubcomposeNetworkImage, andEmojiImagewhen capturing.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| compose-ui/src/commonMain/kotlin/dev/dimension/flare/ui/component/NetworkImageHardware.kt | New expect for applying allowHardware on an ImageRequest.Builder. |
| compose-ui/src/androidMain/.../NetworkImageHardware.android.kt | Android actual delegates to Coil's allowHardware. |
| compose-ui/src/iosMain/.../NetworkImageHardware.ios.kt | iOS actual is a no-op. |
| compose-ui/src/jvmMain/.../NetworkImageHardware.jvm.kt | JVM actual is a no-op. |
| compose-ui/src/commonMain/kotlin/dev/dimension/flare/ui/component/NetworkImage.kt | Adds LocalNetworkImageAllowHardware, threads it through NetworkImage/SubcomposeNetworkImage/EmojiImage, also gates crossfade on the same flag. |
| app/src/main/java/dev/dimension/flare/ui/screen/status/action/StatusShareSheet.kt | Replaces GraphicsLayer capture with off-screen ComposeView + software bitmap; factors out StatusSharePreview/StatusShareCard; sets LocalNetworkImageAllowHardware to false during capture. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| .Builder(platformContext) | ||
| .data(model) | ||
| .crossfade(true) | ||
| .crossfade(allowHardware) |
No description provided.