|
|
@ -1,11 +1,4 @@ |
|
|
|
import 'dart:async'; |
|
|
|
part of '../app.dart'; |
|
|
|
|
|
|
|
|
|
|
|
import 'package:neon/src/apps/news/app.dart'; |
|
|
|
|
|
|
|
import 'package:neon/src/apps/news/blocs/news.dart'; |
|
|
|
|
|
|
|
import 'package:neon/src/models/account.dart'; |
|
|
|
|
|
|
|
import 'package:neon/src/neon.dart'; |
|
|
|
|
|
|
|
import 'package:nextcloud/nextcloud.dart'; |
|
|
|
|
|
|
|
import 'package:rxdart/rxdart.dart'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum FilterType { |
|
|
|
enum FilterType { |
|
|
|
all, |
|
|
|
all, |
|
|
@ -49,8 +42,8 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents |
|
|
|
NewsArticlesBloc( |
|
|
|
NewsArticlesBloc( |
|
|
|
this._newsBloc, |
|
|
|
this._newsBloc, |
|
|
|
this.options, |
|
|
|
this.options, |
|
|
|
this._requestManager, |
|
|
|
this.requestManager, |
|
|
|
this._client, { |
|
|
|
this.client, { |
|
|
|
this.id, |
|
|
|
this.id, |
|
|
|
this.listType, |
|
|
|
this.listType, |
|
|
|
}) { |
|
|
|
}) { |
|
|
@ -66,8 +59,8 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents |
|
|
|
|
|
|
|
|
|
|
|
final NewsBloc _newsBloc; |
|
|
|
final NewsBloc _newsBloc; |
|
|
|
final NewsAppSpecificOptions options; |
|
|
|
final NewsAppSpecificOptions options; |
|
|
|
final RequestManager _requestManager; |
|
|
|
final RequestManager requestManager; |
|
|
|
final NextcloudClient _client; |
|
|
|
final NextcloudClient client; |
|
|
|
final int? id; |
|
|
|
final int? id; |
|
|
|
final ListType? listType; |
|
|
|
final ListType? listType; |
|
|
|
|
|
|
|
|
|
|
@ -132,11 +125,11 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
await _requestManager.wrapNextcloud<List<NewsArticle>, NewsListArticles>( |
|
|
|
await requestManager.wrapNextcloud<List<NewsArticle>, NewsListArticles>( |
|
|
|
_client.id, |
|
|
|
client.id, |
|
|
|
'news-articles-${type.code}-$id-$getRead', |
|
|
|
'news-articles-${type.code}-$id-$getRead', |
|
|
|
articles, |
|
|
|
articles, |
|
|
|
() async => _client.news.listArticles( |
|
|
|
() async => client.news.listArticles( |
|
|
|
type: type.code, |
|
|
|
type: type.code, |
|
|
|
id: id ?? 0, |
|
|
|
id: id ?? 0, |
|
|
|
getRead: getRead ?? true ? 1 : 0, |
|
|
|
getRead: getRead ?? true ? 1 : 0, |
|
|
@ -147,12 +140,12 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
void markArticleAsRead(final NewsArticle article) { |
|
|
|
void markArticleAsRead(final NewsArticle article) { |
|
|
|
wrapAction(() async => _client.news.markArticleAsRead(itemId: article.id)); |
|
|
|
wrapAction(() async => client.news.markArticleAsRead(itemId: article.id)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
void markArticleAsUnread(final NewsArticle article) { |
|
|
|
void markArticleAsUnread(final NewsArticle article) { |
|
|
|
wrapAction(() async => _client.news.markArticleAsUnread(itemId: article.id)); |
|
|
|
wrapAction(() async => client.news.markArticleAsUnread(itemId: article.id)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
@ -162,11 +155,11 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
void starArticle(final NewsArticle article) { |
|
|
|
void starArticle(final NewsArticle article) { |
|
|
|
wrapAction(() async => _client.news.starArticle(itemId: article.id)); |
|
|
|
wrapAction(() async => client.news.starArticle(itemId: article.id)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
void unstarArticle(final NewsArticle article) { |
|
|
|
void unstarArticle(final NewsArticle article) { |
|
|
|
wrapAction(() async => _client.news.unstarArticle(itemId: article.id)); |
|
|
|
wrapAction(() async => client.news.unstarArticle(itemId: article.id)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|