Leaving conversations
Through the WireApplicationManager you can leave group conversations. Here is an example for both on the standalone way:
Use Case: Leave the latest group conversation
- Kotlin
- Java
val applicationManager = wireAppSdk.getApplicationManager()
val latestConversation = applicationManager.getStoredConversations().last {
it.type == Conversation.Type.GROUP
}
applicationManager.leaveConversationSuspending(conversationId = latestConversation.id)
WireApplicationManager applicationManager = wireAppSdk.getApplicationManager();
Conversation latestConversation = null;
for (Conversation conversation : applicationManager.getStoredConversations()) {
if (conversation.type() == Conversation.Type.GROUP) {
latestConversation = conversation;
}
}
if (latestConversation == null) {
throw new NoSuchElementException("No group conversation found");
}
applicationManager.leaveConversation(latestConversation.id());