diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index c0ee651c62..8354aa0a2c 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -13304,6 +13304,8 @@ Sorry for the inconvenience."; "Chat.VideoProcessingInfo" = "The video will be published once converted and optimized."; +"Camera.CollageRetake" = "Retake"; +"Camera.CollageDelete" = "Delete"; "Camera.CollageManagementTooltip" = "Tap a tile to delete or reorder it."; "Camera.CollageReorderingInfo" = "Hold and drag tiles to reorder them."; diff --git a/submodules/TelegramUI/Components/CameraScreen/Sources/CameraCollage.swift b/submodules/TelegramUI/Components/CameraScreen/Sources/CameraCollage.swift index 12ca0997f9..f4f6359fe9 100644 --- a/submodules/TelegramUI/Components/CameraScreen/Sources/CameraCollage.swift +++ b/submodules/TelegramUI/Components/CameraScreen/Sources/CameraCollage.swift @@ -504,6 +504,10 @@ final class CameraCollageView: UIView, UIGestureRecognizerDelegate { self.contextAction?(item.uniqueId, self.extractedContainerView, nil) } + func stopPlayback() { + self.videoPlayer?.pause() + } + func resetPlayback() { self.videoPlayer?.seek(to: .zero) self.videoPlayer?.play() @@ -991,6 +995,12 @@ final class CameraCollageView: UIView, UIGestureRecognizerDelegate { } } + func stopPlayback() { + for (_, itemView) in self.itemViews { + itemView.stopPlayback() + } + } + func resetPlayback() { for (_, itemView) in self.itemViews { itemView.resetPlayback() @@ -1054,7 +1064,7 @@ final class CameraCollageView: UIView, UIGestureRecognizerDelegate { var itemList: [ContextMenuItem] = [] if self.collage.cameraIndex == nil { - itemList.append(.action(ContextMenuActionItem(text: "Retake", icon: { theme in + itemList.append(.action(ContextMenuActionItem(text: presentationData.strings.Camera_CollageRetake, icon: { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Camera"), color: theme.contextMenu.primaryColor) }, action: { [weak self] _, f in f(.default) @@ -1066,7 +1076,7 @@ final class CameraCollageView: UIView, UIGestureRecognizerDelegate { if self.itemViews.count > 2 { itemList.append(.separator) - itemList.append(.action(ContextMenuActionItem(text: "Delete", textColor: .destructive, icon: { theme in + itemList.append(.action(ContextMenuActionItem(text: presentationData.strings.Camera_CollageDelete, textColor: .destructive, icon: { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.contextMenu.destructiveColor) }, action: { [weak self] _, f in f(.dismissWithoutContent) diff --git a/submodules/TelegramUI/Components/CameraScreen/Sources/CameraScreen.swift b/submodules/TelegramUI/Components/CameraScreen/Sources/CameraScreen.swift index d25ca8db2d..82fd580a32 100644 --- a/submodules/TelegramUI/Components/CameraScreen/Sources/CameraScreen.swift +++ b/submodules/TelegramUI/Components/CameraScreen/Sources/CameraScreen.swift @@ -2615,13 +2615,9 @@ public class CameraScreenImpl: ViewController, CameraScreen { view.animateOutToEditor(transition: transition) } - Queue.mainQueue().after(2.0, { - if self.cameraState.isCollageEnabled { - self.collage = nil - if let collageView = self.collageView { - collageView.removeFromSuperview() - self.collageView = nil - } + Queue.mainQueue().after(1.5, { + if let collageView = self.collageView { + collageView.stopPlayback() } }) } @@ -2679,6 +2675,10 @@ public class CameraScreenImpl: ViewController, CameraScreen { if !toGallery { self.resumeCameraCapture(fromGallery: false) + if let collageView = self.collageView { + collageView.resetPlayback() + } + self.cameraIsActive = true self.requestUpdateLayout(transition: .immediate) diff --git a/submodules/TelegramUI/Components/CameraScreen/Sources/CaptureControlsComponent.swift b/submodules/TelegramUI/Components/CameraScreen/Sources/CaptureControlsComponent.swift index 03ddaffe93..4266369a88 100644 --- a/submodules/TelegramUI/Components/CameraScreen/Sources/CaptureControlsComponent.swift +++ b/submodules/TelegramUI/Components/CameraScreen/Sources/CaptureControlsComponent.swift @@ -999,14 +999,22 @@ final class CaptureControlsComponent: Component { func animateInFromEditor(transition: ComponentTransition) { self.animatedOut = false + guard let component = self.component else { + return + } + if let view = self.galleryButtonView.view { transition.setScale(view: view, scale: 1.0) - transition.setAlpha(view: view, alpha: 1.0) + if !component.hideControls { + transition.setAlpha(view: view, alpha: 1.0) + } } if let view = self.flipButtonView.view { transition.setScale(view: view, scale: 1.0) - transition.setAlpha(view: view, alpha: 1.0) + if !component.hideControls { + transition.setAlpha(view: view, alpha: 1.0) + } } if let view = self.shutterButtonView.view {