diff --git a/Signal/src/ViewControllers/MediaGallery/MediaTileViewController.swift b/Signal/src/ViewControllers/MediaGallery/MediaTileViewController.swift index c9d12d3129..50698f6fa2 100644 --- a/Signal/src/ViewControllers/MediaGallery/MediaTileViewController.swift +++ b/Signal/src/ViewControllers/MediaGallery/MediaTileViewController.swift @@ -1408,18 +1408,39 @@ extension MediaTileViewController: MediaGalleryPrimaryViewController { return } - let format = OWSLocalizedString("MEDIA_GALLERY_DELETE_MESSAGES_%d", tableName: "PluralAware", - comment: "Confirmation button text to delete selected media message(s) from the gallery") - let confirmationTitle = String.localizedStringWithFormat(format, indexPaths.count) + let actionSheetTitle = String.localizedStringWithFormat( + OWSLocalizedString( + "MEDIA_GALLERY_DELETE_MEDIA_TITLE", + tableName: "PluralAware", + comment: "Title for confirmation prompt when deleting N items in All Media screen." + ), + indexPaths.count + ) + let actionSheetMessage = OWSLocalizedString( + "MEDIA_GALLERY_DELETE_MEDIA_BODY", + comment: "Explanatory text displayed when deleting N items in All Media screen." + ) + let toastText = String.localizedStringWithFormat( + OWSLocalizedString( + "MEDIA_GALLERY_DELETE_MEDIA_TOAST", + tableName: "PluralAware", + comment: "Toast displayed after successful deletion of N items in All Media screen."), + indexPaths.count + ) - let deleteAction = ActionSheetAction(title: confirmationTitle, style: .destructive) { _ in - let galleryIndexPaths = indexPaths.map { self.mediaGalleryIndexPath($0) } - self.mediaGallery.delete(items: items, atIndexPaths: galleryIndexPaths, initiatedBy: self) - self.accessoriesHelper.endSelectMode() - } - - let actionSheet = ActionSheetController(title: nil, message: nil) - actionSheet.addAction(deleteAction) + let actionSheet = ActionSheetController(title: actionSheetTitle, message: actionSheetMessage) + actionSheet.addAction(ActionSheetAction( + title: CommonStrings.deleteButton, + style: .destructive, + handler: { [self] _ in + let galleryIndexPaths = indexPaths.map { self.mediaGalleryIndexPath($0) } + self.mediaGallery.delete(items: items, atIndexPaths: galleryIndexPaths, initiatedBy: self) + self.accessoriesHelper.endSelectMode() + DispatchQueue.main.async { + self.presentToast(text: toastText, extraVInset: self.collectionView.contentInset.bottom) + } + } + )) actionSheet.addAction(OWSActionSheets.cancelAction) presentActionSheet(actionSheet) diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index f7423367e9..a553f58fa9 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -3538,6 +3538,9 @@ /* Shown in place of message input text in media editor when 'View Once' is on. */ "MEDIA_EDITOR_TEXT_FIELD_VIEW_ONCE_MEDIA" = "View Once Media"; +/* Explanatory text displayed when deleting N items in All Media screen. */ +"MEDIA_GALLERY_DELETE_MEDIA_BODY" = "This will permanently delete the selected files. Any message text associated with these items will also be deleted."; + /* Format for the 'more items' indicator for media galleries. Embeds {{the number of additional items}}. */ "MEDIA_GALLERY_MORE_ITEMS_FORMAT" = "+%@"; diff --git a/Signal/translations/en.lproj/PluralAware.stringsdict b/Signal/translations/en.lproj/PluralAware.stringsdict index 772c82e1ff..72e6c62d0d 100644 --- a/Signal/translations/en.lproj/PluralAware.stringsdict +++ b/Signal/translations/en.lproj/PluralAware.stringsdict @@ -653,7 +653,7 @@ %d groups in common - MEDIA_GALLERY_DELETE_MESSAGES_%d + MEDIA_GALLERY_DELETE_MEDIA_TITLE NSStringLocalizedFormatKey %#@text@ @@ -664,9 +664,25 @@ NSStringFormatValueTypeKey d one - Delete %d Message + Delete %d Item? other - Delete %d Messages + Delete %d Items? + + + MEDIA_GALLERY_DELETE_MEDIA_TOAST + + NSStringLocalizedFormatKey + %#@text@ + text + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + One item deleted + other + %d items deleted MEDIA_GALLERY_ITEM_IMAGE_COUNT_%d