Skip to content
PifeatureMobile20 files · +723 −148

Add cross-platform folder/file picker for local backup export in Kotlin Multiplatform

Session from pi-coding-sessions on Hugging Face by championswimmer · MIT · condensed by Coders Talk

16msession
0interventions
GOAL

Let users pick the folder/file location when exporting a local backup, instead of always saving to a fixed path, and make this work across Android, iOS, Desktop and Web.

  1. Prompt · +0
    In local file backup we don't let users pick the export folder. Research KMP file/folder picker options via Perplexity, then implement picking the export location.
  2. Agent did · +0m
    Researched KMP file/folder picker options via Perplexity (after fixing tool call errors), landed on FileKit as the best cross-platform library, explored its source for save/directory picker APIs, then implemented a JFileChooser-based picker for desktop's LocalFileBackupTransport.
  3. Prompt · +4m
    Make this fully cross platform so Android, iOS and Web can also pick the export location, not just desktop.
  4. Agent did · +4m
    Explored DI modules per platform, integrated FileKit for Android/iOS/Desktop, and built a custom TypeScript/wasm interop layer with the File System Access API (showSaveFilePicker) for Web. Added expect/actual LocalBackupPicker files per platform, wired new backup modules into Koin DI across all four platforms, added FileKit gradle dependencies, and iteratively fixed compile errors (base64/blob conversions, TS return types) until all targets compiled.
  5. Agent did · +13m
    Removed the old desktop-only LocalFileBackupTransport.kt now that a shared PickerLocalBackupTransport replaced it, verified no dangling references, and re-ran builds for desktop, wasm, Android and iOS to confirm everything compiled after cleanup.
  6. Prompt · +15m
    Rename PickerLocalBackupTransport to LocalFileBackupTransport, it's not self-explanatory. Simple rename refactor.
  7. Agent did · +15m
    Renamed the file and class, updated all imports and instantiation call sites across Android, iOS, Desktop and Wasm DI modules, then recompiled all four targets to confirm the rename didn't break anything.
  8. Outcome · +16m
    Committed and pushed 19 files changed (422 insertions, 131 deletions) to arnav/mutli-backup-transports, with successful compiles across desktop, wasm, Android and iOS simulator targets.
VERDICT

Next time I'd just say upfront that the picker needs to work on Android, iOS and Web too, not just desktop — that would have saved a whole extra research and implementation pass. Asking the agent to research via Perplexity first was useful since it found FileKit, which handled most platforms, but Web still needed custom TypeScript interop for the File System Access API. The rename request at the end was quick and clean since the agent updated every call site and reverified builds.

I tried this · 0

Discussion · 0

How Builds work