(&mut self)
| 1910 | } |
| 1911 | |
| 1912 | fn handle_share_session(&mut self) { |
| 1913 | let Some(session_id) = self.current_session_id() else { |
| 1914 | self.alert_dialog.set_message("No active session to share."); |
| 1915 | self.alert_dialog.open(); |
| 1916 | return; |
| 1917 | }; |
| 1918 | let Some(client) = self.context.get_api_client() else { |
| 1919 | return; |
| 1920 | }; |
| 1921 | match client.share_session(&session_id) { |
| 1922 | Ok(response) => { |
| 1923 | let _ = Clipboard::write_text(&response.url); |
| 1924 | self.alert_dialog.set_message(&format!( |
| 1925 | "Session shared. Link copied to clipboard:\n{}", |
| 1926 | response.url |
| 1927 | )); |
| 1928 | self.alert_dialog.open(); |
| 1929 | } |
| 1930 | Err(err) => { |
| 1931 | self.alert_dialog |
| 1932 | .set_message(&format!("Failed to share session:\n{}", err)); |
| 1933 | self.alert_dialog.open(); |
| 1934 | } |
| 1935 | } |
| 1936 | } |
| 1937 | |
| 1938 | fn handle_unshare_session(&mut self) { |
| 1939 | let Some(session_id) = self.current_session_id() else { |
no test coverage detected