fn did_receive_notification_response()

in native/desktop-macos/src/macos/notifications.rs [227:253]


        fn did_receive_notification_response(
            &self,
            _center: &UNUserNotificationCenter,
            response: &UNNotificationResponse,
            completion_handler: &block2::Block<dyn Fn()>,
        ) {
            catch_panic(|| {
                let ns_action_id = &response.actionIdentifier();
                let ns_notification_id = &response.notification().request().identifier();
                let action_id = copy_to_c_string(ns_action_id).unwrap().to_auto_drop();
                let notification_id = copy_to_c_string(ns_notification_id).unwrap().to_auto_drop();
                let callback = self.ivars().on_action;

                if MainThreadMarker::new().is_some() {
                    callback(action_id, notification_id);
                } else {
                    DispatchQueue::main().exec_sync(move || {
                        catch_panic(|| {
                            callback(action_id, notification_id);
                            Ok(())
                        });
                    });
                }
                completion_handler.call(());
                Ok(())
            });
        }