Add showImage handler stub and mobile file provider foundation

- Add haextension.fs.showImage handler that delegates to frontend PhotoSwipe
- Add mobile.rs with open_file_with_provider command for future Android FileProvider integration
- Keep showImage as backwards-compatible no-op since image viewing is now handled client-side

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-10 02:13:44 +01:00
parent e1be08cb76
commit 75093485bd
2 changed files with 42 additions and 0 deletions

33
src-tauri/src/mobile.rs Normal file
View File

@ -0,0 +1,33 @@
use tauri::command;
#[command]
pub async fn open_file_with_provider(path: String, mime_type: Option<String>) -> Result<(), String> {
#[cfg(target_os = "android")]
{
open_file_android(path, mime_type).await
}
#[cfg(not(target_os = "android"))]
{
// On other platforms, use the opener plugin
use tauri_plugin_opener::OpenerExt;
tauri::AppHandle::opener()
.open_path(path, None::<&str>)
.map_err(|e| e.to_string())
}
}
#[cfg(target_os = "android")]
async fn open_file_android(path: String, mime_type: Option<String>) -> Result<(), String> {
use jni::{
objects::{JObject, JString, JValue},
JNIEnv,
};
use tauri::Manager;
// This will be called from the Rust side
// We need to call into the Android Activity to use FileProvider
// For now, return an error - we need to implement the Java/Kotlin side first
Err("Android FileProvider implementation needed".to_string())
}

View File

@ -44,6 +44,15 @@ export async function handleFilesystemMethodAsync(
}
}
case 'haextension.fs.showImage': {
// This method is now handled by the frontend using PhotoSwipe
// We keep it for backwards compatibility but it's a no-op
return {
success: true,
useFrontend: true,
}
}
case 'haextension.fs.openFile': {
const params = request.params as {
data: number[]