Expose leave chat to iOS bridge

This commit is contained in:
Mikhail Kilin
2026-05-21 00:45:39 +03:00
parent 928a5aeda2
commit f7abd1dba0
7 changed files with 57 additions and 0 deletions

View File

@@ -249,6 +249,10 @@ impl<C: TdClientTrait> CoreSession<C> {
Ok(profile)
}
pub async fn leave_chat(&mut self, chat_id: ChatId) -> Result<(), String> {
self.client.leave_chat(chat_id).await
}
pub async fn set_draft(&mut self, chat_id: ChatId, text: String) -> Result<(), String> {
self.client.set_draft_message(chat_id, text.clone()).await?;
self.enqueue_event(CoreEvent::DraftChanged(CoreDraft { chat_id, text }));
@@ -851,6 +855,7 @@ mod tests {
session.emit_auth_state();
session.emit_network_state();
let loaded_profile = session.open_profile(ChatId::new(42)).await.unwrap();
session.leave_chat(ChatId::new(42)).await.unwrap();
session
.set_draft(ChatId::new(42), "Later".to_string())
.await