|
|
|
@ -21,9 +21,9 @@ abstract class NewsBlocEvents {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
abstract class NewsBlocStates { |
|
|
|
|
BehaviorSubject<Result<List<NextcloudNewsFolder>>> get folders; |
|
|
|
|
BehaviorSubject<Result<List<NewsFolder>>> get folders; |
|
|
|
|
|
|
|
|
|
BehaviorSubject<Result<List<NextcloudNewsFeed>>> get feeds; |
|
|
|
|
BehaviorSubject<Result<List<NewsFeed>>> get feeds; |
|
|
|
|
|
|
|
|
|
BehaviorSubject<int> get unreadCounter; |
|
|
|
|
} |
|
|
|
@ -78,16 +78,16 @@ class NewsBloc extends InteractiveBloc implements NewsBlocEvents, NewsBlocStates
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
BehaviorSubject<Result<List<NextcloudNewsFeed>>> feeds = BehaviorSubject<Result<List<NextcloudNewsFeed>>>(); |
|
|
|
|
BehaviorSubject<Result<List<NewsFeed>>> feeds = BehaviorSubject<Result<List<NewsFeed>>>(); |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
BehaviorSubject<Result<List<NextcloudNewsFolder>>> folders = BehaviorSubject<Result<List<NextcloudNewsFolder>>>(); |
|
|
|
|
BehaviorSubject<Result<List<NewsFolder>>> folders = BehaviorSubject<Result<List<NewsFolder>>>(); |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
BehaviorSubject<int> unreadCounter = BehaviorSubject<int>(); |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
late BehaviorSubject<Result<List<NextcloudNewsArticle>>> articles = mainArticlesBloc.articles; |
|
|
|
|
late BehaviorSubject<Result<List<NewsArticle>>> articles = mainArticlesBloc.articles; |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
late BehaviorSubject<FilterType> filterType = mainArticlesBloc.filterType; |
|
|
|
@ -95,14 +95,14 @@ class NewsBloc extends InteractiveBloc implements NewsBlocEvents, NewsBlocStates
|
|
|
|
|
@override |
|
|
|
|
Future refresh() async { |
|
|
|
|
await Future.wait([ |
|
|
|
|
requestManager.wrapNextcloud<List<NextcloudNewsFolder>, NextcloudNewsListFolders>( |
|
|
|
|
requestManager.wrapNextcloud<List<NewsFolder>, NewsListFolders>( |
|
|
|
|
client.id, |
|
|
|
|
'news-folders', |
|
|
|
|
folders, |
|
|
|
|
() async => client.news.listFolders(), |
|
|
|
|
(final response) => response.folders.toList(), |
|
|
|
|
), |
|
|
|
|
requestManager.wrapNextcloud<List<NextcloudNewsFeed>, NextcloudNewsListFeeds>( |
|
|
|
|
requestManager.wrapNextcloud<List<NewsFeed>, NewsListFeeds>( |
|
|
|
|
client.id, |
|
|
|
|
'news-feeds', |
|
|
|
|
feeds, |
|
|
|
@ -165,12 +165,12 @@ class NewsBloc extends InteractiveBloc implements NewsBlocEvents, NewsBlocStates
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
void markArticleAsRead(final NextcloudNewsArticle article) { |
|
|
|
|
void markArticleAsRead(final NewsArticle article) { |
|
|
|
|
mainArticlesBloc.markArticleAsRead(article); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
void markArticleAsUnread(final NextcloudNewsArticle article) { |
|
|
|
|
void markArticleAsUnread(final NewsArticle article) { |
|
|
|
|
mainArticlesBloc.markArticleAsUnread(article); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -180,12 +180,12 @@ class NewsBloc extends InteractiveBloc implements NewsBlocEvents, NewsBlocStates
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
void starArticle(final NextcloudNewsArticle article) { |
|
|
|
|
void starArticle(final NewsArticle article) { |
|
|
|
|
mainArticlesBloc.starArticle(article); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
void unstarArticle(final NextcloudNewsArticle article) { |
|
|
|
|
void unstarArticle(final NewsArticle article) { |
|
|
|
|
mainArticlesBloc.unstarArticle(article); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|