| 1 | //! Call notice payloads: i18n keys (and optional detail after [`NOTICE_DETAIL_SEP`]). |
| 2 | pub const NOTICE_DETAIL_SEP: char = '\u{1f}'; |
| 3 | |
| 4 | pub const CONSENT_FIRST_NOTICE: &str = "calls.notice.consent_first"; |
| 5 | pub const ON_HOLD_NOTICE: &str = "calls.notice.on_hold"; |
| 6 | pub const CHANGE_RUNNING_NOTICE: &str = "calls.notice.change_running"; |
| 7 | pub const VIDEO_FAILED_NOTICE: &str = "calls.notice.video_failed"; |
| 8 | pub const SHARE_QUEUED_NOTICE: &str = "calls.notice.share_queued"; |
| 9 | pub const SHARE_REFUSED_NOTICE: &str = "calls.notice.share_refused"; |
| 10 | pub const NOT_CONNECTED_FOR_VIDEO: &str = "calls.notice.video_starts_once_connected"; |
| 11 | pub const PORTAL_UNAVAILABLE_NOTICE: &str = "calls.notice.portal_unavailable"; |
| 12 | pub const SHARE_SOURCE_GONE_NOTICE: &str = "calls.notice.share_source_gone"; |
| 13 | pub const CALL_TRANSFERRED_NOTICE: &str = "calls.notice.call_transferred"; |
| 14 | pub const TRANSFER_FAILED_NOTICE: &str = "calls.notice.transfer_failed"; |
| 15 | pub const RECORDING_JOIN_FAILED_NOTICE: &str = "calls.notice.recording_join_failed"; |
| 16 | pub const ECHO_TEST_FAILED_NOTICE: &str = "calls.notice.echo_test_failed"; |
| 17 | pub const CAPTIONS_JOIN_FAILED_NOTICE: &str = "calls.notice.captions_join_failed"; |
| 18 | pub const CAPTION_LANGUAGE_FAILED_NOTICE: &str = "calls.notice.caption_language_failed"; |
| 19 | pub const CAMERA_START_NOTICE: &str = "calls.notice.camera_start"; |
| 20 | pub const CAMERA_RESTART_NOTICE: &str = "calls.notice.camera_restart"; |
| 21 | pub const SHARING_START_NOTICE: &str = "calls.notice.sharing_start"; |
| 22 | pub const RAISE_HAND_FAILED_NOTICE: &str = "calls.notice.raise_hand_failed"; |
| 23 | pub const LOWER_HAND_FAILED_NOTICE: &str = "calls.notice.lower_hand_failed"; |
| 24 | pub const LOWER_THAT_HAND_FAILED_NOTICE: &str = "calls.notice.lower_that_hand_failed"; |
| 25 | pub const LOWER_ALL_HANDS_FAILED_NOTICE: &str = "calls.notice.lower_all_hands_failed"; |
| 26 | pub const CONFIRM_RECORDING_FAILED_NOTICE: &str = "calls.notice.confirm_recording_failed"; |
| 27 | pub const HOLD_FAILED_NOTICE: &str = "calls.notice.hold_failed"; |
| 28 | pub const RESUME_FAILED_NOTICE: &str = "calls.notice.resume_failed"; |
| 29 | pub const TRANSFER_NOT_ALLOWED_NOTICE: &str = "calls.notice.transfer_not_allowed"; |
| 30 | pub const TRANSFER_CALL_FAILED_NOTICE: &str = "calls.notice.transfer_call_failed"; |
| 31 | pub const TRANSFERRING_NOTICE: &str = "calls.notice.transferring"; |
| 32 | pub const WHITEBOARDS_MEETINGS_ONLY_NOTICE: &str = "calls.notice.whiteboards_meetings_only"; |
| 33 | pub const WHITEBOARD_OPEN_FAILED_NOTICE: &str = "calls.notice.whiteboard_open_failed"; |
| 34 | pub const REACTION_FAILED_NOTICE: &str = "calls.notice.reaction_failed"; |
| 35 | pub const RECORDING_NOT_STARTED_NOTICE: &str = "calls.notice.recording_not_started"; |
| 36 | pub const RECORDING_START_FAILED_NOTICE: &str = "calls.notice.recording_start_failed"; |
| 37 | pub const CAPTIONS_START_FAILED_NOTICE: &str = "calls.notice.captions_start_failed"; |
| 38 | pub const HOLD_CHANGE_FAILED_NOTICE: &str = "calls.notice.hold_change_failed"; |
| 39 | pub const RECORDING_STOP_FAILED_NOTICE: &str = "calls.notice.recording_stop_failed"; |
| 40 | pub const BACKGROUND_IMAGE_FAILED_NOTICE: &str = "calls.notice.background_image_failed"; |
| 41 | pub const CAMERA_STOPPED_NOTICE: &str = "calls.notice.camera_stopped"; |
| 42 | pub const SCREEN_SHARE_STOPPED_NOTICE: &str = "calls.notice.screen_share_stopped"; |
| 43 | pub const ADMIT_FAILED_NOTICE: &str = "calls.notice.admit_failed"; |
| 44 | pub const ADMIT_ALL_FAILED_NOTICE: &str = "calls.notice.admit_all_failed"; |
| 45 | pub const DENY_FAILED_NOTICE: &str = "calls.notice.deny_failed"; |
| 46 | pub const REMOVE_PARTICIPANT_FAILED_NOTICE: &str = "calls.notice.remove_participant_failed"; |
| 47 | pub const MUTE_PARTICIPANT_FAILED_NOTICE: &str = "calls.notice.mute_participant_failed"; |
| 48 | pub const MUTE_ALL_FAILED_NOTICE: &str = "calls.notice.mute_all_failed"; |
| 49 | pub const MEETING_LOCK_FAILED_NOTICE: &str = "calls.notice.meeting_lock_failed"; |
| 50 | pub const CHANGE_ROLE_FAILED_NOTICE: &str = "calls.notice.change_role_failed"; |
| 51 | pub const MIC_SETTING_FAILED_NOTICE: &str = "calls.notice.mic_setting_failed"; |
| 52 | pub const CAMERA_SETTING_FAILED_NOTICE: &str = "calls.notice.camera_setting_failed"; |
| 53 | pub const ATTENDEE_SETTINGS_FAILED_NOTICE: &str = "calls.notice.attendee_settings_failed"; |
| 54 | pub const INVITE_PERSON_FAILED_NOTICE: &str = "calls.notice.invite_person_failed"; |
| 55 | pub const SPOTLIGHT_FAILED_NOTICE: &str = "calls.notice.spotlight_failed"; |
| 56 | pub const STOP_SPOTLIGHT_FAILED_NOTICE: &str = "calls.notice.stop_spotlight_failed"; |
| 57 | |
| 58 | pub fn notice_with_detail(key: &'static str, detail: impl std::fmt::Display) -> String { |
| 59 | format!("{key}{NOTICE_DETAIL_SEP}{detail}") |
| 60 | } |
| 61 | |
| 62 | #[cfg(test)] |
| 63 | mod tests { |
| 64 | use super::*; |
| 65 | |
| 66 | #[test] |
| 67 | fn notice_id_fixed_keys_match_catalog_paths() { |
| 68 | assert_eq!(CONSENT_FIRST_NOTICE, "calls.notice.consent_first"); |
| 69 | assert_eq!(ON_HOLD_NOTICE, "calls.notice.on_hold"); |
| 70 | assert_eq!(CHANGE_RUNNING_NOTICE, "calls.notice.change_running"); |
| 71 | assert_eq!(VIDEO_FAILED_NOTICE, "calls.notice.video_failed"); |
| 72 | assert_eq!(SHARE_QUEUED_NOTICE, "calls.notice.share_queued"); |
| 73 | assert_eq!(SHARE_REFUSED_NOTICE, "calls.notice.share_refused"); |
| 74 | assert_eq!( |
| 75 | NOT_CONNECTED_FOR_VIDEO, |
| 76 | "calls.notice.video_starts_once_connected" |
| 77 | ); |
| 78 | assert_eq!(PORTAL_UNAVAILABLE_NOTICE, "calls.notice.portal_unavailable"); |
| 79 | assert_eq!(SHARE_SOURCE_GONE_NOTICE, "calls.notice.share_source_gone"); |
| 80 | assert_eq!(CALL_TRANSFERRED_NOTICE, "calls.notice.call_transferred"); |
| 81 | assert_eq!(TRANSFER_FAILED_NOTICE, "calls.notice.transfer_failed"); |
| 82 | assert_eq!( |
| 83 | RECORDING_JOIN_FAILED_NOTICE, |
| 84 | "calls.notice.recording_join_failed" |
| 85 | ); |
| 86 | assert_eq!(ECHO_TEST_FAILED_NOTICE, "calls.notice.echo_test_failed"); |
| 87 | assert_eq!( |
| 88 | CAPTIONS_JOIN_FAILED_NOTICE, |
| 89 | "calls.notice.captions_join_failed" |
| 90 | ); |
| 91 | assert_eq!( |
| 92 | CAPTION_LANGUAGE_FAILED_NOTICE, |
| 93 | "calls.notice.caption_language_failed" |
| 94 | ); |
| 95 | assert_eq!(CAMERA_START_NOTICE, "calls.notice.camera_start"); |
| 96 | assert_eq!(CAMERA_RESTART_NOTICE, "calls.notice.camera_restart"); |
| 97 | assert_eq!(SHARING_START_NOTICE, "calls.notice.sharing_start"); |
| 98 | assert_eq!(RAISE_HAND_FAILED_NOTICE, "calls.notice.raise_hand_failed"); |
| 99 | assert_eq!(TRANSFERRING_NOTICE, "calls.notice.transferring"); |
| 100 | assert_eq!(ADMIT_FAILED_NOTICE, "calls.notice.admit_failed"); |
| 101 | assert_eq!( |
| 102 | BACKGROUND_IMAGE_FAILED_NOTICE, |
| 103 | "calls.notice.background_image_failed" |
| 104 | ); |
| 105 | } |
| 106 | |
| 107 | #[test] |
| 108 | fn notice_id_camera_payload_uses_key_and_detail_sep() { |
| 109 | let payload = notice_with_detail(CAMERA_START_NOTICE, "device busy"); |
| 110 | assert!(payload.starts_with("calls.notice.camera_start")); |
| 111 | assert!(payload.contains(NOTICE_DETAIL_SEP)); |
| 112 | assert!(payload.ends_with("device busy")); |
| 113 | } |
| 114 | } |