mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-08 19:10:53 +00:00
Various improvements
This commit is contained in:
parent
34ff4d1f16
commit
1e800125d5
@ -349,6 +349,8 @@ open class ListView: ASDisplayNode, ASScrollViewDelegate, ASGestureRecognizerDel
|
||||
public final var beganInteractiveDragging: (CGPoint) -> Void = { _ in }
|
||||
public final var endedInteractiveDragging: (CGPoint) -> Void = { _ in }
|
||||
public final var didEndScrolling: ((Bool) -> Void)?
|
||||
public final var didEndScrollingWithOverscroll: (() -> Void)?
|
||||
|
||||
|
||||
private var currentGeneralScrollDirection: GeneralScrollDirection?
|
||||
public final var generalScrollDirectionUpdated: (GeneralScrollDirection) -> Void = { _ in }
|
||||
@ -891,6 +893,10 @@ open class ListView: ASDisplayNode, ASScrollViewDelegate, ASGestureRecognizerDel
|
||||
self.resetScrollIndicatorFlashTimer(start: false)
|
||||
|
||||
self.isAuxiliaryDisplayLinkEnabled = true
|
||||
|
||||
if scrollView.contentOffset.y < -48.0 {
|
||||
self.didEndScrollingWithOverscroll?()
|
||||
}
|
||||
} else {
|
||||
self.isDeceleratingAfterTracking = false
|
||||
self.resetHeaderItemsFlashTimer(start: true)
|
||||
|
@ -70,7 +70,7 @@ public func makePresentationTheme(chatTheme: ChatTheme, dark: Bool = false) -> P
|
||||
return nil
|
||||
}
|
||||
let defaultTheme = makeDefaultPresentationTheme(reference: PresentationBuiltinThemeReference(baseTheme: settings.baseTheme), serviceBackgroundColor: nil, preview: false)
|
||||
let theme = customizePresentationTheme(defaultTheme, editing: true, accentColor: UIColor(rgb: settings.accentColor), outgoingAccentColor: settings.outgoingAccentColor.flatMap { UIColor(rgb: $0) }, backgroundColors: [], bubbleColors: settings.messageColors, animateBubbleColors: settings.animateMessageColors, wallpaper: settings.wallpaper)
|
||||
let theme = customizePresentationTheme(defaultTheme, editing: false, accentColor: UIColor(rgb: settings.accentColor), outgoingAccentColor: settings.outgoingAccentColor.flatMap { UIColor(rgb: $0) }, backgroundColors: [], bubbleColors: settings.messageColors, animateBubbleColors: settings.animateMessageColors, wallpaper: settings.wallpaper)
|
||||
if case let .gift(starGiftValue, _) = chatTheme {
|
||||
theme.starGift = starGiftValue
|
||||
}
|
||||
|
@ -258,7 +258,9 @@ private final class ThemeSettingsThemeItemIconNode : ListViewItemNode {
|
||||
private let emojiImageNode: TransformImageNode
|
||||
private var animatedStickerNode: AnimatedStickerNode?
|
||||
private var placeholderNode: StickerShimmerEffectNode
|
||||
private var bubbleNode: ASImageNode?
|
||||
private var avatarNode: AvatarNode?
|
||||
private var replaceNode: ASImageNode?
|
||||
var snapshotView: UIView?
|
||||
|
||||
var item: ThemeSettingsThemeIconItem?
|
||||
@ -509,6 +511,37 @@ private final class ThemeSettingsThemeItemIconNode : ListViewItemNode {
|
||||
animatedStickerNode.updateLayout(size: emojiFrame.size)
|
||||
}
|
||||
|
||||
if let _ = item.peer {
|
||||
let bubbleNode: ASImageNode
|
||||
if let current = strongSelf.bubbleNode {
|
||||
bubbleNode = current
|
||||
} else {
|
||||
bubbleNode = ASImageNode()
|
||||
strongSelf.insertSubnode(bubbleNode, belowSubnode: strongSelf.emojiContainerNode)
|
||||
strongSelf.bubbleNode = bubbleNode
|
||||
|
||||
var bubbleColor: UIColor?
|
||||
if let theme = item.chatTheme, case let .gift(_, themeSettings) = theme {
|
||||
if item.nightMode {
|
||||
if let theme = themeSettings.first(where: { $0.baseTheme == .night || $0.baseTheme == .tinted }) {
|
||||
bubbleColor = UIColor(rgb: UInt32(bitPattern: theme.accentColor))
|
||||
}
|
||||
} else {
|
||||
if let theme = themeSettings.first(where: { $0.baseTheme == .classic || $0.baseTheme == .day }) {
|
||||
bubbleColor = UIColor(rgb: UInt32(bitPattern: theme.accentColor))
|
||||
}
|
||||
}
|
||||
}
|
||||
if let bubbleColor {
|
||||
bubbleNode.image = generateFilledRoundedRectImage(size: CGSize(width: 24.0, height: 48.0), cornerRadius: 12.0, color: bubbleColor)
|
||||
}
|
||||
}
|
||||
bubbleNode.frame = CGRect(origin: CGPoint(x: 50.0, y: 12.0), size: CGSize(width: 24.0, height: 48.0))
|
||||
} else if let bubbleNode = strongSelf.bubbleNode {
|
||||
strongSelf.bubbleNode = nil
|
||||
bubbleNode.removeFromSupernode()
|
||||
}
|
||||
|
||||
if let peer = item.peer {
|
||||
let avatarNode: AvatarNode
|
||||
if let current = strongSelf.avatarNode {
|
||||
@ -525,6 +558,25 @@ private final class ThemeSettingsThemeItemIconNode : ListViewItemNode {
|
||||
strongSelf.avatarNode = nil
|
||||
avatarNode.removeFromSupernode()
|
||||
}
|
||||
|
||||
if let _ = item.peer {
|
||||
let replaceNode: ASImageNode
|
||||
if let current = strongSelf.replaceNode {
|
||||
replaceNode = current
|
||||
} else {
|
||||
replaceNode = ASImageNode()
|
||||
strongSelf.insertSubnode(replaceNode, belowSubnode: strongSelf.emojiContainerNode)
|
||||
strongSelf.replaceNode = replaceNode
|
||||
replaceNode.image = generateTintedImage(image: UIImage(bundleImageName: "Settings/Refresh"), color: .white)
|
||||
}
|
||||
replaceNode.transform = CATransform3DMakeRotation(.pi / 2.0, 0.0, 0.0, 1.0)
|
||||
if let image = replaceNode.image {
|
||||
replaceNode.frame = CGRect(origin: CGPoint(x: 53.0, y: 37.0), size: image.size)
|
||||
}
|
||||
} else if let replaceNode = strongSelf.replaceNode {
|
||||
strongSelf.replaceNode = nil
|
||||
replaceNode.removeFromSupernode()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -996,7 +1048,7 @@ private class ChatThemeScreenNode: ViewControllerTracingNode, ASScrollViewDelega
|
||||
emojiFile = file
|
||||
}
|
||||
}
|
||||
if let themePeerId = uniqueGift.themePeerId {
|
||||
if let themePeerId = uniqueGift.themePeerId, theme.id != initiallySelectedTheme?.id {
|
||||
peer = peers[themePeerId]
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ private final class GiftThemeTransferAlertContentNode: AlertContentNode {
|
||||
return ("URL", url)
|
||||
}
|
||||
), textAlignment: .center)
|
||||
self.arrowNode.image = generateTintedImage(image: UIImage(bundleImageName: "Media Editor/CutoutUndo"), color: theme.controlBorderColor)
|
||||
self.arrowNode.image = generateTintedImage(image: UIImage(bundleImageName: "Media Editor/CutoutUndo"), color: theme.secondaryColor.withAlphaComponent(0.9))
|
||||
|
||||
self.actionNodesSeparator.backgroundColor = theme.separatorColor
|
||||
for actionNode in self.actionNodes {
|
||||
|
12
submodules/TelegramUI/Images.xcassets/Settings/Refresh.imageset/Contents.json
vendored
Normal file
12
submodules/TelegramUI/Images.xcassets/Settings/Refresh.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "rotate_18.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
submodules/TelegramUI/Images.xcassets/Settings/Refresh.imageset/rotate_18.pdf
vendored
Normal file
BIN
submodules/TelegramUI/Images.xcassets/Settings/Refresh.imageset/rotate_18.pdf
vendored
Normal file
Binary file not shown.
@ -456,11 +456,11 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, ASGestu
|
||||
panRecognizer.delaysTouchesBegan = false
|
||||
panRecognizer.cancelsTouchesInView = true
|
||||
panRecognizer.shouldBegin = { [weak self] point in
|
||||
guard let strongSelf = self else {
|
||||
guard let self else {
|
||||
return false
|
||||
}
|
||||
if strongSelf.controlsNode.bounds.contains(strongSelf.view.convert(point, to: strongSelf.controlsNode.view)) {
|
||||
if strongSelf.controlsNode.frame.maxY <= strongSelf.historyNode.frame.minY {
|
||||
if self.controlsNode.bounds.contains(self.view.convert(point, to: self.controlsNode.view)) {
|
||||
if self.controlsNode.frame.maxY <= self.historyNode.frame.minY {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@ -512,6 +512,12 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, ASGestu
|
||||
}
|
||||
})
|
||||
self.historyNode.autoScrollWhenReordering = false
|
||||
self.historyNode.didEndScrollingWithOverscroll = { [weak self] in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
self.requestDismiss()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -751,7 +757,7 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, ASGestu
|
||||
self.requestDismiss()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
if let recognizer = gestureRecognizer as? UIPanGestureRecognizer {
|
||||
let location = recognizer.location(in: self.view)
|
||||
|
Loading…
x
Reference in New Issue
Block a user