From e222ac55932355ab2714fdb1125a8cc1f28dd9f9 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Sat, 15 Jul 2023 17:29:18 +0200 Subject: [PATCH] refactor(neon,neon_files): Adjust to generated specs --- packages/neon/neon/lib/src/app.dart | 4 +-- .../neon/neon/lib/src/blocs/accounts.dart | 2 +- packages/neon/neon/lib/src/blocs/apps.dart | 11 ++++---- .../neon/neon/lib/src/blocs/capabilities.dart | 13 ++++----- .../lib/src/blocs/login_check_account.dart | 2 +- .../src/blocs/login_check_server_status.dart | 4 +-- .../neon/neon/lib/src/blocs/login_flow.dart | 14 +++++----- .../neon/neon/lib/src/blocs/user_details.dart | 5 ++-- .../neon/lib/src/blocs/user_statuses.dart | 23 ++++++++------- .../neon/neon/lib/src/models/account.dart | 1 + .../lib/src/models/push_notification.dart | 2 +- .../lib/src/models/push_notification.g.dart | 2 +- .../neon/lib/src/pages/account_settings.dart | 8 +++--- .../src/pages/login_check_server_status.dart | 4 +-- packages/neon/neon/lib/src/theme/colors.dart | 12 ++++---- packages/neon/neon/lib/src/theme/theme.dart | 4 +-- .../neon/neon/lib/src/widgets/drawer.dart | 28 ++++++++----------- .../neon/lib/src/widgets/user_avatar.dart | 16 ++++++----- .../neon_files/lib/widgets/file_preview.dart | 2 +- .../neon/neon_news/lib/blocs/articles.dart | 4 +-- 20 files changed, 79 insertions(+), 82 deletions(-) diff --git a/packages/neon/neon/lib/src/app.dart b/packages/neon/neon/lib/src/app.dart index 4a9ce8d4..39df45f6 100644 --- a/packages/neon/neon/lib/src/app.dart +++ b/packages/neon/neon/lib/src/app.dart @@ -8,7 +8,6 @@ import 'package:flutter_native_splash/flutter_native_splash.dart'; import 'package:neon/l10n/localizations.dart'; import 'package:neon/src/bloc/result_builder.dart'; import 'package:neon/src/blocs/accounts.dart'; -import 'package:neon/src/blocs/capabilities.dart'; import 'package:neon/src/models/account.dart'; import 'package:neon/src/models/app_ids.dart'; import 'package:neon/src/models/app_implementation.dart'; @@ -22,6 +21,7 @@ import 'package:neon/src/utils/global.dart'; import 'package:neon/src/utils/global_options.dart'; import 'package:neon/src/utils/localizations.dart'; import 'package:neon/src/utils/push_utils.dart'; +import 'package:nextcloud/nextcloud.dart'; import 'package:provider/provider.dart'; import 'package:quick_actions/quick_actions.dart'; import 'package:tray_manager/tray_manager.dart' as tray; @@ -285,7 +285,7 @@ class _NeonAppState extends State with WidgetsBindingObserver, tray.Tra stream: _accountsBloc.activeAccount, builder: (final context, final activeAccountSnapshot) { FlutterNativeSplash.remove(); - return ResultBuilder.behaviorSubject( + return ResultBuilder.behaviorSubject( stream: activeAccountSnapshot.hasData ? _accountsBloc.getCapabilitiesBlocFor(activeAccountSnapshot.data!).capabilities : null, diff --git a/packages/neon/neon/lib/src/blocs/accounts.dart b/packages/neon/neon/lib/src/blocs/accounts.dart index 747efa84..88ebd811 100644 --- a/packages/neon/neon/lib/src/blocs/accounts.dart +++ b/packages/neon/neon/lib/src/blocs/accounts.dart @@ -157,7 +157,7 @@ class AccountsBloc extends Bloc implements AccountsBlocEvents, AccountsBlocState unawaited(() async { try { - await account.client.core.deleteAppPassword(); + await account.client.core.appPassword.deleteAppPassword(); } catch (e, s) { debugPrint(e.toString()); debugPrint(s.toString()); diff --git a/packages/neon/neon/lib/src/blocs/apps.dart b/packages/neon/neon/lib/src/blocs/apps.dart index 3abf1864..12def172 100644 --- a/packages/neon/neon/lib/src/blocs/apps.dart +++ b/packages/neon/neon/lib/src/blocs/apps.dart @@ -16,8 +16,6 @@ import 'package:nextcloud/nextcloud.dart'; import 'package:provider/provider.dart'; import 'package:rxdart/rxdart.dart'; -typedef NextcloudApp = CoreNavigationApps_Ocs_Data; - abstract class AppsBlocEvents { /// Sets the active app using the [appID]. /// @@ -27,7 +25,7 @@ abstract class AppsBlocEvents { } abstract class AppsBlocStates { - BehaviorSubject>> get apps; + BehaviorSubject>> get apps; BehaviorSubject>> get appImplementations; @@ -181,7 +179,7 @@ class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates BehaviorSubject>>(); @override - BehaviorSubject>> apps = BehaviorSubject>>(); + BehaviorSubject>> apps = BehaviorSubject>>(); @override BehaviorSubject> notificationsAppImplementation = @@ -195,11 +193,12 @@ class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates @override Future refresh() async { - await _requestManager.wrapNextcloud, CoreNavigationApps>( + await _requestManager + .wrapNextcloud, CoreNavigationGetAppsNavigationResponse200ApplicationJson>( _account.id, 'apps-apps', apps, - () async => _account.client.core.getNavigationApps(), + () async => _account.client.core.navigation.getAppsNavigation(), (final response) => response.ocs.data.toList(), ); } diff --git a/packages/neon/neon/lib/src/blocs/capabilities.dart b/packages/neon/neon/lib/src/blocs/capabilities.dart index b4d4c902..ce1a1a35 100644 --- a/packages/neon/neon/lib/src/blocs/capabilities.dart +++ b/packages/neon/neon/lib/src/blocs/capabilities.dart @@ -8,13 +8,10 @@ import 'package:neon/src/utils/request_manager.dart'; import 'package:nextcloud/nextcloud.dart'; import 'package:rxdart/rxdart.dart'; -typedef Capabilities = CoreServerCapabilities_Ocs_Data; -typedef NextcloudTheme = CoreServerCapabilities_Ocs_Data_Capabilities_Theming; - abstract class CapabilitiesBlocEvents {} abstract class CapabilitiesBlocStates { - BehaviorSubject> get capabilities; + BehaviorSubject> get capabilities; } @internal @@ -36,15 +33,17 @@ class CapabilitiesBloc extends InteractiveBloc implements CapabilitiesBlocEvents } @override - BehaviorSubject> capabilities = BehaviorSubject>(); + BehaviorSubject> capabilities = + BehaviorSubject>(); @override Future refresh() async { - await _requestManager.wrapNextcloud( + await _requestManager.wrapNextcloud( _account.id, 'capabilities', capabilities, - () async => _account.client.core.getCapabilities(), + () async => _account.client.core.ocs.getCapabilities(), (final response) => response.ocs.data, ); } diff --git a/packages/neon/neon/lib/src/blocs/login_check_account.dart b/packages/neon/neon/lib/src/blocs/login_check_account.dart index 0a9a19aa..5608dd0a 100644 --- a/packages/neon/neon/lib/src/blocs/login_check_account.dart +++ b/packages/neon/neon/lib/src/blocs/login_check_account.dart @@ -49,7 +49,7 @@ class LoginCheckAccountBloc extends InteractiveBloc userAgentOverride: neonUserAgent, ); - final response = await client.provisioningApi.getCurrentUser(); + final response = await client.provisioningApi.users.getCurrentUser(); final account = Account( serverURL: serverURL, diff --git a/packages/neon/neon/lib/src/blocs/login_check_server_status.dart b/packages/neon/neon/lib/src/blocs/login_check_server_status.dart index b29a7b78..5a4877e6 100644 --- a/packages/neon/neon/lib/src/blocs/login_check_server_status.dart +++ b/packages/neon/neon/lib/src/blocs/login_check_server_status.dart @@ -11,7 +11,7 @@ abstract interface class LoginCheckServerStatusBlocEvents {} abstract interface class LoginCheckServerStatusBlocStates { /// Contains the current server connection state - BehaviorSubject> get state; + BehaviorSubject> get state; } class LoginCheckServerStatusBloc extends InteractiveBloc @@ -28,7 +28,7 @@ class LoginCheckServerStatusBloc extends InteractiveBloc } @override - BehaviorSubject> state = BehaviorSubject(); + BehaviorSubject> state = BehaviorSubject(); @override Future refresh() async { diff --git a/packages/neon/neon/lib/src/blocs/login_flow.dart b/packages/neon/neon/lib/src/blocs/login_flow.dart index 185a0053..18426321 100644 --- a/packages/neon/neon/lib/src/blocs/login_flow.dart +++ b/packages/neon/neon/lib/src/blocs/login_flow.dart @@ -10,9 +10,9 @@ import 'package:rxdart/rxdart.dart'; abstract class LoginFlowBlocEvents {} abstract class LoginFlowBlocStates { - BehaviorSubject> get init; + BehaviorSubject> get init; - Stream get result; + Stream get result; } class LoginFlowBloc extends InteractiveBloc implements LoginFlowBlocEvents, LoginFlowBlocStates { @@ -25,7 +25,7 @@ class LoginFlowBloc extends InteractiveBloc implements LoginFlowBlocEvents, Logi serverURL, userAgentOverride: neonUserAgent, ); - final _resultController = StreamController(); + final _resultController = StreamController(); Timer? _pollTimer; @@ -37,23 +37,23 @@ class LoginFlowBloc extends InteractiveBloc implements LoginFlowBlocEvents, Logi } @override - BehaviorSubject> init = BehaviorSubject>(); + BehaviorSubject> init = BehaviorSubject>(); @override - late Stream result = _resultController.stream.asBroadcastStream(); + late Stream result = _resultController.stream.asBroadcastStream(); @override Future refresh() async { try { init.add(Result.loading()); - final initResponse = await _client.core.initLoginFlow(); + final initResponse = await _client.core.clientFlowLoginV2.init(); init.add(Result.success(initResponse)); _cancelPollTimer(); _pollTimer = Timer.periodic(const Duration(seconds: 1), (final _) async { try { - final resultResponse = await _client.core.getLoginFlowResult(token: initResponse.poll.token); + final resultResponse = await _client.core.clientFlowLoginV2.poll(token: initResponse.poll.token); _cancelPollTimer(); _resultController.add(resultResponse); } catch (e, s) { diff --git a/packages/neon/neon/lib/src/blocs/user_details.dart b/packages/neon/neon/lib/src/blocs/user_details.dart index d7a67c99..f1c7282d 100644 --- a/packages/neon/neon/lib/src/blocs/user_details.dart +++ b/packages/neon/neon/lib/src/blocs/user_details.dart @@ -38,11 +38,12 @@ class UserDetailsBloc extends InteractiveBloc implements UserDetailsBlocEvents, @override Future refresh() async { - await _requestManager.wrapNextcloud( + await _requestManager + .wrapNextcloud( _account.id, 'user-details', userDetails, - () async => _account.client.provisioningApi.getCurrentUser(), + () async => _account.client.provisioningApi.users.getCurrentUser(), (final response) => response.ocs.data, ); } diff --git a/packages/neon/neon/lib/src/blocs/user_statuses.dart b/packages/neon/neon/lib/src/blocs/user_statuses.dart index cf3fe553..5c871aac 100644 --- a/packages/neon/neon/lib/src/blocs/user_statuses.dart +++ b/packages/neon/neon/lib/src/blocs/user_statuses.dart @@ -16,7 +16,7 @@ abstract class UserStatusesBlocEvents { } abstract class UserStatusesBlocStates { - BehaviorSubject>> get statuses; + BehaviorSubject>> get statuses; } @internal @@ -41,8 +41,8 @@ class UserStatusesBloc extends InteractiveBloc implements UserStatusesBlocEvents } @override - BehaviorSubject>> statuses = - BehaviorSubject>>(); + BehaviorSubject>> statuses = + BehaviorSubject>>(); @override Future refresh() async { @@ -60,17 +60,17 @@ class UserStatusesBloc extends InteractiveBloc implements UserStatusesBlocEvents try { _updateStatus(username, Result.loading()); - UserStatusPublicStatus? data; + UserStatusPublic? data; if (_account.username == username) { final isAway = _platform.canUseWindowManager && (!(await windowManager.isFocused()) || !(await windowManager.isVisible())); - final response = await _account.client.userStatus.heartbeat( - status: isAway ? UserStatusType.away : UserStatusType.online, + final response = await _account.client.userStatus.heartbeat.heartbeat( + status: isAway ? 'away' : 'online', ); - data = response.ocs.data.status?.publicStatus; + data = response.ocs.data.public; } else { - final response = await _account.client.userStatus.getPublicStatus(userId: username); - data = response.ocs.data.publicStatus; + final response = await _account.client.userStatus.statuses.find(userId: username); + data = response.ocs.data; } _updateStatus(username, Result.success(data)); @@ -85,10 +85,9 @@ class UserStatusesBloc extends InteractiveBloc implements UserStatusesBlocEvents } } - Map> get _statuses => - statuses.valueOrNull ?? >{}; + Map> get _statuses => statuses.valueOrNull ?? >{}; - void _updateStatus(final String username, final Result result) { + void _updateStatus(final String username, final Result result) { statuses.add({ ..._statuses, username: result, diff --git a/packages/neon/neon/lib/src/models/account.dart b/packages/neon/neon/lib/src/models/account.dart index 2d56003b..09dbb545 100644 --- a/packages/neon/neon/lib/src/models/account.dart +++ b/packages/neon/neon/lib/src/models/account.dart @@ -39,6 +39,7 @@ class Account implements Credentials { ); factory Account.fromJson(final Map json) => _$AccountFromJson(json); + Map toJson() => _$AccountToJson(this); @override diff --git a/packages/neon/neon/lib/src/models/push_notification.dart b/packages/neon/neon/lib/src/models/push_notification.dart index 5ac8176b..d7857f0c 100644 --- a/packages/neon/neon/lib/src/models/push_notification.dart +++ b/packages/neon/neon/lib/src/models/push_notification.dart @@ -24,5 +24,5 @@ class PushNotification { final String type; - final NotificationsNotificationDecryptedSubject subject; + final NotificationsDecryptedSubject subject; } diff --git a/packages/neon/neon/lib/src/models/push_notification.g.dart b/packages/neon/neon/lib/src/models/push_notification.g.dart index 5705d8d6..6cf4b31f 100644 --- a/packages/neon/neon/lib/src/models/push_notification.g.dart +++ b/packages/neon/neon/lib/src/models/push_notification.g.dart @@ -10,7 +10,7 @@ PushNotification _$PushNotificationFromJson(Map json) => PushNo accountID: json['accountID'] as String, priority: json['priority'] as String, type: json['type'] as String, - subject: NotificationsNotificationDecryptedSubject.fromJson(json['subject'] as Map), + subject: NotificationsDecryptedSubject.fromJson(json['subject'] as Map), ); Map _$PushNotificationToJson(PushNotification instance) => { diff --git a/packages/neon/neon/lib/src/pages/account_settings.dart b/packages/neon/neon/lib/src/pages/account_settings.dart index d0aa50d3..7aa70fd3 100644 --- a/packages/neon/neon/lib/src/pages/account_settings.dart +++ b/packages/neon/neon/lib/src/pages/account_settings.dart @@ -88,7 +88,7 @@ class AccountSettingsPage extends StatelessWidget { children: [ if (userDetails.hasData) ...[ LinearProgressIndicator( - value: userDetails.requireData.quota.relative / 100, + value: (userDetails.requireData.quota.relative ?? 0) / 100, backgroundColor: Theme.of(context).colorScheme.primary.withOpacity(0.3), ), const SizedBox( @@ -96,9 +96,9 @@ class AccountSettingsPage extends StatelessWidget { ), Text( AppLocalizations.of(context).accountOptionsQuotaUsedOf( - filesize(userDetails.requireData.quota.used, 1), - filesize(userDetails.requireData.quota.total, 1), - userDetails.requireData.quota.relative.toString(), + filesize(userDetails.requireData.quota.used ?? 0, 1), + filesize(userDetails.requireData.quota.total ?? 0, 1), + (userDetails.requireData.quota.relative ?? 0).toString(), ), ), ], diff --git a/packages/neon/neon/lib/src/pages/login_check_server_status.dart b/packages/neon/neon/lib/src/pages/login_check_server_status.dart index 9a6afac3..dd1b8579 100644 --- a/packages/neon/neon/lib/src/pages/login_check_server_status.dart +++ b/packages/neon/neon/lib/src/pages/login_check_server_status.dart @@ -103,7 +103,7 @@ class _LoginCheckServerStatusPageState extends State } } - Widget _buildServerVersionTile(final Result result) { + Widget _buildServerVersionTile(final Result result) { if (result.hasError) { return NeonValidationTile( title: AppLocalizations.of(context).loginCheckingServerVersion, @@ -131,7 +131,7 @@ class _LoginCheckServerStatusPageState extends State ); } - Widget _buildMaintenanceModeTile(final Result result) { + Widget _buildMaintenanceModeTile(final Result result) { if (result.hasError) { return NeonValidationTile( title: AppLocalizations.of(context).loginCheckingMaintenanceMode, diff --git a/packages/neon/neon/lib/src/theme/colors.dart b/packages/neon/neon/lib/src/theme/colors.dart index 46366fab..1c1f2652 100644 --- a/packages/neon/neon/lib/src/theme/colors.dart +++ b/packages/neon/neon/lib/src/theme/colors.dart @@ -29,13 +29,13 @@ abstract final class NcColors { static const Color accept = Colors.green; } -/// [UserStatusType] color mapping. -extension UserStatusTypeColors on UserStatusType { +/// [UserStatusPublic] status color mapping. +extension UserStatusTypeColors on UserStatusPublic { /// The color for the user status. - Color? get color => switch (this) { - UserStatusType.online => const Color(0xFF49B382), - UserStatusType.away => const Color(0xFFF4A331), - UserStatusType.dnd => const Color(0xFFED484C), + Color? get color => switch (status) { + 'online' => const Color(0xFF49B382), + 'away' => const Color(0xFFF4A331), + 'dnd' => const Color(0xFFED484C), _ => null, }; } diff --git a/packages/neon/neon/lib/src/theme/theme.dart b/packages/neon/neon/lib/src/theme/theme.dart index 4a1d37a2..4c48bd1a 100644 --- a/packages/neon/neon/lib/src/theme/theme.dart +++ b/packages/neon/neon/lib/src/theme/theme.dart @@ -16,14 +16,14 @@ class AppTheme { this.appThemes, }) : keepOriginalAccentColor = nextcloudTheme == null || keepOriginalAccentColor; - final CoreServerCapabilities_Ocs_Data_Capabilities_Theming? nextcloudTheme; + final CoreOcsGetCapabilitiesResponse200ApplicationJson_Ocs_Data_Capabilities_Theming? nextcloudTheme; final bool keepOriginalAccentColor; final bool oledAsDark; final Iterable? appThemes; final NeonTheme neonTheme; ColorScheme _buildColorScheme(final Brightness brightness) { - final primary = nextcloudTheme?.color != null ? HexColor(nextcloudTheme!.color!) : neonTheme.colorScheme.primary; + final primary = nextcloudTheme?.color != null ? HexColor(nextcloudTheme!.color) : neonTheme.colorScheme.primary; final keepOriginalAccentColorOverride = keepOriginalAccentColor ? primary : null; final oledBackgroundOverride = oledAsDark && brightness == Brightness.dark ? NcColors.oledBackground : null; diff --git a/packages/neon/neon/lib/src/widgets/drawer.dart b/packages/neon/neon/lib/src/widgets/drawer.dart index 47779a76..75aedd83 100644 --- a/packages/neon/neon/lib/src/widgets/drawer.dart +++ b/packages/neon/neon/lib/src/widgets/drawer.dart @@ -6,13 +6,13 @@ import 'package:neon/l10n/localizations.dart'; import 'package:neon/src/bloc/result_builder.dart'; import 'package:neon/src/blocs/accounts.dart'; import 'package:neon/src/blocs/apps.dart'; -import 'package:neon/src/blocs/capabilities.dart'; import 'package:neon/src/models/app_implementation.dart'; import 'package:neon/src/router.dart'; import 'package:neon/src/widgets/cached_image.dart'; import 'package:neon/src/widgets/drawer_destination.dart'; import 'package:neon/src/widgets/exception.dart'; import 'package:neon/src/widgets/linear_progress_indicator.dart'; +import 'package:nextcloud/nextcloud.dart'; import 'package:provider/provider.dart'; @internal @@ -121,7 +121,7 @@ class NeonDrawerHeader extends StatelessWidget { final accountsBloc = Provider.of(context, listen: false); final capabilitiesBloc = accountsBloc.activeCapabilitiesBloc; - final branding = ResultBuilder.behaviorSubject( + final branding = ResultBuilder.behaviorSubject( stream: capabilitiesBloc.capabilities, builder: (final context, final capabilities) { if (!capabilities.hasData) { @@ -147,21 +147,17 @@ class NeonDrawerHeader extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - if (theme.name != null) ...[ - Text( - theme.name!, - style: DefaultTextStyle.of(context).style.copyWith( - color: Theme.of(context).appBarTheme.foregroundColor, - ), + Text( + theme.name, + style: DefaultTextStyle.of(context).style.copyWith( + color: Theme.of(context).appBarTheme.foregroundColor, + ), + ), + Flexible( + child: NeonCachedImage.url( + url: theme.logo, ), - ], - if (theme.logo != null) ...[ - Flexible( - child: NeonCachedImage.url( - url: theme.logo!, - ), - ), - ], + ), ], ); }, diff --git a/packages/neon/neon/lib/src/widgets/user_avatar.dart b/packages/neon/neon/lib/src/widgets/user_avatar.dart index 4ecc7de4..58d751f1 100644 --- a/packages/neon/neon/lib/src/widgets/user_avatar.dart +++ b/packages/neon/neon/lib/src/widgets/user_avatar.dart @@ -68,22 +68,24 @@ class _UserAvatarState extends State { cacheKey: '${widget.account.id}-avatar-${widget.username}-$brightness$pixelSize', getImage: () async { if (brightness == Brightness.dark) { - return widget.account.client.core.getDarkAvatar( + return (await widget.account.client.core.avatar.getAvatarDark( userId: widget.username, size: pixelSize, - ); + )) + .data; } else { - return widget.account.client.core.getAvatar( + return (await widget.account.client.core.avatar.getAvatar( userId: widget.username, size: pixelSize, - ); + )) + .data; } }, ), ), ), if (widget.showStatus) ...[ - ResultBuilder( + ResultBuilder( stream: _userStatusBloc.statuses.mapNotNull((final statuses) => statuses[widget.username]), builder: _userStatusIconBuilder, ), @@ -93,7 +95,7 @@ class _UserAvatarState extends State { }, ); - Widget _userStatusIconBuilder(final BuildContext context, final Result result) { + Widget _userStatusIconBuilder(final BuildContext context, final Result result) { final hasEmoji = result.data?.icon != null; final scaledSize = size / (hasEmoji ? 2 : 3); @@ -120,7 +122,7 @@ class _UserAvatarState extends State { } else if (result.hasData) { decoration = BoxDecoration( shape: BoxShape.circle, - color: result.data!.status.color, + color: result.data!.color, ); } diff --git a/packages/neon/neon_files/lib/widgets/file_preview.dart b/packages/neon/neon_files/lib/widgets/file_preview.dart index cbf9d171..118a474f 100644 --- a/packages/neon/neon_files/lib/widgets/file_preview.dart +++ b/packages/neon/neon_files/lib/widgets/file_preview.dart @@ -103,7 +103,7 @@ class FilePreviewImage extends NeonCachedImage { required final int width, required final int height, }) : super.custom( - getImage: () async => account.client.core.getPreview( + getImage: () async => account.client.core.preview.getPreview( file: path, x: width, y: height, diff --git a/packages/neon/neon_news/lib/blocs/articles.dart b/packages/neon/neon_news/lib/blocs/articles.dart index 78a715e6..af014c09 100644 --- a/packages/neon/neon_news/lib/blocs/articles.dart +++ b/packages/neon/neon_news/lib/blocs/articles.dart @@ -127,10 +127,10 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents await requestManager.wrapNextcloud, NewsListArticles>( account.id, - 'news-articles-${type.code}-$id-$getRead', + 'news-articles-${type.index}-$id-$getRead', articles, () async => account.client.news.listArticles( - type: type.code, + type: type.index, id: id ?? 0, getRead: getRead ?? true ? 1 : 0, ),