diff --git a/lib/presentation/localizations/app_localizations.dart b/lib/presentation/localizations/app_localizations.dart index 48deba02a..6904f0353 100644 --- a/lib/presentation/localizations/app_localizations.dart +++ b/lib/presentation/localizations/app_localizations.dart @@ -3023,6 +3023,14 @@ class AppLocalizations { name: 'reach_upload_request_limit_message_own_server' ); } + + String get you_cant_delete_the_last_version { + return Intl.message( + "You can't delete the last version, try to delete the whole document", + name: 'you_cant_delete_the_last_version', + ); + } + } class AppLocalizationsDelegate extends LocalizationsDelegate { diff --git a/lib/presentation/util/toast_message_handler.dart b/lib/presentation/util/toast_message_handler.dart index 56e569fb0..109f0fa4c 100644 --- a/lib/presentation/util/toast_message_handler.dart +++ b/lib/presentation/util/toast_message_handler.dart @@ -429,6 +429,10 @@ class ToastMessageHandler { } else if (failure is CopyToSharedSpaceFailure) { appToast.showErrorToast(AppLocalizations.of(context).cannot_copy_file_to_shared_space); _cleanSharedSpaceNodeVersionsViewState(); + } else if (failure is RemoveFinalSharedSpaceNodeVersionFailure) { + appToast.showErrorToast( + AppLocalizations.of(context).you_cant_delete_the_last_version); + _cleanSharedSpaceNodeVersionsViewState(); } }, (success) { diff --git a/lib/presentation/widget/shared_space_document/shared_space_node_versions/shared_space_node_versions_viewmodel.dart b/lib/presentation/widget/shared_space_document/shared_space_node_versions/shared_space_node_versions_viewmodel.dart index 9f42314f1..3d8a71006 100644 --- a/lib/presentation/widget/shared_space_document/shared_space_node_versions/shared_space_node_versions_viewmodel.dart +++ b/lib/presentation/widget/shared_space_document/shared_space_node_versions/shared_space_node_versions_viewmodel.dart @@ -228,7 +228,7 @@ class SharedSpaceNodeVersionsViewModel extends BaseViewModel { .onConfirmAction(AppLocalizations.of(context).delete, (_) { _appNavigation.popBack(); if (finalVersion) { - store.dispatch(_removeFinalNodeVersionAction(nodeVersionArguments.workGroupNode)); + store.dispatch(SharedSpaceNodeVersionsAction(Left(RemoveFinalSharedSpaceNodeVersionFailure()))); } else { store.dispatch(_removeNodeVersionAction(document)); }