desmos-labs / mooncake

The first decentralized social app based on Desmos
MIT License
46 stars 14 forks source link

Implement rich link preview inside posts #79

Closed RiccardoM closed 4 years ago

RiccardoM commented 4 years ago
## Feature description Currently when the user creates a post containing one or more link(s), the link appear as a simple clickable text. update: https://www.youtube.com/watch?v=sZQ4Ddtz2A4&feature=youtu.be another reference ![photo5803408760553714271](https://user-images.githubusercontent.com/9119016/87750625-3ef2b180-c7fc-11ea-97e9-332a5d7ba985.jpg) I think that in order to give the users a better experience, we should implement links previews. ## Implementation proposal Navigating across [pub.dev](https://pub.dev), I've found that it might be a good library to use to implement this: [rich_link_preview](https://pub.dev/packages/rich_link_preview). The way we could handle this is by getting any URL present inside the message body and using that to generate the link preview. Also, the following conditions should apply: - if the message has more than one link, take the last one; - if the message has one or more images, do not display the link preview; - if the message has a poll, do not display the link preview.
ryuash commented 4 years ago

@RiccardoM There is a version incompatibility

Because graphql >=4.0.0-alpha.0 depends on http ^0.12.1 and graphql <1.0.0 requires SDK version >=1.19.0 <2.0.0, graphql <1.0.0-∞ or >=4.0.0-alpha.0 requires http ^0.12.1.

And because graphql >=1.0.0 <3.0.0-beta.3 depends on http ^0.12.0+2 and graphql >=3.0.0-beta.3 <4.0.0-alpha.0 depends on http ^0.12.0+4, every version of graphql requires http ^0.12.0+2.

Because open_graph_parser >=0.0.2 <0.0.6 requires SDK version >=2.0.0 <2.2.0 and open_graph_parser >=0.0.6 depends on http >=0.11.3+17 <=0.12.0, open_graph_parser >=0.0.2 requires http >=0.11.3+17 <=0.12.0.

Thus, graphql is incompatible with open_graph_parser >=0.0.2.

And because every version of rich_link_preview depends on open_graph_parser ^0.0.4, graphql is incompatible with rich_link_preview.

So, because mooncake depends on both graphql any and rich_link_preview any, version solving failed.
pub get failed (1; So, because mooncake depends on both graphql any and rich_link_preview any, version solving failed.)
exit code 1
RiccardoM commented 4 years ago

@ryuash Looks like the library is outdated. What about we fork it and maybe update it/extend it? https://github.com/wingkwong/rich_link_preview

Another option could be to implement it ourselves from scratch but I would say that's a lot of work. Maybe getting that code into the app and customizing it might be better, leaving an open issue about later extracting it as an external library in the future