mirror of
https://github.com/chatmail/core.git
synced 2026-04-20 15:06:30 +03:00
add thumbnail for image in chatlist item (#4311)
* add thumbnail for image in chatlist item * added preview for stickers and gifs also * added last_message_type and last_message_id to ChatListItemFetchResult addresses link2ext comment * code optimization fixes: https://github.com/deltachat/deltachat-core-rust/pull/4311#discussion_r1162791672 * code formatting * fix clippy * add changelog entry --------- Co-authored-by: meganoahj <s3ccg@testrun.org> Co-authored-by: Simon Laux <mobile.info@simonlaux.de>
This commit is contained in:
@@ -50,6 +50,9 @@ pub struct Summary {
|
||||
|
||||
/// Message state.
|
||||
pub state: MessageState,
|
||||
|
||||
/// Message preview image path
|
||||
pub thumbnail_path: Option<String>,
|
||||
}
|
||||
|
||||
impl Summary {
|
||||
@@ -90,11 +93,22 @@ impl Summary {
|
||||
text = stock_str::reply_noun(context).await
|
||||
}
|
||||
|
||||
let thumbnail_path = if msg.viewtype == Viewtype::Image
|
||||
|| msg.viewtype == Viewtype::Gif
|
||||
|| msg.viewtype == Viewtype::Sticker
|
||||
{
|
||||
msg.get_file(context)
|
||||
.and_then(|path| path.to_str().map(|p| p.to_owned()))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
Self {
|
||||
prefix,
|
||||
text,
|
||||
timestamp: msg.get_timestamp(),
|
||||
state: msg.state,
|
||||
thumbnail_path,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user