mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-07-14 16:37:22 +02:00
feat: update to alpha.17, typed mobile plugin IPC arguments (#676)
Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
This commit is contained in:
committed by
GitHub
parent
76cfdc32b4
commit
e438e0a62d
@@ -33,7 +33,7 @@ pub fn init<R: Runtime, C: DeserializeOwned>(
|
||||
impl<R: Runtime> crate::NotificationBuilder<R> {
|
||||
pub fn show(self) -> crate::Result<()> {
|
||||
self.handle
|
||||
.run_mobile_plugin::<ShowResponse>("show", self.data)
|
||||
.run_mobile_plugin::<i32>("show", self.data)
|
||||
.map(|_| ())
|
||||
.map_err(Into::into)
|
||||
}
|
||||
@@ -89,8 +89,7 @@ impl<R: Runtime> Notification<R> {
|
||||
|
||||
pub fn active(&self) -> crate::Result<Vec<ActiveNotification>> {
|
||||
self.0
|
||||
.run_mobile_plugin::<ActiveResponse>("getActive", ())
|
||||
.map(|r| r.notifications)
|
||||
.run_mobile_plugin("getActive", ())
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
@@ -102,8 +101,7 @@ impl<R: Runtime> Notification<R> {
|
||||
|
||||
pub fn pending(&self) -> crate::Result<Vec<PendingNotification>> {
|
||||
self.0
|
||||
.run_mobile_plugin::<PendingResponse>("getPending", ())
|
||||
.map(|r| r.notifications)
|
||||
.run_mobile_plugin("getPending", ())
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
@@ -138,34 +136,11 @@ impl<R: Runtime> Notification<R> {
|
||||
#[cfg(target_os = "android")]
|
||||
pub fn list_channels(&self) -> crate::Result<Vec<Channel>> {
|
||||
self.0
|
||||
.run_mobile_plugin::<ListChannelsResult>("listChannels", ())
|
||||
.map(|r| r.channels)
|
||||
.run_mobile_plugin("listChannels", ())
|
||||
.map_err(Into::into)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
#[derive(Deserialize)]
|
||||
struct ListChannelsResult {
|
||||
channels: Vec<Channel>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct PendingResponse {
|
||||
notifications: Vec<PendingNotification>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct ActiveResponse {
|
||||
notifications: Vec<ActiveNotification>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct ShowResponse {
|
||||
#[allow(dead_code)]
|
||||
id: i32,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct PermissionResponse {
|
||||
|
||||
Reference in New Issue
Block a user