diff --git a/packages/app/lib/apps.dart b/packages/app/lib/apps.dart index bf516df9..093bbc81 100644 --- a/packages/app/lib/apps.dart +++ b/packages/app/lib/apps.dart @@ -1,6 +1,5 @@ import 'package:neon/models.dart'; import 'package:neon/platform.dart'; -import 'package:neon/utils.dart'; import 'package:neon_files/neon_files.dart'; import 'package:neon_news/neon_news.dart'; import 'package:neon_notes/neon_notes.dart'; @@ -9,12 +8,11 @@ import 'package:shared_preferences/shared_preferences.dart'; List getAppImplementations( final SharedPreferences sharedPreferences, - final RequestManager requestManager, final NeonPlatform platform, ) => [ - FilesApp(sharedPreferences, requestManager, platform), - NewsApp(sharedPreferences, requestManager, platform), - NotesApp(sharedPreferences, requestManager, platform), - NotificationsApp(sharedPreferences, requestManager, platform), + FilesApp(sharedPreferences, platform), + NewsApp(sharedPreferences, platform), + NotesApp(sharedPreferences, platform), + NotificationsApp(sharedPreferences, platform), ]; diff --git a/packages/neon/neon/lib/neon.dart b/packages/neon/neon/lib/neon.dart index 9d01e322..ab74d0fc 100644 --- a/packages/neon/neon/lib/neon.dart +++ b/packages/neon/neon/lib/neon.dart @@ -19,8 +19,7 @@ import 'package:provider/provider.dart'; import 'package:shared_preferences/shared_preferences.dart'; Future runNeon({ - required final Iterable Function(SharedPreferences, RequestManager, NeonPlatform) - getAppImplementations, + required final Iterable Function(SharedPreferences, NeonPlatform) getAppImplementations, required final NeonTheme theme, @visibleForTesting final WidgetsBinding? bindingOverride, @visibleForTesting final Account? account, @@ -33,10 +32,8 @@ Future runNeon({ final sharedPreferences = await SharedPreferences.getInstance(); final platform = await getNeonPlatform(); - final cache = Cache(platform); - await cache.init(); - final requestManager = RequestManager(cache); - final allAppImplementations = getAppImplementations(sharedPreferences, requestManager, platform); + await RequestManager.instance.initCache(platform); + final allAppImplementations = getAppImplementations(sharedPreferences, platform); final packageInfo = await PackageInfo.fromPlatform(); buildUserAgent(packageInfo); @@ -47,7 +44,6 @@ Future runNeon({ ); final accountsBloc = AccountsBloc( - requestManager, platform, sharedPreferences, globalOptions, @@ -86,9 +82,6 @@ Future runNeon({ Provider( create: (final _) => globalOptions, ), - Provider( - create: (final _) => requestManager, - ), Provider( create: (final _) => accountsBloc, ), diff --git a/packages/neon/neon/lib/src/bloc/bloc.dart b/packages/neon/neon/lib/src/bloc/bloc.dart index f4ba59b8..d1e9b2bf 100644 --- a/packages/neon/neon/lib/src/bloc/bloc.dart +++ b/packages/neon/neon/lib/src/bloc/bloc.dart @@ -32,7 +32,7 @@ abstract class InteractiveBloc extends Bloc { if (disableTimeout) { await call(); } else { - await RequestManager.timeout(call); + await RequestManager.instance.timeout(call); } await (refresh ?? this.refresh)(); diff --git a/packages/neon/neon/lib/src/blocs/accounts.dart b/packages/neon/neon/lib/src/blocs/accounts.dart index f760beeb..26d3ff07 100644 --- a/packages/neon/neon/lib/src/blocs/accounts.dart +++ b/packages/neon/neon/lib/src/blocs/accounts.dart @@ -14,7 +14,6 @@ import 'package:neon/src/platform/platform.dart'; import 'package:neon/src/settings/models/storage.dart'; import 'package:neon/src/utils/account_options.dart'; import 'package:neon/src/utils/global_options.dart'; -import 'package:neon/src/utils/request_manager.dart'; import 'package:rxdart/rxdart.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -58,7 +57,6 @@ abstract interface class AccountsBlocStates { class AccountsBloc extends Bloc implements AccountsBlocEvents, AccountsBlocStates { AccountsBloc( - this._requestManager, this._platform, this._sharedPreferences, this._globalOptions, @@ -100,7 +98,6 @@ class AccountsBloc extends Bloc implements AccountsBlocEvents, AccountsBlocState } } - final RequestManager _requestManager; final NeonPlatform _platform; late final AppStorage _storage = AppStorage('accounts', _sharedPreferences); final SharedPreferences _sharedPreferences; @@ -237,7 +234,6 @@ class AccountsBloc extends Bloc implements AccountsBlocEvents, AccountsBlocState } return _appsBlocs[account.id] = AppsBloc( - _requestManager, getCapabilitiesBlocFor(account), this, account, @@ -258,10 +254,7 @@ class AccountsBloc extends Bloc implements AccountsBlocEvents, AccountsBlocState return _capabilitiesBlocs[account.id]!; } - return _capabilitiesBlocs[account.id] = CapabilitiesBloc( - _requestManager, - account, - ); + return _capabilitiesBlocs[account.id] = CapabilitiesBloc(account); } /// The userDetailsBloc for the [activeAccount]. @@ -277,10 +270,7 @@ class AccountsBloc extends Bloc implements AccountsBlocEvents, AccountsBlocState return _userDetailsBlocs[account.id]!; } - return _userDetailsBlocs[account.id] = UserDetailsBloc( - _requestManager, - account, - ); + return _userDetailsBlocs[account.id] = UserDetailsBloc(account); } /// The userStatusBloc for the [activeAccount]. diff --git a/packages/neon/neon/lib/src/blocs/apps.dart b/packages/neon/neon/lib/src/blocs/apps.dart index a04ae662..d3727017 100644 --- a/packages/neon/neon/lib/src/blocs/apps.dart +++ b/packages/neon/neon/lib/src/blocs/apps.dart @@ -41,7 +41,6 @@ abstract class AppsBlocStates { @internal class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates { AppsBloc( - this._requestManager, this._capabilitiesBloc, this._accountsBloc, this._account, @@ -151,7 +150,6 @@ class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates Iterable _filteredAppImplementations(final Iterable appIds) => _allAppImplementations.where((final a) => appIds.contains(a.id)); - final RequestManager _requestManager; final CapabilitiesBloc _capabilitiesBloc; final AccountsBloc _accountsBloc; final Account _account; @@ -195,7 +193,7 @@ class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates @override Future refresh() async { - await _requestManager + await RequestManager.instance .wrapNextcloud, CoreNavigationGetAppsNavigationResponse200ApplicationJson>( _account.id, 'apps-apps', diff --git a/packages/neon/neon/lib/src/blocs/capabilities.dart b/packages/neon/neon/lib/src/blocs/capabilities.dart index ce1a1a35..9bd04931 100644 --- a/packages/neon/neon/lib/src/blocs/capabilities.dart +++ b/packages/neon/neon/lib/src/blocs/capabilities.dart @@ -17,13 +17,11 @@ abstract class CapabilitiesBlocStates { @internal class CapabilitiesBloc extends InteractiveBloc implements CapabilitiesBlocEvents, CapabilitiesBlocStates { CapabilitiesBloc( - this._requestManager, this._account, ) { unawaited(refresh()); } - final RequestManager _requestManager; final Account _account; @override @@ -38,7 +36,7 @@ class CapabilitiesBloc extends InteractiveBloc implements CapabilitiesBlocEvents @override Future refresh() async { - await _requestManager.wrapNextcloud( _account.id, 'capabilities', diff --git a/packages/neon/neon/lib/src/blocs/user_details.dart b/packages/neon/neon/lib/src/blocs/user_details.dart index f1c7282d..1111bfeb 100644 --- a/packages/neon/neon/lib/src/blocs/user_details.dart +++ b/packages/neon/neon/lib/src/blocs/user_details.dart @@ -17,13 +17,11 @@ abstract class UserDetailsBlocStates { @internal class UserDetailsBloc extends InteractiveBloc implements UserDetailsBlocEvents, UserDetailsBlocStates { UserDetailsBloc( - this._requestManager, this._account, ) { unawaited(refresh()); } - final RequestManager _requestManager; final Account _account; @override @@ -38,7 +36,7 @@ class UserDetailsBloc extends InteractiveBloc implements UserDetailsBlocEvents, @override Future refresh() async { - await _requestManager + await RequestManager.instance .wrapNextcloud( _account.id, 'user-details', diff --git a/packages/neon/neon/lib/src/models/app_implementation.dart b/packages/neon/neon/lib/src/models/app_implementation.dart index 5c387cff..8ead9a8d 100644 --- a/packages/neon/neon/lib/src/models/app_implementation.dart +++ b/packages/neon/neon/lib/src/models/app_implementation.dart @@ -9,7 +9,6 @@ import 'package:neon/src/models/account.dart'; import 'package:neon/src/platform/platform.dart'; 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:provider/provider.dart'; import 'package:rxdart/rxdart.dart'; @@ -18,7 +17,6 @@ import 'package:shared_preferences/shared_preferences.dart'; abstract class AppImplementation { AppImplementation( final SharedPreferences sharedPreferences, - this.requestManager, this.platform, ) { final storage = AppStorage('app-$id', sharedPreferences); @@ -28,7 +26,6 @@ abstract class AppImplementation String get id; LocalizationsDelegate get localizationsDelegate; List get supportedLocales; - final RequestManager requestManager; final NeonPlatform platform; String nameFromLocalization(final AppLocalizations localizations) => localizations.appImplementationName(id); diff --git a/packages/neon/neon/lib/src/models/notifications_interface.dart b/packages/neon/neon/lib/src/models/notifications_interface.dart index 742be3a6..61bb56e6 100644 --- a/packages/neon/neon/lib/src/models/notifications_interface.dart +++ b/packages/neon/neon/lib/src/models/notifications_interface.dart @@ -6,7 +6,6 @@ abstract interface class NotificationsAppInterface extends AppImplementation { NotificationsAppInterface( super.sharedPreferences, - super.requestManager, super.platform, ); } diff --git a/packages/neon/neon/lib/src/utils/push_utils.dart b/packages/neon/neon/lib/src/utils/push_utils.dart index af42b13b..353bfc01 100644 --- a/packages/neon/neon/lib/src/utils/push_utils.dart +++ b/packages/neon/neon/lib/src/utils/push_utils.dart @@ -13,12 +13,10 @@ import 'package:neon/src/blocs/accounts.dart'; import 'package:neon/src/models/account.dart'; import 'package:neon/src/models/app_ids.dart'; import 'package:neon/src/models/push_notification.dart'; -import 'package:neon/src/platform/platform.dart'; import 'package:neon/src/settings/models/storage.dart'; import 'package:neon/src/theme/colors.dart'; import 'package:neon/src/utils/global.dart'; import 'package:neon/src/utils/localizations.dart'; -import 'package:neon/src/utils/request_manager.dart'; import 'package:nextcloud/nextcloud.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -96,10 +94,6 @@ class PushUtils { } else { final localizations = await appLocalizationsFromSystem(); - final platform = await getNeonPlatform(); - final cache = Cache(platform); - await cache.init(); - var accounts = []; Account? account; NotificationsNotification? notification; diff --git a/packages/neon/neon/lib/src/utils/request_manager.dart b/packages/neon/neon/lib/src/utils/request_manager.dart index 59084143..ea16dad4 100644 --- a/packages/neon/neon/lib/src/utils/request_manager.dart +++ b/packages/neon/neon/lib/src/utils/request_manager.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'package:flutter/foundation.dart'; +import 'package:meta/meta.dart'; import 'package:neon/src/bloc/result.dart'; import 'package:neon/src/platform/platform.dart'; import 'package:nextcloud/nextcloud.dart'; @@ -9,13 +10,24 @@ import 'package:rxdart/rxdart.dart'; import 'package:sqflite/sqflite.dart'; import 'package:xml/xml.dart' as xml; -@immutable class RequestManager { - const RequestManager([ - this.cache, - ]); + RequestManager(); - final Cache? cache; + @visibleForTesting + factory RequestManager.mocked(final RequestManager requestManager) => _requestManager = requestManager; + + static RequestManager? _requestManager; + + /// Gets the current instance of [RequestManager]. + // ignore: prefer_constructors_over_static_methods + static RequestManager get instance => _requestManager ??= RequestManager(); + + Future initCache(final NeonPlatform platform) async { + _cache = Cache(platform); + await _cache!.init(); + } + + Cache? _cache; Future wrapNextcloud( final String clientID, @@ -100,7 +112,7 @@ class RequestManager { try { final response = await (disableTimeout ? call() : timeout(call)); - await cache?.set(key, await compute(serialize, response)); + await _cache?.set(key, await compute(serialize, response)); subject.add(Result.success(unwrap(response))); } catch (e, s) { debugPrint(e.toString()); @@ -146,8 +158,8 @@ class RequestManager { ) async { T? cached; try { - if (cache != null && await cache!.has(key)) { - cached = unwrap(await compute(deserialize, (await cache!.get(key))!)); + if (_cache != null && await _cache!.has(key)) { + cached = unwrap(await compute(deserialize, (await _cache!.get(key))!)); } } catch (e, s) { debugPrint(e.toString()); @@ -167,12 +179,13 @@ class RequestManager { return false; } - static Future timeout( + Future timeout( final Future Function() call, ) => call().timeout(const Duration(seconds: 30)); } +@internal class Cache { Cache(this._platform); diff --git a/packages/neon/neon/lib/utils.dart b/packages/neon/neon/lib/utils.dart index 6f1522a1..a0ecb48e 100644 --- a/packages/neon/neon/lib/utils.dart +++ b/packages/neon/neon/lib/utils.dart @@ -3,5 +3,5 @@ export 'package:neon/src/utils/confirmation_dialog.dart'; export 'package:neon/src/utils/exceptions.dart'; export 'package:neon/src/utils/hex_color.dart'; export 'package:neon/src/utils/rename_dialog.dart'; -export 'package:neon/src/utils/request_manager.dart'; +export 'package:neon/src/utils/request_manager.dart' hide Cache; export 'package:neon/src/utils/validators.dart'; diff --git a/packages/neon/neon_files/lib/blocs/browser.dart b/packages/neon/neon_files/lib/blocs/browser.dart index 2b1092c0..d322e095 100644 --- a/packages/neon/neon_files/lib/blocs/browser.dart +++ b/packages/neon/neon_files/lib/blocs/browser.dart @@ -14,14 +14,12 @@ abstract class FilesBrowserBlocStates { class FilesBrowserBloc extends InteractiveBloc implements FilesBrowserBlocEvents, FilesBrowserBlocStates { FilesBrowserBloc( - this._requestManager, this.options, this.account, ) { unawaited(refresh()); } - final RequestManager _requestManager; final FilesAppSpecificOptions options; final Account account; @@ -40,7 +38,7 @@ class FilesBrowserBloc extends InteractiveBloc implements FilesBrowserBlocEvents @override Future refresh() async { - await _requestManager.wrapWebDav>( + await RequestManager.instance.wrapWebDav>( account.id, 'files-${path.value.join('/')}', files, diff --git a/packages/neon/neon_files/lib/blocs/files.dart b/packages/neon/neon_files/lib/blocs/files.dart index b6da7f78..182ba82e 100644 --- a/packages/neon/neon_files/lib/blocs/files.dart +++ b/packages/neon/neon_files/lib/blocs/files.dart @@ -28,7 +28,6 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta FilesBloc( this.options, this.account, - this._requestManager, this._platform, ) { options.uploadQueueParallelism.addListener(_uploadParalelismListener); @@ -37,7 +36,6 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta final FilesAppSpecificOptions options; final Account account; - final RequestManager _requestManager; final NeonPlatform _platform; late final browser = getNewFilesBrowserBloc(); @@ -185,7 +183,7 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta tasks.add(tasks.value..remove(task)); } - FilesBrowserBloc getNewFilesBrowserBloc() => FilesBrowserBloc(_requestManager, options, account); + FilesBrowserBloc getNewFilesBrowserBloc() => FilesBrowserBloc(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 0c0abcd4..a065ca17 100644 --- a/packages/neon/neon_files/lib/neon_files.dart +++ b/packages/neon/neon_files/lib/neon_files.dart @@ -44,7 +44,7 @@ part 'widgets/browser_view.dart'; part 'widgets/file_preview.dart'; class FilesApp extends AppImplementation { - FilesApp(super.sharedPreferences, super.requestManager, super.platform); + FilesApp(super.sharedPreferences, super.platform); @override String id = AppIDs.files; @@ -62,7 +62,6 @@ class FilesApp extends AppImplementation { FilesBloc buildBloc(final Account account) => FilesBloc( options, account, - requestManager, platform, ); diff --git a/packages/neon/neon_news/lib/blocs/articles.dart b/packages/neon/neon_news/lib/blocs/articles.dart index 210a2492..f8ae1f55 100644 --- a/packages/neon/neon_news/lib/blocs/articles.dart +++ b/packages/neon/neon_news/lib/blocs/articles.dart @@ -33,7 +33,6 @@ class NewsMainArticlesBloc extends NewsArticlesBloc { NewsMainArticlesBloc( super._newsBloc, super.options, - super.requestManager, super.account, ); } @@ -42,7 +41,6 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents NewsArticlesBloc( this._newsBloc, this.options, - this.requestManager, this.account, { this.id, this.listType, @@ -59,7 +57,6 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents final NewsBloc _newsBloc; final NewsAppSpecificOptions options; - final RequestManager requestManager; final Account account; final int? id; final ListType? listType; @@ -118,7 +115,7 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents } } - await requestManager.wrapNextcloud, NewsListArticles>( + await RequestManager.instance.wrapNextcloud, NewsListArticles>( account.id, 'news-articles-${type.index}-$id-$getRead', articles, diff --git a/packages/neon/neon_news/lib/blocs/news.dart b/packages/neon/neon_news/lib/blocs/news.dart index e505f274..d1022df4 100644 --- a/packages/neon/neon_news/lib/blocs/news.dart +++ b/packages/neon/neon_news/lib/blocs/news.dart @@ -31,7 +31,6 @@ abstract class NewsBlocStates { class NewsBloc extends InteractiveBloc implements NewsBlocEvents, NewsBlocStates, NewsMainArticlesBloc { NewsBloc( this.options, - this.requestManager, this.account, ) { mainArticlesBloc.articles.listen((final result) { @@ -50,13 +49,11 @@ class NewsBloc extends InteractiveBloc implements NewsBlocEvents, NewsBlocStates @override final NewsAppSpecificOptions options; @override - final RequestManager requestManager; @override final Account account; late final mainArticlesBloc = NewsMainArticlesBloc( this, options, - requestManager, account, ); @@ -95,14 +92,14 @@ class NewsBloc extends InteractiveBloc implements NewsBlocEvents, NewsBlocStates @override Future refresh() async { await Future.wait([ - requestManager.wrapNextcloud, NewsListFolders>( + RequestManager.instance.wrapNextcloud, NewsListFolders>( account.id, 'news-folders', folders, () async => account.client.news.listFolders(), (final response) => response.folders.toList(), ), - requestManager.wrapNextcloud, NewsListFeeds>( + RequestManager.instance.wrapNextcloud, NewsListFeeds>( account.id, 'news-feeds', feeds, diff --git a/packages/neon/neon_news/lib/neon_news.dart b/packages/neon/neon_news/lib/neon_news.dart index 412ab5d1..8b69ea1d 100644 --- a/packages/neon/neon_news/lib/neon_news.dart +++ b/packages/neon/neon_news/lib/neon_news.dart @@ -52,7 +52,7 @@ part 'widgets/folder_view.dart'; part 'widgets/folders_view.dart'; class NewsApp extends AppImplementation { - NewsApp(super.sharedPreferences, super.requestManager, super.platform); + NewsApp(super.sharedPreferences, super.platform); @override String id = AppIDs.news; @@ -69,7 +69,6 @@ class NewsApp extends AppImplementation { @override NewsBloc buildBloc(final Account account) => NewsBloc( options, - requestManager, account, ); diff --git a/packages/neon/neon_news/lib/pages/feed.dart b/packages/neon/neon_news/lib/pages/feed.dart index 09fa438f..108c5ba0 100644 --- a/packages/neon/neon_news/lib/pages/feed.dart +++ b/packages/neon/neon_news/lib/pages/feed.dart @@ -20,7 +20,6 @@ class NewsFeedPage extends StatelessWidget { bloc: NewsArticlesBloc( bloc, bloc.options, - bloc.requestManager, 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 c58743a3..aa6f438b 100644 --- a/packages/neon/neon_news/lib/widgets/folder_view.dart +++ b/packages/neon/neon_news/lib/widgets/folder_view.dart @@ -47,7 +47,6 @@ class _NewsFolderViewState extends State { bloc: NewsArticlesBloc( widget.bloc, widget.bloc.options, - widget.bloc.requestManager, widget.bloc.account, id: widget.folder.id, listType: ListType.folder, diff --git a/packages/neon/neon_notes/lib/blocs/notes.dart b/packages/neon/neon_notes/lib/blocs/notes.dart index f25386c6..95642765 100644 --- a/packages/neon/neon_notes/lib/blocs/notes.dart +++ b/packages/neon/neon_notes/lib/blocs/notes.dart @@ -25,14 +25,12 @@ abstract class NotesBlocStates { class NotesBloc extends InteractiveBloc implements NotesBlocEvents, NotesBlocStates { NotesBloc( this.options, - this.requestManager, this.account, ) { unawaited(refresh()); } final NotesAppSpecificOptions options; - final RequestManager requestManager; final Account account; @override @@ -46,7 +44,7 @@ class NotesBloc extends InteractiveBloc implements NotesBlocEvents, NotesBlocSta @override Future refresh() async { - await requestManager.wrapNextcloud, BuiltList>( + await RequestManager.instance.wrapNextcloud, BuiltList>( account.id, 'notes-notes', notes, diff --git a/packages/neon/neon_notes/lib/neon_notes.dart b/packages/neon/neon_notes/lib/neon_notes.dart index 5cd6dec2..af9ccfcf 100644 --- a/packages/neon/neon_notes/lib/neon_notes.dart +++ b/packages/neon/neon_notes/lib/neon_notes.dart @@ -42,7 +42,7 @@ part 'widgets/notes_floating_action_button.dart'; part 'widgets/notes_view.dart'; class NotesApp extends AppImplementation { - NotesApp(super.sharedPreferences, super.requestManager, super.platform); + NotesApp(super.sharedPreferences, super.platform); @override String id = AppIDs.notes; @@ -59,7 +59,6 @@ class NotesApp extends AppImplementation { @override NotesBloc buildBloc(final Account account) => NotesBloc( options, - requestManager, account, ); diff --git a/packages/neon/neon_notifications/lib/blocs/notifications.dart b/packages/neon/neon_notifications/lib/blocs/notifications.dart index 82d1aec7..93dde480 100644 --- a/packages/neon/neon_notifications/lib/blocs/notifications.dart +++ b/packages/neon/neon_notifications/lib/blocs/notifications.dart @@ -16,7 +16,6 @@ class NotificationsBloc extends InteractiveBloc implements NotificationsBlocInterface, NotificationsBlocEvents, NotificationsBlocStates { NotificationsBloc( this.options, - this._requestManager, this._account, ) { notifications.listen((final result) { @@ -31,7 +30,6 @@ class NotificationsBloc extends InteractiveBloc @override final NotificationsAppSpecificOptions options; - final RequestManager _requestManager; final Account _account; late final NeonTimer _timer; @@ -52,7 +50,7 @@ class NotificationsBloc extends InteractiveBloc @override Future refresh() async { - await _requestManager.wrapNextcloud, NotificationsListNotifications>( + await RequestManager.instance.wrapNextcloud, NotificationsListNotifications>( _account.id, 'notifications-notifications', notifications, diff --git a/packages/neon/neon_notifications/lib/neon_notifications.dart b/packages/neon/neon_notifications/lib/neon_notifications.dart index 7760a412..3d55d24d 100644 --- a/packages/neon/neon_notifications/lib/neon_notifications.dart +++ b/packages/neon/neon_notifications/lib/neon_notifications.dart @@ -22,7 +22,7 @@ part 'pages/main.dart'; class NotificationsApp extends AppImplementation implements NotificationsAppInterface { - NotificationsApp(super.sharedPreferences, super.requestManager, super.platform); + NotificationsApp(super.sharedPreferences, super.platform); @override String id = AppIDs.notifications; @@ -39,7 +39,6 @@ class NotificationsApp extends AppImplementation NotificationsBloc( options, - requestManager, account, );