rust_macios/user_notifications/
un_text_input_notification_action.rs1use objc::{msg_send, sel, sel_impl};
2use rust_macios_objective_c_runtime_proc_macros::interface_impl;
3
4use crate::{foundation::NSString, object, objective_c_runtime::traits::FromId};
5
6use super::{IUNNotificationAction, UNNotificationActionIcon, UNNotificationActionOptions};
7
8object! {
9 unsafe pub struct UNTextInputNotificationAction;
10}
11
12impl IUNNotificationAction for UNTextInputNotificationAction {}
13
14#[interface_impl(UNNotificationAction)]
15impl UNTextInputNotificationAction {
16 #[method]
21 pub fn action_with_identifier_title_options_text_input_button_title_text_input_placeholder(
22 identifier: NSString,
23 title: NSString,
24 options: &[UNNotificationActionOptions],
25 text_input_button_title: NSString,
26 text_input_placeholder: NSString,
27 ) -> Self
28 where
29 Self: Sized + FromId,
30 {
31 unsafe {
32 Self::from_id(
33 msg_send![Self::m_class(), actionWithIdentifier: identifier title: title options: options textInputButtonTitle: text_input_button_title textInputPlaceholder: text_input_placeholder],
34 )
35 }
36 }
37
38 #[method]
40 pub fn action_with_identifier_title_options_icon_text_input_button_title_text_input_placeholder(
41 identifier: NSString,
42 title: NSString,
43 options: &[UNNotificationActionOptions],
44 icon: UNNotificationActionIcon,
45 text_input_button_title: NSString,
46 text_input_placeholder: NSString,
47 ) -> Self
48 where
49 Self: Sized + FromId,
50 {
51 unsafe {
52 Self::from_id(
53 msg_send![Self::m_class(), actionWithIdentifier: identifier title: title options: options icon: icon textInputButtonTitle: text_input_button_title textInputPlaceholder: text_input_placeholder],
54 )
55 }
56 }
57
58 #[property]
63 pub fn text_input_button_title(&self) -> NSString {
64 unsafe { NSString::from_id(msg_send![self.m_self(), textInputButtonTitle]) }
65 }
66
67 #[property]
69 pub fn text_input_placeholder(&self) -> NSString {
70 unsafe { NSString::from_id(msg_send![self.m_self(), textInputPlaceholder]) }
71 }
72}