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