From 6079e199a24c11dbcaeabdb4cd77e851029bd192 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Fri, 13 Sep 2024 08:42:50 -0300 Subject: [PATCH] fix(core): requestPermissions not resolving on Android the checkPermissions command is also a PermissionCallback, and the annotation check is incorrectly ignoring that fact, so the requestPermissions is never resolved for the geolocation plugin --- .changes/fix-request-permissions.md | 5 +++++ .../src/main/java/app/tauri/plugin/PluginHandle.kt | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 .changes/fix-request-permissions.md diff --git a/.changes/fix-request-permissions.md b/.changes/fix-request-permissions.md new file mode 100644 index 000000000000..b00774f379f3 --- /dev/null +++ b/.changes/fix-request-permissions.md @@ -0,0 +1,5 @@ +--- +"tauri": patch:bug +--- + +Fix `requestPermissions` not resolving on Android. diff --git a/crates/tauri/mobile/android/src/main/java/app/tauri/plugin/PluginHandle.kt b/crates/tauri/mobile/android/src/main/java/app/tauri/plugin/PluginHandle.kt index 5e10f17bd653..ff946bbc75cf 100644 --- a/crates/tauri/mobile/android/src/main/java/app/tauri/plugin/PluginHandle.kt +++ b/crates/tauri/mobile/android/src/main/java/app/tauri/plugin/PluginHandle.kt @@ -143,9 +143,13 @@ class PluginHandle(private val manager: PluginManager, val name: String, val ins val command = method.getAnnotation(Command::class.java) ?: continue val methodMeta = CommandData(method, command) commands[method.name] = methodMeta - } else if (method.isAnnotationPresent(ActivityCallback::class.java)) { + } + + if (method.isAnnotationPresent(ActivityCallback::class.java)) { startActivityCallbackMethods[method.name] = method - } else if (method.isAnnotationPresent(PermissionCallback::class.java)) { + } + + if (method.isAnnotationPresent(PermissionCallback::class.java)) { permissionCallbackMethods[method.name] = method } }