Change media saving option strings

This commit is contained in:
Ilya Laktyushin 2021-08-11 19:06:20 +03:00
parent 436ebb4be4
commit 6907ac9150
5 changed files with 12 additions and 7 deletions

View File

@ -6569,6 +6569,9 @@ Sorry for the inconvenience.";
"Gallery.VideoSaved" = "Video Saved";
"Gallery.WaitForVideoDownoad" = "Please wait for the video to be fully downloaded.";
"Gallery.SaveImage" = "Save Image";
"Gallery.SaveVideo" = "Save Video";
"VoiceChat.VideoParticipantsLimitExceededExtended" = "The voice chat is over %@ members.\nNew participants only have access to audio stream. ";
"PlaybackSpeed.Title" = "Playback Speed";

View File

@ -2089,7 +2089,7 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
c.setItems(strongSelf.contextMenuSpeedItems())
})))
if let (message, maybeFile, _) = strongSelf.contentInfo(), let file = maybeFile {
items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.Gallery_SaveToGallery, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Download"), color: theme.actionSheet.primaryTextColor) }, action: { _, f in
items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.Gallery_SaveVideo, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Download"), color: theme.actionSheet.primaryTextColor) }, action: { _, f in
f(.default)
if let strongSelf = self {

View File

@ -387,20 +387,22 @@ public final class ShareController: ViewController {
break
case let .image(representations):
if case .saveToCameraRoll = preferredAction {
self.defaultAction = ShareControllerAction(title: self.presentationData.strings.Preview_SaveToCameraRoll, action: { [weak self] in
self.defaultAction = ShareControllerAction(title: self.presentationData.strings.Gallery_SaveImage, action: { [weak self] in
self?.saveToCameraRoll(representations: representations)
self?.actionCompleted?()
})
}
case let .media(mediaReference):
var canSave = false
var isVideo = false
if mediaReference.media is TelegramMediaImage {
canSave = true
} else if mediaReference.media is TelegramMediaFile {
} else if let file = mediaReference.media as? TelegramMediaFile {
canSave = true
isVideo = file.isVideo
}
if case .saveToCameraRoll = preferredAction, canSave {
self.defaultAction = ShareControllerAction(title: self.presentationData.strings.Preview_SaveToCameraRoll, action: { [weak self] in
self.defaultAction = ShareControllerAction(title: isVideo ? self.presentationData.strings.Gallery_SaveVideo : self.presentationData.strings.Gallery_SaveImage, action: { [weak self] in
self?.saveToCameraRoll(mediaReference: mediaReference)
self?.actionCompleted?()
})

View File

@ -955,8 +955,6 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
}
if let status = status {
contentNode.state = .progress(status)
} else {
}
}, completed: { [weak self] in
guard let strongSelf = self, let contentNode = strongSelf.contentNode as? ShareLoadingContainerNode else {

View File

@ -615,17 +615,19 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState
}
if resourceAvailable, !message.containsSecretMedia {
var mediaReference: AnyMediaReference?
var isVideo = false
for media in message.media {
if let image = media as? TelegramMediaImage, let _ = largestImageRepresentation(image.representations) {
mediaReference = ImageMediaReference.standalone(media: image).abstract
break
} else if let file = media as? TelegramMediaFile, file.isVideo {
mediaReference = FileMediaReference.standalone(media: file).abstract
isVideo = true
break
}
}
if let mediaReference = mediaReference {
actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Preview_SaveToCameraRoll, icon: { theme in
actions.append(.action(ContextMenuActionItem(text: isVideo ? chatPresentationInterfaceState.strings.Gallery_SaveVideo : chatPresentationInterfaceState.strings.Gallery_SaveImage, icon: { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Save"), color: theme.actionSheet.primaryTextColor)
}, action: { _, f in
let _ = (saveToCameraRoll(context: context, postbox: context.account.postbox, mediaReference: mediaReference)