Browse Source

refactor(neon): Rename NeonException to NeonError

Signed-off-by: jld3103 <jld3103yt@gmail.com>
pull/852/head
jld3103 1 year ago
parent
commit
905cb47d76
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 4
      packages/neon/neon/lib/src/pages/account_settings.dart
  2. 4
      packages/neon/neon/lib/src/pages/home.dart
  3. 6
      packages/neon/neon/lib/src/pages/login_check_account.dart
  4. 4
      packages/neon/neon/lib/src/pages/login_check_server_status.dart
  5. 4
      packages/neon/neon/lib/src/pages/login_flow.dart
  6. 4
      packages/neon/neon/lib/src/pages/login_qr_code.dart
  7. 8
      packages/neon/neon/lib/src/pages/settings.dart
  8. 4
      packages/neon/neon/lib/src/widgets/account_tile.dart
  9. 4
      packages/neon/neon/lib/src/widgets/app_bar.dart
  10. 4
      packages/neon/neon/lib/src/widgets/cached_image.dart
  11. 4
      packages/neon/neon/lib/src/widgets/drawer.dart
  12. 56
      packages/neon/neon/lib/src/widgets/error.dart
  13. 4
      packages/neon/neon/lib/src/widgets/list_view.dart
  14. 4
      packages/neon/neon/lib/src/widgets/unified_search_results.dart
  15. 2
      packages/neon/neon/lib/widgets.dart
  16. 2
      packages/neon/neon_files/lib/pages/main.dart
  17. 2
      packages/neon/neon_files/lib/widgets/browser_view.dart
  18. 2
      packages/neon/neon_news/lib/dialogs/add_feed.dart
  19. 2
      packages/neon/neon_news/lib/pages/article.dart
  20. 2
      packages/neon/neon_news/lib/pages/main.dart
  21. 2
      packages/neon/neon_news/lib/widgets/articles_view.dart
  22. 2
      packages/neon/neon_notes/lib/dialogs/create_note.dart
  23. 2
      packages/neon/neon_notes/lib/dialogs/select_category.dart
  24. 4
      packages/neon/neon_notes/lib/utils/exception_handler.dart
  25. 2
      packages/neon/neon_notifications/lib/pages/main.dart

4
packages/neon/neon/lib/src/pages/account_settings.dart

@ -13,7 +13,7 @@ import 'package:neon/src/settings/widgets/settings_category.dart';
import 'package:neon/src/settings/widgets/settings_list.dart'; import 'package:neon/src/settings/widgets/settings_list.dart';
import 'package:neon/src/theme/dialog.dart'; import 'package:neon/src/theme/dialog.dart';
import 'package:neon/src/utils/confirmation_dialog.dart'; import 'package:neon/src/utils/confirmation_dialog.dart';
import 'package:neon/src/widgets/exception.dart'; import 'package:neon/src/widgets/error.dart';
import 'package:neon/src/widgets/linear_progress_indicator.dart'; import 'package:neon/src/widgets/linear_progress_indicator.dart';
import 'package:nextcloud/nextcloud.dart'; import 'package:nextcloud/nextcloud.dart';
@ -104,7 +104,7 @@ class AccountSettingsPage extends StatelessWidget {
), ),
), ),
], ],
NeonException( NeonError(
userDetails.error, userDetails.error,
onRetry: userDetailsBloc.refresh, onRetry: userDetailsBloc.refresh,
), ),

4
packages/neon/neon/lib/src/pages/home.dart

@ -14,7 +14,7 @@ import 'package:neon/src/utils/global_popups.dart';
import 'package:neon/src/utils/provider.dart'; import 'package:neon/src/utils/provider.dart';
import 'package:neon/src/widgets/app_bar.dart'; import 'package:neon/src/widgets/app_bar.dart';
import 'package:neon/src/widgets/drawer.dart'; import 'package:neon/src/widgets/drawer.dart';
import 'package:neon/src/widgets/exception.dart'; import 'package:neon/src/widgets/error.dart';
import 'package:neon/src/widgets/unified_search_results.dart'; import 'package:neon/src/widgets/unified_search_results.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -91,7 +91,7 @@ class _HomePageState extends State<HomePage> {
debugPrint(e.toString()); debugPrint(e.toString());
debugPrint(s.toString()); debugPrint(s.toString());
if (mounted) { if (mounted) {
NeonException.showSnackbar(context, e); NeonError.showSnackbar(context, e);
} }
} }
} }

6
packages/neon/neon/lib/src/pages/login_check_account.dart

@ -12,7 +12,7 @@ import 'package:neon/src/router.dart';
import 'package:neon/src/theme/dialog.dart'; import 'package:neon/src/theme/dialog.dart';
import 'package:neon/src/utils/provider.dart'; import 'package:neon/src/utils/provider.dart';
import 'package:neon/src/widgets/account_tile.dart'; import 'package:neon/src/widgets/account_tile.dart';
import 'package:neon/src/widgets/exception.dart'; import 'package:neon/src/widgets/error.dart';
import 'package:neon/src/widgets/validation_tile.dart'; import 'package:neon/src/widgets/validation_tile.dart';
@internal @internal
@ -68,7 +68,7 @@ class _LoginCheckAccountPageState extends State<LoginCheckAccountPage> {
if (state.hasError) ...[ if (state.hasError) ...[
Builder( Builder(
builder: (final context) { builder: (final context) {
final details = NeonException.getDetails(context, state.error); final details = NeonError.getDetails(context, state.error);
return NeonValidationTile( return NeonValidationTile(
title: details.isUnauthorized title: details.isUnauthorized
? AppLocalizations.of(context).errorCredentialsForAccountNoLongerMatch ? AppLocalizations.of(context).errorCredentialsForAccountNoLongerMatch
@ -91,7 +91,7 @@ class _LoginCheckAccountPageState extends State<LoginCheckAccountPage> {
const HomeRoute().go(context); const HomeRoute().go(context);
} }
: () { : () {
if (state.hasError && NeonException.getDetails(context, state.error).isUnauthorized) { if (state.hasError && NeonError.getDetails(context, state.error).isUnauthorized) {
Navigator.pop(context); Navigator.pop(context);
return; return;
} }

4
packages/neon/neon/lib/src/pages/login_check_server_status.dart

@ -6,7 +6,7 @@ import 'package:neon/src/bloc/result_builder.dart';
import 'package:neon/src/blocs/login_check_server_status.dart'; import 'package:neon/src/blocs/login_check_server_status.dart';
import 'package:neon/src/router.dart'; import 'package:neon/src/router.dart';
import 'package:neon/src/theme/dialog.dart'; import 'package:neon/src/theme/dialog.dart';
import 'package:neon/src/widgets/exception.dart'; import 'package:neon/src/widgets/error.dart';
import 'package:neon/src/widgets/validation_tile.dart'; import 'package:neon/src/widgets/validation_tile.dart';
import 'package:nextcloud/nextcloud.dart'; import 'package:nextcloud/nextcloud.dart';
@ -67,7 +67,7 @@ class _LoginCheckServerStatusPageState extends State<LoginCheckServerStatusPage>
children: [ children: [
if (state.hasError) ...[ if (state.hasError) ...[
NeonValidationTile( NeonValidationTile(
title: NeonException.getDetails(context, state.error).text, title: NeonError.getDetails(context, state.error).text,
state: ValidationState.failure, state: ValidationState.failure,
), ),
], ],

4
packages/neon/neon/lib/src/pages/login_flow.dart

@ -4,7 +4,7 @@ import 'package:neon/l10n/localizations.dart';
import 'package:neon/src/bloc/result_builder.dart'; import 'package:neon/src/bloc/result_builder.dart';
import 'package:neon/src/blocs/login_flow.dart'; import 'package:neon/src/blocs/login_flow.dart';
import 'package:neon/src/router.dart'; import 'package:neon/src/router.dart';
import 'package:neon/src/widgets/exception.dart'; import 'package:neon/src/widgets/error.dart';
import 'package:neon/src/widgets/linear_progress_indicator.dart'; import 'package:neon/src/widgets/linear_progress_indicator.dart';
import 'package:url_launcher/url_launcher_string.dart'; import 'package:url_launcher/url_launcher_string.dart';
@ -68,7 +68,7 @@ class _LoginFlowPageState extends State<LoginFlowPage> {
NeonLinearProgressIndicator( NeonLinearProgressIndicator(
visible: init.isLoading, visible: init.isLoading,
), ),
NeonException( NeonError(
init.error, init.error,
onRetry: bloc.refresh, onRetry: bloc.refresh,
), ),

4
packages/neon/neon/lib/src/pages/login_qr_code.dart

@ -4,7 +4,7 @@ import 'package:meta/meta.dart';
import 'package:neon/src/models/account.dart'; import 'package:neon/src/models/account.dart';
import 'package:neon/src/router.dart'; import 'package:neon/src/router.dart';
import 'package:neon/src/utils/exceptions.dart'; import 'package:neon/src/utils/exceptions.dart';
import 'package:neon/src/widgets/exception.dart'; import 'package:neon/src/widgets/error.dart';
@internal @internal
class LoginQRcodePage extends StatefulWidget { class LoginQRcodePage extends StatefulWidget {
@ -53,7 +53,7 @@ class _LoginQRcodePageState extends State<LoginQRcodePage> {
debugPrint(s.toString()); debugPrint(s.toString());
_lastErrorURL = url; _lastErrorURL = url;
NeonException.showSnackbar(context, e); NeonError.showSnackbar(context, e);
} }
} }
}, },

8
packages/neon/neon/lib/src/pages/settings.dart

@ -23,7 +23,7 @@ import 'package:neon/src/utils/confirmation_dialog.dart';
import 'package:neon/src/utils/global_options.dart'; import 'package:neon/src/utils/global_options.dart';
import 'package:neon/src/utils/provider.dart'; import 'package:neon/src/utils/provider.dart';
import 'package:neon/src/utils/save_file.dart'; import 'package:neon/src/utils/save_file.dart';
import 'package:neon/src/widgets/exception.dart'; import 'package:neon/src/widgets/error.dart';
import 'package:package_info_plus/package_info_plus.dart'; import 'package:package_info_plus/package_info_plus.dart';
import 'package:url_launcher/url_launcher_string.dart'; import 'package:url_launcher/url_launcher_string.dart';
@ -287,7 +287,7 @@ class _SettingsPageState extends State<SettingsPage> {
debugPrint(e.toString()); debugPrint(e.toString());
debugPrint(s.toString()); debugPrint(s.toString());
if (mounted) { if (mounted) {
NeonException.showSnackbar(context, e); NeonError.showSnackbar(context, e);
} }
} }
}, },
@ -312,7 +312,7 @@ class _SettingsPageState extends State<SettingsPage> {
if (!result.files.single.path!.endsWith('.json')) { if (!result.files.single.path!.endsWith('.json')) {
if (mounted) { if (mounted) {
NeonException.showSnackbar( NeonError.showSnackbar(
context, context,
AppLocalizations.of(context).settingsImportWrongFileExtension, AppLocalizations.of(context).settingsImportWrongFileExtension,
); );
@ -325,7 +325,7 @@ class _SettingsPageState extends State<SettingsPage> {
debugPrint(e.toString()); debugPrint(e.toString());
debugPrint(s.toString()); debugPrint(s.toString());
if (mounted) { if (mounted) {
NeonException.showSnackbar(context, e); NeonError.showSnackbar(context, e);
} }
} }
}, },

4
packages/neon/neon/lib/src/widgets/account_tile.dart

@ -4,7 +4,7 @@ import 'package:neon/src/bloc/result_builder.dart';
import 'package:neon/src/blocs/accounts.dart'; import 'package:neon/src/blocs/accounts.dart';
import 'package:neon/src/models/account.dart'; import 'package:neon/src/models/account.dart';
import 'package:neon/src/utils/provider.dart'; import 'package:neon/src/utils/provider.dart';
import 'package:neon/src/widgets/exception.dart'; import 'package:neon/src/widgets/error.dart';
import 'package:neon/src/widgets/linear_progress_indicator.dart'; import 'package:neon/src/widgets/linear_progress_indicator.dart';
import 'package:neon/src/widgets/user_avatar.dart'; import 'package:neon/src/widgets/user_avatar.dart';
import 'package:nextcloud/nextcloud.dart'; import 'package:nextcloud/nextcloud.dart';
@ -79,7 +79,7 @@ class NeonAccountTile extends StatelessWidget {
const SizedBox( const SizedBox(
width: 5, width: 5,
), ),
NeonException( NeonError(
userDetails.error, userDetails.error,
onlyIcon: true, onlyIcon: true,
iconSize: 24, iconSize: 24,

4
packages/neon/neon/lib/src/widgets/app_bar.dart

@ -12,7 +12,7 @@ import 'package:neon/src/models/notifications_interface.dart';
import 'package:neon/src/utils/provider.dart'; import 'package:neon/src/utils/provider.dart';
import 'package:neon/src/widgets/account_switcher_button.dart'; import 'package:neon/src/widgets/account_switcher_button.dart';
import 'package:neon/src/widgets/app_implementation_icon.dart'; import 'package:neon/src/widgets/app_implementation_icon.dart';
import 'package:neon/src/widgets/exception.dart'; import 'package:neon/src/widgets/error.dart';
import 'package:neon/src/widgets/linear_progress_indicator.dart'; import 'package:neon/src/widgets/linear_progress_indicator.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
@ -89,7 +89,7 @@ class _NeonAppBarState extends State<NeonAppBar> {
const SizedBox( const SizedBox(
width: 8, width: 8,
), ),
NeonException( NeonError(
appImplementations.error, appImplementations.error,
onRetry: appsBloc.refresh, onRetry: appsBloc.refresh,
onlyIcon: true, onlyIcon: true,

4
packages/neon/neon/lib/src/widgets/cached_image.dart

@ -9,7 +9,7 @@ import 'package:neon/nextcloud.dart';
import 'package:neon/src/blocs/accounts.dart'; import 'package:neon/src/blocs/accounts.dart';
import 'package:neon/src/models/account.dart'; import 'package:neon/src/models/account.dart';
import 'package:neon/src/utils/provider.dart'; import 'package:neon/src/utils/provider.dart';
import 'package:neon/src/widgets/exception.dart'; import 'package:neon/src/widgets/error.dart';
import 'package:neon/src/widgets/linear_progress_indicator.dart'; import 'package:neon/src/widgets/linear_progress_indicator.dart';
typedef CacheReviver = FutureOr<Uint8List?> Function(CacheManager cacheManager); typedef CacheReviver = FutureOr<Uint8List?> Function(CacheManager cacheManager);
@ -182,7 +182,7 @@ class _NeonCachedImageState extends State<NeonCachedImage> {
Widget _buildError(final dynamic error) => Widget _buildError(final dynamic error) =>
widget.errorBuilder?.call(context, error) ?? widget.errorBuilder?.call(context, error) ??
NeonException( NeonError(
error, error,
onRetry: () { onRetry: () {
setState(() {}); setState(() {});

4
packages/neon/neon/lib/src/widgets/drawer.dart

@ -11,7 +11,7 @@ import 'package:neon/src/router.dart';
import 'package:neon/src/utils/provider.dart'; import 'package:neon/src/utils/provider.dart';
import 'package:neon/src/widgets/cached_image.dart'; import 'package:neon/src/widgets/cached_image.dart';
import 'package:neon/src/widgets/drawer_destination.dart'; import 'package:neon/src/widgets/drawer_destination.dart';
import 'package:neon/src/widgets/exception.dart'; import 'package:neon/src/widgets/error.dart';
import 'package:neon/src/widgets/linear_progress_indicator.dart'; import 'package:neon/src/widgets/linear_progress_indicator.dart';
import 'package:nextcloud/nextcloud.dart'; import 'package:nextcloud/nextcloud.dart';
@ -131,7 +131,7 @@ class NeonDrawerHeader extends StatelessWidget {
} }
if (capabilities.hasError) { if (capabilities.hasError) {
return NeonException( return NeonError(
capabilities.error, capabilities.error,
onRetry: capabilitiesBloc.refresh, onRetry: capabilitiesBloc.refresh,
); );

56
packages/neon/neon/lib/src/widgets/exception.dart → packages/neon/neon/lib/src/widgets/error.dart

@ -11,9 +11,9 @@ import 'package:neon/src/utils/exceptions.dart';
import 'package:neon/src/utils/provider.dart'; import 'package:neon/src/utils/provider.dart';
import 'package:nextcloud/nextcloud.dart'; import 'package:nextcloud/nextcloud.dart';
class NeonException extends StatelessWidget { class NeonError extends StatelessWidget {
const NeonException( const NeonError(
this.exception, { this.error, {
required this.onRetry, required this.onRetry,
this.onlyIcon = false, this.onlyIcon = false,
this.iconSize, this.iconSize,
@ -21,14 +21,14 @@ class NeonException extends StatelessWidget {
super.key, super.key,
}); });
final dynamic exception; final dynamic error;
final VoidCallback onRetry; final VoidCallback onRetry;
final bool onlyIcon; final bool onlyIcon;
final double? iconSize; final double? iconSize;
final Color? color; final Color? color;
static void showSnackbar(final BuildContext context, final dynamic exception) { static void showSnackbar(final BuildContext context, final dynamic error) {
final details = getDetails(context, exception); final details = getDetails(context, error);
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
@ -45,11 +45,11 @@ class NeonException extends StatelessWidget {
@override @override
Widget build(final BuildContext context) { Widget build(final BuildContext context) {
if (exception == null) { if (error == null) {
return const SizedBox(); return const SizedBox();
} }
final details = getDetails(context, exception); final details = getDetails(context, error);
final color = this.color ?? Theme.of(context).colorScheme.error; final color = this.color ?? Theme.of(context).colorScheme.error;
final errorIcon = Icon( final errorIcon = Icon(
@ -111,71 +111,71 @@ class NeonException extends StatelessWidget {
} }
@internal @internal
static ExceptionDetails getDetails(final BuildContext context, final dynamic exception) { static ExceptionDetails getDetails(final BuildContext context, final dynamic error) {
if (exception is String) { if (error is String) {
return ExceptionDetails( return ExceptionDetails(
text: exception, text: error,
); );
} }
if (exception is MissingPermissionException) { if (error is MissingPermissionException) {
return ExceptionDetails( return ExceptionDetails(
text: AppLocalizations.of(context).errorMissingPermission(exception.permission.toString().split('.')[1]), text: AppLocalizations.of(context).errorMissingPermission(error.permission.toString().split('.')[1]),
); );
} }
if (exception is UnableToOpenFileException) { if (error is UnableToOpenFileException) {
return ExceptionDetails( return ExceptionDetails(
text: AppLocalizations.of(context).errorUnableToOpenFile, text: AppLocalizations.of(context).errorUnableToOpenFile,
); );
} }
if (exception is InvalidQRcodeException) { if (error is InvalidQRcodeException) {
return ExceptionDetails( return ExceptionDetails(
text: AppLocalizations.of(context).errorInvalidQRcode, text: AppLocalizations.of(context).errorInvalidQRcode,
); );
} }
if (exception is DynamiteApiException) { if (error is DynamiteApiException) {
if (exception.statusCode == 401) { if (error.statusCode == 401) {
return ExceptionDetails( return ExceptionDetails(
text: AppLocalizations.of(context).errorCredentialsForAccountNoLongerMatch, text: AppLocalizations.of(context).errorCredentialsForAccountNoLongerMatch,
isUnauthorized: true, isUnauthorized: true,
); );
} }
if (exception.statusCode >= 500 && exception.statusCode <= 599) { if (error.statusCode >= 500 && error.statusCode <= 599) {
return ExceptionDetails( return ExceptionDetails(
text: AppLocalizations.of(context).errorServerHadAProblemProcessingYourRequest, text: AppLocalizations.of(context).errorServerHadAProblemProcessingYourRequest,
); );
} }
} }
if (exception is SocketException) { if (error is SocketException) {
return ExceptionDetails( return ExceptionDetails(
text: exception.address != null text: error.address != null
? AppLocalizations.of(context).errorUnableToReachServerAt(exception.address!.host) ? AppLocalizations.of(context).errorUnableToReachServerAt(error.address!.host)
: AppLocalizations.of(context).errorUnableToReachServer, : AppLocalizations.of(context).errorUnableToReachServer,
); );
} }
if (exception is ClientException) { if (error is ClientException) {
return ExceptionDetails( return ExceptionDetails(
text: exception.uri != null text: error.uri != null
? AppLocalizations.of(context).errorUnableToReachServerAt(exception.uri!.host) ? AppLocalizations.of(context).errorUnableToReachServerAt(error.uri!.host)
: AppLocalizations.of(context).errorUnableToReachServer, : AppLocalizations.of(context).errorUnableToReachServer,
); );
} }
if (exception is HttpException) { if (error is HttpException) {
return ExceptionDetails( return ExceptionDetails(
text: exception.uri != null text: error.uri != null
? AppLocalizations.of(context).errorUnableToReachServerAt(exception.uri!.host) ? AppLocalizations.of(context).errorUnableToReachServerAt(error.uri!.host)
: AppLocalizations.of(context).errorUnableToReachServer, : AppLocalizations.of(context).errorUnableToReachServer,
); );
} }
if (exception is TimeoutException) { if (error is TimeoutException) {
return ExceptionDetails( return ExceptionDetails(
text: AppLocalizations.of(context).errorConnectionTimedOut, text: AppLocalizations.of(context).errorConnectionTimedOut,
); );

4
packages/neon/neon/lib/src/widgets/list_view.dart

@ -1,5 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:neon/src/widgets/exception.dart'; import 'package:neon/src/widgets/error.dart';
import 'package:neon/src/widgets/linear_progress_indicator.dart'; import 'package:neon/src/widgets/linear_progress_indicator.dart';
class NeonListView<T> extends StatelessWidget { class NeonListView<T> extends StatelessWidget {
@ -47,7 +47,7 @@ class NeonListView<T> extends StatelessWidget {
padding: withFloatingActionButton ? const EdgeInsets.only(bottom: 88) : null, padding: withFloatingActionButton ? const EdgeInsets.only(bottom: 88) : null,
children: [ children: [
...?topScrollingChildren, ...?topScrollingChildren,
NeonException( NeonError(
error, error,
onRetry: onRefresh, onRetry: onRefresh,
), ),

4
packages/neon/neon/lib/src/widgets/unified_search_results.dart

@ -10,7 +10,7 @@ import 'package:neon/src/models/account.dart';
import 'package:neon/src/theme/sizes.dart'; import 'package:neon/src/theme/sizes.dart';
import 'package:neon/src/utils/provider.dart'; import 'package:neon/src/utils/provider.dart';
import 'package:neon/src/widgets/cached_image.dart'; import 'package:neon/src/widgets/cached_image.dart';
import 'package:neon/src/widgets/exception.dart'; import 'package:neon/src/widgets/error.dart';
import 'package:neon/src/widgets/image_wrapper.dart'; import 'package:neon/src/widgets/image_wrapper.dart';
import 'package:neon/src/widgets/linear_progress_indicator.dart'; import 'package:neon/src/widgets/linear_progress_indicator.dart';
import 'package:neon/src/widgets/list_view.dart'; import 'package:neon/src/widgets/list_view.dart';
@ -66,7 +66,7 @@ class NeonUnifiedSearchResults extends StatelessWidget {
provider.name, provider.name,
style: Theme.of(context).textTheme.headlineSmall, style: Theme.of(context).textTheme.headlineSmall,
), ),
NeonException( NeonError(
result.error, result.error,
onRetry: bloc.refresh, onRetry: bloc.refresh,
), ),

2
packages/neon/neon/lib/widgets.dart

@ -1,6 +1,6 @@
export 'package:neon/src/widgets/cached_image.dart'; export 'package:neon/src/widgets/cached_image.dart';
export 'package:neon/src/widgets/dialog.dart'; export 'package:neon/src/widgets/dialog.dart';
export 'package:neon/src/widgets/exception.dart' hide ExceptionDetails; export 'package:neon/src/widgets/error.dart' hide ExceptionDetails;
export 'package:neon/src/widgets/image_wrapper.dart'; export 'package:neon/src/widgets/image_wrapper.dart';
export 'package:neon/src/widgets/linear_progress_indicator.dart'; export 'package:neon/src/widgets/linear_progress_indicator.dart';
export 'package:neon/src/widgets/list_view.dart'; export 'package:neon/src/widgets/list_view.dart';

2
packages/neon/neon_files/lib/pages/main.dart

@ -18,7 +18,7 @@ class _FilesMainPageState extends State<FilesMainPage> {
bloc = NeonProvider.of<FilesBloc>(context); bloc = NeonProvider.of<FilesBloc>(context);
bloc.errors.listen((final error) { bloc.errors.listen((final error) {
NeonException.showSnackbar(context, error); NeonError.showSnackbar(context, error);
}); });
} }

2
packages/neon/neon_files/lib/widgets/browser_view.dart

@ -34,7 +34,7 @@ class _FilesBrowserViewState extends State<FilesBrowserView> {
@override @override
void initState() { void initState() {
widget.bloc.errors.listen((final error) { widget.bloc.errors.listen((final error) {
NeonException.showSnackbar(context, error); NeonError.showSnackbar(context, error);
}); });
super.initState(); super.initState();

2
packages/neon/neon_news/lib/dialogs/add_feed.dart

@ -73,7 +73,7 @@ class _NewsAddFeedDialogState extends State<NewsAddFeedDialog> {
), ),
if (widget.folderID == null) ...[ if (widget.folderID == null) ...[
Center( Center(
child: NeonException( child: NeonError(
folders.error, folders.error,
onRetry: widget.bloc.refresh, onRetry: widget.bloc.refresh,
), ),

2
packages/neon/neon_news/lib/pages/article.dart

@ -30,7 +30,7 @@ class _NewsArticlePageState extends State<NewsArticlePage> {
super.initState(); super.initState();
widget.bloc.errors.listen((final error) { widget.bloc.errors.listen((final error) {
NeonException.showSnackbar(context, error); NeonError.showSnackbar(context, error);
}); });
WidgetsBinding.instance.addPostFrameCallback((final _) { WidgetsBinding.instance.addPostFrameCallback((final _) {

2
packages/neon/neon_news/lib/pages/main.dart

@ -19,7 +19,7 @@ class _NewsMainPageState extends State<NewsMainPage> {
bloc = NeonProvider.of<NewsBloc>(context); bloc = NeonProvider.of<NewsBloc>(context);
bloc.errors.listen((final error) { bloc.errors.listen((final error) {
NeonException.showSnackbar(context, error); NeonError.showSnackbar(context, error);
}); });
} }

2
packages/neon/neon_news/lib/widgets/articles_view.dart

@ -20,7 +20,7 @@ class _NewsArticlesViewState extends State<NewsArticlesView> {
super.initState(); super.initState();
widget.bloc.errors.listen((final error) { widget.bloc.errors.listen((final error) {
NeonException.showSnackbar(context, error); NeonError.showSnackbar(context, error);
}); });
} }

2
packages/neon/neon_notes/lib/dialogs/create_note.dart

@ -55,7 +55,7 @@ class _NotesCreateNoteDialogState extends State<NotesCreateNoteDialog> {
), ),
if (widget.category == null) ...[ if (widget.category == null) ...[
Center( Center(
child: NeonException( child: NeonError(
notes.error, notes.error,
onRetry: widget.bloc.refresh, onRetry: widget.bloc.refresh,
), ),

2
packages/neon/neon_notes/lib/dialogs/select_category.dart

@ -37,7 +37,7 @@ class _NotesSelectCategoryDialogState extends State<NotesSelectCategoryDialog> {
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
Center( Center(
child: NeonException( child: NeonError(
notes.error, notes.error,
onRetry: widget.bloc.refresh, onRetry: widget.bloc.refresh,
), ),

4
packages/neon/neon_notes/lib/utils/exception_handler.dart

@ -2,8 +2,8 @@ part of '../neon_notes.dart';
void handleNotesException(final BuildContext context, final Object error) { void handleNotesException(final BuildContext context, final Object error) {
if (error is DynamiteApiException && error.statusCode == 412) { if (error is DynamiteApiException && error.statusCode == 412) {
NeonException.showSnackbar(context, AppLocalizations.of(context).errorChangedOnServer); NeonError.showSnackbar(context, AppLocalizations.of(context).errorChangedOnServer);
} else { } else {
NeonException.showSnackbar(context, error); NeonError.showSnackbar(context, error);
} }
} }

2
packages/neon/neon_notifications/lib/pages/main.dart

@ -19,7 +19,7 @@ class _NotificationsMainPageState extends State<NotificationsMainPage> {
bloc = NeonProvider.of<NotificationsBlocInterface>(context) as NotificationsBloc; bloc = NeonProvider.of<NotificationsBlocInterface>(context) as NotificationsBloc;
bloc.errors.listen((final error) { bloc.errors.listen((final error) {
NeonException.showSnackbar(context, error); NeonError.showSnackbar(context, error);
}); });
} }

Loading…
Cancel
Save