Skip to content

Commit 1e80012

Browse files
committed
Various improvements
1 parent 34ff4d1 commit 1e80012

File tree

7 files changed

+83
-7
lines changed

7 files changed

+83
-7
lines changed

submodules/Display/Source/ListView.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,8 @@ open class ListView: ASDisplayNode, ASScrollViewDelegate, ASGestureRecognizerDel
349349
public final var beganInteractiveDragging: (CGPoint) -> Void = { _ in }
350350
public final var endedInteractiveDragging: (CGPoint) -> Void = { _ in }
351351
public final var didEndScrolling: ((Bool) -> Void)?
352+
public final var didEndScrollingWithOverscroll: (() -> Void)?
353+
352354

353355
private var currentGeneralScrollDirection: GeneralScrollDirection?
354356
public final var generalScrollDirectionUpdated: (GeneralScrollDirection) -> Void = { _ in }
@@ -891,6 +893,10 @@ open class ListView: ASDisplayNode, ASScrollViewDelegate, ASGestureRecognizerDel
891893
self.resetScrollIndicatorFlashTimer(start: false)
892894

893895
self.isAuxiliaryDisplayLinkEnabled = true
896+
897+
if scrollView.contentOffset.y < -48.0 {
898+
self.didEndScrollingWithOverscroll?()
899+
}
894900
} else {
895901
self.isDeceleratingAfterTracking = false
896902
self.resetHeaderItemsFlashTimer(start: true)

submodules/TelegramPresentationData/Sources/MakePresentationTheme.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public func makePresentationTheme(chatTheme: ChatTheme, dark: Bool = false) -> P
7070
return nil
7171
}
7272
let defaultTheme = makeDefaultPresentationTheme(reference: PresentationBuiltinThemeReference(baseTheme: settings.baseTheme), serviceBackgroundColor: nil, preview: false)
73-
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)
73+
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)
7474
if case let .gift(starGiftValue, _) = chatTheme {
7575
theme.starGift = starGiftValue
7676
}

submodules/TelegramUI/Components/ChatThemeScreen/Sources/ChatThemeScreen.swift

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ private final class ThemeSettingsThemeItemIconNode : ListViewItemNode {
258258
private let emojiImageNode: TransformImageNode
259259
private var animatedStickerNode: AnimatedStickerNode?
260260
private var placeholderNode: StickerShimmerEffectNode
261+
private var bubbleNode: ASImageNode?
261262
private var avatarNode: AvatarNode?
263+
private var replaceNode: ASImageNode?
262264
var snapshotView: UIView?
263265

264266
var item: ThemeSettingsThemeIconItem?
@@ -509,6 +511,37 @@ private final class ThemeSettingsThemeItemIconNode : ListViewItemNode {
509511
animatedStickerNode.updateLayout(size: emojiFrame.size)
510512
}
511513

514+
if let _ = item.peer {
515+
let bubbleNode: ASImageNode
516+
if let current = strongSelf.bubbleNode {
517+
bubbleNode = current
518+
} else {
519+
bubbleNode = ASImageNode()
520+
strongSelf.insertSubnode(bubbleNode, belowSubnode: strongSelf.emojiContainerNode)
521+
strongSelf.bubbleNode = bubbleNode
522+
523+
var bubbleColor: UIColor?
524+
if let theme = item.chatTheme, case let .gift(_, themeSettings) = theme {
525+
if item.nightMode {
526+
if let theme = themeSettings.first(where: { $0.baseTheme == .night || $0.baseTheme == .tinted }) {
527+
bubbleColor = UIColor(rgb: UInt32(bitPattern: theme.accentColor))
528+
}
529+
} else {
530+
if let theme = themeSettings.first(where: { $0.baseTheme == .classic || $0.baseTheme == .day }) {
531+
bubbleColor = UIColor(rgb: UInt32(bitPattern: theme.accentColor))
532+
}
533+
}
534+
}
535+
if let bubbleColor {
536+
bubbleNode.image = generateFilledRoundedRectImage(size: CGSize(width: 24.0, height: 48.0), cornerRadius: 12.0, color: bubbleColor)
537+
}
538+
}
539+
bubbleNode.frame = CGRect(origin: CGPoint(x: 50.0, y: 12.0), size: CGSize(width: 24.0, height: 48.0))
540+
} else if let bubbleNode = strongSelf.bubbleNode {
541+
strongSelf.bubbleNode = nil
542+
bubbleNode.removeFromSupernode()
543+
}
544+
512545
if let peer = item.peer {
513546
let avatarNode: AvatarNode
514547
if let current = strongSelf.avatarNode {
@@ -525,6 +558,25 @@ private final class ThemeSettingsThemeItemIconNode : ListViewItemNode {
525558
strongSelf.avatarNode = nil
526559
avatarNode.removeFromSupernode()
527560
}
561+
562+
if let _ = item.peer {
563+
let replaceNode: ASImageNode
564+
if let current = strongSelf.replaceNode {
565+
replaceNode = current
566+
} else {
567+
replaceNode = ASImageNode()
568+
strongSelf.insertSubnode(replaceNode, belowSubnode: strongSelf.emojiContainerNode)
569+
strongSelf.replaceNode = replaceNode
570+
replaceNode.image = generateTintedImage(image: UIImage(bundleImageName: "Settings/Refresh"), color: .white)
571+
}
572+
replaceNode.transform = CATransform3DMakeRotation(.pi / 2.0, 0.0, 0.0, 1.0)
573+
if let image = replaceNode.image {
574+
replaceNode.frame = CGRect(origin: CGPoint(x: 53.0, y: 37.0), size: image.size)
575+
}
576+
} else if let replaceNode = strongSelf.replaceNode {
577+
strongSelf.replaceNode = nil
578+
replaceNode.removeFromSupernode()
579+
}
528580
}
529581
})
530582
}
@@ -996,7 +1048,7 @@ private class ChatThemeScreenNode: ViewControllerTracingNode, ASScrollViewDelega
9961048
emojiFile = file
9971049
}
9981050
}
999-
if let themePeerId = uniqueGift.themePeerId {
1051+
if let themePeerId = uniqueGift.themePeerId, theme.id != initiallySelectedTheme?.id {
10001052
peer = peers[themePeerId]
10011053
}
10021054
}

submodules/TelegramUI/Components/ChatThemeScreen/Sources/GiftThemeTransferAlertController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ private final class GiftThemeTransferAlertContentNode: AlertContentNode {
127127
return ("URL", url)
128128
}
129129
), textAlignment: .center)
130-
self.arrowNode.image = generateTintedImage(image: UIImage(bundleImageName: "Media Editor/CutoutUndo"), color: theme.controlBorderColor)
130+
self.arrowNode.image = generateTintedImage(image: UIImage(bundleImageName: "Media Editor/CutoutUndo"), color: theme.secondaryColor.withAlphaComponent(0.9))
131131

132132
self.actionNodesSeparator.backgroundColor = theme.separatorColor
133133
for actionNode in self.actionNodes {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "rotate_18.pdf",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
}
12+
}
Binary file not shown.

submodules/TelegramUI/Sources/OverlayAudioPlayerControllerNode.swift

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,11 +456,11 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, ASGestu
456456
panRecognizer.delaysTouchesBegan = false
457457
panRecognizer.cancelsTouchesInView = true
458458
panRecognizer.shouldBegin = { [weak self] point in
459-
guard let strongSelf = self else {
459+
guard let self else {
460460
return false
461461
}
462-
if strongSelf.controlsNode.bounds.contains(strongSelf.view.convert(point, to: strongSelf.controlsNode.view)) {
463-
if strongSelf.controlsNode.frame.maxY <= strongSelf.historyNode.frame.minY {
462+
if self.controlsNode.bounds.contains(self.view.convert(point, to: self.controlsNode.view)) {
463+
if self.controlsNode.frame.maxY <= self.historyNode.frame.minY {
464464
return true
465465
}
466466
}
@@ -512,6 +512,12 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, ASGestu
512512
}
513513
})
514514
self.historyNode.autoScrollWhenReordering = false
515+
self.historyNode.didEndScrollingWithOverscroll = { [weak self] in
516+
guard let self else {
517+
return
518+
}
519+
self.requestDismiss()
520+
}
515521
}
516522

517523

@@ -751,7 +757,7 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, ASGestu
751757
self.requestDismiss()
752758
}
753759
}
754-
760+
755761
override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
756762
if let recognizer = gestureRecognizer as? UIPanGestureRecognizer {
757763
let location = recognizer.location(in: self.view)

0 commit comments

Comments
 (0)