r/Kotlin • u/One_Programmer_7407 • 4h ago
Fana Cumik: Open-source manga and webtoon reader sharing one Compose Multiplatform UI across Android, Desktop JVM, and WasmJs
galleryI wanted to see how much of a media-heavy reader could run out of shared/ before platform differences forced separate UI layers. In Fana Cumik (v1.0.1), every screen from catalog search to reading history runs from one Compose Multiplatform codebase across Android, Desktop JVM, and WebAssembly (wasmJs), leaving only network engines, storage, window insets, and region tile decoders behind expect/actual contracts.
Two engineering problems shaped the codebase:
- Blurry 16,000 px webtoon strips: Standard decoders cap vertical texture heights, which shrinks a 900 px wide strip proportionally and stretches it back up into muddy dialogue. Fana Cumik fetches encoded bytes into a bounded disk cache, then slices tall strips into 2048 px vertical
ImageBitmaptiles usingBitmapRegionDecoderon Android and off-screen SkiaSurfacedrawing (SamplingMode.MITCHELL) on Desktop and Web. Removing per-item aspect-ratio wrappers keeps the tiles flush with zero hairline gaps. - Duplicate image requests during fast scrolling:
ReaderImageControllerowns all page requests keyed by(url, targetWidth, targetHeight)and caps concurrency at 2 running jobs (at most 1 speculative preload). Scrolling a preloaded page into view promotes the in-flight job instead of firing a second HTTP GET.
Other technical details in v1.0.1:
- Fractional webtoon scroll offsets and paged indices save to a single serialized SQLite connection (
Dispatchers.IO.limitedParallelism(1)) on Android and Desktop, orlocalStorageon Web, every 2s and after 750ms of settle. - Global history compacts rows in SQL via
ROW_NUMBER() OVER (PARTITION BY source_id, manga_id ...)so binge-reading does not flood the recent list while manga details keep per-chapter resume states. - Web deployment pairs
wasmJsassets on Cloudflare Pages with two Functions to handle API proxying and upstream CDN CORS headers. - R8 shrinking keeps the signed Android release APK at 7.5 MB (AAB at 8.4 MB), alongside a 49.3 MB Desktop JAR and an 80.2 MB Linux x64
jpackagebundle.
Links:
- Source code (MIT):https://github.com/MasFana/FanaCumik-App
- Project page and downloads:https://masfana.github.io/FanaCumik-App/
If anyone here is shipping wasmJs or heavy image lists in Compose Multiplatform, I would appreciate feedback on the architecture and browser performance.