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

pull/1377/head
Emin Yilmaz 1 year ago committed by GitHub
parent 381aed09a6
commit bd4544dbd7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
"clipboard-manager": "patch"
---
Fix reading and writing text on Android and iOS.

@ -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,
})

Loading…
Cancel
Save