|
|
@ -18,7 +18,6 @@ abstract class NewsArticleBlocStates { |
|
|
|
|
|
|
|
|
|
|
|
class NewsArticleBloc extends InteractiveBloc implements NewsArticleBlocEvents, NewsArticleBlocStates { |
|
|
|
class NewsArticleBloc extends InteractiveBloc implements NewsArticleBlocEvents, NewsArticleBlocStates { |
|
|
|
NewsArticleBloc( |
|
|
|
NewsArticleBloc( |
|
|
|
this._client, |
|
|
|
|
|
|
|
this._newsArticlesBloc, |
|
|
|
this._newsArticlesBloc, |
|
|
|
final NewsArticle article, |
|
|
|
final NewsArticle article, |
|
|
|
) { |
|
|
|
) { |
|
|
@ -27,7 +26,6 @@ class NewsArticleBloc extends InteractiveBloc implements NewsArticleBlocEvents, |
|
|
|
starred.add(article.starred); |
|
|
|
starred.add(article.starred); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
final NextcloudClient _client; |
|
|
|
|
|
|
|
final NewsArticlesBloc _newsArticlesBloc; |
|
|
|
final NewsArticlesBloc _newsArticlesBloc; |
|
|
|
|
|
|
|
|
|
|
|
late final int _id; |
|
|
|
late final int _id; |
|
|
@ -51,7 +49,7 @@ class NewsArticleBloc extends InteractiveBloc implements NewsArticleBlocEvents, |
|
|
|
@override |
|
|
|
@override |
|
|
|
void markArticleAsRead() { |
|
|
|
void markArticleAsRead() { |
|
|
|
_wrapArticleAction(() async { |
|
|
|
_wrapArticleAction(() async { |
|
|
|
await _client.news.markArticleAsRead(itemId: _id); |
|
|
|
await _newsArticlesBloc.client.news.markArticleAsRead(itemId: _id); |
|
|
|
unread.add(false); |
|
|
|
unread.add(false); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
@ -59,7 +57,7 @@ class NewsArticleBloc extends InteractiveBloc implements NewsArticleBlocEvents, |
|
|
|
@override |
|
|
|
@override |
|
|
|
void markArticleAsUnread() { |
|
|
|
void markArticleAsUnread() { |
|
|
|
_wrapArticleAction(() async { |
|
|
|
_wrapArticleAction(() async { |
|
|
|
await _client.news.markArticleAsUnread(itemId: _id); |
|
|
|
await _newsArticlesBloc.client.news.markArticleAsUnread(itemId: _id); |
|
|
|
unread.add(true); |
|
|
|
unread.add(true); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
@ -67,7 +65,7 @@ class NewsArticleBloc extends InteractiveBloc implements NewsArticleBlocEvents, |
|
|
|
@override |
|
|
|
@override |
|
|
|
void starArticle() { |
|
|
|
void starArticle() { |
|
|
|
_wrapArticleAction(() async { |
|
|
|
_wrapArticleAction(() async { |
|
|
|
await _client.news.starArticle(itemId: _id); |
|
|
|
await _newsArticlesBloc.client.news.starArticle(itemId: _id); |
|
|
|
starred.add(true); |
|
|
|
starred.add(true); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
@ -75,7 +73,7 @@ class NewsArticleBloc extends InteractiveBloc implements NewsArticleBlocEvents, |
|
|
|
@override |
|
|
|
@override |
|
|
|
void unstarArticle() { |
|
|
|
void unstarArticle() { |
|
|
|
_wrapArticleAction(() async { |
|
|
|
_wrapArticleAction(() async { |
|
|
|
await _client.news.unstarArticle(itemId: _id); |
|
|
|
await _newsArticlesBloc.client.news.unstarArticle(itemId: _id); |
|
|
|
starred.add(false); |
|
|
|
starred.add(false); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|