issues #81: Display link previews beneath a message containing a link
Fixes #81 Remaining Issue:
1. Due to the complexity of the page, many web pages cannot display the preview.
2. The preview card requires scrolling the page to be displayed.
You need to pass the ci first.
You need to pass the ci first.
done
One other issue, when there is more than one link, is the display of this card only one or, all of them, and when displaying too many cards, does it take up too much vertical space in the room_screen?
- Other than that, I think our
MatrixRequestcould have been simpler.
we just need url to fetch the description, title and preview image.
MatrixRequest::FetchLinkPreview { url } => {
let _fetch_task = Handle::current().spawn(async move {
let preview_service = url_preview::PreviewService::with_no_cache();
match preview_service.generate_preview(&url).await {
Ok(preview) => {
log!("preview data: {:?}", preview);
},
Err(e) => {
log!("Failed to fetch link preview card for {url}: {e}");
}
};
});
}
when we get the preview data, then we store to chace or use Cx::post_action(Some); pass the data to the widget
-
We can use
LinkPreviewname to replace theCardname. also same to change thecard_cache. -
It seems we don't need to change much of the code in
room_screen, just handle it inhtml_or_plaintext.
you can see this PR #390
The latest branch move to https://github.com/project-robius/robrix/pull/556