Various Fixes

This commit is contained in:
Ilya Laktyushin 2021-09-22 00:08:47 +03:00
parent 9aa4256dbf
commit b57632c670
2 changed files with 10 additions and 5 deletions

View File

@ -587,8 +587,12 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll
} else if let media = media as? TelegramMediaFile, !media.isAnimated {
for attribute in media.attributes {
switch attribute {
case .Video:
case let .Video(_, dimensions, _):
if dimensions.height > 0 {
if CGFloat(dimensions.width) / CGFloat(dimensions.height) > 1.33 {
canFullscreen = true
}
}
default:
break
}
@ -1114,7 +1118,7 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll
}
var preferredAction = ShareControllerPreferredAction.default
var actionCompletionText: String = ""
var actionCompletionText: String?
if let generalMessageContentKind = generalMessageContentKind {
switch generalMessageContentKind {
case .image:
@ -1164,6 +1168,7 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll
} else if let image = content.image {
subject = .media(.webPage(webPage: WebpageReference(webpage), media: image))
preferredAction = .saveToCameraRoll
actionCompletionText = strongSelf.presentationData.strings.Gallery_ImageSaved
}
}
} else if let file = m as? TelegramMediaFile {
@ -1185,7 +1190,7 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll
self?.interacting?(false)
}
shareController.actionCompleted = { [weak self] in
if let strongSelf = self {
if let strongSelf = self, let actionCompletionText = actionCompletionText {
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
strongSelf.controllerInteraction?.presentController(UndoOverlayController(presentationData: presentationData, content: .mediaSaved(text: actionCompletionText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
}

View File

@ -892,7 +892,7 @@ public final class ShareController: ViewController {
} else {
context = self.sharedContext.makeTempAccountContext(account: self.currentAccount)
}
self.controllerNode.transitionToProgressWithValue(signal: SaveToCameraRoll.saveToCameraRoll(context: context, postbox: context.account.postbox, mediaReference: mediaReference) |> map(Optional.init))
self.controllerNode.transitionToProgressWithValue(signal: SaveToCameraRoll.saveToCameraRoll(context: context, postbox: context.account.postbox, mediaReference: mediaReference) |> map(Optional.init), dismissImmediately: true)
}
private func switchToAccount(account: Account, animateIn: Bool) {