fix(plugin): fix android_package_id to follow cli (#10763)

* fix(plugin): fix android_package_id to follow cli

* Update tooling/cli/templates/plugin/src/mobile.rs

* add change file

---------

Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
This commit is contained in:
Masahiko Sakakibara
2024-08-27 01:39:05 +09:00
committed by GitHub
parent 21c2488d2e
commit fb6bf31425
2 changed files with 7 additions and 4 deletions

View File

@@ -0,0 +1,6 @@
---
'tauri-cli': 'patch:changes'
'@tauri-apps/cli': 'patch:changes'
---
Update plugin template Android code to match documentation on Android package ID usage.

View File

@@ -9,9 +9,6 @@ use tauri::{
use crate::models::*;
#[cfg(target_os = "android")]
const PLUGIN_IDENTIFIER: &str = "{{ android_package_id }}";
#[cfg(target_os = "ios")]
tauri::ios_plugin_binding!(init_plugin_{{ plugin_name_snake_case }});
@@ -21,7 +18,7 @@ pub fn init<R: Runtime, C: DeserializeOwned>(
api: PluginApi<R, C>,
) -> crate::Result<{{ plugin_name_pascal_case }}<R>> {
#[cfg(target_os = "android")]
let handle = api.register_android_plugin(PLUGIN_IDENTIFIER, "ExamplePlugin")?;
let handle = api.register_android_plugin("{{ android_package_id }}", "ExamplePlugin")?;
#[cfg(target_os = "ios")]
let handle = api.register_ios_plugin(init_plugin_{{ plugin_name_snake_case }})?;
Ok({{ plugin_name_pascal_case }}(handle))