소스 검색

feat(core): use camel case on mobile command name (#6340)

Lucas Fernandes Nogueira 2 년 전
부모
커밋
1035a83187
2개의 변경된 파일8개의 추가작업 그리고 4개의 파일을 삭제
  1. 4 2
      core/tauri/Cargo.toml
  2. 4 2
      core/tauri/src/window.rs

+ 4 - 2
core/tauri/Cargo.toml

@@ -109,12 +109,14 @@ win7-notifications = { version = "0.3.1", optional = true }
 version = "0.44"
 features = [ "Win32_Foundation" ]
 
-[target."cfg(target_os = \"android\")".dependencies]
+[target."cfg(any(target_os = \"android\", target_os = \"ios\"))".dependencies]
 log = "0.4"
+heck = "0.4"
+
+[target."cfg(target_os = \"android\")".dependencies]
 jni = "0.20"
 
 [target."cfg(target_os = \"ios\")".dependencies]
-log = "0.4"
 libc = "0.2"
 objc = "0.2"
 cocoa = "0.24"

+ 4 - 2
core/tauri/src/window.rs

@@ -1506,7 +1506,9 @@ impl<R: Runtime> Window<R> {
                   crate::ios::post_ipc_message(
                     webview.inner(),
                     &plugin.as_str().into(),
-                    &message.command.as_str().into(),
+                    &heck::ToLowerCamelCase::to_lower_camel_case(message.command.as_str())
+                      .as_str()
+                      .into(),
                     crate::ios::json_to_dictionary(message.payload),
                     resolver.callback.0,
                     resolver.error.0,
@@ -1558,7 +1560,7 @@ impl<R: Runtime> Window<R> {
                       &[
                         webview.into(),
                         env.new_string(plugin)?.into(),
-                        env.new_string(&message.command)?.into(),
+                        env.new_string(&heck::ToLowerCamelCase::to_lower_camel_case(message.command.as_str()))?.into(),
                         data,
                         (callback.0 as i64).into(),
                         (error.0 as i64).into(),