Various fixes

This commit is contained in:
Ilya Laktyushin 2022-11-12 12:51:07 +04:00
parent de5d52ea48
commit 1311ee7de6
4 changed files with 99 additions and 84 deletions

View File

@ -38,6 +38,7 @@ open class OverlayMediaItemNode: ASDisplayNode {
}
open var customTransition: Bool = false
open var isRemoved: Bool = false
open func setShouldAcquireContext(_ value: Bool) {
}

View File

@ -3276,7 +3276,10 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
self?.donePressed()
completion?()
})
} else if case .right = action, !peerIds.isEmpty {
} else if case .right = action {
if !threadIds.isEmpty {
} else if !peerIds.isEmpty {
let actionSheet = ActionSheetController(presentationData: self.presentationData)
var items: [ActionSheetItem] = []
items.append(ActionSheetButtonItem(title: self.presentationData.strings.ChatList_DeleteConfirmation(Int32(peerIds.count)), color: .destructive, action: { [weak self, weak actionSheet] in
@ -3360,6 +3363,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
])
])
self.present(actionSheet, in: .window(.root))
}
} else if case .middle = action {
switch self.location {
case let .chatList(groupId):

View File

@ -145,8 +145,11 @@ final class AppIconsDemoComponent: Component {
from = CGPoint(x: availableSize.width * 0.5, y: availableSize.height * 0.5)
delay = 0.0
}
view.layer.animateScale(from: 3.0, to: 1.0, duration: 0.5, delay: delay, timingFunction: kCAMediaTimingFunctionSpring)
view.layer.animatePosition(from: from, to: CGPoint(), duration: 0.5, delay: delay, timingFunction: kCAMediaTimingFunctionSpring, additive: true)
Queue.mainQueue().after(delay) {
view.layer.animateScale(from: 3.0, to: 1.0, duration: 0.5, delay: 0.0, timingFunction: kCAMediaTimingFunctionSpring)
view.layer.animatePosition(from: from, to: CGPoint(), duration: 0.5, delay: 0.0, timingFunction: kCAMediaTimingFunctionSpring, additive: true)
}
i += 1
}

View File

@ -293,11 +293,13 @@ final class OverlayMediaControllerNode: ASDisplayNode, UIGestureRecognizerDelega
if customTransition {
node.removeFromSupernode()
} else {
if !node.isRemoved {
let nodeSize = self.videoNodes[index].currentSize
node.layer.animateFrame(from: node.layer.frame, to: CGRect(origin: self.nodePosition(layout: validLayout, size: nodeSize, location: self.videoNodes[index].location, hidden: true, isMinimized: self.videoNodes[index].isMinimized, tempExtendedTopInset: node.tempExtendedTopInset), size: nodeSize), duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false, completion: { [weak node] _ in
node?.removeFromSupernode()
})
}
}
} else {
node.removeFromSupernode()
}
@ -368,11 +370,16 @@ final class OverlayMediaControllerNode: ASDisplayNode, UIGestureRecognizerDelega
}
self.videoNodes[index].location = updatedLocation
draggingNode.frame = CGRect(origin: self.nodePosition(layout: validLayout, size: nodeSize, location: updatedLocation, hidden: !draggingNode.hasAttachedContext, isMinimized: self.videoNodes[index].isMinimized, tempExtendedTopInset: draggingNode.tempExtendedTopInset), size: nodeSize)
draggingNode.layer.animateFrame(from: previousFrame, to: draggingNode.frame, duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring)
draggingNode.frame = CGRect(origin: self.nodePosition(layout: validLayout, size: nodeSize, location: updatedLocation, hidden: !draggingNode.hasAttachedContext || shouldDismiss, isMinimized: self.videoNodes[index].isMinimized, tempExtendedTopInset: draggingNode.tempExtendedTopInset), size: nodeSize)
draggingNode.layer.animateFrame(from: previousFrame, to: draggingNode.frame, duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring, completion: { [weak draggingNode] _ in
if draggingNode?.isRemoved == true {
draggingNode?.removeFromSupernode()
}
})
self.draggingNode = nil
if shouldDismiss && !draggingNode.isMinimizeable {
draggingNode.isRemoved = true
draggingNode.dismiss()
}
}