mark posts as read when opening

This commit is contained in:
Lea 2023-01-01 02:05:19 +01:00
parent 3b44a0f535
commit d2f61e77b1
Signed by: Lea
GPG key ID: 1BAFFE8347019C42

View file

@ -32,11 +32,18 @@ class _HomepagePostState extends State<HomepagePost> {
: Theme.of(context).colorScheme.secondaryContainer.withAlpha(150), : Theme.of(context).colorScheme.secondaryContainer.withAlpha(150),
), ),
child: InkWell( child: InkWell(
onTap: () { onTap: () async {
Navigator.of(context).push( Navigator.of(context).push(
MaterialPageRoute( MaterialPageRoute(
builder: (context) => ArticlePage(article: post)), builder: (context) => ArticlePage(article: post)),
); );
if (!post.isRead) {
await post.api
.request()
.markItem(post, ItemMarkType.read)
.execute();
setState(() {});
}
}, },
onLongPress: () async { onLongPress: () async {
var theme = Theme.of(context); var theme = Theme.of(context);