diff --git a/packages/neon/neon/lib/src/models/account.dart b/packages/neon/neon/lib/src/models/account.dart index 93ce1391..b85c624d 100644 --- a/packages/neon/neon/lib/src/models/account.dart +++ b/packages/neon/neon/lib/src/models/account.dart @@ -66,6 +66,8 @@ class Account implements Credentials { String get id => client.id; + String get humanReadableID => client.humanReadableID; + final NextcloudClient _client; NextcloudClient get client => _client; diff --git a/packages/neon/neon/lib/src/models/app_implementation.dart b/packages/neon/neon/lib/src/models/app_implementation.dart index 427e7e19..5c387cff 100644 --- a/packages/neon/neon/lib/src/models/app_implementation.dart +++ b/packages/neon/neon/lib/src/models/app_implementation.dart @@ -11,7 +11,6 @@ import 'package:neon/src/settings/models/nextcloud_app_options.dart'; import 'package:neon/src/settings/models/storage.dart'; import 'package:neon/src/utils/request_manager.dart'; import 'package:neon/src/widgets/drawer_destination.dart'; -import 'package:nextcloud/nextcloud.dart'; import 'package:provider/provider.dart'; import 'package:rxdart/rxdart.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -40,9 +39,9 @@ abstract class AppImplementation final Map blocs = {}; - T getBloc(final Account account) => blocs[account.id] ??= buildBloc(account.client); + T getBloc(final Account account) => blocs[account.id] ??= buildBloc(account); - T buildBloc(final NextcloudClient client); + T buildBloc(final Account account); Provider get blocProvider => Provider( create: (final context) { diff --git a/packages/neon/neon/lib/src/pages/account_settings.dart b/packages/neon/neon/lib/src/pages/account_settings.dart index 21e752c4..d0aa50d3 100644 --- a/packages/neon/neon/lib/src/pages/account_settings.dart +++ b/packages/neon/neon/lib/src/pages/account_settings.dart @@ -30,7 +30,7 @@ class AccountSettingsPage extends StatelessWidget { Widget build(final BuildContext context) { final options = bloc.getOptionsFor(account); final userDetailsBloc = bloc.getUserDetailsBlocFor(account); - final name = account.client.humanReadableID; + final name = account.humanReadableID; final appBar = AppBar( title: Text(name), @@ -39,7 +39,7 @@ class AccountSettingsPage extends StatelessWidget { onPressed: () async { if (await showConfirmationDialog( context, - AppLocalizations.of(context).accountOptionsRemoveConfirm(account.client.humanReadableID), + AppLocalizations.of(context).accountOptionsRemoveConfirm(account.humanReadableID), )) { final isActive = bloc.activeAccount.valueOrNull == account; diff --git a/packages/neon/neon/lib/src/utils/global_options.dart b/packages/neon/neon/lib/src/utils/global_options.dart index f0fccbe7..15657168 100644 --- a/packages/neon/neon/lib/src/utils/global_options.dart +++ b/packages/neon/neon/lib/src/utils/global_options.dart @@ -107,7 +107,7 @@ class GlobalOptions { } initialAccount.values = { for (final account in accounts) ...{ - account.id: (final context) => account.client.humanReadableID, + account.id: (final context) => account.humanReadableID, }, }; } diff --git a/packages/neon/neon/lib/src/utils/push_utils.dart b/packages/neon/neon/lib/src/utils/push_utils.dart index 5e6623c2..af42b13b 100644 --- a/packages/neon/neon/lib/src/utils/push_utils.dart +++ b/packages/neon/neon/lib/src/utils/push_utils.dart @@ -160,7 +160,7 @@ class PushUtils { android: AndroidNotificationDetails( appID, appName ?? appID, - subText: accounts.length > 1 && account != null ? account.client.humanReadableID : null, + subText: accounts.length > 1 && account != null ? account.humanReadableID : null, groupKey: 'app_$appID', icon: '@mipmap/ic_launcher', largeIcon: largeIconBitmap, diff --git a/packages/neon/neon/lib/src/widgets/account_tile.dart b/packages/neon/neon/lib/src/widgets/account_tile.dart index 390865c1..bffa171f 100644 --- a/packages/neon/neon/lib/src/widgets/account_tile.dart +++ b/packages/neon/neon/lib/src/widgets/account_tile.dart @@ -90,7 +90,7 @@ class NeonAccountTile extends StatelessWidget { ), ), subtitle: Text( - account.client.humanReadableID, + account.humanReadableID, style: Theme.of(context).textTheme.bodySmall!.copyWith( color: textColor, ), diff --git a/packages/neon/neon/lib/src/widgets/app_bar.dart b/packages/neon/neon/lib/src/widgets/app_bar.dart index 8933c57e..f008a1c6 100644 --- a/packages/neon/neon/lib/src/widgets/app_bar.dart +++ b/packages/neon/neon/lib/src/widgets/app_bar.dart @@ -71,7 +71,7 @@ class NeonAppBar extends StatelessWidget implements PreferredSizeWidget { ), if (accounts.length > 1) ...[ Text( - account.client.humanReadableID, + account.humanReadableID, style: Theme.of(context).textTheme.bodySmall, ), ], @@ -140,7 +140,7 @@ class _NotificationIconButtonState extends State { Text(app.name(context)), if (_accounts.length > 1) ...[ Text( - _account.client.humanReadableID, + _account.humanReadableID, style: Theme.of(context).textTheme.bodySmall, ), ], diff --git a/packages/neon/neon_files/lib/blocs/browser.dart b/packages/neon/neon_files/lib/blocs/browser.dart index e3fff3f8..4c893b18 100644 --- a/packages/neon/neon_files/lib/blocs/browser.dart +++ b/packages/neon/neon_files/lib/blocs/browser.dart @@ -16,14 +16,14 @@ class FilesBrowserBloc extends InteractiveBloc implements FilesBrowserBlocEvents FilesBrowserBloc( this._requestManager, this.options, - this.client, + this.account, ) { unawaited(refresh()); } final RequestManager _requestManager; final FilesAppSpecificOptions options; - final NextcloudClient client; + final Account account; @override void dispose() { @@ -41,10 +41,10 @@ class FilesBrowserBloc extends InteractiveBloc implements FilesBrowserBlocEvents @override Future refresh() async { await _requestManager.wrapWebDav>( - client.id, + account.id, 'files-${path.value.join('/')}', files, - () async => client.webdav.propfind( + () async => account.client.webdav.propfind( path.value.join('/'), prop: WebDavPropWithoutValues.fromBools( davgetcontenttype: true, @@ -69,6 +69,6 @@ class FilesBrowserBloc extends InteractiveBloc implements FilesBrowserBlocEvents @override void createFolder(final List path) { - wrapAction(() async => client.webdav.mkcol(path.join('/'))); + wrapAction(() async => account.client.webdav.mkcol(path.join('/'))); } } diff --git a/packages/neon/neon_files/lib/blocs/files.dart b/packages/neon/neon_files/lib/blocs/files.dart index 005d74f6..414ad37e 100644 --- a/packages/neon/neon_files/lib/blocs/files.dart +++ b/packages/neon/neon_files/lib/blocs/files.dart @@ -29,7 +29,7 @@ abstract class FilesBlocStates { class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocStates { FilesBloc( this.options, - this.client, + this.account, this._requestManager, this._platform, ) { @@ -38,7 +38,7 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta } final FilesAppSpecificOptions options; - final NextcloudClient client; + final Account account; final RequestManager _requestManager; final NeonPlatform _platform; late final browser = getNewFilesBrowserBloc(); @@ -66,7 +66,7 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta @override void addFavorite(final List path) { wrapAction( - () async => client.webdav.proppatch( + () async => account.client.webdav.proppatch( path.join('/'), set: WebDavProp(ocfavorite: 1), ), @@ -75,17 +75,17 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta @override void copy(final List path, final List destination) { - wrapAction(() async => client.webdav.copy(path.join('/'), destination.join('/'))); + wrapAction(() async => account.client.webdav.copy(path.join('/'), destination.join('/'))); } @override void delete(final List path) { - wrapAction(() async => client.webdav.delete(path.join('/'))); + wrapAction(() async => account.client.webdav.delete(path.join('/'))); } @override void move(final List path, final List destination) { - wrapAction(() async => client.webdav.move(path.join('/'), destination.join('/'))); + wrapAction(() async => account.client.webdav.move(path.join('/'), destination.join('/'))); } @override @@ -124,7 +124,7 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta @override void removeFavorite(final List path) { wrapAction( - () async => client.webdav.proppatch( + () async => account.client.webdav.proppatch( path.join('/'), set: WebDavProp(ocfavorite: 0), ), @@ -134,7 +134,7 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta @override void rename(final List path, final String name) { wrapAction( - () async => client.webdav.move( + () async => account.client.webdav.move( path.join('/'), (path.sublist(0, path.length - 1)..add(name)).join('/'), ), @@ -148,7 +148,7 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta final file = File( p.join( await _platform.getUserAccessibleAppDataPath(), - client.humanReadableID, + account.humanReadableID, 'files', path.join(Platform.pathSeparator), ), @@ -175,7 +175,7 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta lastModified: stat.modified, ); uploadTasks.add(uploadTasks.value..add(task)); - await _uploadQueue.add(() => task.execute(client, file.openRead())); + await _uploadQueue.add(() => task.execute(account.client, file.openRead())); uploadTasks.add(uploadTasks.value..removeWhere((final t) => t == task)); }, disableTimeout: true, @@ -192,14 +192,14 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta path: path, ); downloadTasks.add(downloadTasks.value..add(task)); - await _downloadQueue.add(() => task.execute(client, sink)); + await _downloadQueue.add(() => task.execute(account.client, sink)); downloadTasks.add(downloadTasks.value..removeWhere((final t) => t == task)); } finally { await sink.close(); } } - FilesBrowserBloc getNewFilesBrowserBloc() => FilesBrowserBloc(_requestManager, options, client); + FilesBrowserBloc getNewFilesBrowserBloc() => FilesBrowserBloc(_requestManager, options, account); void _downloadParalelismListener() { _downloadQueue.parallel = options.downloadQueueParallelism.value; diff --git a/packages/neon/neon_files/lib/neon_files.dart b/packages/neon/neon_files/lib/neon_files.dart index d830140f..59d1a17c 100644 --- a/packages/neon/neon_files/lib/neon_files.dart +++ b/packages/neon/neon_files/lib/neon_files.dart @@ -61,9 +61,9 @@ class FilesApp extends AppImplementation { FilesAppSpecificOptions buildOptions(final AppStorage storage) => FilesAppSpecificOptions(storage); @override - FilesBloc buildBloc(final NextcloudClient client) => FilesBloc( + FilesBloc buildBloc(final Account account) => FilesBloc( options, - client, + account, requestManager, platform, ); diff --git a/packages/neon/neon_news/lib/blocs/article.dart b/packages/neon/neon_news/lib/blocs/article.dart index fc6efef3..5795ff6f 100644 --- a/packages/neon/neon_news/lib/blocs/article.dart +++ b/packages/neon/neon_news/lib/blocs/article.dart @@ -49,7 +49,7 @@ class NewsArticleBloc extends InteractiveBloc implements NewsArticleBlocEvents, @override void markArticleAsRead() { _wrapArticleAction(() async { - await _newsArticlesBloc.client.news.markArticleAsRead(itemId: _id); + await _newsArticlesBloc.account.client.news.markArticleAsRead(itemId: _id); unread.add(false); }); } @@ -57,7 +57,7 @@ class NewsArticleBloc extends InteractiveBloc implements NewsArticleBlocEvents, @override void markArticleAsUnread() { _wrapArticleAction(() async { - await _newsArticlesBloc.client.news.markArticleAsUnread(itemId: _id); + await _newsArticlesBloc.account.client.news.markArticleAsUnread(itemId: _id); unread.add(true); }); } @@ -65,7 +65,7 @@ class NewsArticleBloc extends InteractiveBloc implements NewsArticleBlocEvents, @override void starArticle() { _wrapArticleAction(() async { - await _newsArticlesBloc.client.news.starArticle(itemId: _id); + await _newsArticlesBloc.account.client.news.starArticle(itemId: _id); starred.add(true); }); } @@ -73,7 +73,7 @@ class NewsArticleBloc extends InteractiveBloc implements NewsArticleBlocEvents, @override void unstarArticle() { _wrapArticleAction(() async { - await _newsArticlesBloc.client.news.unstarArticle(itemId: _id); + await _newsArticlesBloc.account.client.news.unstarArticle(itemId: _id); starred.add(false); }); } diff --git a/packages/neon/neon_news/lib/blocs/articles.dart b/packages/neon/neon_news/lib/blocs/articles.dart index 74b6c494..78a715e6 100644 --- a/packages/neon/neon_news/lib/blocs/articles.dart +++ b/packages/neon/neon_news/lib/blocs/articles.dart @@ -34,7 +34,7 @@ class NewsMainArticlesBloc extends NewsArticlesBloc { super.newsBloc, super.options, super.requestManager, - super.client, + super.account, ); } @@ -43,7 +43,7 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents this._newsBloc, this.options, this.requestManager, - this.client, { + this.account, { this.id, this.listType, }) { @@ -60,7 +60,7 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents final NewsBloc _newsBloc; final NewsAppSpecificOptions options; final RequestManager requestManager; - final NextcloudClient client; + final Account account; final int? id; final ListType? listType; @@ -126,10 +126,10 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents } await requestManager.wrapNextcloud, NewsListArticles>( - client.id, + account.id, 'news-articles-${type.code}-$id-$getRead', articles, - () async => client.news.listArticles( + () async => account.client.news.listArticles( type: type.code, id: id ?? 0, getRead: getRead ?? true ? 1 : 0, @@ -140,12 +140,12 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents @override void markArticleAsRead(final NewsArticle article) { - wrapAction(() async => client.news.markArticleAsRead(itemId: article.id)); + wrapAction(() async => account.client.news.markArticleAsRead(itemId: article.id)); } @override void markArticleAsUnread(final NewsArticle article) { - wrapAction(() async => client.news.markArticleAsUnread(itemId: article.id)); + wrapAction(() async => account.client.news.markArticleAsUnread(itemId: article.id)); } @override @@ -155,11 +155,11 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents @override void starArticle(final NewsArticle article) { - wrapAction(() async => client.news.starArticle(itemId: article.id)); + wrapAction(() async => account.client.news.starArticle(itemId: article.id)); } @override void unstarArticle(final NewsArticle article) { - wrapAction(() async => client.news.unstarArticle(itemId: article.id)); + wrapAction(() async => account.client.news.unstarArticle(itemId: article.id)); } } diff --git a/packages/neon/neon_news/lib/blocs/news.dart b/packages/neon/neon_news/lib/blocs/news.dart index bb775bd0..e505f274 100644 --- a/packages/neon/neon_news/lib/blocs/news.dart +++ b/packages/neon/neon_news/lib/blocs/news.dart @@ -32,7 +32,7 @@ class NewsBloc extends InteractiveBloc implements NewsBlocEvents, NewsBlocStates NewsBloc( this.options, this.requestManager, - this.client, + this.account, ) { mainArticlesBloc.articles.listen((final result) { if (result.hasData) { @@ -52,12 +52,12 @@ class NewsBloc extends InteractiveBloc implements NewsBlocEvents, NewsBlocStates @override final RequestManager requestManager; @override - final NextcloudClient client; + final Account account; late final mainArticlesBloc = NewsMainArticlesBloc( this, options, requestManager, - client, + account, ); late int _newestItemId; @@ -96,17 +96,17 @@ class NewsBloc extends InteractiveBloc implements NewsBlocEvents, NewsBlocStates Future refresh() async { await Future.wait([ requestManager.wrapNextcloud, NewsListFolders>( - client.id, + account.id, 'news-folders', folders, - () async => client.news.listFolders(), + () async => account.client.news.listFolders(), (final response) => response.folders.toList(), ), requestManager.wrapNextcloud, NewsListFeeds>( - client.id, + account.id, 'news-feeds', feeds, - () async => client.news.listFeeds(), + () async => account.client.news.listFeeds(), (final response) { // This is a bit ugly, but IDGAF right now if (response.newestItemId != null) { @@ -121,47 +121,47 @@ class NewsBloc extends InteractiveBloc implements NewsBlocEvents, NewsBlocStates @override void addFeed(final String url, final int? folderId) { - wrapAction(() async => client.news.addFeed(url: url, folderId: folderId)); + wrapAction(() async => account.client.news.addFeed(url: url, folderId: folderId)); } @override void createFolder(final String name) { - wrapAction(() async => client.news.createFolder(name: name)); + wrapAction(() async => account.client.news.createFolder(name: name)); } @override void deleteFolder(final int folderId) { - wrapAction(() async => client.news.deleteFolder(folderId: folderId)); + wrapAction(() async => account.client.news.deleteFolder(folderId: folderId)); } @override void markFeedAsRead(final int feedId) { - wrapAction(() async => client.news.markFeedAsRead(feedId: feedId, newestItemId: _newestItemId)); + wrapAction(() async => account.client.news.markFeedAsRead(feedId: feedId, newestItemId: _newestItemId)); } @override void markFolderAsRead(final int folderId) { - wrapAction(() async => client.news.markFolderAsRead(folderId: folderId, newestItemId: _newestItemId)); + wrapAction(() async => account.client.news.markFolderAsRead(folderId: folderId, newestItemId: _newestItemId)); } @override void moveFeed(final int feedId, final int? folderId) { - wrapAction(() async => client.news.moveFeed(feedId: feedId, folderId: folderId)); + wrapAction(() async => account.client.news.moveFeed(feedId: feedId, folderId: folderId)); } @override void removeFeed(final int feedId) { - wrapAction(() async => client.news.deleteFeed(feedId: feedId)); + wrapAction(() async => account.client.news.deleteFeed(feedId: feedId)); } @override void renameFeed(final int feedId, final String feedTitle) { - wrapAction(() async => client.news.renameFeed(feedId: feedId, feedTitle: feedTitle)); + wrapAction(() async => account.client.news.renameFeed(feedId: feedId, feedTitle: feedTitle)); } @override void renameFolder(final int folderId, final String name) { - wrapAction(() async => client.news.renameFolder(folderId: folderId, name: name)); + wrapAction(() async => account.client.news.renameFolder(folderId: folderId, name: name)); } @override diff --git a/packages/neon/neon_news/lib/neon_news.dart b/packages/neon/neon_news/lib/neon_news.dart index 727a1f5a..8284e769 100644 --- a/packages/neon/neon_news/lib/neon_news.dart +++ b/packages/neon/neon_news/lib/neon_news.dart @@ -67,10 +67,10 @@ class NewsApp extends AppImplementation { NewsAppSpecificOptions buildOptions(final AppStorage storage) => NewsAppSpecificOptions(storage, platform); @override - NewsBloc buildBloc(final NextcloudClient client) => NewsBloc( + NewsBloc buildBloc(final Account account) => NewsBloc( options, requestManager, - client, + account, ); @override diff --git a/packages/neon/neon_news/lib/pages/feed.dart b/packages/neon/neon_news/lib/pages/feed.dart index c81f1be8..09fa438f 100644 --- a/packages/neon/neon_news/lib/pages/feed.dart +++ b/packages/neon/neon_news/lib/pages/feed.dart @@ -21,7 +21,7 @@ class NewsFeedPage extends StatelessWidget { bloc, bloc.options, bloc.requestManager, - bloc.client, + bloc.account, id: feed.id, listType: ListType.feed, ), diff --git a/packages/neon/neon_news/lib/widgets/folder_view.dart b/packages/neon/neon_news/lib/widgets/folder_view.dart index 62752f7d..c58743a3 100644 --- a/packages/neon/neon_news/lib/widgets/folder_view.dart +++ b/packages/neon/neon_news/lib/widgets/folder_view.dart @@ -48,7 +48,7 @@ class _NewsFolderViewState extends State { widget.bloc, widget.bloc.options, widget.bloc.requestManager, - widget.bloc.client, + widget.bloc.account, id: widget.folder.id, listType: ListType.folder, ), diff --git a/packages/neon/neon_notes/lib/blocs/note.dart b/packages/neon/neon_notes/lib/blocs/note.dart index b3a4eea3..88d4bf89 100644 --- a/packages/neon/neon_notes/lib/blocs/note.dart +++ b/packages/neon/neon_notes/lib/blocs/note.dart @@ -67,7 +67,7 @@ class NotesNoteBloc extends InteractiveBloc implements NotesNoteBlocEvents, Note @override void updateCategory(final String category) { _wrapAction( - (final etag) async => _notesBloc.client.notes.updateNote( + (final etag) async => _notesBloc.account.client.notes.updateNote( id: id, category: category, ifMatch: '"$etag"', @@ -78,7 +78,7 @@ class NotesNoteBloc extends InteractiveBloc implements NotesNoteBlocEvents, Note @override void updateContent(final String content) { _wrapAction( - (final etag) async => _notesBloc.client.notes.updateNote( + (final etag) async => _notesBloc.account.client.notes.updateNote( id: id, content: content, ifMatch: '"$etag"', @@ -89,7 +89,7 @@ class NotesNoteBloc extends InteractiveBloc implements NotesNoteBlocEvents, Note @override void updateTitle(final String title) { _wrapAction( - (final etag) async => _notesBloc.client.notes.updateNote( + (final etag) async => _notesBloc.account.client.notes.updateNote( id: id, title: title, ifMatch: '"$etag"', diff --git a/packages/neon/neon_notes/lib/blocs/notes.dart b/packages/neon/neon_notes/lib/blocs/notes.dart index 01900a31..f25386c6 100644 --- a/packages/neon/neon_notes/lib/blocs/notes.dart +++ b/packages/neon/neon_notes/lib/blocs/notes.dart @@ -26,14 +26,14 @@ class NotesBloc extends InteractiveBloc implements NotesBlocEvents, NotesBlocSta NotesBloc( this.options, this.requestManager, - this.client, + this.account, ) { unawaited(refresh()); } final NotesAppSpecificOptions options; final RequestManager requestManager; - final NextcloudClient client; + final Account account; @override void dispose() { @@ -47,10 +47,10 @@ class NotesBloc extends InteractiveBloc implements NotesBlocEvents, NotesBlocSta @override Future refresh() async { await requestManager.wrapNextcloud, BuiltList>( - client.id, + account.id, 'notes-notes', notes, - () async => client.notes.getNotes(), + () async => account.client.notes.getNotes(), List.from, ); } @@ -58,7 +58,7 @@ class NotesBloc extends InteractiveBloc implements NotesBlocEvents, NotesBlocSta @override void createNote({final String title = '', final String category = ''}) { wrapAction( - () async => client.notes.createNote( + () async => account.client.notes.createNote( title: title, category: category, ), @@ -67,7 +67,7 @@ class NotesBloc extends InteractiveBloc implements NotesBlocEvents, NotesBlocSta @override void deleteNote(final int id) { - wrapAction(() async => client.notes.deleteNote(id: id)); + wrapAction(() async => account.client.notes.deleteNote(id: id)); } @override @@ -80,7 +80,7 @@ class NotesBloc extends InteractiveBloc implements NotesBlocEvents, NotesBlocSta final bool? favorite, }) { wrapAction( - () async => client.notes.updateNote( + () async => account.client.notes.updateNote( id: id, title: title, category: category, diff --git a/packages/neon/neon_notes/lib/neon_notes.dart b/packages/neon/neon_notes/lib/neon_notes.dart index e032f25f..eb2838f5 100644 --- a/packages/neon/neon_notes/lib/neon_notes.dart +++ b/packages/neon/neon_notes/lib/neon_notes.dart @@ -57,10 +57,10 @@ class NotesApp extends AppImplementation { NotesAppSpecificOptions buildOptions(final AppStorage storage) => NotesAppSpecificOptions(storage); @override - NotesBloc buildBloc(final NextcloudClient client) => NotesBloc( + NotesBloc buildBloc(final Account account) => NotesBloc( options, requestManager, - client, + account, ); @override diff --git a/packages/neon/neon_notifications/lib/blocs/notifications.dart b/packages/neon/neon_notifications/lib/blocs/notifications.dart index d246eeb6..82d1aec7 100644 --- a/packages/neon/neon_notifications/lib/blocs/notifications.dart +++ b/packages/neon/neon_notifications/lib/blocs/notifications.dart @@ -17,7 +17,7 @@ class NotificationsBloc extends InteractiveBloc NotificationsBloc( this.options, this._requestManager, - this._client, + this._account, ) { notifications.listen((final result) { if (result.hasData) { @@ -32,7 +32,7 @@ class NotificationsBloc extends InteractiveBloc @override final NotificationsAppSpecificOptions options; final RequestManager _requestManager; - final NextcloudClient _client; + final Account _account; late final NeonTimer _timer; @override @@ -53,21 +53,21 @@ class NotificationsBloc extends InteractiveBloc @override Future refresh() async { await _requestManager.wrapNextcloud, NotificationsListNotifications>( - _client.id, + _account.id, 'notifications-notifications', notifications, - () async => _client.notifications.listNotifications(), + () async => _account.client.notifications.listNotifications(), (final response) => response.ocs.data.toList(), ); } @override void deleteAllNotifications() { - wrapAction(() async => _client.notifications.deleteAllNotifications()); + wrapAction(() async => _account.client.notifications.deleteAllNotifications()); } @override void deleteNotification(final int id) { - wrapAction(() async => _client.notifications.deleteNotification(id: id)); + wrapAction(() async => _account.client.notifications.deleteNotification(id: id)); } } diff --git a/packages/neon/neon_notifications/lib/neon_notifications.dart b/packages/neon/neon_notifications/lib/neon_notifications.dart index a297768a..9c5c2661 100644 --- a/packages/neon/neon_notifications/lib/neon_notifications.dart +++ b/packages/neon/neon_notifications/lib/neon_notifications.dart @@ -37,10 +37,10 @@ class NotificationsApp extends AppImplementation NotificationsAppSpecificOptions(storage); @override - NotificationsBloc buildBloc(final NextcloudClient client) => NotificationsBloc( + NotificationsBloc buildBloc(final Account account) => NotificationsBloc( options, requestManager, - client, + account, ); @override