# Consumer R8/ProGuard rules for the storage plugin. Gradle hands a consumer
# file to whatever app links this module, and it is INERT unless that app
# minifies: src-tauri/gen/android/app/build.gradle.kts sets
# isMinifyEnabled = true for the `release` build type and false for `debug`,
# and the debug type names no proguard files at all. The deploy pipeline
# builds debug, so nothing in this file reaches it.
#
# Nothing below is called from Kotlin, which is the whole problem. Tauri
# reaches this plugin by STRING, at three layers:
#
#   1. register_android_plugin("com.soulstream.storage", "StoragePlugin") is
#      turned into "com/soulstream/storage/StoragePlugin" and handed to
#      FindClass; the instance is built through the JNI signature
#      "(Landroid/app/Activity;)V" (tauri/src/plugin/mobile.rs).
#   2. PluginHandle.indexMethods() files every @Command under
#      commands[method.name] and every @ActivityCallback under
#      startActivityCallbackMethods[method.name]; invoke() looks up the name
#      Rust asked for and throws "No command pickFolder found for plugin ..."
#      when it is not there.
#   3. Jackson fills the @InvokeArg classes FIELD by field — PluginManager
#      sets FIELD visibility to ANY — so field names weigh the same as
#      method names.
#
# Six commands (pickFolder, allFilesAccess, requestAllFilesAccess, pickImage,
# pickFile, createDocument) and four activity callbacks (folderPicked,
# imagePicked, filePicked, documentCreated). createDocument is the easy one
# to miss by hand: it has no JS-facing command at all, it is called from Rust
# by playlist export.
#
# Tauri's own consumer rules already match all of this by annotation
# (-keep @TauriPlugin public class * { @Command public <methods>; ... }).
# These name it outright anyway: theirs are generic, ours are specific, the
# failure is silent and user-facing, and nobody has built a release APK of
# this app yet to find out which of us was needed. Narrow them once a release
# build has actually been smoke-tested command by command.
-keep class com.soulstream.storage.StoragePlugin { *; }
-keep class com.soulstream.storage.CreateDocumentArgs { *; }
-keep class com.soulstream.storage.PickFileArgs { *; }
