diff --git a/src/lib.rs b/src/lib.rs index a9147194..ccced5c5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,7 +10,6 @@ //! `recv_timeout`. The request is handled in another thread and the response is //! sent through a channel to the thread calling the method. -#[macro_use] extern crate solicit; extern crate rustc_serialize; extern crate time; diff --git a/src/payload.rs b/src/payload.rs index 396f1a11..07891002 100644 --- a/src/payload.rs +++ b/src/payload.rs @@ -29,6 +29,24 @@ impl Payload { sound: Some(sound.into()), content_available: None, category: category, + mutable_content: false, + }, + custom: custom_data, + } + } + + pub fn new_mutable(alert: APSLocalizedAlert, sound: S, badge: Option, category: Option, + custom_data: Option) -> Payload + where S: Into + { + Payload { + aps: APS { + alert: Some(APSAlert::Localized(alert)), + badge: badge, + sound: Some(sound.into()), + content_available: None, + category: category, + mutable_content: true, }, custom: custom_data, } @@ -42,6 +60,7 @@ impl Payload { sound: None, content_available: Some(1), category: None, + mutable_content: false, }, custom: custom_data, } @@ -90,6 +109,9 @@ pub struct APS { /// Provide this key with a string value that represents the identifier property. pub category: Option, + + /// Can the client modify the alert before showing it to the user + pub mutable_content: bool, } impl ToJson for APS { @@ -116,6 +138,9 @@ impl ToJson for APS { if let Some(ref category) = self.category { d.insert("category".to_string(), category.to_json()); } + if self.mutable_content { + d.insert("mutable-content".to_string(), 1.to_json()); + } Json::Object(d) } }