mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
6502dbcff9
commit
fddaf7451d
@ -2564,7 +2564,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
||||
return nil
|
||||
}
|
||||
|
||||
fileprivate func openStoryCamera() {
|
||||
fileprivate func openStoryCamera(fromList: Bool) {
|
||||
switch self.storyPostingAvailability {
|
||||
case .premium:
|
||||
guard self.isPremium else {
|
||||
@ -2588,12 +2588,22 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
||||
|
||||
var cameraTransitionIn: StoryCameraTransitionIn?
|
||||
if let componentView = self.chatListHeaderView() {
|
||||
if let (transitionView, _) = componentView.storyPeerListView()?.transitionViewForItem(peerId: self.context.account.peerId) {
|
||||
cameraTransitionIn = StoryCameraTransitionIn(
|
||||
sourceView: transitionView,
|
||||
sourceRect: transitionView.bounds,
|
||||
sourceCornerRadius: transitionView.bounds.height * 0.5
|
||||
)
|
||||
if fromList {
|
||||
if let (transitionView, _) = componentView.storyPeerListView()?.transitionViewForItem(peerId: self.context.account.peerId) {
|
||||
cameraTransitionIn = StoryCameraTransitionIn(
|
||||
sourceView: transitionView,
|
||||
sourceRect: transitionView.bounds,
|
||||
sourceCornerRadius: transitionView.bounds.height * 0.5
|
||||
)
|
||||
}
|
||||
} else {
|
||||
if let rightButtonView = componentView.rightButtonViews["story"] {
|
||||
cameraTransitionIn = StoryCameraTransitionIn(
|
||||
sourceView: rightButtonView,
|
||||
sourceRect: rightButtonView.bounds,
|
||||
sourceCornerRadius: rightButtonView.bounds.height * 0.5
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2609,6 +2619,12 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
||||
destinationRect: transitionView.bounds,
|
||||
destinationCornerRadius: transitionView.bounds.height * 0.5
|
||||
)
|
||||
} else if let rightButtonView = componentView.rightButtonViews["story"] {
|
||||
return StoryCameraTransitionOut(
|
||||
destinationView: rightButtonView,
|
||||
destinationRect: rightButtonView.bounds,
|
||||
destinationCornerRadius: rightButtonView.bounds.height * 0.5
|
||||
)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@ -2651,7 +2667,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
||||
}
|
||||
|
||||
if openCamera {
|
||||
self.openStoryCamera()
|
||||
self.openStoryCamera(fromList: true)
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -2686,7 +2702,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
||||
return
|
||||
}
|
||||
|
||||
self.openStoryCamera()
|
||||
self.openStoryCamera(fromList: true)
|
||||
})
|
||||
})))
|
||||
|
||||
@ -3552,7 +3568,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
||||
}
|
||||
|
||||
if peerId == self.context.account.peerId, storyContentState.slice == nil {
|
||||
self.openStoryCamera()
|
||||
self.openStoryCamera(fromList: true)
|
||||
return
|
||||
}
|
||||
|
||||
@ -5846,7 +5862,7 @@ private final class ChatListLocationContext {
|
||||
guard let self, let parentController = self.parentController else {
|
||||
return
|
||||
}
|
||||
parentController.openStoryCamera()
|
||||
parentController.openStoryCamera(fromList: false)
|
||||
}
|
||||
)))
|
||||
} else {
|
||||
|
@ -221,7 +221,7 @@ public extension UIView {
|
||||
}
|
||||
|
||||
private func layoutMetricsForScreenSize(_ size: CGSize) -> LayoutMetrics {
|
||||
if size.width > 690.0 && size.height > 690.0 {
|
||||
if size.width > 690.0 && size.height > 650.0 {
|
||||
return LayoutMetrics(widthClass: .regular, heightClass: .regular)
|
||||
} else {
|
||||
return LayoutMetrics(widthClass: .compact, heightClass: .compact)
|
||||
|
@ -259,9 +259,9 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
|
||||
}
|
||||
}
|
||||
|
||||
private func startPosition(relativeTo entity: DrawingEntity?) -> CGPoint {
|
||||
private func startPosition(relativeTo entity: DrawingEntity?, onlyVertical: Bool = false) -> CGPoint {
|
||||
let offsetLength = round(self.size.width * 0.1)
|
||||
let offset = CGPoint(x: offsetLength, y: offsetLength)
|
||||
let offset = CGPoint(x: onlyVertical ? 0.0 : offsetLength, y: offsetLength)
|
||||
if let entity = entity {
|
||||
return entity.center.offsetBy(dx: offset.x, dy: offset.y)
|
||||
} else {
|
||||
@ -297,7 +297,7 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
|
||||
}
|
||||
|
||||
public func prepareNewEntity(_ entity: DrawingEntity, setup: Bool = true, relativeTo: DrawingEntity? = nil) {
|
||||
let center = self.startPosition(relativeTo: relativeTo)
|
||||
let center = self.startPosition(relativeTo: relativeTo, onlyVertical: entity is DrawingTextEntity)
|
||||
let rotation = self.getEntityInitialRotation()
|
||||
let zoomScale = 1.0 / (self.drawingView?.zoomScale ?? 1.0)
|
||||
|
||||
|
@ -1220,7 +1220,7 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
|
||||
var itemHeight = itemWidth
|
||||
if case let .assets(_, mode) = controller.subject, case .story = mode {
|
||||
itemHeight = 180.0
|
||||
itemHeight = floor(itemWidth * 1.227)
|
||||
}
|
||||
|
||||
self.gridNode.transaction(GridNodeTransaction(deleteItems: [], insertItems: [], updateItems: [], scrollToItem: nil, updateLayout: GridNodeUpdateLayout(layout: GridNodeLayout(size: bounds.size, insets: gridInsets, scrollIndicatorInsets: nil, preloadSize: itemHeight * 3.0, type: .fixed(itemSize: CGSize(width: itemWidth, height: itemHeight), fillWidth: true, lineSpacing: itemSpacing, itemSpacing: itemSpacing), cutout: cameraRect), transition: transition), itemTransition: .immediate, stationaryItems: .none, updateFirstIndexInSectionOffset: nil, updateOpaqueState: nil, synchronousLoads: false), completion: { [weak self] _ in
|
||||
|
@ -111,7 +111,7 @@ private final class ShutterButtonContentComponent: Component {
|
||||
self.blobView = ShutterBlobView(test: false)
|
||||
self.addSubview(self.blobView!)
|
||||
|
||||
Queue.mainQueue().after(0.1) {
|
||||
Queue.mainQueue().after(0.2) {
|
||||
self.innerLayer.removeFromSuperlayer()
|
||||
}
|
||||
}
|
||||
|
@ -760,6 +760,12 @@ public final class ChatListHeaderComponent: Component {
|
||||
return self.effectiveContentView?.rightButtonViews.first?.value.view
|
||||
}
|
||||
|
||||
public var rightButtonViews: [AnyHashable: UIView] {
|
||||
return self.effectiveContentView?.rightButtonViews.reduce(into: [:], { result, view in
|
||||
result[view.key] = view.value.view
|
||||
}) ?? [:]
|
||||
}
|
||||
|
||||
public var titleContentView: UIView? {
|
||||
return self.effectiveContentView?.titleContentView?.view
|
||||
}
|
||||
|
@ -462,7 +462,7 @@ extension CIImage {
|
||||
}
|
||||
|
||||
private func render(context: CIContext, width: Int, height: Int, bytesPerRow: Int, data: Data, type: AnimationRendererFrameType, pixelBuffer: CVPixelBuffer, tintColor: UIColor?) -> CIImage? {
|
||||
//let calculatedBytesPerRow = (4 * Int(width) + 31) & (~31)
|
||||
let calculatedBytesPerRow = (4 * Int(width) + 31) & (~31)
|
||||
//assert(bytesPerRow == calculatedBytesPerRow)
|
||||
|
||||
|
||||
@ -475,7 +475,7 @@ private func render(context: CIContext, width: Int, height: Int, bytesPerRow: In
|
||||
guard let bytes = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
||||
return
|
||||
}
|
||||
decodeYUVAToRGBA(bytes, dest, Int32(width), Int32(height), Int32(width * 4))
|
||||
decodeYUVAToRGBA(bytes, dest, Int32(width), Int32(height), Int32(calculatedBytesPerRow))
|
||||
}
|
||||
case .argb:
|
||||
data.withUnsafeBytes { buffer -> Void in
|
||||
|
@ -3760,12 +3760,12 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
||||
duration = 5.0
|
||||
|
||||
firstFrame = .single(image)
|
||||
case let .video(path, _, _, _, _, _, _, _, _):
|
||||
case let .video(path, _, _, _, _, _, durationValue, _, _):
|
||||
videoResult = .videoFile(path: path)
|
||||
if let videoTrimRange = mediaEditor.values.videoTrimRange {
|
||||
duration = videoTrimRange.upperBound - videoTrimRange.lowerBound
|
||||
} else {
|
||||
duration = 5.0
|
||||
duration = durationValue
|
||||
}
|
||||
|
||||
firstFrame = Signal<UIImage?, NoError> { subscriber in
|
||||
@ -3823,7 +3823,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
||||
if let videoTrimRange = mediaEditor.values.videoTrimRange {
|
||||
duration = videoTrimRange.upperBound - videoTrimRange.lowerBound
|
||||
} else {
|
||||
duration = 5.0
|
||||
duration = draft.duration ?? 5.0
|
||||
}
|
||||
firstFrame = Signal<UIImage?, NoError> { subscriber in
|
||||
let avAsset = AVURLAsset(url: URL(fileURLWithPath: draft.fullPath()))
|
||||
|
Loading…
x
Reference in New Issue
Block a user