fix(clipboard-manager): match Rust method parameters with native methods (#1379)

This commit is contained in:
Emin Yilmaz
2024-05-30 00:43:40 +09:00
committed by GitHub
parent 381aed09a6
commit bd4544dbd7
2 changed files with 8 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"clipboard-manager": "patch"
---
Fix reading and writing text on Android and iOS.
+3 -3
View File
@@ -37,7 +37,7 @@ impl<R: Runtime> Clipboard<R> {
pub fn write_text<'a, T: Into<Cow<'a, str>>>(&self, text: T) -> crate::Result<()> {
let text = text.into().to_string();
self.0
.run_mobile_plugin("write", ClipKind::PlainText { text, label: None })
.run_mobile_plugin("writeText", ClipKind::PlainText { text, label: None })
.map_err(Into::into)
}
@@ -50,7 +50,7 @@ impl<R: Runtime> Clipboard<R> {
let label = label.into().to_string();
self.0
.run_mobile_plugin(
"write",
"writeText",
ClipKind::PlainText {
text,
label: Some(label),
@@ -67,7 +67,7 @@ impl<R: Runtime> Clipboard<R> {
pub fn read_text(&self) -> crate::Result<String> {
self.0
.run_mobile_plugin("read", ())
.run_mobile_plugin("readText", ())
.map(|c| match c {
ClipboardContents::PlainText { text } => text,
})