Skip to content

Commit

Permalink
LA-1354 removed deleting last version of a file
Browse files Browse the repository at this point in the history
  • Loading branch information
KhaledNjim committed Nov 10, 2024
1 parent 12fcb7c commit c384a20
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lib/presentation/localizations/app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<AppLocalizations> {
Expand Down
4 changes: 4 additions & 0 deletions lib/presentation/util/toast_message_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit c384a20

Please sign in to comment.