-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(conversations): create conversation list with last message #1437
Conversation
…age' into mc/conversation-list-w-last-message
Co-authored-by: Dakota Brink <[email protected]>
@@ -1141,6 +1161,12 @@ pub struct FfiConversation { | |||
inner: MlsGroup<RustXmtpClient>, | |||
} | |||
|
|||
#[derive(uniffi::Object)] | |||
pub struct FfiConversationListItem { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
introduced this struct to avoid changing all the current functions!
@@ -965,6 +965,26 @@ impl FfiConversations { | |||
Ok(convo_list) | |||
} | |||
|
|||
pub async fn list_conversations( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default order is:
ORDER BY COALESCE(rm.sent_at_ns, g.created_at_ns) DESC
…age' into mc/conversation-list-w-last-message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
resolves #1181 |
@@ -947,6 +947,26 @@ impl FfiConversations { | |||
Ok(convo_list) | |||
} | |||
|
|||
pub async fn list_conversations( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand when this is supposed to be used instead of the list()
function above? cc @mchenani
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I saw in android, we fetched the conversations and the get the last message one by one and map them together.
we can replace it with this.
Summary:
Added a SQL view to represent the list of client conversations, including the last message in each conversation.
Context:
Previously, all conversations were loaded, and the last message for each conversation was fetched individually, resulting in inefficiencies.
Solution:
Introduced a SQL-level View to streamline fetching the conversation list, with each row including the latest message, improving performance and clarity.
close #1181